Skip to content

Commit 72922aa

Browse files
DavidZemonqdot
authored andcommitted
fix: Ignore failed descriptor reads on Windows
This brings the Windows implementation in line with Linux Fixes #361
1 parent 9537a23 commit 72922aa

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

src/winrtble/peripheral.rs

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -415,29 +415,23 @@ impl ApiPeripheral for Peripheral {
415415
Ok(characteristics) => {
416416
let characteristics =
417417
characteristics.into_iter().map(|characteristic| async {
418-
match BLEDevice::get_characteristic_descriptors(&characteristic)
419-
.await
420-
{
421-
Ok(descriptors) => {
422-
let descriptors: HashMap<Uuid, BLEDescriptor> =
423-
descriptors
424-
.into_iter()
425-
.map(|descriptor| {
426-
let descriptor =
427-
BLEDescriptor::new(descriptor);
428-
(descriptor.uuid(), descriptor)
429-
})
430-
.collect();
431-
Ok((characteristic, descriptors))
432-
}
433-
Err(e) => {
434-
error!("get_characteristic_descriptors_async {:?}", e);
435-
Err(e)
436-
}
437-
}
418+
let c = characteristic.clone();
419+
(
420+
characteristic,
421+
BLEDevice::get_characteristic_descriptors(&c)
422+
.await
423+
.unwrap_or(Vec::new())
424+
.into_iter()
425+
.map(|descriptor| {
426+
let descriptor = BLEDescriptor::new(descriptor);
427+
(descriptor.uuid(), descriptor)
428+
})
429+
.collect(),
430+
)
438431
});
439-
let characteristics = futures::future::try_join_all(characteristics)
440-
.await?
432+
433+
let characteristics = futures::future::join_all(characteristics)
434+
.await
441435
.into_iter()
442436
.map(|(characteristic, descriptors)| {
443437
let characteristic =

0 commit comments

Comments
 (0)