I presume that by "the DUE" you mean Arduino DUE. In that case, the QPCPP-Arduino library comes with the DPP example that shows events with parameters (directory libraries\qpcpp_arm-cm\examples\dpp_bsp-sam\dpp_bsp-sam.qm).
Specifically, the model dpp_bsp-sam.qm contains the package Events with event TableEvt. Later in the code, you will see how these events are produced (e.g. Philo state machine, state "hungry", entry action):
And here is an example how the Table AO accesses the TableEvt (Table state machine, state "serving", transition HUNGRY).
uint8_tn=Q_EVT_CAST(TableEvt)->philoNum;
Please note the use of the macro Q_EVT_CAST(TableEvt). This macro encapsulates downcasting of the event pointer e (passed to all state handlers as parameter) from the base class QEvt to the subclass TableEvt in this case. Using macro for that allows to encapsulate this deviation from the MISRA /AUTOSAR rules.
--MMS
Last edit: Quantum Leaps 2022-01-24
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Do you have any examples showing how to access user defined event data in QM? I'm using QPCPP for the DUE
I presume that by "the DUE" you mean Arduino DUE. In that case, the QPCPP-Arduino library comes with the DPP example that shows events with parameters (directory
libraries\qpcpp_arm-cm\examples\dpp_bsp-sam\dpp_bsp-sam.qm
).Specifically, the model
dpp_bsp-sam.qm
contains the packageEvents
with eventTableEvt
. Later in the code, you will see how these events are produced (e.g. Philo state machine, state "hungry", entry action):And here is an example how the Table AO accesses the
TableEvt
(Table state machine, state "serving", transition HUNGRY).Please note the use of the macro
Q_EVT_CAST(TableEvt)
. This macro encapsulates downcasting of the event pointere
(passed to all state handlers as parameter) from the base classQEvt
to the subclassTableEvt
in this case. Using macro for that allows to encapsulate this deviation from the MISRA /AUTOSAR rules.--MMS
Last edit: Quantum Leaps 2022-01-24
I must have missed that one.
thanks