diff options
author | Attila Dusnoki <dati91@gmail.com> | 2016-03-02 15:00:13 +0100 |
---|---|---|
committer | Attila Dusnoki <dati91@gmail.com> | 2016-03-16 10:34:48 +0100 |
commit | e7d70cfabf5ad412045fd4088379afd1bedfaece (patch) | |
tree | 864717991d59edd654547256df45dd60f099f61b /components/script/dom/bluetooth.rs | |
parent | 00628704ca5f3318a4b97b7586cd17b31eabf5f6 (diff) | |
download | servo-e7d70cfabf5ad412045fd4088379afd1bedfaece.tar.gz servo-e7d70cfabf5ad412045fd4088379afd1bedfaece.zip |
WebBluetooth API classes
Diffstat (limited to 'components/script/dom/bluetooth.rs')
-rw-r--r-- | components/script/dom/bluetooth.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs new file mode 100644 index 00000000000..58d506dec45 --- /dev/null +++ b/components/script/dom/bluetooth.rs @@ -0,0 +1,39 @@ +/* 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::BluetoothBinding; +use dom::bindings::codegen::Bindings::BluetoothBinding::BluetoothMethods; +use dom::bindings::global::GlobalRef; +use dom::bindings::js::Root; +use dom::bindings::reflector::{Reflector, reflect_dom_object}; +use dom::bluetoothdevice::BluetoothDevice; + +// https://webbluetoothcg.github.io/web-bluetooth/#bluetooth +#[dom_struct] +pub struct Bluetooth { + reflector_: Reflector, +} + +impl Bluetooth { + pub fn new_inherited() -> Bluetooth { + Bluetooth { + reflector_: Reflector::new(), + } + } + + pub fn new(global: GlobalRef) -> Root<Bluetooth> { + reflect_dom_object(box Bluetooth::new_inherited(), + global, + BluetoothBinding::Wrap) + } +} + +impl BluetoothMethods for Bluetooth { + + // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice + fn RequestDevice(&self) -> Option<Root<BluetoothDevice>> { + //UNIMPLEMENTED + None + } +} |