diff options
author | fokinv <fokin.valentin@stud.u-szeged.hu> | 2016-10-10 09:35:59 +0200 |
---|---|---|
committer | zakorgyula <gyula.zakor@gmail.com> | 2016-11-04 15:36:55 +0100 |
commit | d30bcbd33948f41fc3389f8105885060fd7541a5 (patch) | |
tree | 219debf2e7bc99d75e250a2234832dee53f319de /components/bluetooth/lib.rs | |
parent | dd733f6994e27a91e46fb8f9feb9a7e7179cfcda (diff) | |
download | servo-d30bcbd33948f41fc3389f8105885060fd7541a5.tar.gz servo-d30bcbd33948f41fc3389f8105885060fd7541a5.zip |
Blacklisted items are removed when calling getServices/Characteristics/Descriptors.
Diffstat (limited to 'components/bluetooth/lib.rs')
-rw-r--r-- | components/bluetooth/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/components/bluetooth/lib.rs b/components/bluetooth/lib.rs index 55c883917f6..f01332fe01b 100644 --- a/components/bluetooth/lib.rs +++ b/components/bluetooth/lib.rs @@ -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))); } |