Add event target for bluetooth

This commit is contained in:
Attila Dusnoki 2016-11-18 19:08:25 +01:00 committed by Attila Dusnoki
parent b18ec28fa7
commit d9c7ffb5b3
11 changed files with 111 additions and 19 deletions

View file

@ -28,9 +28,10 @@ dictionary RequestDeviceOptions {
};
[Pref="dom.bluetooth.enabled"]
interface Bluetooth {
interface Bluetooth : EventTarget {
// [SecureContext]
// readonly attribute BluetoothDevice? referringDevice;
attribute EventHandler onavailabilitychanged;
// [SecureContext]
// Promise<boolean> getAvailability();
// [SecureContext]

View file

@ -5,7 +5,7 @@
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice
[Pref="dom.bluetooth.enabled"]
interface BluetoothDevice {
interface BluetoothDevice : EventTarget {
readonly attribute DOMString id;
readonly attribute DOMString? name;
// TODO: remove this after BluetoothAdvertisingEvent implemented.
@ -17,7 +17,12 @@ interface BluetoothDevice {
// readonly attribute boolean watchingAdvertisements;
};
[NoInterfaceObject]
interface BluetoothDeviceEventHandlers {
attribute EventHandler ongattserverdisconnected;
};
// BluetoothDevice implements EventTarget;
// BluetoothDevice implements BluetoothDeviceEventHandlers;
BluetoothDevice implements BluetoothDeviceEventHandlers;
// BluetoothDevice implements CharacteristicEventHandlers;
// BluetoothDevice implements ServiceEventHandlers;

View file

@ -5,7 +5,7 @@
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattcharacteristic
[Pref="dom.bluetooth.enabled"]
interface BluetoothRemoteGATTCharacteristic {
interface BluetoothRemoteGATTCharacteristic : EventTarget {
readonly attribute BluetoothRemoteGATTService service;
readonly attribute DOMString uuid;
readonly attribute BluetoothCharacteristicProperties properties;
@ -21,5 +21,10 @@ interface BluetoothRemoteGATTCharacteristic {
Promise<BluetoothRemoteGATTCharacteristic> stopNotifications();
};
//BluetootRemoteGATTCharacteristic implements EventTarget;
//BluetootRemoteGATTCharacteristic implements CharacteristicEventHandlers;
[NoInterfaceObject]
interface CharacteristicEventHandlers {
attribute EventHandler oncharacteristicvaluechanged;
};
// BluetoothRemoteGATTCharacteristic implements EventTarget;
BluetoothRemoteGATTCharacteristic implements CharacteristicEventHandlers;

View file

@ -5,7 +5,7 @@
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattservice
[Pref="dom.bluetooth.enabled"]
interface BluetoothRemoteGATTService {
interface BluetoothRemoteGATTService : EventTarget {
readonly attribute BluetoothDevice device;
readonly attribute DOMString uuid;
readonly attribute boolean isPrimary;
@ -15,3 +15,14 @@ interface BluetoothRemoteGATTService {
Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service);
};
[NoInterfaceObject]
interface ServiceEventHandlers {
attribute EventHandler onserviceadded;
attribute EventHandler onservicechanged;
attribute EventHandler onserviceremoved;
};
// BluetoothRemoteGATTService implements EventTarget;
// BluetoothRemoteGATTService implements CharacteristicEventHandlers;
BluetoothRemoteGATTService implements ServiceEventHandlers;