User avatar
przemof
Posts: 161
Joined: Mon Dec 30, 2013 6:43 pm

BLE devices with no names

Wed Nov 21, 2018 1:12 pm

I'm working on embedded project that uses BLE sensors. Afters scanning some of the BLE devices give nice names, but some are replying with BLE address only. My test sensors reply with human readable names and BLE device name is mandatory [1], so I guess I could safely ignore the devices without names. Is it a good idea?

[1] https://www.bluetooth.com/specification ... access.xml

User avatar
Douglas6
Posts: 4645
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BLE devices with no names

Wed Nov 21, 2018 4:32 pm

It is mandatory to have a GATT service to expose the name of a BLE device, but it is NOT mandatory for a device to include that name in its advertising packets.

I would not ignore devices that are not advertising names without knowing more about them. On the other hand it's not clear what you are trying to do.

User avatar
przemof
Posts: 161
Joined: Mon Dec 30, 2013 6:43 pm

Re: BLE devices with no names

Wed Nov 21, 2018 6:24 pm

Thanks for the reply! I'm making a bicycle computer [1]. So asking each device for name and filtering out those not complying should be OK. I'm mostly interested with speed/cadence/heart rate sensors. Currently I just scan for devices and present user with the results without filtering. If device gives a name the name is used. If there is no name the address is used instead. It looks rather ugly and for the user information that the device
C8:69:CD:61:A2:A6 is available for connection is not really useful - that's why I'm asking if I can skip those devices.

[1]
http://opencyclingcomputer.eu/
https://github.com/PrzemoF/Open-Cycling-Computer

User avatar
Douglas6
Posts: 4645
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BLE devices with no names

Wed Nov 21, 2018 6:51 pm

Sure, as long as you know the sensors you are using supply their name. You could also query the devices and filter by the services they offer, maybe.

User avatar
przemof
Posts: 161
Joined: Mon Dec 30, 2013 6:43 pm

Re: BLE devices with no names

Wed Nov 21, 2018 6:59 pm

I want to "do the right thing" - I'm sure it will work with my sensors, but the underlying system should be useful for other embedded projects as well (IoT controller, weather stations, smart home heating etc), so I'm trying to make it "futureproof" without knowing what sensors will be connected.

I'll be querying for services and characteristics as well, but I need to play with bluepy first to see if it's reliable enough.
Thanks again!

User avatar
przemof
Posts: 161
Joined: Mon Dec 30, 2013 6:43 pm

[SOLVED] Re: BLE devices with no names

Wed Nov 28, 2018 9:43 am

I have code that scans for BLE devices and then tries to get services to determine if a device provides the service i need (heart rate or cycling speed/cadence). I do the initial scan in 4 seconds, but connecting to each device and checking services takes over 60 seconds (for 3 devices). I could try to use multiple threads if bluepy could handle it, but is there a better way?
What I wanted is:
1. User selects to connect with a heart rate sensor
2. Perform BLE scan
3. Filter out devices by service
4. Show use all heart rate sensors

The problem is with devices that I'm not interested in - they refuse connection and I wait for time out. I may end up with user selecting the device and then I can verify if the device provides what's needed, but i don't like that. Another idea is to build a local list with 'bad' addresses, so only the first scan would be very long, but it's a workaround, not a proper solution.

Any ideas how to solve it?

Edit: bluepy ScanEntry has a field 'connectable' that provides required info, so I can skip problematic devices. More here: https://ianharvey.github.io/bluepy-doc/scanentry.html

Return to “Off topic discussion”