Signal/Trigger management in QM
Real-Time Event Frameworks based on active objects & state machines
Brought to you by:
quantum-leaps
Came here with a feature request to create/manage signals in QM, just like attributes.
Found a similar request here
But there's no update since 2014?
We can create an attribute with enum_t type, however, we can't set the enum_t elements. (We can with some tweaks)
Tweaks: (there's attached files with an example based on Blinky)
declare command inside an enum_tSuggestion:
enum_t "superclass". We could add attributes to the class and it would be declared as enum_t instead of structenum_t element to attributes. Again, a package could then be declared as enum_t, however, it could only have enum_t element type of attributesGenerated file:
#ifndef SHARED_H
#define SHARED_H
enum_t Signals {
MOD_INIT_SIG = Q_USER_SIG,
/*$declare${MODULE::Signals::Publish_Signals} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
/*${MODULE::Signals::Publish_Signals::LED_ON_SIG} ..........................*/
LED_ON_SIG ,
/*${MODULE::Signals::Publish_Signals::LED_OFF_SIG} .........................*/
LED_OFF_SIG ,
/*$enddecl${MODULE::Signals::Publish_Signals} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
MAX_PUB_SIG,/* the last published signal */
/*$declare${MODULE::Signals::Post_Signals} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
/*$enddecl${MODULE::Signals::Post_Signals} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
MAX_SIG /* the last signal (keep always last) */
}
/*$declare${MODULE::Events} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
/*${MODULE::Events::Blink_Status_Evt} ......................................*/
typedef struct {
/* protected: */
QEvt super;
/* public: */
uint8_t status;
} Blink_Status_Evt;
/*$enddecl${MODULE::Events} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
#endif /* SHARED_H */
Anonymous
Enumerations with initialization can be modeled in QM by using visibility "type".
For example, you can open the qpc.qm (github.com) model and paste-link to the following element: ${QS::QSpyPre}
Last edit: Quantum Leaps 2023-01-24