mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement GetAvailability for Bluetooth
This commit is contained in:
parent
8ca1383c41
commit
ca7aa6bff8
9 changed files with 98 additions and 9 deletions
|
@ -246,13 +246,16 @@ impl BluetoothManager {
|
|||
},
|
||||
BluetoothRequest::Test(data_set_name, sender) => {
|
||||
let _ = sender.send(self.test(data_set_name));
|
||||
}
|
||||
},
|
||||
BluetoothRequest::SetRepresentedToNull(service_ids, characteristic_ids, descriptor_ids) => {
|
||||
self.remove_ids_from_caches(service_ids, characteristic_ids, descriptor_ids)
|
||||
}
|
||||
},
|
||||
BluetoothRequest::IsRepresentedDeviceNull(id, sender) => {
|
||||
let _ = sender.send(!self.device_is_cached(&id));
|
||||
}
|
||||
},
|
||||
BluetoothRequest::GetAvailability(sender) => {
|
||||
let _ = sender.send(self.get_availability());
|
||||
},
|
||||
BluetoothRequest::Exit => {
|
||||
break
|
||||
},
|
||||
|
@ -924,4 +927,9 @@ impl BluetoothManager {
|
|||
// TODO: Implement this when supported in lower level
|
||||
return Err(BluetoothError::NotSupported);
|
||||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-getavailability
|
||||
fn get_availability(&mut self) -> BluetoothResponseResult {
|
||||
Ok(BluetoothResponse::GetAvailability(self.get_adapter().is_ok()))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue