-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Maxlen of Bluetooth name? Too long names result in a crash during start_advertising #5043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
My suggestion would be, either to quietly slice the name in the setter to the max allowable length or raise an error in the setter and not let the error come up in start_advertizing. |
I like the idea of validating the name when it is set. That is clearest for the setter on how to fix it. |
Fine with me, but is 26 characters really the threshold? |
I'm not sure where the limit is being imposed. Figuring that out is part of the task here. 31 bytes is the limit for legacy advertisements IIRC. |
Yes, this is also my limited understanding. |
What do you mean by Bluetooth Beacon? Do you have an example product that does it? BLE 5 does have extended advertisements that would support up to ~512 bytes IIRC. |
Bluetooth beacons are used for indoor navigation for blind and visually impaired persons. |
How are you getting the name of a BLE beacon? My impression is that they may simply advertise an ID that an app can lookup for a name. |
The defined maximum length of the name is 248 bytes, but whether you can use that depends on the advertising capabilities of the peripheral. The actual length that fits depends on what else is in the advertising packet (e.g. various UUIDs), including in the extended advertisement. So I don't think we can validate the length when The nRF SD adds the default name to the advertisement by itself, so it's not even that we are assembling the advertisement and it's too long. We'd have to keep track of the default name length and also see that there is not another name given. I am going to move this to Long Term, because I don't see a short-term fix, unfortunately. |
CircuitPython version
Code/REPL
Behavior
When I use device names with 27 characters or more a Runtime Error is thrown during Advertisement.

In this picture, you see a crash with devicename 30 characters long.,
Description
Error when allowing user-specific DeviceNames.
(I will limit them to 26 Characters in the code)user-specific
Additional information
During narrowing down this issue I found another strange bug which I will file later.
The text was updated successfully, but these errors were encountered: