-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(ble): Add the ability to enable and disable advertising #2546
base: main
Are you sure you want to change the base?
Conversation
Regarding docs I think there might end up being some confusion when people see "This turns on advertising", use the behavior expecting to be able to connect a new device yet nothing happens because they haven't selected an unused profile. |
I see your point, it would still advertise if it's in an occupied profile but wouldn't pair and work properly. Perhaps it would be better worded as "Permits advertising (note that other conditions must be met for the device to be visible)"? |
That still sounds like it's a bit unclear to some. What would you consider to be the difference between what you've defined as |
Functionally there's not really any difference I suppose |
I think renaming and rephrasing it appropriately would be both clearer and make it usable by non-tech people, then. Sometimes a user might want to just turn off BT after all. |
Hmm, I'm not sure about describing it as turning off Bluetooth when it doesn't do that. My concern is users may wonder if it affects split connections if it's described as shutting off Bluetooth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, so that's not an accurate description. Hmm.
Currently advertising cannot be disabled, In some circumstances it may be desirable to disable advertising to the host e.g. seeking consistency between an endpoint switch and percieved board behaviour Update behavior_bt.c Revert "Update behavior_bt.c" This reverts commit d822523.
Co-Authored-By: Nicolas Munnich <98408764+Nick-Munnich@users.noreply.github.com>
Currently advertising cannot be disabled, In some circumstances it may be desirable to disable advertising to the host e.g. seeking consistency between an endpoint switch and percieved board behaviour.
This adds 3 new options to &bt, ADV_ON, ADV_OFF and ADV_TOG as well as the metadata and documentation for the behaviour.
ble.c
has been updated with a static flag that gets checked inupdate_advertising()
and doesn't permit any adveritising state other thanZMK_ADV_NONE
unless it's set. it's defaulted to true so standard board behavior shouldn't change.The ability to get the current adverising state has also been added, it could have utility in custom display widgets.
Tested on a development board, I've noticed some hosts cache the advertising info so it still shows up as a connectible device if the switch is used whilst the bluetooth devices menu is open, but it still cannot be connected to. Using an app like nRF connect or a different host it can be seen that the device properly stops advertising