Update WebBluetooth to use Promises

This commit is contained in:
Mátyás Mustoha 2016-09-15 10:44:17 +02:00 committed by Attila Dusnoki
parent fb52bb7c8d
commit e05a839d25
32 changed files with 684 additions and 458 deletions

View file

@ -23,9 +23,7 @@ interface Bluetooth {
// [SecureContext]
// readonly attribute BluetoothDevice? referringDevice;
// [SecureContext]
// Promise<BluetoothDevice> requestDevice(RequestDeviceOptions options);
[Throws]
BluetoothDevice requestDevice(optional RequestDeviceOptions options);
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options);
};
// Bluetooth implements EventTarget;

View file

@ -10,18 +10,12 @@ interface BluetoothRemoteGATTCharacteristic {
readonly attribute DOMString uuid;
readonly attribute BluetoothCharacteristicProperties properties;
readonly attribute ByteString? value;
[Throws]
BluetoothRemoteGATTDescriptor getDescriptor(BluetoothDescriptorUUID descriptor);
[Throws]
sequence<BluetoothRemoteGATTDescriptor> getDescriptors(optional BluetoothDescriptorUUID descriptor);
//Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
//Promise<sequence<BluetoothRemoteGATTDescriptor>>
//getDescriptors(optional BluetoothDescriptorUUID descriptor);
[Throws]
ByteString readValue();
Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
Promise<sequence<BluetoothRemoteGATTDescriptor>>
getDescriptors(optional BluetoothDescriptorUUID descriptor);
Promise<ByteString> readValue();
//Promise<DataView> readValue();
[Throws]
void writeValue(sequence<octet> value);
Promise<void> writeValue(sequence<octet> value);
//Promise<void> writeValue(BufferSource value);
//Promise<void> startNotifications();
//Promise<void> stopNotifications();

View file

@ -9,10 +9,8 @@ interface BluetoothRemoteGATTDescriptor {
readonly attribute BluetoothRemoteGATTCharacteristic characteristic;
readonly attribute DOMString uuid;
readonly attribute ByteString? value;
[Throws]
ByteString readValue();
Promise<ByteString> readValue();
//Promise<DataView> readValue();
[Throws]
void writeValue(sequence<octet> value);
Promise<void> writeValue(sequence<octet> value);
//Promise<void> writeValue(BufferSource value);
};

View file

@ -8,15 +8,9 @@
interface BluetoothRemoteGATTServer {
readonly attribute BluetoothDevice device;
readonly attribute boolean connected;
[Throws]
BluetoothRemoteGATTServer connect();
Promise<BluetoothRemoteGATTServer> connect();
[Throws]
void disconnect();
[Throws]
BluetoothRemoteGATTService getPrimaryService(BluetoothServiceUUID service);
[Throws]
sequence<BluetoothRemoteGATTService> getPrimaryServices(optional BluetoothServiceUUID service);
//Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
//Promise<sequence<BluetoothRemoteGATTService>>getPrimaryServices(optional BluetoothServiceUUID service);
//Promise<BluetoothRemoteGATTServer> connect();
Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>> getPrimaryServices(optional BluetoothServiceUUID service);
};

View file

@ -9,18 +9,9 @@ interface BluetoothRemoteGATTService {
readonly attribute BluetoothDevice device;
readonly attribute DOMString uuid;
readonly attribute boolean isPrimary;
[Throws]
BluetoothRemoteGATTCharacteristic getCharacteristic(BluetoothCharacteristicUUID characteristic);
[Throws]
sequence<BluetoothRemoteGATTCharacteristic> getCharacteristics
(optional BluetoothCharacteristicUUID characteristic);
//Promise<BluetoothRemoteGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic);
//Promise<sequence<BluetoothRemoteGATTCharacteristic>>
//getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
[Throws]
BluetoothRemoteGATTService getIncludedService(BluetoothServiceUUID service);
[Throws]
sequence<BluetoothRemoteGATTService> getIncludedServices(optional BluetoothServiceUUID service);
//Promise<BluetoothRemoteGATTService>getIncludedService(BluetoothServiceUUID service);
//Promise<sequence<BluetoothRemoteGATTService>>getIncludedServices(optional BluetoothServiceUUID service);
Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic);
Promise<sequence<BluetoothRemoteGATTCharacteristic>>
getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service);
};