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 {
7171 }
7272
7373 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.
7879 let props = peripheral. properties ( ) . await . ok ( ) ??;
79-
8080 let local_name = props. local_name . as_ref ( ) ?;
81- if local_name != BADGE_BLE_DEVICE_NAME {
82- return None ;
83- }
8481
85- if props
86- . services
87- . iter ( )
88- . any ( |uuid| * uuid == BADGE_SERVICE_UUID )
89- {
82+ if local_name == BADGE_BLE_DEVICE_NAME {
9083 Some ( Self { peripheral } )
9184 } else {
9285 None
You can’t perform that action at this time.
0 commit comments