Implement GetAvailability for Bluetooth

This commit is contained in:
Attila Dusnoki 2017-02-03 15:31:24 +01:00
parent 8ca1383c41
commit ca7aa6bff8
9 changed files with 98 additions and 9 deletions

View file

@ -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()))
}
}