Check if the BluetoothDevice is connected, when calling getGATT functions.

This commit is contained in:
zakorgyula 2016-10-06 17:27:00 +02:00
parent 11dbb7120f
commit b72dcf326b
15 changed files with 28 additions and 50 deletions

View file

@ -87,6 +87,9 @@ impl BluetoothRemoteGATTCharacteristic {
if uuid_is_blacklisted(uuid.as_ref(), Blacklist::All) {
return Err(Security)
}
if !self.Service().Device().Gatt().Connected() {
return Err(Network)
}
let (sender, receiver) = ipc::channel().unwrap();
self.get_bluetooth_thread().send(
BluetoothMethodMsg::GetDescriptor(self.get_instance_id(), uuid, sender)).unwrap();
@ -117,6 +120,9 @@ impl BluetoothRemoteGATTCharacteristic {
}
}
};
if !self.Service().Device().Gatt().Connected() {
return Err(Network)
}
let (sender, receiver) = ipc::channel().unwrap();
self.get_bluetooth_thread().send(
BluetoothMethodMsg::GetDescriptors(self.get_instance_id(), uuid, sender)).unwrap();