mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Error handling
This commit is contained in:
parent
b851045415
commit
27ad1437a1
8 changed files with 61 additions and 76 deletions
|
@ -188,10 +188,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => return Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
*self.value.borrow_mut() = value;
|
*self.value.borrow_mut() = value;
|
||||||
|
@ -200,19 +197,17 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-writevalue
|
||||||
fn WriteValue(&self, value: Vec<u8>) {
|
fn WriteValue(&self, value: Vec<u8>) -> Fallible<()> {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread().send(
|
||||||
BluetoothMethodMsg::WriteValue(self.get_instance_id(), value, sender)).unwrap();
|
BluetoothMethodMsg::WriteValue(self.get_instance_id(), value, sender)).unwrap();
|
||||||
let result = receiver.recv().unwrap();
|
let result = receiver.recv().unwrap();
|
||||||
match result {
|
match result {
|
||||||
BluetoothObjectMsg::BluetoothWriteValue => (),
|
BluetoothObjectMsg::BluetoothWriteValue => Ok(()),
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
},
|
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding;
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::BluetoothRemoteGATTDescriptorMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTDescriptorBinding::BluetoothRemoteGATTDescriptorMethods;
|
||||||
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::Network;
|
use dom::bindings::error::Error::{Type, Network};
|
||||||
use dom::bindings::error::Fallible;
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{JS, MutHeap, Root};
|
use dom::bindings::js::{JS, MutHeap, Root};
|
||||||
|
@ -103,10 +103,7 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => return Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
};
|
||||||
*self.value.borrow_mut() = value;
|
*self.value.borrow_mut() = value;
|
||||||
|
@ -115,19 +112,17 @@ impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-writevalue
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-writevalue
|
||||||
fn WriteValue(&self, value: Vec<u8>) {
|
fn WriteValue(&self, value: Vec<u8>) -> Fallible<()> {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread().send(
|
||||||
BluetoothMethodMsg::WriteValue(self.get_instance_id(), value, sender)).unwrap();
|
BluetoothMethodMsg::WriteValue(self.get_instance_id(), value, sender)).unwrap();
|
||||||
let result = receiver.recv().unwrap();
|
let result = receiver.recv().unwrap();
|
||||||
match result {
|
match result {
|
||||||
BluetoothObjectMsg::BluetoothWriteValue => (),
|
BluetoothObjectMsg::BluetoothWriteValue => Ok(()),
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
},
|
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMet
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||||
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
||||||
|
use dom::bindings::error::Error::Type;
|
||||||
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{JS, MutHeap, Root};
|
use dom::bindings::js::{JS, MutHeap, Root};
|
||||||
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
||||||
|
@ -60,29 +62,28 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-connect
|
||||||
fn Connect(&self) -> Root<BluetoothRemoteGATTServer> {
|
fn Connect(&self) -> Fallible<Root<BluetoothRemoteGATTServer>> {
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread()
|
||||||
BluetoothMethodMsg::GATTServerConnect(String::from(self.Device().Id()), sender)).unwrap();
|
.send(BluetoothMethodMsg::GATTServerConnect(String::from(self.Device().Id()), sender))
|
||||||
|
.unwrap();
|
||||||
let server = receiver.recv().unwrap();
|
let server = receiver.recv().unwrap();
|
||||||
match server {
|
match server {
|
||||||
BluetoothObjectMsg::BluetoothServer {
|
BluetoothObjectMsg::BluetoothServer {
|
||||||
connected
|
connected
|
||||||
} => {
|
} => {
|
||||||
self.connected.set(connected);
|
self.connected.set(connected);
|
||||||
|
Ok(Root::from_ref(self))
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
},
|
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
Root::from_ref(self)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect
|
||||||
fn Disconnect(&self) {
|
fn Disconnect(&self) -> Fallible<()>{
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread().send(
|
||||||
BluetoothMethodMsg::GATTServerDisconnect(String::from(self.Device().Id()), sender)).unwrap();
|
BluetoothMethodMsg::GATTServerDisconnect(String::from(self.Device().Id()), sender)).unwrap();
|
||||||
|
@ -92,24 +93,20 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||||
connected
|
connected
|
||||||
} => {
|
} => {
|
||||||
self.connected.set(connected);
|
self.connected.set(connected);
|
||||||
|
Ok(())
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
},
|
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
|
||||||
fn GetPrimaryService(&self, service: StringOrUnsignedLong) -> Option<Root<BluetoothRemoteGATTService>> {
|
fn GetPrimaryService(&self, service: StringOrUnsignedLong) -> Fallible<Root<BluetoothRemoteGATTService>> {
|
||||||
let uuid: String = match BluetoothUUID::GetService(self.global().r(), service.clone()) {
|
let uuid: String = match BluetoothUUID::GetService(self.global().r(), service.clone()) {
|
||||||
Ok(domstring) => domstring.to_string(),
|
Ok(domstring) => domstring.to_string(),
|
||||||
Err(_) => {
|
Err(error) => return Err(error),
|
||||||
println!("No UUID provided!");
|
|
||||||
return None;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread().send(
|
||||||
|
@ -121,7 +118,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||||
is_primary,
|
is_primary,
|
||||||
instance_id,
|
instance_id,
|
||||||
} => {
|
} => {
|
||||||
Some(BluetoothRemoteGATTService::new(self.global().r(),
|
Ok(BluetoothRemoteGATTService::new(self.global().r(),
|
||||||
&self.device.get(),
|
&self.device.get(),
|
||||||
DOMString::from(uuid),
|
DOMString::from(uuid),
|
||||||
is_primary,
|
is_primary,
|
||||||
|
@ -129,28 +126,26 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
|
||||||
fn GetPrimaryServices(&self, service: Option<StringOrUnsignedLong>)
|
fn GetPrimaryServices(&self, service: Option<StringOrUnsignedLong>)
|
||||||
-> Option<Vec<Root<BluetoothRemoteGATTService>>> {
|
-> Fallible<Vec<Root<BluetoothRemoteGATTService>>> {
|
||||||
let uuid: Option<String> = match service {
|
let uuid: Option<String> = match service {
|
||||||
Some(s) => match BluetoothUUID::GetService(self.global().r(), s.clone()) {
|
Some(s) => match BluetoothUUID::GetService(self.global().r(), s.clone()) {
|
||||||
Ok(domstring) => Some(domstring.to_string()),
|
Ok(domstring) => Some(domstring.to_string()),
|
||||||
Err(_) => None,
|
Err(error) => return Err(error),
|
||||||
},
|
},
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
let mut services: Vec<Root<BluetoothRemoteGATTService>> = vec!();
|
let mut services: Vec<Root<BluetoothRemoteGATTService>> = vec!();
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread()
|
||||||
BluetoothMethodMsg::GetPrimaryServices(String::from(self.Device().Id()), uuid, sender)).unwrap();
|
.send(BluetoothMethodMsg::GetPrimaryServices(String::from(self.Device().Id()), uuid, sender))
|
||||||
|
.unwrap();
|
||||||
let services_vec = receiver.recv().unwrap();
|
let services_vec = receiver.recv().unwrap();
|
||||||
match services_vec {
|
match services_vec {
|
||||||
BluetoothObjectMsg::BluetoothServices {
|
BluetoothObjectMsg::BluetoothServices {
|
||||||
|
@ -172,14 +167,11 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(services)
|
Ok(services)
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
||||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
||||||
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
||||||
|
use dom::bindings::error::Error::Type;
|
||||||
|
use dom::bindings::error::Fallible;
|
||||||
use dom::bindings::global::GlobalRef;
|
use dom::bindings::global::GlobalRef;
|
||||||
use dom::bindings::js::{JS, MutHeap, Root};
|
use dom::bindings::js::{JS, MutHeap, Root};
|
||||||
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
||||||
|
@ -84,18 +86,16 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic
|
||||||
fn GetCharacteristic(&self, characteristic: StringOrUnsignedLong)
|
fn GetCharacteristic(&self, characteristic: StringOrUnsignedLong)
|
||||||
-> Option<Root<BluetoothRemoteGATTCharacteristic>> {
|
-> Fallible<Root<BluetoothRemoteGATTCharacteristic>> {
|
||||||
let uuid: String = match BluetoothUUID::GetCharacteristic(self.global().r(),
|
let uuid: String = match BluetoothUUID::GetCharacteristic(self.global().r(),
|
||||||
characteristic.clone()) {
|
characteristic.clone()) {
|
||||||
Ok(domstring) => domstring.to_string(),
|
Ok(domstring) => domstring.to_string(),
|
||||||
Err(_) => {
|
Err(error) => return Err(error),
|
||||||
println!("No UUID provided!");
|
|
||||||
return None;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread()
|
||||||
BluetoothMethodMsg::GetCharacteristic(self.get_instance_id(), uuid, sender)).unwrap();
|
.send(BluetoothMethodMsg::GetCharacteristic(self.get_instance_id(), uuid, sender))
|
||||||
|
.unwrap();
|
||||||
let characteristic = receiver.recv().unwrap();
|
let characteristic = receiver.recv().unwrap();
|
||||||
match characteristic {
|
match characteristic {
|
||||||
BluetoothObjectMsg::BluetoothCharacteristic {
|
BluetoothObjectMsg::BluetoothCharacteristic {
|
||||||
|
@ -121,7 +121,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
||||||
authenticated_signed_writes,
|
authenticated_signed_writes,
|
||||||
reliable_write,
|
reliable_write,
|
||||||
writable_auxiliaries);
|
writable_auxiliaries);
|
||||||
Some(BluetoothRemoteGATTCharacteristic::new(self.global().r(),
|
Ok(BluetoothRemoteGATTCharacteristic::new(self.global().r(),
|
||||||
&self,
|
&self,
|
||||||
DOMString::from(uuid),
|
DOMString::from(uuid),
|
||||||
properties,
|
properties,
|
||||||
|
@ -129,28 +129,26 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => return Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics
|
||||||
fn GetCharacteristics(&self, characteristic: Option<StringOrUnsignedLong>)
|
fn GetCharacteristics(&self, characteristic: Option<StringOrUnsignedLong>)
|
||||||
-> Option<Vec<Root<BluetoothRemoteGATTCharacteristic>>> {
|
-> Fallible<Vec<Root<BluetoothRemoteGATTCharacteristic>>> {
|
||||||
let uuid: Option<String> = match characteristic {
|
let uuid: Option<String> = match characteristic {
|
||||||
Some(c) => match BluetoothUUID::GetCharacteristic(self.global().r(), c.clone()) {
|
Some(c) => match BluetoothUUID::GetCharacteristic(self.global().r(), c.clone()) {
|
||||||
Ok(domstring) => Some(domstring.to_string()),
|
Ok(domstring) => Some(domstring.to_string()),
|
||||||
Err(_) => None,
|
Err(error) => return Err(error),
|
||||||
},
|
},
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
let mut characteristics: Vec<Root<BluetoothRemoteGATTCharacteristic>> = vec!();
|
let mut characteristics: Vec<Root<BluetoothRemoteGATTCharacteristic>> = vec!();
|
||||||
let (sender, receiver) = ipc::channel().unwrap();
|
let (sender, receiver) = ipc::channel().unwrap();
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread()
|
||||||
BluetoothMethodMsg::GetCharacteristics(self.get_instance_id(), uuid, sender)).unwrap();
|
.send(BluetoothMethodMsg::GetCharacteristics(self.get_instance_id(), uuid, sender))
|
||||||
|
.unwrap();
|
||||||
let characteristics_vec = receiver.recv().unwrap();
|
let characteristics_vec = receiver.recv().unwrap();
|
||||||
match characteristics_vec {
|
match characteristics_vec {
|
||||||
BluetoothObjectMsg::BluetoothCharacteristics {
|
BluetoothObjectMsg::BluetoothCharacteristics {
|
||||||
|
@ -192,14 +190,11 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(characteristics)
|
Ok(characteristics)
|
||||||
},
|
},
|
||||||
BluetoothObjectMsg::Error {
|
BluetoothObjectMsg::Error {
|
||||||
error
|
error
|
||||||
} => {
|
} => return Err(Type(error)),
|
||||||
println!("{}", error);
|
|
||||||
None
|
|
||||||
},
|
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ interface BluetoothRemoteGATTCharacteristic {
|
||||||
[Throws]
|
[Throws]
|
||||||
ByteString readValue();
|
ByteString readValue();
|
||||||
//Promise<DataView> readValue();
|
//Promise<DataView> readValue();
|
||||||
|
[Throws]
|
||||||
void writeValue(sequence<octet> value);
|
void writeValue(sequence<octet> value);
|
||||||
//Promise<void> writeValue(BufferSource value);
|
//Promise<void> writeValue(BufferSource value);
|
||||||
//Promise<void> startNotifications();
|
//Promise<void> startNotifications();
|
||||||
|
|
|
@ -12,6 +12,7 @@ interface BluetoothRemoteGATTDescriptor {
|
||||||
[Throws]
|
[Throws]
|
||||||
ByteString readValue();
|
ByteString readValue();
|
||||||
//Promise<DataView> readValue();
|
//Promise<DataView> readValue();
|
||||||
|
[Throws]
|
||||||
void writeValue(sequence<octet> value);
|
void writeValue(sequence<octet> value);
|
||||||
//Promise<void> writeValue(BufferSource value);
|
//Promise<void> writeValue(BufferSource value);
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,10 +8,14 @@
|
||||||
interface BluetoothRemoteGATTServer {
|
interface BluetoothRemoteGATTServer {
|
||||||
readonly attribute BluetoothDevice device;
|
readonly attribute BluetoothDevice device;
|
||||||
readonly attribute boolean connected;
|
readonly attribute boolean connected;
|
||||||
|
[Throws]
|
||||||
BluetoothRemoteGATTServer connect();
|
BluetoothRemoteGATTServer connect();
|
||||||
|
[Throws]
|
||||||
void disconnect();
|
void disconnect();
|
||||||
BluetoothRemoteGATTService? getPrimaryService((DOMString or unsigned long) service);
|
[Throws]
|
||||||
sequence<BluetoothRemoteGATTService>? getPrimaryServices(optional (DOMString or unsigned long) service);
|
BluetoothRemoteGATTService getPrimaryService((DOMString or unsigned long) service);
|
||||||
|
[Throws]
|
||||||
|
sequence<BluetoothRemoteGATTService> getPrimaryServices(optional (DOMString or unsigned long) service);
|
||||||
//Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
|
//Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
|
||||||
//Promise<sequence<BluetoothRemoteGATTService>>getPrimaryServices(optional BluetoothServiceUUID service);
|
//Promise<sequence<BluetoothRemoteGATTService>>getPrimaryServices(optional BluetoothServiceUUID service);
|
||||||
//Promise<BluetoothRemoteGATTServer> connect();
|
//Promise<BluetoothRemoteGATTServer> connect();
|
||||||
|
|
|
@ -9,8 +9,10 @@ interface BluetoothRemoteGATTService {
|
||||||
readonly attribute BluetoothDevice device;
|
readonly attribute BluetoothDevice device;
|
||||||
readonly attribute DOMString uuid;
|
readonly attribute DOMString uuid;
|
||||||
readonly attribute boolean isPrimary;
|
readonly attribute boolean isPrimary;
|
||||||
BluetoothRemoteGATTCharacteristic? getCharacteristic((DOMString or unsigned long) characteristic);
|
[Throws]
|
||||||
sequence<BluetoothRemoteGATTCharacteristic>? getCharacteristics
|
BluetoothRemoteGATTCharacteristic getCharacteristic((DOMString or unsigned long) characteristic);
|
||||||
|
[Throws]
|
||||||
|
sequence<BluetoothRemoteGATTCharacteristic> getCharacteristics
|
||||||
(optional (DOMString or unsigned long) characteristic);
|
(optional (DOMString or unsigned long) characteristic);
|
||||||
//Promise<BluetoothRemoteGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic);
|
//Promise<BluetoothRemoteGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic);
|
||||||
//Promise<sequence<BluetoothRemoteGATTCharacteristic>>
|
//Promise<sequence<BluetoothRemoteGATTCharacteristic>>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue