-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web-sys: Add WebBluetooth to enabled directory
Add WebBluetooth IDL (taken from WebBluetooth spec), as well as generated files and feature updates.
- Loading branch information
Showing
26 changed files
with
2,278 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#![allow(unused_imports)] | ||
use super::*; | ||
use wasm_bindgen::prelude::*; | ||
#[wasm_bindgen] | ||
extern "C" { | ||
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = AllowedBluetoothDevice)] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
#[doc = "The `AllowedBluetoothDevice` dictionary."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] | ||
pub type AllowedBluetoothDevice; | ||
} | ||
impl AllowedBluetoothDevice { | ||
#[doc = "Construct a new `AllowedBluetoothDevice`."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] | ||
pub fn new( | ||
allowed_services: &::wasm_bindgen::JsValue, | ||
device_id: &str, | ||
may_use_gatt: bool, | ||
) -> Self { | ||
#[allow(unused_mut)] | ||
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); | ||
ret.allowed_services(allowed_services); | ||
ret.device_id(device_id); | ||
ret.may_use_gatt(may_use_gatt); | ||
ret | ||
} | ||
#[doc = "Change the `allowedServices` field of this object."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] | ||
pub fn allowed_services(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { | ||
use wasm_bindgen::JsValue; | ||
let r = ::js_sys::Reflect::set( | ||
self.as_ref(), | ||
&JsValue::from("allowedServices"), | ||
&JsValue::from(val), | ||
); | ||
debug_assert!( | ||
r.is_ok(), | ||
"setting properties should never fail on our dictionary objects" | ||
); | ||
let _ = r; | ||
self | ||
} | ||
#[doc = "Change the `deviceId` field of this object."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] | ||
pub fn device_id(&mut self, val: &str) -> &mut Self { | ||
use wasm_bindgen::JsValue; | ||
let r = ::js_sys::Reflect::set( | ||
self.as_ref(), | ||
&JsValue::from("deviceId"), | ||
&JsValue::from(val), | ||
); | ||
debug_assert!( | ||
r.is_ok(), | ||
"setting properties should never fail on our dictionary objects" | ||
); | ||
let _ = r; | ||
self | ||
} | ||
#[doc = "Change the `mayUseGATT` field of this object."] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `AllowedBluetoothDevice`*"] | ||
pub fn may_use_gatt(&mut self, val: bool) -> &mut Self { | ||
use wasm_bindgen::JsValue; | ||
let r = ::js_sys::Reflect::set( | ||
self.as_ref(), | ||
&JsValue::from("mayUseGATT"), | ||
&JsValue::from(val), | ||
); | ||
debug_assert!( | ||
r.is_ok(), | ||
"setting properties should never fail on our dictionary objects" | ||
); | ||
let _ = r; | ||
self | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
#![allow(unused_imports)] | ||
use super::*; | ||
use wasm_bindgen::prelude::*; | ||
#[wasm_bindgen] | ||
extern "C" { | ||
# [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = Bluetooth , typescript_type = "Bluetooth")] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
#[doc = "The `Bluetooth` class."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub type Bluetooth; | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = onavailabilitychanged)] | ||
#[doc = "Getter for the `onavailabilitychanged` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onavailabilitychanged)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn onavailabilitychanged(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = onavailabilitychanged)] | ||
#[doc = "Setter for the `onavailabilitychanged` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onavailabilitychanged)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_onavailabilitychanged(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
#[cfg(feature = "BluetoothDevice")] | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = referringDevice)] | ||
#[doc = "Getter for the `referringDevice` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/referringDevice)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`, `BluetoothDevice`*"] | ||
pub fn referring_device(this: &Bluetooth) -> Option<BluetoothDevice>; | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = onadvertisementreceived)] | ||
#[doc = "Getter for the `onadvertisementreceived` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onadvertisementreceived)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn onadvertisementreceived(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = onadvertisementreceived)] | ||
#[doc = "Setter for the `onadvertisementreceived` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onadvertisementreceived)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_onadvertisementreceived(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = ongattserverdisconnected)] | ||
#[doc = "Getter for the `ongattserverdisconnected` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/ongattserverdisconnected)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn ongattserverdisconnected(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = ongattserverdisconnected)] | ||
#[doc = "Setter for the `ongattserverdisconnected` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/ongattserverdisconnected)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_ongattserverdisconnected(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = oncharacteristicvaluechanged)] | ||
#[doc = "Getter for the `oncharacteristicvaluechanged` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/oncharacteristicvaluechanged)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn oncharacteristicvaluechanged(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = oncharacteristicvaluechanged)] | ||
#[doc = "Setter for the `oncharacteristicvaluechanged` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/oncharacteristicvaluechanged)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_oncharacteristicvaluechanged(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = onserviceadded)] | ||
#[doc = "Getter for the `onserviceadded` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onserviceadded)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn onserviceadded(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = onserviceadded)] | ||
#[doc = "Setter for the `onserviceadded` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onserviceadded)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_onserviceadded(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = onservicechanged)] | ||
#[doc = "Getter for the `onservicechanged` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onservicechanged)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn onservicechanged(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = onservicechanged)] | ||
#[doc = "Setter for the `onservicechanged` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onservicechanged)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_onservicechanged(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
# [wasm_bindgen (structural , method , getter , js_class = "Bluetooth" , js_name = onserviceremoved)] | ||
#[doc = "Getter for the `onserviceremoved` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onserviceremoved)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn onserviceremoved(this: &Bluetooth) -> Option<::js_sys::Function>; | ||
# [wasm_bindgen (structural , method , setter , js_class = "Bluetooth" , js_name = onserviceremoved)] | ||
#[doc = "Setter for the `onserviceremoved` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/onserviceremoved)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn set_onserviceremoved(this: &Bluetooth, value: Option<&::js_sys::Function>); | ||
# [wasm_bindgen (method , structural , js_class = "Bluetooth" , js_name = getAvailability)] | ||
#[doc = "The `getAvailability()` method."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/getAvailability)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn get_availability(this: &Bluetooth) -> ::js_sys::Promise; | ||
# [wasm_bindgen (method , structural , js_class = "Bluetooth" , js_name = getDevices)] | ||
#[doc = "The `getDevices()` method."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/getDevices)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn get_devices(this: &Bluetooth) -> ::js_sys::Promise; | ||
# [wasm_bindgen (method , structural , js_class = "Bluetooth" , js_name = requestDevice)] | ||
#[doc = "The `requestDevice()` method."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`*"] | ||
pub fn request_device(this: &Bluetooth) -> ::js_sys::Promise; | ||
#[cfg(feature = "RequestDeviceOptions")] | ||
# [wasm_bindgen (method , structural , js_class = "Bluetooth" , js_name = requestDevice)] | ||
#[doc = "The `requestDevice()` method."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Bluetooth/requestDevice)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `Bluetooth`, `RequestDeviceOptions`*"] | ||
pub fn request_device_with_options( | ||
this: &Bluetooth, | ||
options: &RequestDeviceOptions, | ||
) -> ::js_sys::Promise; | ||
} |
66 changes: 66 additions & 0 deletions
66
crates/web-sys/src/features/gen_BluetoothAdvertisingEvent.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#![allow(unused_imports)] | ||
use super::*; | ||
use wasm_bindgen::prelude::*; | ||
#[wasm_bindgen] | ||
extern "C" { | ||
# [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = BluetoothAdvertisingEvent , typescript_type = "BluetoothAdvertisingEvent")] | ||
#[derive(Debug, Clone, PartialEq, Eq)] | ||
#[doc = "The `BluetoothAdvertisingEvent` class."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`*"] | ||
pub type BluetoothAdvertisingEvent; | ||
#[cfg(feature = "BluetoothDevice")] | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = device)] | ||
#[doc = "Getter for the `device` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/device)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`, `BluetoothDevice`*"] | ||
pub fn device(this: &BluetoothAdvertisingEvent) -> BluetoothDevice; | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = name)] | ||
#[doc = "Getter for the `name` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/name)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`*"] | ||
pub fn name(this: &BluetoothAdvertisingEvent) -> Option<String>; | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = appearance)] | ||
#[doc = "Getter for the `appearance` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/appearance)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`*"] | ||
pub fn appearance(this: &BluetoothAdvertisingEvent) -> Option<u16>; | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = txPower)] | ||
#[doc = "Getter for the `txPower` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/txPower)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`*"] | ||
pub fn tx_power(this: &BluetoothAdvertisingEvent) -> Option<i8>; | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = rssi)] | ||
#[doc = "Getter for the `rssi` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/rssi)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`*"] | ||
pub fn rssi(this: &BluetoothAdvertisingEvent) -> Option<i8>; | ||
#[cfg(feature = "BluetoothManufacturerDataMap")] | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = manufacturerData)] | ||
#[doc = "Getter for the `manufacturerData` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/manufacturerData)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`, `BluetoothManufacturerDataMap`*"] | ||
pub fn manufacturer_data(this: &BluetoothAdvertisingEvent) -> BluetoothManufacturerDataMap; | ||
#[cfg(feature = "BluetoothServiceDataMap")] | ||
# [wasm_bindgen (structural , method , getter , js_class = "BluetoothAdvertisingEvent" , js_name = serviceData)] | ||
#[doc = "Getter for the `serviceData` field of this object."] | ||
#[doc = ""] | ||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothAdvertisingEvent/serviceData)"] | ||
#[doc = ""] | ||
#[doc = "*This API requires the following crate features to be activated: `BluetoothAdvertisingEvent`, `BluetoothServiceDataMap`*"] | ||
pub fn service_data(this: &BluetoothAdvertisingEvent) -> BluetoothServiceDataMap; | ||
} |
Oops, something went wrong.