Skip to content

Commit

Permalink
fix: Ignore failed descriptor reads on Windows
Browse files Browse the repository at this point in the history
This brings the Windows implementation in line with Linux

Fixes deviceplug#361
  • Loading branch information
DavidZemon authored and qdot committed Jan 10, 2024
1 parent 9537a23 commit 72922aa
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions src/winrtble/peripheral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,29 +415,23 @@ impl ApiPeripheral for Peripheral {
Ok(characteristics) => {
let characteristics =
characteristics.into_iter().map(|characteristic| async {
match BLEDevice::get_characteristic_descriptors(&characteristic)
.await
{
Ok(descriptors) => {
let descriptors: HashMap<Uuid, BLEDescriptor> =
descriptors
.into_iter()
.map(|descriptor| {
let descriptor =
BLEDescriptor::new(descriptor);
(descriptor.uuid(), descriptor)
})
.collect();
Ok((characteristic, descriptors))
}
Err(e) => {
error!("get_characteristic_descriptors_async {:?}", e);
Err(e)
}
}
let c = characteristic.clone();
(
characteristic,
BLEDevice::get_characteristic_descriptors(&c)
.await
.unwrap_or(Vec::new())
.into_iter()
.map(|descriptor| {
let descriptor = BLEDescriptor::new(descriptor);
(descriptor.uuid(), descriptor)
})
.collect(),
)
});
let characteristics = futures::future::try_join_all(characteristics)
.await?

let characteristics = futures::future::join_all(characteristics)
.await
.into_iter()
.map(|(characteristic, descriptors)| {
let characteristic =
Expand Down

0 comments on commit 72922aa

Please sign in to comment.