mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Untry
This commit is contained in:
parent
7af5a7fd54
commit
316cd35767
34 changed files with 261 additions and 264 deletions
|
@ -436,7 +436,7 @@ impl BluetoothManager {
|
|||
device_id: &str,
|
||||
filters: &BluetoothScanfilterSequence)
|
||||
-> BluetoothResult<bool> {
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
match self.get_device(&mut adapter, device_id) {
|
||||
Some(ref device) => Ok(matches_filters(device, filters)),
|
||||
None => Ok(false),
|
||||
|
@ -578,7 +578,7 @@ impl BluetoothManager {
|
|||
options: RequestDeviceoptions)
|
||||
-> BluetoothResponseResult {
|
||||
// Step 6.
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
|
||||
// Step 7.
|
||||
// Note: There are no requiredServiceUUIDS, we scan for all devices.
|
||||
|
@ -630,7 +630,7 @@ impl BluetoothManager {
|
|||
if !self.device_is_cached(&device_id) {
|
||||
return Err(BluetoothError::Network);
|
||||
}
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
|
||||
// Step 5.1.1.
|
||||
match self.get_device(&mut adapter, &device_id) {
|
||||
|
@ -660,7 +660,7 @@ impl BluetoothManager {
|
|||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-disconnect
|
||||
fn gatt_server_disconnect(&mut self, device_id: String) -> BluetoothResult<()> {
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
match self.get_device(&mut adapter, &device_id) {
|
||||
Some(d) => {
|
||||
// Step 2.
|
||||
|
@ -687,7 +687,7 @@ impl BluetoothManager {
|
|||
single: bool,
|
||||
child_type: GATTType)
|
||||
-> BluetoothResponseResult {
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
match child_type {
|
||||
GATTType::PrimaryService => {
|
||||
// Step 5.
|
||||
|
@ -839,7 +839,7 @@ impl BluetoothManager {
|
|||
fn read_value(&mut self, id: String) -> BluetoothResponseResult {
|
||||
// (Characteristic) Step 5.2: Missing because it is optional.
|
||||
// (Descriptor) Step 5.1: Missing because it is optional.
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
|
||||
// (Characteristic) Step 5.3.
|
||||
let mut value = self.get_gatt_characteristic(&mut adapter, &id)
|
||||
|
@ -871,7 +871,7 @@ impl BluetoothManager {
|
|||
fn write_value(&mut self, id: String, value: Vec<u8>) -> BluetoothResponseResult {
|
||||
// (Characteristic) Step 7.2: Missing because it is optional.
|
||||
// (Descriptor) Step 7.1: Missing because it is optional.
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
|
||||
// (Characteristic) Step 7.3.
|
||||
let mut result = self.get_gatt_characteristic(&mut adapter, &id)
|
||||
|
@ -913,7 +913,7 @@ impl BluetoothManager {
|
|||
}
|
||||
|
||||
// (StartNotification) TODO: Step 7: Missing because it is optional.
|
||||
let mut adapter = try!(self.get_adapter());
|
||||
let mut adapter = self.get_adapter()?;
|
||||
match self.get_gatt_characteristic(&mut adapter, &id) {
|
||||
Some(c) => {
|
||||
let result = match enable {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue