Open ReFil opened 2 months ago
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.
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.
@caksoylar There's been some prior discussion of that in https://github.com/zmkfirmware/zmk/pull/2033#discussion_r1438859308
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
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 callzmk_ble_active_profile_is_open()
andzmk_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