mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-01-15 17:40:51 -05:00
How to add new command handling in bluetooth
remember Blutetooth Worker command handling uses double dispatch (if you are not familiar with the technique, see: double dispatch example)
To add a new event:
- In
event/Events.hpp- Add new event
- remember to
- inherit from base event
- add override on
dispatchfunction
- Events may have const data inside, in such case please:
- set const data in constructor
- set data as const in structure
- do not add needless getter/setter
- In
AbstractController.hpp:- Add new event to forward declaration
- Add new event handler in the class below
- In
WorkerController.{hpp,cpp}- Add new event handler to worker controller implementation
- Add event handling in the desired state
- When adding new Handler or Event in the sml state machine please:
- define structure per each event handler
- this way we have it's name in the logs wich is super helpful
- In
testcatalog- add unit tests regarding the state added
- please add tests for both: success and failure scenarions, not only the green path
Bluetooth command handling state diagram
To generate state machine diagram
make bluetooth_uml then ./bluetooth_uml > bluetooth_uml.puml and generate diagram via plantuml from that