Skip to content

Instantly share code, notes, and snippets.

@zakorgy
Created January 27, 2016 15:06
Show Gist options
  • Save zakorgy/328e773fad02def13232 to your computer and use it in GitHub Desktop.
Save zakorgy/328e773fad02def13232 to your computer and use it in GitHub Desktop.
diff --git a/components/script/dom/bluetoothadvertisingdata.rs b/components/script/dom/bluetoothadvertisingdata.rs
index 1896e46..5634a62 100644
--- a/components/script/dom/bluetoothadvertisingdata.rs
+++ b/components/script/dom/bluetoothadvertisingdata.rs
@@ -40,14 +40,17 @@ impl BluetoothAdvertisingData {
}
impl BluetoothAdvertisingDataMethods for BluetoothAdvertisingData {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingdata-appearance
fn GetAppearance(&self) -> Option<u16> {
Some(self.appearance)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingdata-txpower
fn GetTxPower(&self) -> Option<i8> {
Some(self.txPower)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingdata-rssi
fn GetRssi(&self) -> Option<i8> {
Some(self.rssi)
}
diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs
index f97a55a..13a23a8 100644
--- a/components/script/dom/bluetoothcharacteristicproperties.rs
+++ b/components/script/dom/bluetoothcharacteristicproperties.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding;
-use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
+use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::*;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::Root;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
@@ -75,38 +75,47 @@ impl BluetoothCharacteristicProperties {
}
impl BluetoothCharacteristicPropertiesMethods for BluetoothCharacteristicProperties {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-broadcast
fn Broadcast(&self) -> bool {
self.broadcast
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-read
fn Read(&self) -> bool {
self.read
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-writewithoutresponse
fn WriteWithoutResponse(&self) -> bool {
self.writeWithoutResponse
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-write
fn Write(&self) -> bool {
self.write
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-notify
fn Notify(&self) -> bool {
self.notify
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-indicate
fn Indicate(&self) -> bool {
self.indicate
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-authenticatedsignedwrites
fn AuthenticatedSignedWrites(&self) -> bool {
self.authenticatedSignedWrites
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-reliablewrite
fn ReliableWrite(&self) -> bool {
self.reliableWrite
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-writeableauxilaries
fn WritableAuxiliaries(&self) -> bool {
self.writableAuxiliaries
}
diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs
index 732b206..9f09673 100644
--- a/components/script/dom/bluetoothdevice.rs
+++ b/components/script/dom/bluetoothdevice.rs
@@ -2,16 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use dom::bluetoothadvertisingdata::BluetoothAdvertisingData;
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::{BluetoothDeviceMethods, VendorIDSource};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
+use dom::bluetoothadvertisingdata::BluetoothAdvertisingData;
+use dom::bluetoothgattremoteserver::BluetoothGATTRemoteServer;
use util::str::DOMString;
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice
+pub type Uuid = DOMString;
+
#[dom_struct]
pub struct BluetoothDevice {
reflector_: Reflector,
@@ -23,8 +26,8 @@ pub struct BluetoothDevice {
vendorID: u32,
productID: u32,
productVersion: u32,
- // gattServer: BluetoothGATTRemoteServer,
- // uuids: UUID[],
+ gattServer: JS<BluetoothGATTRemoteServer>,
+ //TODO:uuids: Vec<u32>,
}
impl BluetoothDevice {
@@ -35,7 +38,8 @@ impl BluetoothDevice {
vendorIDSource: VendorIDSource,
vendorID: u32,
productID: u32,
- productVersion: u32)
+ productVersion: u32,
+ gattServer: &BluetoothGATTRemoteServer)
-> BluetoothDevice {
BluetoothDevice {
reflector_: Reflector::new(),
@@ -47,6 +51,7 @@ impl BluetoothDevice {
vendorID: vendorID,
productID: productID,
productVersion: productVersion,
+ gattServer: JS::from_ref(gattServer),
}
}
@@ -58,7 +63,8 @@ impl BluetoothDevice {
vendorIDSource: VendorIDSource,
vendorID: u32,
productID: u32,
- productVersion: u32)
+ productVersion: u32,
+ gattServer: &BluetoothGATTRemoteServer)
-> Root<BluetoothDevice> {
reflect_dom_object(box BluetoothDevice::new_inherited(id,
name,
@@ -67,42 +73,56 @@ impl BluetoothDevice {
vendorIDSource,
vendorID,
productID,
- productVersion),
+ productVersion,
+ gattServer),
global,
BluetoothDeviceBinding::Wrap)
}
}
impl BluetoothDeviceMethods for BluetoothDevice {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-id
fn Id(&self) -> DOMString {
self.id.clone()
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-name
fn GetName(&self) -> Option<DOMString> {
Some(self.name.clone())
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#addata
fn AdData(&self) -> Root<BluetoothAdvertisingData> {
Root::from_ref(&*self.adData)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-deviceclass
fn GetDeviceClass(&self) -> Option<u32> {
Some(self.deviceClass)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-vendoridsource
fn GetVendorIDSource(&self) -> Option<VendorIDSource> {
Some(self.vendorIDSource)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-vendorid
fn GetVendorID(&self) -> Option<u32> {
Some(self.vendorID)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-productid
fn GetProductID(&self) -> Option<u32> {
Some(self.productID)
}
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-productversion
fn GetProductVersion(&self) -> Option<u32> {
Some(self.productVersion)
}
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#gattserver
+ fn GetGattServer(&self) -> Option<Root<BluetoothGATTRemoteServer>> {
+ Some(Root::from_ref(&*self.gattServer))
+ }
}
diff --git a/components/script/dom/bluetoothgattcharacteristic.rs b/components/script/dom/bluetoothgattcharacteristic.rs
new file mode 100644
index 0000000..215cb6e
--- /dev/null
+++ b/components/script/dom/bluetoothgattcharacteristic.rs
@@ -0,0 +1,69 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::bindings::codegen::Bindings::BluetoothGATTCharacteristicBinding;
+use dom::bindings::codegen::Bindings::BluetoothGATTCharacteristicBinding::BluetoothGATTCharacteristicMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{JS, Root};
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
+//use dom::bluetoothuuid::BluetoothUUID;
+//use dom::bluetoothgattservice:BluetoothGATTService;
+use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties;
+use util::str::DOMString;
+use uuid::Uuid;
+
+
+// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattcharacteristic
+
+#[dom_struct]
+pub struct BluetoothGATTCharacteristic {
+ reflector_: Reflector,
+ properties: JS<BluetoothCharacteristicProperties>,
+ //service :JS<BluetoothGATTService>,
+ uuid: Uuid,
+ //value :ArrayBuffer,
+}
+
+impl BluetoothGATTCharacteristic {
+ pub fn new_inherited(//service: &BluetoothGATTService,
+ uuid: Uuid,
+ properties: &BluetoothCharacteristicProperties,
+ //value: ArrayBuffer,
+ ) -> BluetoothGATTCharacteristic {
+ BluetoothGATTCharacteristic {
+ reflector_: Reflector::new(),
+ //service: JS::from_ref(service),
+ uuid: uuid,
+ properties: JS::from_ref(properties),
+ //value: value,
+ }
+ }
+
+ pub fn new(global: GlobalRef,
+ //service: &BluetoothGATTService,
+ uuid: Uuid,
+ properties: &BluetoothCharacteristicProperties,
+ //value: ArrayBuffer,
+ ) -> Root<BluetoothGATTCharacteristic>{
+ reflect_dom_object(box BluetoothGATTCharacteristic::new_inherited(//service,
+ uuid,
+ properties,
+ //value,
+ ),
+ global,
+ BluetoothGATTCharacteristicBinding::Wrap)
+ }
+}
+
+impl BluetoothGATTCharacteristicMethods for BluetoothGATTCharacteristic {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattcharacteristic-properties
+ fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
+ Root::from_ref(&*self.properties)
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattcharacteristic-uuid
+ fn Uuid(&self) -> DOMString {
+ DOMString::from_string(self.uuid.to_string().clone())
+ }
+}
diff --git a/components/script/dom/bluetoothgattdescriptor.rs b/components/script/dom/bluetoothgattdescriptor.rs
new file mode 100644
index 0000000..b8393d8
--- /dev/null
+++ b/components/script/dom/bluetoothgattdescriptor.rs
@@ -0,0 +1,59 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::bindings::codegen::Bindings::BluetoothGATTDescriptorBinding;
+use dom::bindings::codegen::Bindings::BluetoothGATTDescriptorBinding::BluetoothGATTDescriptorMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{JS, Root};
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
+//use dom::bluetoothuuid::BluetoothUUID;
+use dom::bluetoothgattcharacteristic::BluetoothGATTCharacteristic;
+use util::str::DOMString;
+use uuid::Uuid;
+
+
+// http://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattdescriptor
+
+#[dom_struct]
+pub struct BluetoothGATTDescriptor {
+ reflector_: Reflector,
+ characteristic: JS<BluetoothGATTCharacteristic>,
+ uuid: Uuid,
+ //value: ArrayBuffer,
+}
+
+impl BluetoothGATTDescriptor {
+ pub fn new_inherited(characteristic: &BluetoothGATTCharacteristic,
+ uuid: Uuid,
+ ) -> BluetoothGATTDescriptor {
+ BluetoothGATTDescriptor {
+ reflector_: Reflector::new(),
+ characteristic: JS::from_ref(characteristic),
+ uuid: uuid,
+ }
+ }
+
+ pub fn new(global: GlobalRef,
+ characteristic: &BluetoothGATTCharacteristic,
+ uuid: Uuid,
+ ) -> Root<BluetoothGATTDescriptor>{
+ reflect_dom_object(box BluetoothGATTDescriptor::new_inherited(characteristic,
+ uuid,
+ ),
+ global,
+ BluetoothGATTDescriptorBinding::Wrap)
+ }
+}
+
+impl BluetoothGATTDescriptorMethods for BluetoothGATTDescriptor {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattdescriptor-characteristic
+ fn Characteristic(&self) -> Root<BluetoothGATTCharacteristic> {
+ Root::from_ref(&*self.characteristic)
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattdescriptor-uuid
+ fn Uuid(&self) -> DOMString {
+ DOMString::from_string(self.uuid.to_string())
+ }
+}
diff --git a/components/script/dom/bluetoothgattremoteserver.rs b/components/script/dom/bluetoothgattremoteserver.rs
new file mode 100644
index 0000000..ee3af67
--- /dev/null
+++ b/components/script/dom/bluetoothgattremoteserver.rs
@@ -0,0 +1,59 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use dom::bindings::codegen::Bindings::BluetoothGATTRemoteServerBinding;
+use dom::bindings::codegen::Bindings::BluetoothGATTRemoteServerBinding::BluetoothGATTRemoteServerMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{JS, Root};
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
+use dom::bluetoothdevice::BluetoothDevice;
+
+#[dom_struct]
+pub struct BluetoothGATTRemoteServer {
+ reflector_: Reflector,
+ device: JS<BluetoothDevice>,
+ connected: bool,
+}
+
+impl BluetoothGATTRemoteServer {
+ pub fn new_inherited(device: &BluetoothDevice, connected: bool) -> BluetoothGATTRemoteServer {
+ BluetoothGATTRemoteServer {
+ reflector_: Reflector::new(),
+ device: JS::from_ref(device),
+ connected: connected,
+ }
+ }
+
+ pub fn new(global: GlobalRef, device: &BluetoothDevice, connected: bool) -> Root<BluetoothGATTRemoteServer> {
+ reflect_dom_object(box BluetoothGATTRemoteServer::new_inherited(
+ device,
+ connected),
+ global,
+ BluetoothGATTRemoteServerBinding::Wrap)
+ }
+
+ fn disconnect(&self) -> () {
+ // FIXME (zakorgy)
+ // Set this.connected to false.
+ // In parallel: if, for all BluetoothDevices device in the whole UA with device@[[representedDevice]]
+ // the same device as this.device@[[representedDevice]],
+ // device.gattServer === null or !device.gattServer.connected,
+ // the UA MAY destroy device@[[representedDevice]]’s ATT Bearer.
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattremoteserver-disconnect
+ // https://webbluetoothcg.github.io/web-bluetooth/#same-device
+ ()
+ }
+}
+
+impl BluetoothGATTRemoteServerMethods for BluetoothGATTRemoteServer {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattremoteserver-device
+ fn Device(&self) -> Root<BluetoothDevice> {
+ Root::from_ref(&*self.device)
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattremoteserver-connected
+ fn Connected(&self) -> bool {
+ self.connected
+ }
+}
diff --git a/components/script/dom/bluetoothgattservice.rs b/components/script/dom/bluetoothgattservice.rs
new file mode 100644
index 0000000..dd72bd4
--- /dev/null
+++ b/components/script/dom/bluetoothgattservice.rs
@@ -0,0 +1,58 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+extern crate uuid;
+use dom::bindings::codegen::Bindings::BluetoothGATTServiceBinding;
+use dom::bindings::codegen::Bindings::BluetoothGATTServiceBinding::BluetoothGATTServiceMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{JS, Root};
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
+use dom::bluetoothdevice::BluetoothDevice;
+use util::str::DOMString;
+use uuid::Uuid;
+
+#[dom_struct]
+pub struct BluetoothGATTService {
+ reflector_: Reflector,
+ device: JS<BluetoothDevice>,
+ isPrimary: bool,
+ uuid: Uuid,
+}
+
+impl BluetoothGATTService {
+ pub fn new_inherited(device: &BluetoothDevice, isPrimary: bool, uuid: Uuid) -> BluetoothGATTService {
+ BluetoothGATTService {
+ reflector_: Reflector::new(),
+ device: JS::from_ref(device),
+ isPrimary: isPrimary,
+ uuid: uuid,
+ }
+ }
+
+ pub fn new(global: GlobalRef, device: &BluetoothDevice, isPrimary: bool, uuid: Uuid) -> Root<BluetoothGATTService> {
+ reflect_dom_object(box BluetoothGATTService::new_inherited(
+ device,
+ isPrimary,
+ uuid),
+ global,
+ BluetoothGATTServiceBinding::Wrap)
+ }
+}
+
+impl BluetoothGATTServiceMethods for BluetoothGATTService {
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattservice-device
+ fn Device(&self) -> Root<BluetoothDevice> {
+ Root::from_ref(&*self.device)
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattservice-uuid
+ fn IsPrimary(&self) -> bool {
+ self.isPrimary
+ }
+
+ // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattservice-uuid
+ fn Uuid(&self) -> DOMString {
+ DOMString::from_string(self.uuid.to_simple_string().clone())
+ }
+}
diff --git a/components/script/dom/bluetoothuuid.rs b/components/script/dom/bluetoothuuid.rs
index 65a64f5..6756c40 100644
--- a/components/script/dom/bluetoothuuid.rs
+++ b/components/script/dom/bluetoothuuid.rs
@@ -13,6 +13,7 @@ pub struct BluetoothUUID {
reflector_: Reflector,
}
+
impl BluetoothUUID {
pub fn CanonicalUUID(_: GlobalRef, _alias: u32) -> DOMString {
DOMString::new()
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index a91e2d1..4b041bc 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -221,6 +221,10 @@ pub mod bluetooth;
pub mod bluetoothadvertisingdata;
pub mod bluetoothcharacteristicproperties;
pub mod bluetoothdevice;
+pub mod bluetoothgattcharacteristic;
+pub mod bluetoothgattdescriptor;
+pub mod bluetoothgattremoteserver;
+pub mod bluetoothgattservice;
pub mod bluetoothuuid;
pub mod browsingcontext;
pub mod canvasgradient;
diff --git a/components/script/dom/webidls/Bluetooth.webidl b/components/script/dom/webidls/Bluetooth.webidl
index b60d7c0..6084275 100644
--- a/components/script/dom/webidls/Bluetooth.webidl
+++ b/components/script/dom/webidls/Bluetooth.webidl
@@ -13,4 +13,4 @@ interface Bluetooth {
// Bluetooth implements EventTarget;
// Bluetooth implements CharacteristicEventHandlers;
-// Bluetooth implements ServiceEventHandlers;
\ No newline at end of file
+// Bluetooth implements ServiceEventHandlers;
diff --git a/components/script/dom/webidls/BluetoothAdvertisingData.webidl b/components/script/dom/webidls/BluetoothAdvertisingData.webidl
index 7f3e3f5..4175261 100644
--- a/components/script/dom/webidls/BluetoothAdvertisingData.webidl
+++ b/components/script/dom/webidls/BluetoothAdvertisingData.webidl
@@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothadvertisingdata
+//https://webbluetoothcg.github.io/web-bluetooth/#bluetoothadvertisingdata
interface BluetoothAdvertisingData {
readonly attribute unsigned short? appearance;
diff --git a/components/script/dom/webidls/BluetoothDevice.webidl b/components/script/dom/webidls/BluetoothDevice.webidl
index ab6a804..d69b483 100644
--- a/components/script/dom/webidls/BluetoothDevice.webidl
+++ b/components/script/dom/webidls/BluetoothDevice.webidl
@@ -20,7 +20,7 @@ interface BluetoothDevice {
readonly attribute unsigned long? vendorID;
readonly attribute unsigned long? productID;
readonly attribute unsigned long? productVersion;
- // readonly attribute BluetoothGATTRemoteServer? gattServer;
- // readonly attribute UUID[] uuids;
+ readonly attribute BluetoothGATTRemoteServer? gattServer;
+ //readonly attribute UUID[] uuids;
//Promise<BluetoothGATTRemoteServer> connectGATT();
};
diff --git a/components/script/dom/webidls/BluetoothGATTCharacteristic.webidl b/components/script/dom/webidls/BluetoothGATTCharacteristic.webidl
new file mode 100644
index 0000000..fcf2eaa
--- /dev/null
+++ b/components/script/dom/webidls/BluetoothGATTCharacteristic.webidl
@@ -0,0 +1,26 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattcharacteristic
+
+interface BluetoothGATTCharacteristic {
+ readonly attribute BluetoothCharacteristicProperties properties;
+ //readonly attribute BluetoothGATTService service;
+ readonly attribute UUID uuid;
+ //readonly attribute ArrayBuffer? value;
+
+ // TODO(fokinv) use Promise when implemented ( https://github.com/servo/servo/issues/4282 )
+
+ //Promise<BluetoothGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
+ //Promise<sequence<BluetoothGATTDescriptor>>
+ //getDescriptors(optional BluetoothDescriptorUUID descriptor);
+ //Promise<DataView> readValue();
+ //Promise<void> writeValue(BufferSource value);
+ //Promise<void> startNotifications();
+ //Promise<void> stopNotifications();
+};
+
+//BluetoothGATTCharacteristic implements EventTarget;
+//BluetoothGATTCharacteristic implements CharacteristicEventHandlers;
diff --git a/components/script/dom/webidls/BluetoothGATTDescriptor.webidl b/components/script/dom/webidls/BluetoothGATTDescriptor.webidl
new file mode 100644
index 0000000..48c1e4a
--- /dev/null
+++ b/components/script/dom/webidls/BluetoothGATTDescriptor.webidl
@@ -0,0 +1,17 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// http://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattdescriptor
+
+interface BluetoothGATTDescriptor {
+ readonly attribute BluetoothGATTCharacteristic characteristic;
+ readonly attribute UUID uuid;
+ //readonly attribute ArrayBuffer? value;
+
+ // TODO(fokinv) use Promise when implemented ( https://github.com/servo/servo/issues/4282 )
+
+ //Promise<DataView> readValue();
+ //Promise<void> writeValue(BufferSource value);
+};
diff --git a/components/script/dom/webidls/BluetoothGATTRemoteServer.webidl b/components/script/dom/webidls/BluetoothGATTRemoteServer.webidl
new file mode 100644
index 0000000..34eb4fa
--- /dev/null
+++ b/components/script/dom/webidls/BluetoothGATTRemoteServer.webidl
@@ -0,0 +1,16 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//https://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattremoteserver
+
+interface BluetoothGATTRemoteServer {
+ readonly attribute BluetoothDevice device;
+
+ readonly attribute boolean connected;
+
+ //void disconnect();
+ //Promise<BluetoothGATTService> getPrimaryService(BluetoothServiceUUID service);
+ //Promise<sequence<BluetoothGATTService>>getPrimaryServices(optional BluetoothServiceUUID service);
+};
diff --git a/components/script/dom/webidls/BluetoothGATTService.webidl b/components/script/dom/webidls/BluetoothGATTService.webidl
new file mode 100644
index 0000000..57f2b6a
--- /dev/null
+++ b/components/script/dom/webidls/BluetoothGATTService.webidl
@@ -0,0 +1,17 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothgattservice
+
+interface BluetoothGATTService {
+ readonly attribute BluetoothDevice device;
+ readonly attribute boolean isPrimary;
+ readonly attribute UUID uuid;
+ //Promise<BluetoothGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic);
+ //Promise<sequence<BluetoothGATTCharacteristic>>
+ //getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
+ //Promise<BluetoothGATTService>getIncludedService(BluetoothServiceUUID service);
+ //Promise<sequence<BluetoothGATTService>>getIncludedServices(optional BluetoothServiceUUID service);
+};
diff --git a/python/tidy.py b/python/tidy.py
index eada4fb..243cbed 100644
--- a/python/tidy.py
+++ b/python/tidy.py
@@ -445,6 +445,7 @@ def check_webidl_spec(file_name, contents):
"//xhr.spec.whatwg.org",
"//w3c.github.io",
"//heycam.github.io/webidl",
+ "//webbluetoothcg.github.io/web-bluetooth/",
# Not a URL
"// This interface is entirely internal to Servo, and should not be" +
" accessible to\n// web pages."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment