fysom
fysom copied to clipboard
Callback for every Event
Firstly, many thanks for this very useful and well-written module.
It would be good to have another callback, oneveryevent()
(or onanyevent()
), that is run when any event is triggered.
In my use case, my FSM has events like "receive_command_packet", "receive_ack_packet", "receive_error_packet", etc. Each time I receive a packet, an FSM event is triggered, and I need to store the last received packet in a data member.
The current ugly workaround is to define on_event_()
callbacks for every event in my FSM.
Sounds useful! I'll add this when I find some time. You could also file a pull request ;)