Skip to content
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 information to profile changed event #2275

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ReFil
Copy link
Contributor

@ReFil ReFil commented Apr 17, 2024

Currently the ble_active_profile_changed event will trigger if a profile is cleared or disconnected but it's up on the individual event handlers to call zmk_ble_active_profile_is_open() and zmk_ble_active_profile_is_connected() to actually retrieve that information, integrating all this inside the event streamlines downstream implementations as all they need to do is retrieve this information from the event rather than each event handler call the getter functions

@ReFil ReFil requested a review from a team as a code owner April 17, 2024 08:06
@snoyer
Copy link

snoyer commented Apr 17, 2024

Another consideration would be to generalize ble_active_profile_changed to ble_profile_changed as we may want to know about any profile changing instead of only the active one. Example use-case would be to display an up-to-date status for every available profile even when the change is initiated by the connected device and not ZMK (eg. a device bound to a non-selected profile disconnects), see #2265.

The current raise_profile_changed_event(void) method could be renamed raise_current_profile_changed_event(void) and a new raise_profile_changed_event(...) would take a profile address or index parameter.

@caksoylar
Copy link
Contributor

I also thought it might be nice to consolidate the profile status to an enum with three values: open, disconnected, connected. Three states are exclusive to each other, so two APIs to query it seems inelegant.

@ReFil
Copy link
Contributor Author

ReFil commented Apr 17, 2024

@caksoylar There's been some prior discussion of that in #2033 (comment)

I think changing to that abruptly would break a lot of custom display and widget implementations, there'd need to be a phased rollout where the bool return one calls the enum one for a period of time

@caksoylar caksoylar added enhancement New feature or request core Core functionality/behavior of ZMK labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core functionality/behavior of ZMK enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants