aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bluetoothcharacteristicproperties.rs
diff options
context:
space:
mode:
authorAttila Dusnoki <dati91@gmail.com>2016-03-02 15:00:13 +0100
committerAttila Dusnoki <dati91@gmail.com>2016-03-16 10:34:48 +0100
commite7d70cfabf5ad412045fd4088379afd1bedfaece (patch)
tree864717991d59edd654547256df45dd60f099f61b /components/script/dom/bluetoothcharacteristicproperties.rs
parent00628704ca5f3318a4b97b7586cd17b31eabf5f6 (diff)
downloadservo-e7d70cfabf5ad412045fd4088379afd1bedfaece.tar.gz
servo-e7d70cfabf5ad412045fd4088379afd1bedfaece.zip
WebBluetooth API classes
Diffstat (limited to 'components/script/dom/bluetoothcharacteristicproperties.rs')
-rw-r--r--components/script/dom/bluetoothcharacteristicproperties.rs122
1 files changed, 122 insertions, 0 deletions
diff --git a/components/script/dom/bluetoothcharacteristicproperties.rs b/components/script/dom/bluetoothcharacteristicproperties.rs
new file mode 100644
index 00000000000..9abb5e5cd5b
--- /dev/null
+++ b/components/script/dom/bluetoothcharacteristicproperties.rs
@@ -0,0 +1,122 @@
+/* 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::BluetoothCharacteristicPropertiesBinding;
+use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::
+ BluetoothCharacteristicPropertiesMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::Root;
+use dom::bindings::reflector::{Reflector, reflect_dom_object};
+
+// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties
+ #[dom_struct]
+pub struct BluetoothCharacteristicProperties {
+ reflector_: Reflector,
+ broadcast: bool,
+ read: bool,
+ writeWithoutResponse: bool,
+ write: bool,
+ notify: bool,
+ indicate: bool,
+ authenticatedSignedWrites: bool,
+ reliableWrite: bool,
+ writableAuxiliaries: bool,
+}
+
+impl BluetoothCharacteristicProperties {
+ pub fn new_inherited(broadcast: bool,
+ read: bool,
+ writeWithoutResponse: bool,
+ write: bool,
+ notify: bool,
+ indicate: bool,
+ authenticatedSignedWrites: bool,
+ reliableWrite: bool,
+ writableAuxiliaries: bool)
+ -> BluetoothCharacteristicProperties {
+ BluetoothCharacteristicProperties {
+ reflector_: Reflector::new(),
+ broadcast: broadcast,
+ read: read,
+ writeWithoutResponse: writeWithoutResponse,
+ write: write,
+ notify: notify,
+ indicate: indicate,
+ authenticatedSignedWrites: authenticatedSignedWrites,
+ reliableWrite: reliableWrite,
+ writableAuxiliaries: writableAuxiliaries,
+ }
+ }
+
+ pub fn new(global: GlobalRef,
+ broadcast: bool,
+ read: bool,
+ writeWithoutResponse: bool,
+ write: bool,
+ notify: bool,
+ indicate: bool,
+ authenticatedSignedWrites: bool,
+ reliableWrite: bool,
+ writableAuxiliaries: bool)
+ -> Root<BluetoothCharacteristicProperties> {
+ reflect_dom_object(box BluetoothCharacteristicProperties::new_inherited(broadcast,
+ read,
+ writeWithoutResponse,
+ write,
+ notify,
+ indicate,
+ authenticatedSignedWrites,
+ reliableWrite,
+ writableAuxiliaries),
+ global,
+ BluetoothCharacteristicPropertiesBinding::Wrap)
+ }
+ }
+
+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-writableauxiliaries
+ fn WritableAuxiliaries(&self) -> bool {
+ self.writableAuxiliaries
+ }
+}