File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -71,22 +71,15 @@ impl Device {
71
71
}
72
72
73
73
async fn from_peripheral ( peripheral : Peripheral ) -> Option < Self > {
74
- // Check whether the BLE device has the service UUID we're looking for
75
- // and also the correct name.
76
- // The service uuid is also by devices that are not LED badges, so
77
- // the name check is also necessary.
74
+ // The existance of the service with the correct UUID
75
+ // exists is already checked by the scan filter.
76
+ // But we also need to check the device name to make sure
77
+ // we're talking to a badge as some devices that are not led badges
78
+ // also use the same service UUID.
78
79
let props = peripheral. properties ( ) . await . ok ( ) ??;
79
-
80
80
let local_name = props. local_name . as_ref ( ) ?;
81
- if local_name != BADGE_BLE_DEVICE_NAME {
82
- return None ;
83
- }
84
81
85
- if props
86
- . services
87
- . iter ( )
88
- . any ( |uuid| * uuid == BADGE_SERVICE_UUID )
89
- {
82
+ if local_name == BADGE_BLE_DEVICE_NAME {
90
83
Some ( Self { peripheral } )
91
84
} else {
92
85
None
You can’t perform that action at this time.
0 commit comments