Created
February 8, 2016 10:16
-
-
Save zakorgy/02ea81951a92a4f9a2e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs | |
index 156d635..b8d9c4e 100644 | |
--- a/components/script/dom/bluetooth.rs | |
+++ b/components/script/dom/bluetooth.rs | |
@@ -2,9 +2,71 @@ | |
* 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::reflector::Reflector; | |
+extern crate uuid; | |
+use dom::bindings::reflector::{Reflector, reflect_dom_object}; | |
+use dom::bluetoothdevice::BluetoothDevice; | |
+use dom::bindings::codegen::Bindings::BluetoothBinding; | |
+use dom::bindings::codegen::Bindings::BluetoothBinding::BluetoothMethods; | |
+use dom::bindings::codegen::Bindings::BluetoothDeviceBinding; | |
+use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::{BluetoothDeviceMethods, VendorIDSource}; | |
+use util::str::DOMString; | |
+use dom::bindings::global::{GlobalRef, global_root_from_reflector, global_root_from_object}; | |
+use dom::bindings::js::{JS, Root}; | |
+use dom::bluetoothgattremoteserver::BluetoothGATTRemoteServer; | |
+//use uuid::Uuid; | |
+//use std::mem; | |
+use std::cmp::Ordering; | |
#[dom_struct] | |
pub struct Bluetooth { | |
reflector_: Reflector, | |
+ mockDevice: JS<BluetoothDevice>, | |
+} | |
+ | |
+impl Bluetooth { | |
+ pub fn new_inherited(global: GlobalRef) -> Bluetooth { | |
+ Bluetooth { | |
+ reflector_: Reflector::new(), | |
+ mockDevice: JS::from_ref(&BluetoothDevice::new(global, | |
+ DOMString::from("DeviceID"), | |
+ DOMString::from("DeviceName"), | |
+ 342_u32, | |
+ VendorIDSource::Bluetooth, | |
+ 8543_u32, | |
+ 1100_u32, | |
+ 200_u32, | |
+ )), | |
+ } | |
+ } | |
+ | |
+ pub fn new(global: GlobalRef) -> Root<Bluetooth> { | |
+ reflect_dom_object(box Bluetooth::new_inherited(global), | |
+ global, | |
+ BluetoothBinding::Wrap) | |
+ } | |
+ | |
+ pub fn request_device(&self, | |
+ nameFilter: DOMString, | |
+ namePrefixFilter: DOMString | |
+ ) -> DOMString { | |
+ let mut rvDOMString = DOMString::new(); | |
+ if nameFilter.is_empty() && namePrefixFilter.is_empty() { | |
+ rvDOMString = DOMString::from("Error:empty nameFilter and namePrefixFilter"); | |
+ } else if nameFilter.is_empty() { | |
+ rvDOMString = DOMString::from("Namefilter is empty"); | |
+ } else if namePrefixFilter.is_empty() { | |
+ rvDOMString = DOMString::from("NamePrefixFilter is empty!"); | |
+ } else { | |
+ rvDOMString = DOMString::from("NameFilter and namePrefixFilter both has a value!"); | |
+ } | |
+ | |
+ rvDOMString | |
+ } | |
+} | |
+ | |
+ | |
+impl BluetoothMethods for Bluetooth { | |
+ fn RequestDevice(&self) -> Root<BluetoothDevice> { | |
+ Root::from_ref(&*self.mockDevice) | |
+ } | |
} | |
diff --git a/components/script/dom/bluetoothdevice.rs b/components/script/dom/bluetoothdevice.rs | |
index 9f09673..4257723 100644 | |
--- a/components/script/dom/bluetoothdevice.rs | |
+++ b/components/script/dom/bluetoothdevice.rs | |
@@ -20,61 +20,64 @@ pub struct BluetoothDevice { | |
reflector_: Reflector, | |
id: DOMString, | |
name: DOMString, | |
- adData: JS<BluetoothAdvertisingData>, | |
+ //adData: JS<BluetoothAdvertisingData>, | |
deviceClass: u32, | |
vendorIDSource: VendorIDSource, | |
vendorID: u32, | |
productID: u32, | |
productVersion: u32, | |
- gattServer: JS<BluetoothGATTRemoteServer>, | |
+ //gattServer: Option<JS<BluetoothGATTRemoteServer>>, | |
//TODO:uuids: Vec<u32>, | |
} | |
impl BluetoothDevice { | |
pub fn new_inherited(id: DOMString, | |
name: DOMString, | |
- adData: &BluetoothAdvertisingData, | |
+ //adData: &BluetoothAdvertisingData, | |
deviceClass: u32, | |
vendorIDSource: VendorIDSource, | |
vendorID: u32, | |
productID: u32, | |
- productVersion: u32, | |
- gattServer: &BluetoothGATTRemoteServer) | |
+ productVersion: u32 | |
+ //gattServer: Option<&BluetoothGATTRemoteServer> | |
+ ) | |
-> BluetoothDevice { | |
BluetoothDevice { | |
reflector_: Reflector::new(), | |
id: id, | |
name: name, | |
- adData: JS::from_ref(adData), | |
+ //adData: JS::from_ref(adData), | |
deviceClass: deviceClass, | |
vendorIDSource: vendorIDSource, | |
vendorID: vendorID, | |
productID: productID, | |
productVersion: productVersion, | |
- gattServer: JS::from_ref(gattServer), | |
+ //gattServer: gattServer.map(JS::from_ref), | |
} | |
} | |
pub fn new(global: GlobalRef, | |
id: DOMString, | |
name: DOMString, | |
- adData: &BluetoothAdvertisingData, | |
+ //adData: &BluetoothAdvertisingData, | |
deviceClass: u32, | |
vendorIDSource: VendorIDSource, | |
vendorID: u32, | |
productID: u32, | |
productVersion: u32, | |
- gattServer: &BluetoothGATTRemoteServer) | |
+ //gattServer: Option<&BluetoothGATTRemoteServer> | |
+ ) | |
-> Root<BluetoothDevice> { | |
reflect_dom_object(box BluetoothDevice::new_inherited(id, | |
name, | |
- adData, | |
+ //adData, | |
deviceClass, | |
vendorIDSource, | |
vendorID, | |
productID, | |
- productVersion, | |
- gattServer), | |
+ productVersion | |
+ //gattServer | |
+ ), | |
global, | |
BluetoothDeviceBinding::Wrap) | |
} | |
@@ -92,9 +95,9 @@ impl BluetoothDeviceMethods for BluetoothDevice { | |
} | |
// https://webbluetoothcg.github.io/web-bluetooth/#addata | |
- fn AdData(&self) -> Root<BluetoothAdvertisingData> { | |
+ /*fn AdData(&self) -> Root<BluetoothAdvertisingData> { | |
Root::from_ref(&*self.adData) | |
- } | |
+ }*/ | |
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-deviceclass | |
fn GetDeviceClass(&self) -> Option<u32> { | |
@@ -122,7 +125,11 @@ impl BluetoothDeviceMethods for BluetoothDevice { | |
} | |
// https://webbluetoothcg.github.io/web-bluetooth/#gattserver | |
- fn GetGattServer(&self) -> Option<Root<BluetoothGATTRemoteServer>> { | |
- Some(Root::from_ref(&*self.gattServer)) | |
- } | |
+ /*fn GetGattServer(&self) -> Option<Root<BluetoothGATTRemoteServer>> { | |
+ if let Some(ref is_server) = self.gattServer.clone() { | |
+ Some(Root::from_ref(&is_server)) | |
+ } else { | |
+ None | |
+ } | |
+ }*/ | |
} | |
diff --git a/components/script/dom/bluetoothgattremoteserver.rs b/components/script/dom/bluetoothgattremoteserver.rs | |
index 04976b0..2a02e7c 100644 | |
--- a/components/script/dom/bluetoothgattremoteserver.rs | |
+++ b/components/script/dom/bluetoothgattremoteserver.rs | |
@@ -8,20 +8,21 @@ use dom::bindings::global::GlobalRef; | |
use dom::bindings::js::{JS, Root}; | |
use dom::bindings::reflector::{Reflector, reflect_dom_object}; | |
use dom::bluetoothdevice::BluetoothDevice; | |
+use std::cell::Cell; | |
#[dom_struct] | |
pub struct BluetoothGATTRemoteServer { | |
reflector_: Reflector, | |
device: JS<BluetoothDevice>, | |
- connected: bool, | |
+ connected: Cell<bool>, | |
} | |
impl BluetoothGATTRemoteServer { | |
- pub fn new_inherited(device: &BluetoothDevice, connected: bool) -> BluetoothGATTRemoteServer { | |
+ pub fn new_inherited(device: &BluetoothDevice, is_connected: bool) -> BluetoothGATTRemoteServer { | |
BluetoothGATTRemoteServer { | |
reflector_: Reflector::new(), | |
device: JS::from_ref(device), | |
- connected: connected, | |
+ connected: Cell::new(is_connected), | |
} | |
} | |
@@ -42,11 +43,12 @@ impl BluetoothGATTRemoteServerMethods for BluetoothGATTRemoteServer { | |
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattremoteserver-connected | |
fn Connected(&self) -> bool { | |
- self.connected | |
+ self.connected.clone().get() | |
} | |
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothgattremoteserver-disconnect | |
fn Disconnect(&self) -> () { | |
+ self.connected.set(!self.Connected()); | |
// FIXME (zakorgy) | |
() | |
} | |
diff --git a/components/script/dom/navigator.rs b/components/script/dom/navigator.rs | |
index 5fa0465..de7b284 100644 | |
--- a/components/script/dom/navigator.rs | |
+++ b/components/script/dom/navigator.rs | |
@@ -1,30 +1,34 @@ | |
/* 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::bluetooth::Bluetooth; | |
use dom::bindings::codegen::Bindings::NavigatorBinding; | |
use dom::bindings::codegen::Bindings::NavigatorBinding::NavigatorMethods; | |
use dom::bindings::global::GlobalRef; | |
-use dom::bindings::js::Root; | |
+use dom::bindings::js::{JS, Root}; | |
use dom::bindings::reflector::{Reflector, reflect_dom_object}; | |
use dom::navigatorinfo; | |
use dom::window::Window; | |
use util::str::DOMString; | |
+use std::cell::RefCell; | |
+use std::thread; | |
#[dom_struct] | |
pub struct Navigator { | |
reflector_: Reflector, | |
+ bluetooth: JS<Bluetooth>, | |
} | |
impl Navigator { | |
- fn new_inherited() -> Navigator { | |
+ fn new_inherited(window: &Window) -> Navigator { | |
Navigator { | |
- reflector_: Reflector::new() | |
+ reflector_: Reflector::new(), | |
+ bluetooth: JS::from_ref(&Bluetooth::new(GlobalRef::Window(window))), | |
} | |
} | |
pub fn new(window: &Window) -> Root<Navigator> { | |
- reflect_dom_object(box Navigator::new_inherited(), | |
+ reflect_dom_object(box Navigator::new_inherited(window), | |
GlobalRef::Window(window), | |
NavigatorBinding::Wrap) | |
} | |
@@ -65,4 +69,8 @@ impl NavigatorMethods for Navigator { | |
fn AppVersion(&self) -> DOMString { | |
navigatorinfo::AppVersion() | |
} | |
+ | |
+ fn Bluetooth(&self) -> Root<Bluetooth> { | |
+ Root::from_ref(&*self.bluetooth) | |
+ } | |
} | |
diff --git a/components/script/dom/webidls/Bluetooth.webidl b/components/script/dom/webidls/Bluetooth.webidl | |
index 6084275..42ba4cc 100644 | |
--- a/components/script/dom/webidls/Bluetooth.webidl | |
+++ b/components/script/dom/webidls/Bluetooth.webidl | |
@@ -9,6 +9,7 @@ interface Bluetooth { | |
// TODO(dati) use Promise when implemented ( https://github.com/servo/servo/issues/4282 ) | |
// Promise<BluetoothDevice> requestDevice(RequestDeviceOptions options); | |
// BluetoothDevice requestDevice(RequestDeviceOptions options); | |
+ BluetoothDevice requestDevice (); // próba function konzolhoz | |
}; | |
// Bluetooth implements EventTarget; | |
diff --git a/components/script/dom/webidls/BluetoothDevice.webidl b/components/script/dom/webidls/BluetoothDevice.webidl | |
index d69b483..cfa3141 100644 | |
--- a/components/script/dom/webidls/BluetoothDevice.webidl | |
+++ b/components/script/dom/webidls/BluetoothDevice.webidl | |
@@ -14,13 +14,13 @@ enum VendorIDSource { | |
interface BluetoothDevice { | |
readonly attribute DOMString id; | |
readonly attribute DOMString? name; | |
- readonly attribute BluetoothAdvertisingData adData; | |
+ //readonly attribute BluetoothAdvertisingData adData; | |
readonly attribute unsigned long? deviceClass; | |
readonly attribute VendorIDSource? vendorIDSource; | |
readonly attribute unsigned long? vendorID; | |
readonly attribute unsigned long? productID; | |
readonly attribute unsigned long? productVersion; | |
- readonly attribute BluetoothGATTRemoteServer? gattServer; | |
+ //readonly attribute BluetoothGATTRemoteServer? gattServer; | |
//readonly attribute UUID[] uuids; | |
//Promise<BluetoothGATTRemoteServer> connectGATT(); | |
}; | |
diff --git a/components/script/dom/webidls/BluetoothUUID.webidl b/components/script/dom/webidls/BluetoothUUID.webidl | |
index dddeafb..2e5704c 100644 | |
--- a/components/script/dom/webidls/BluetoothUUID.webidl | |
+++ b/components/script/dom/webidls/BluetoothUUID.webidl | |
@@ -6,17 +6,18 @@ | |
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothuuid | |
interface BluetoothUUID { | |
- // static UUID getService((DOMString or unsigned long) name); | |
- // static UUID getCharacteristic((DOMString or unsigned long) name); | |
- // static UUID getDescriptor((DOMString or unsigned long) name); | |
+ //static UUID getService((DOMString or unsigned long) name); | |
+ //static UUID getCharacteristic((DOMString or unsigned long) name); | |
+ //static UUID getDescriptor((DOMString or unsigned long) name); | |
static UUID canonicalUUID([EnforceRange] unsigned long alias); | |
}; | |
typedef DOMString UUID; | |
-// typedef (DOMString or unsigned long) BluetoothServiceUUID; | |
+typedef (DOMString or unsigned long) BluetoothServiceUUID; | |
-// typedef (DOMString or unsigned long) BluetoothCharacteristicUUID; | |
+typedef (DOMString or unsigned long) BluetoothCharacteristicUUID; | |
+ | |
+typedef (DOMString or unsigned long) BluetoothDescriptorUUID; | |
-// typedef (DOMString or unsigned long) BluetoothDescriptorUUID; | |
diff --git a/components/script/dom/webidls/Navigator.webidl b/components/script/dom/webidls/Navigator.webidl | |
index 869eaab..8bec10e 100644 | |
--- a/components/script/dom/webidls/Navigator.webidl | |
+++ b/components/script/dom/webidls/Navigator.webidl | |
@@ -6,8 +6,11 @@ | |
// https://html.spec.whatwg.org/multipage/#navigator | |
interface Navigator { | |
// objects implementing this interface also implement the interfaces given below | |
+ | |
+ | |
}; | |
Navigator implements NavigatorID; | |
+Navigator implements NavigatorBluetooth; | |
//Navigator implements NavigatorLanguage; | |
//Navigator implements NavigatorOnLine; | |
//Navigator implements NavigatorContentUtils; | |
@@ -25,3 +28,8 @@ interface NavigatorID { | |
boolean taintEnabled(); // constant false | |
readonly attribute DOMString userAgent; | |
}; | |
+ | |
+[NoInterfaceObject] | |
+interface NavigatorBluetooth { | |
+ readonly attribute Bluetooth bluetooth; | |
+}; | |
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock | |
index dd8ef98..bbdfc39 100644 | |
--- a/components/servo/Cargo.lock | |
+++ b/components/servo/Cargo.lock | |
@@ -533,7 +533,7 @@ dependencies = [ | |
[[package]] | |
name = "expat-sys" | |
-version = "2.1.1-really.0" | |
+version = "2.1.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
@@ -1651,7 +1651,7 @@ name = "servo-fontconfig-sys" | |
version = "2.11.2-really.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
- "expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
+ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | |
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
@@ -1700,7 +1700,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
- "expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
+ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock | |
index f860549..2b0f2f2 100644 | |
--- a/ports/cef/Cargo.lock | |
+++ b/ports/cef/Cargo.lock | |
@@ -501,7 +501,7 @@ dependencies = [ | |
[[package]] | |
name = "expat-sys" | |
-version = "2.1.1-really.0" | |
+version = "2.1.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
@@ -1601,7 +1601,7 @@ name = "servo-fontconfig-sys" | |
version = "2.11.2-really.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
- "expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
+ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | |
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
@@ -1650,7 +1650,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
- "expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
+ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock | |
index 1ab510b..1d4cb34 100644 | |
--- a/ports/gonk/Cargo.lock | |
+++ b/ports/gonk/Cargo.lock | |
@@ -492,7 +492,7 @@ dependencies = [ | |
[[package]] | |
name = "expat-sys" | |
-version = "2.1.1-really.0" | |
+version = "2.1.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"make-cmd 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
@@ -1570,7 +1570,7 @@ name = "servo-fontconfig-sys" | |
version = "2.11.2-really.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
- "expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
+ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | |
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
@@ -1619,7 +1619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
- "expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
+ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
diff --git a/tests/html/test_bluetooth_requestdevice.html b/tests/html/test_bluetooth_requestdevice.html | |
new file mode 100644 | |
index 0000000..ebe902f | |
--- /dev/null | |
+++ b/tests/html/test_bluetooth_requestdevice.html | |
@@ -0,0 +1,16 @@ | |
+<!DOCTYPE html> | |
+<html> | |
+ <head> | |
+ <title>Test innerHeight</title> | |
+ <script type="text/javascript"> | |
+ function requestDevice() { | |
+ var device= window.navigator.bluetooth.requestDevice(); | |
+ console.log(device); | |
+ return device; | |
+ } | |
+ </script> | |
+ </head> | |
+ <body> | |
+ <button onclick="requestDevice();">Test</button> | |
+ </body> | |
+</html> | |
\ No newline at end of file | |
diff --git a/tests/html/test_bluetoothdevice_getters.html b/tests/html/test_bluetoothdevice_getters.html | |
new file mode 100644 | |
index 0000000..c334069 | |
--- /dev/null | |
+++ b/tests/html/test_bluetoothdevice_getters.html | |
@@ -0,0 +1,59 @@ | |
+<!DOCTYPE html> | |
+<html> | |
+ <head> | |
+ <title>Test innerHeight</title> | |
+ <script type="text/javascript"> | |
+ function getID() { | |
+ var device = window.navigator.bluetooth.requestDevice(); | |
+ console.log(device); | |
+ var deviceId = device.Id(); | |
+ console.log(deviceId); | |
+ return deviceId; | |
+ } | |
+ function getName() { | |
+ var deviceName = window.navigator.bluetooth.requestDevice().name; | |
+ console.log(deviceName); | |
+ return deviceName; | |
+ } | |
+ function getDeviceClass() { | |
+ var deviceClass = window.navigator.bluetooth.requestDevice().class; | |
+ console.log(deviceClass); | |
+ return deviceClass; | |
+ } | |
+ function getVendorIDSource() { | |
+ var vendorIdSource = window.navigator.bluetooth.requestDevice().vendorIDSource; | |
+ console.log(vendorIdSource); | |
+ return vendorIdSource; | |
+ } | |
+ function getVendorID() { | |
+ var vendorId = window.navigator.bluetooth.requestDevice().vendorID; | |
+ console.log(vendorId); | |
+ return vendorId; | |
+ } | |
+ function getProductID() { | |
+ var productId = window.navigator.bluetooth.requestDevice().productID; | |
+ console.log(productId); | |
+ return productId; | |
+ } | |
+ function getProductVersion() { | |
+ var productVersion = window.navigator.bluetooth.requestDevice().productVersion; | |
+ console.log(productVersion); | |
+ return productVersion; | |
+ } | |
+ function getGattServer() { | |
+ var gattServer = window.navigator.bluetooth.requestDevice().gatt; | |
+ console.log(gattServer); | |
+ return gattServer | |
+ } | |
+ </script> | |
+ </head> | |
+ <body> | |
+ <button onclick="getName();">Test Name</button></br> | |
+ <button onclick="getDeviceClass();">Test Class</button></br> | |
+ <button onclick="getVendorIDSource();">Test Name VendorIDSource</button></br> | |
+ <button onclick="getVendorID();">Test VendorID</button></br> | |
+ <button onclick="getProductID();">Test ProductID</button></br> | |
+ <button onclick="getProductVersion();">Test ProductVersion</button></br> | |
+ <button onclick="getGattServer();">Test GATTServer</button> </br> | |
+ </body> | |
+</html> | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment