mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
Blacklisted items are removed when calling getServices/Characteristics/Descriptors.
This commit is contained in:
parent
dd733f6994
commit
d30bcbd339
14 changed files with 20 additions and 15 deletions
|
@ -19,6 +19,7 @@ use bluetooth_traits::{BluetoothCharacteristicMsg, BluetoothCharacteristicsMsg};
|
|||
use bluetooth_traits::{BluetoothDescriptorMsg, BluetoothDescriptorsMsg};
|
||||
use bluetooth_traits::{BluetoothDeviceMsg, BluetoothError, BluetoothMethodMsg};
|
||||
use bluetooth_traits::{BluetoothResult, BluetoothServiceMsg, BluetoothServicesMsg};
|
||||
use bluetooth_traits::blacklist::{uuid_is_blacklisted, Blacklist};
|
||||
use bluetooth_traits::scanfilter::{BluetoothScanfilter, BluetoothScanfilterSequence, RequestDeviceoptions};
|
||||
use device::bluetooth::{BluetoothAdapter, BluetoothDevice, BluetoothGATTCharacteristic};
|
||||
use device::bluetooth::{BluetoothGATTDescriptor, BluetoothGATTService};
|
||||
|
@ -681,7 +682,8 @@ impl BluetoothManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
services_vec.retain(|s| self.allowed_services
|
||||
services_vec.retain(|s| !uuid_is_blacklisted(&s.uuid, Blacklist::All) &&
|
||||
self.allowed_services
|
||||
.get(&device_id)
|
||||
.map_or(false, |uuids| uuids.contains(&s.uuid)));
|
||||
if services_vec.is_empty() {
|
||||
|
@ -758,6 +760,7 @@ impl BluetoothManager {
|
|||
if let Some(uuid) = uuid {
|
||||
services_vec.retain(|ref s| s.uuid == uuid);
|
||||
}
|
||||
services_vec.retain(|s| !uuid_is_blacklisted(&s.uuid, Blacklist::All));
|
||||
if services_vec.is_empty() {
|
||||
return drop(sender.send(Err(BluetoothError::NotFound)));
|
||||
}
|
||||
|
@ -834,6 +837,7 @@ impl BluetoothManager {
|
|||
});
|
||||
}
|
||||
}
|
||||
characteristics_vec.retain(|c| !uuid_is_blacklisted(&c.uuid, Blacklist::All));
|
||||
if characteristics_vec.is_empty() {
|
||||
return drop(sender.send(Err(BluetoothError::NotFound)));
|
||||
}
|
||||
|
@ -888,6 +892,7 @@ impl BluetoothManager {
|
|||
});
|
||||
}
|
||||
}
|
||||
descriptors_vec.retain(|d| !uuid_is_blacklisted(&d.uuid, Blacklist::All));
|
||||
if descriptors_vec.is_empty() {
|
||||
return drop(sender.send(Err(BluetoothError::NotFound)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue