mirror of
https://github.com/servo/servo.git
synced 2025-06-08 00:23:30 +00:00
Cleaned up ripples due to MutJS to JS type change
This commit is contained in:
parent
7e3c9e2197
commit
29340b7adf
6 changed files with 38 additions and 38 deletions
|
@ -15,7 +15,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||||
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
||||||
use dom::bindings::error::Error::{self, Network, NotFound, Security, Type};
|
use dom::bindings::error::Error::{self, Network, NotFound, Security, Type};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::js::{MutJS, Root};
|
use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::refcounted::{Trusted, TrustedPromise};
|
use dom::bindings::refcounted::{Trusted, TrustedPromise};
|
||||||
use dom::bindings::reflector::{DomObject, reflect_dom_object};
|
use dom::bindings::reflector::{DomObject, reflect_dom_object};
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
|
@ -83,7 +83,7 @@ impl<T: AsyncBluetoothListener + DomObject> BluetoothContext<T> {
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct Bluetooth {
|
pub struct Bluetooth {
|
||||||
eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
device_instance_map: DOMRefCell<HashMap<String, MutJS<BluetoothDevice>>>,
|
device_instance_map: DOMRefCell<HashMap<String, JS<BluetoothDevice>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Bluetooth {
|
impl Bluetooth {
|
||||||
|
@ -104,7 +104,7 @@ impl Bluetooth {
|
||||||
self.global().as_window().bluetooth_thread()
|
self.global().as_window().bluetooth_thread()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_device_map(&self) -> &DOMRefCell<HashMap<String, MutJS<BluetoothDevice>>> {
|
pub fn get_device_map(&self) -> &DOMRefCell<HashMap<String, JS<BluetoothDevice>>> {
|
||||||
&self.device_instance_map
|
&self.device_instance_map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,13 +466,13 @@ impl AsyncBluetoothListener for Bluetooth {
|
||||||
BluetoothResponse::RequestDevice(device) => {
|
BluetoothResponse::RequestDevice(device) => {
|
||||||
let mut device_instance_map = self.device_instance_map.borrow_mut();
|
let mut device_instance_map = self.device_instance_map.borrow_mut();
|
||||||
if let Some(existing_device) = device_instance_map.get(&device.id.clone()) {
|
if let Some(existing_device) = device_instance_map.get(&device.id.clone()) {
|
||||||
return promise.resolve_native(promise_cx, &existing_device.get());
|
return promise.resolve_native(promise_cx, &**existing_device);
|
||||||
}
|
}
|
||||||
let bt_device = BluetoothDevice::new(&self.global(),
|
let bt_device = BluetoothDevice::new(&self.global(),
|
||||||
DOMString::from(device.id.clone()),
|
DOMString::from(device.id.clone()),
|
||||||
device.name.map(DOMString::from),
|
device.name.map(DOMString::from),
|
||||||
&self);
|
&self);
|
||||||
device_instance_map.insert(device.id, MutJS::new(&bt_device));
|
device_instance_map.insert(device.id, JS::from_ref(&bt_device));
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
|
||||||
// Step 5.
|
// Step 5.
|
||||||
promise.resolve_native(promise_cx, &bt_device);
|
promise.resolve_native(promise_cx, &bt_device);
|
||||||
|
|
|
@ -12,7 +12,7 @@ use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||||
use dom::bindings::error::Error;
|
use dom::bindings::error::Error;
|
||||||
use dom::bindings::error::ErrorResult;
|
use dom::bindings::error::ErrorResult;
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
use dom::bindings::js::{MutJS, MutNullableJS, Root};
|
use dom::bindings::js::{JS, MutNullableJS, Root};
|
||||||
use dom::bindings::reflector::{DomObject, reflect_dom_object};
|
use dom::bindings::reflector::{DomObject, reflect_dom_object};
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async};
|
use dom::bluetooth::{AsyncBluetoothListener, Bluetooth, response_async};
|
||||||
|
@ -37,10 +37,10 @@ pub struct BluetoothDevice {
|
||||||
id: DOMString,
|
id: DOMString,
|
||||||
name: Option<DOMString>,
|
name: Option<DOMString>,
|
||||||
gatt: MutNullableJS<BluetoothRemoteGATTServer>,
|
gatt: MutNullableJS<BluetoothRemoteGATTServer>,
|
||||||
context: MutJS<Bluetooth>,
|
context: JS<Bluetooth>,
|
||||||
attribute_instance_map: (DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTService>>>,
|
attribute_instance_map: (DOMRefCell<HashMap<String, JS<BluetoothRemoteGATTService>>>,
|
||||||
DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTCharacteristic>>>,
|
DOMRefCell<HashMap<String, JS<BluetoothRemoteGATTCharacteristic>>>,
|
||||||
DOMRefCell<HashMap<String, MutJS<BluetoothRemoteGATTDescriptor>>>),
|
DOMRefCell<HashMap<String, JS<BluetoothRemoteGATTDescriptor>>>),
|
||||||
watching_advertisements: Cell<bool>,
|
watching_advertisements: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ impl BluetoothDevice {
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
gatt: Default::default(),
|
gatt: Default::default(),
|
||||||
context: MutJS::new(context),
|
context: JS::from_ref(context),
|
||||||
attribute_instance_map: (DOMRefCell::new(HashMap::new()),
|
attribute_instance_map: (DOMRefCell::new(HashMap::new()),
|
||||||
DOMRefCell::new(HashMap::new()),
|
DOMRefCell::new(HashMap::new()),
|
||||||
DOMRefCell::new(HashMap::new())),
|
DOMRefCell::new(HashMap::new())),
|
||||||
|
@ -75,7 +75,7 @@ impl BluetoothDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_context(&self) -> Root<Bluetooth> {
|
fn get_context(&self) -> Root<Bluetooth> {
|
||||||
self.context.get()
|
Root::from_ref(&self.context)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_or_create_service(&self,
|
pub fn get_or_create_service(&self,
|
||||||
|
@ -85,14 +85,14 @@ impl BluetoothDevice {
|
||||||
let (ref service_map_ref, _, _) = self.attribute_instance_map;
|
let (ref service_map_ref, _, _) = self.attribute_instance_map;
|
||||||
let mut service_map = service_map_ref.borrow_mut();
|
let mut service_map = service_map_ref.borrow_mut();
|
||||||
if let Some(existing_service) = service_map.get(&service.instance_id) {
|
if let Some(existing_service) = service_map.get(&service.instance_id) {
|
||||||
return existing_service.get();
|
return Root::from_ref(&existing_service);
|
||||||
}
|
}
|
||||||
let bt_service = BluetoothRemoteGATTService::new(&server.global(),
|
let bt_service = BluetoothRemoteGATTService::new(&server.global(),
|
||||||
&server.Device(),
|
&server.Device(),
|
||||||
DOMString::from(service.uuid.clone()),
|
DOMString::from(service.uuid.clone()),
|
||||||
service.is_primary,
|
service.is_primary,
|
||||||
service.instance_id.clone());
|
service.instance_id.clone());
|
||||||
service_map.insert(service.instance_id.clone(), MutJS::new(&bt_service));
|
service_map.insert(service.instance_id.clone(), JS::from_ref(&bt_service));
|
||||||
return bt_service;
|
return bt_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ impl BluetoothDevice {
|
||||||
let (_, ref characteristic_map_ref, _) = self.attribute_instance_map;
|
let (_, ref characteristic_map_ref, _) = self.attribute_instance_map;
|
||||||
let mut characteristic_map = characteristic_map_ref.borrow_mut();
|
let mut characteristic_map = characteristic_map_ref.borrow_mut();
|
||||||
if let Some(existing_characteristic) = characteristic_map.get(&characteristic.instance_id) {
|
if let Some(existing_characteristic) = characteristic_map.get(&characteristic.instance_id) {
|
||||||
return existing_characteristic.get();
|
return Root::from_ref(&existing_characteristic);
|
||||||
}
|
}
|
||||||
let properties =
|
let properties =
|
||||||
BluetoothCharacteristicProperties::new(&service.global(),
|
BluetoothCharacteristicProperties::new(&service.global(),
|
||||||
|
@ -121,7 +121,7 @@ impl BluetoothDevice {
|
||||||
DOMString::from(characteristic.uuid.clone()),
|
DOMString::from(characteristic.uuid.clone()),
|
||||||
&properties,
|
&properties,
|
||||||
characteristic.instance_id.clone());
|
characteristic.instance_id.clone());
|
||||||
characteristic_map.insert(characteristic.instance_id.clone(), MutJS::new(&bt_characteristic));
|
characteristic_map.insert(characteristic.instance_id.clone(), JS::from_ref(&bt_characteristic));
|
||||||
return bt_characteristic;
|
return bt_characteristic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,13 +139,13 @@ impl BluetoothDevice {
|
||||||
let (_, _, ref descriptor_map_ref) = self.attribute_instance_map;
|
let (_, _, ref descriptor_map_ref) = self.attribute_instance_map;
|
||||||
let mut descriptor_map = descriptor_map_ref.borrow_mut();
|
let mut descriptor_map = descriptor_map_ref.borrow_mut();
|
||||||
if let Some(existing_descriptor) = descriptor_map.get(&descriptor.instance_id) {
|
if let Some(existing_descriptor) = descriptor_map.get(&descriptor.instance_id) {
|
||||||
return existing_descriptor.get();
|
return Root::from_ref(&existing_descriptor);
|
||||||
}
|
}
|
||||||
let bt_descriptor = BluetoothRemoteGATTDescriptor::new(&characteristic.global(),
|
let bt_descriptor = BluetoothRemoteGATTDescriptor::new(&characteristic.global(),
|
||||||
characteristic,
|
characteristic,
|
||||||
DOMString::from(descriptor.uuid.clone()),
|
DOMString::from(descriptor.uuid.clone()),
|
||||||
descriptor.instance_id.clone());
|
descriptor.instance_id.clone());
|
||||||
descriptor_map.insert(descriptor.instance_id.clone(), MutJS::new(&bt_descriptor));
|
descriptor_map.insert(descriptor.instance_id.clone(), JS::from_ref(&bt_descriptor));
|
||||||
return bt_descriptor;
|
return bt_descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ impl BluetoothDevice {
|
||||||
for (id, device) in context.get_device_map().borrow().iter() {
|
for (id, device) in context.get_device_map().borrow().iter() {
|
||||||
// Step 2.1 - 2.2.
|
// Step 2.1 - 2.2.
|
||||||
if id == &self.Id().to_string() {
|
if id == &self.Id().to_string() {
|
||||||
if device.get().Gatt().Connected() {
|
if device.Gatt().Connected() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
// TODO: Step 2.3: Implement activeAlgorithms internal slot for BluetoothRemoteGATTServer.
|
// TODO: Step 2.3: Implement activeAlgorithms internal slot for BluetoothRemoteGATTServer.
|
||||||
|
|
|
@ -16,7 +16,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::Bluetoo
|
||||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||||
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
|
use dom::bindings::error::Error::{self, InvalidModification, Network, NotSupported, Security};
|
||||||
use dom::bindings::inheritance::Castable;
|
use dom::bindings::inheritance::Castable;
|
||||||
use dom::bindings::js::{MutJS, Root};
|
use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::reflector::{DomObject, reflect_dom_object};
|
use dom::bindings::reflector::{DomObject, reflect_dom_object};
|
||||||
use dom::bindings::str::{ByteString, DOMString};
|
use dom::bindings::str::{ByteString, DOMString};
|
||||||
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async};
|
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async};
|
||||||
|
@ -38,9 +38,9 @@ pub const MAXIMUM_ATTRIBUTE_LENGTH: usize = 512;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct BluetoothRemoteGATTCharacteristic {
|
pub struct BluetoothRemoteGATTCharacteristic {
|
||||||
eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
service: MutJS<BluetoothRemoteGATTService>,
|
service: JS<BluetoothRemoteGATTService>,
|
||||||
uuid: DOMString,
|
uuid: DOMString,
|
||||||
properties: MutJS<BluetoothCharacteristicProperties>,
|
properties: JS<BluetoothCharacteristicProperties>,
|
||||||
value: DOMRefCell<Option<ByteString>>,
|
value: DOMRefCell<Option<ByteString>>,
|
||||||
instance_id: String,
|
instance_id: String,
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,9 @@ impl BluetoothRemoteGATTCharacteristic {
|
||||||
-> BluetoothRemoteGATTCharacteristic {
|
-> BluetoothRemoteGATTCharacteristic {
|
||||||
BluetoothRemoteGATTCharacteristic {
|
BluetoothRemoteGATTCharacteristic {
|
||||||
eventtarget: EventTarget::new_inherited(),
|
eventtarget: EventTarget::new_inherited(),
|
||||||
service: MutJS::new(service),
|
service: JS::from_ref(service),
|
||||||
uuid: uuid,
|
uuid: uuid,
|
||||||
properties: MutJS::new(properties),
|
properties: JS::from_ref(properties),
|
||||||
value: DOMRefCell::new(None),
|
value: DOMRefCell::new(None),
|
||||||
instance_id: instance_id,
|
instance_id: instance_id,
|
||||||
}
|
}
|
||||||
|
@ -87,12 +87,12 @@ impl BluetoothRemoteGATTCharacteristic {
|
||||||
impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic {
|
impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic {
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
|
||||||
fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
|
fn Properties(&self) -> Root<BluetoothCharacteristicProperties> {
|
||||||
self.properties.get()
|
Root::from_ref(&self.properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-service
|
||||||
fn Service(&self) -> Root<BluetoothRemoteGATTService> {
|
fn Service(&self) -> Root<BluetoothRemoteGATTService> {
|
||||||
self.service.get()
|
Root::from_ref(&self.service)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-uuid
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-uuid
|
||||||
|
|
|
@ -13,7 +13,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::Blue
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
||||||
use dom::bindings::error::Error::{self, InvalidModification, Network, Security};
|
use dom::bindings::error::Error::{self, InvalidModification, Network, Security};
|
||||||
use dom::bindings::js::{MutJS, Root};
|
use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||||
use dom::bindings::str::{ByteString, DOMString};
|
use dom::bindings::str::{ByteString, DOMString};
|
||||||
use dom::bluetooth::{AsyncBluetoothListener, response_async};
|
use dom::bluetooth::{AsyncBluetoothListener, response_async};
|
||||||
|
@ -28,7 +28,7 @@ use std::rc::Rc;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct BluetoothRemoteGATTDescriptor {
|
pub struct BluetoothRemoteGATTDescriptor {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
characteristic: MutJS<BluetoothRemoteGATTCharacteristic>,
|
characteristic: JS<BluetoothRemoteGATTCharacteristic>,
|
||||||
uuid: DOMString,
|
uuid: DOMString,
|
||||||
value: DOMRefCell<Option<ByteString>>,
|
value: DOMRefCell<Option<ByteString>>,
|
||||||
instance_id: String,
|
instance_id: String,
|
||||||
|
@ -41,7 +41,7 @@ impl BluetoothRemoteGATTDescriptor {
|
||||||
-> BluetoothRemoteGATTDescriptor {
|
-> BluetoothRemoteGATTDescriptor {
|
||||||
BluetoothRemoteGATTDescriptor {
|
BluetoothRemoteGATTDescriptor {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
characteristic: MutJS::new(characteristic),
|
characteristic: JS::from_ref(characteristic),
|
||||||
uuid: uuid,
|
uuid: uuid,
|
||||||
value: DOMRefCell::new(None),
|
value: DOMRefCell::new(None),
|
||||||
instance_id: instance_id,
|
instance_id: instance_id,
|
||||||
|
@ -72,7 +72,7 @@ impl BluetoothRemoteGATTDescriptor {
|
||||||
impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
|
||||||
fn Characteristic(&self) -> Root<BluetoothRemoteGATTCharacteristic> {
|
fn Characteristic(&self) -> Root<BluetoothRemoteGATTCharacteristic> {
|
||||||
self.characteristic.get()
|
Root::from_ref(&self.characteristic)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-uuid
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-uuid
|
||||||
|
|
|
@ -8,7 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||||
use dom::bindings::error::Error;
|
use dom::bindings::error::Error;
|
||||||
use dom::bindings::error::ErrorResult;
|
use dom::bindings::error::ErrorResult;
|
||||||
use dom::bindings::js::{MutJS, Root};
|
use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||||
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async};
|
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children, response_async};
|
||||||
use dom::bluetoothdevice::BluetoothDevice;
|
use dom::bluetoothdevice::BluetoothDevice;
|
||||||
|
@ -24,7 +24,7 @@ use std::rc::Rc;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct BluetoothRemoteGATTServer {
|
pub struct BluetoothRemoteGATTServer {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
device: MutJS<BluetoothDevice>,
|
device: JS<BluetoothDevice>,
|
||||||
connected: Cell<bool>,
|
connected: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ impl BluetoothRemoteGATTServer {
|
||||||
pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer {
|
pub fn new_inherited(device: &BluetoothDevice) -> BluetoothRemoteGATTServer {
|
||||||
BluetoothRemoteGATTServer {
|
BluetoothRemoteGATTServer {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
device: MutJS::new(device),
|
device: JS::from_ref(device),
|
||||||
connected: Cell::new(false),
|
connected: Cell::new(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ impl BluetoothRemoteGATTServer {
|
||||||
impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
|
||||||
fn Device(&self) -> Root<BluetoothDevice> {
|
fn Device(&self) -> Root<BluetoothDevice> {
|
||||||
self.device.get()
|
Root::from_ref(&self.device)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connected
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connected
|
||||||
|
|
|
@ -9,7 +9,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
||||||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||||
use dom::bindings::error::Error;
|
use dom::bindings::error::Error;
|
||||||
use dom::bindings::js::{MutJS, Root};
|
use dom::bindings::js::{JS, Root};
|
||||||
use dom::bindings::reflector::reflect_dom_object;
|
use dom::bindings::reflector::reflect_dom_object;
|
||||||
use dom::bindings::str::DOMString;
|
use dom::bindings::str::DOMString;
|
||||||
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children};
|
use dom::bluetooth::{AsyncBluetoothListener, get_gatt_children};
|
||||||
|
@ -25,7 +25,7 @@ use std::rc::Rc;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct BluetoothRemoteGATTService {
|
pub struct BluetoothRemoteGATTService {
|
||||||
eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
device: MutJS<BluetoothDevice>,
|
device: JS<BluetoothDevice>,
|
||||||
uuid: DOMString,
|
uuid: DOMString,
|
||||||
is_primary: bool,
|
is_primary: bool,
|
||||||
instance_id: String,
|
instance_id: String,
|
||||||
|
@ -39,7 +39,7 @@ impl BluetoothRemoteGATTService {
|
||||||
-> BluetoothRemoteGATTService {
|
-> BluetoothRemoteGATTService {
|
||||||
BluetoothRemoteGATTService {
|
BluetoothRemoteGATTService {
|
||||||
eventtarget: EventTarget::new_inherited(),
|
eventtarget: EventTarget::new_inherited(),
|
||||||
device: MutJS::new(device),
|
device: JS::from_ref(device),
|
||||||
uuid: uuid,
|
uuid: uuid,
|
||||||
is_primary: is_primary,
|
is_primary: is_primary,
|
||||||
instance_id: instance_id,
|
instance_id: instance_id,
|
||||||
|
@ -68,7 +68,7 @@ impl BluetoothRemoteGATTService {
|
||||||
impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device
|
||||||
fn Device(&self) -> Root<BluetoothDevice> {
|
fn Device(&self) -> Root<BluetoothDevice> {
|
||||||
self.device.get()
|
Root::from_ref(&self.device)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-isprimary
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-isprimary
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue