Add event service for gestures, button actions, and raw message bus events#124
Add event service for gestures, button actions, and raw message bus events#124microbit-matt-hillsdon wants to merge 4 commits intoappsfrom
Conversation
…vents Pin events can be added as a high-level feature later if there's demand. For now they're accessible via the numeric API with CODAL/DAL constants in the user program.
|
For discussion/experimentation rather than a quick review + merge. |
|
Had a play and it looks good. It was a bit unexpected that the Gestures section would affect the Raw Events section. Listening to gestures would cause it to stream raw events, and stopping listening to the gestures would not stop gesture raw events, but after some thought, it makes sense because gestures get subscribed. Also, not sure if there is a root for getting the touch logo press event as well. |
- Add logoaction named event for V2 logo touch button (source 121), reusing ButtonActionData with button: "Logo" - Fix reconnect bug: BLE notification callback was not re-registered after disconnect because notificationsStarted flag persisted - Separate named vs explicit subscription filters so microbitevent only dispatches events from subscribeToEvent calls - Add Logo row to demo Button Events section
|
I've tried to separate out the notifications so you only get low level ones if you ask for them. I've added the logo as a button and it seems to work well. I also added detail to the demo about what requires what service as otherwise the split of the button-related behaviours is inexplicable (similar to JSDoc already added). |
Pin events can be added as a high-level feature later if there's demand. They make much less sense for a general purpose "control/monitor the micro:bit over BLE" program. Though maybe useful for digital twin projects as they can observe pins without changing the pin mode (but can't read values, just transitions).
For now they're accessible via the numeric API with CODAL/DAL constants in the user program.
I do slightly wonder what the point of the button service is now...