Reaction to all events or a subset of events

29 views
Skip to first unread message

alex

unread,
Aug 31, 2021, 2:02:39 AM8/31/21
to YAKINDU User

Hello,
1- How can we define a reaction to all events or a subset of events (let's say all events in the named interface mygroup1) ?
2- Sth. like the following is in my mind:
2-1- * / doX()
OR
2-2- mygroup1.* / doY()

The use case would be to catch unhandled events and ...

Regards

Axel Terfloth

unread,
Aug 31, 2021, 3:51:52 AM8/31/21
to yakind...@googlegroups.com
Hello Alex,

a reaction to all events is defined by ‚always / doX()‘ but it is not possible to match subsets of events using patterns as suggested by 2-2.   

Regards,
Axel


--
You received this message because you are subscribed to the Google Groups "YAKINDU User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yakindu-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/yakindu-user/3f3301a9-de84-4d70-85a4-8e1df3371da8n%40googlegroups.com.


Need professional support for Yakindu Statechart Tools?
Contact us: state...@itemis.de


Vorstand/Board: Jens Wagener (Vors./chairman), Dr. Stephan Eberle, Abdelghani El-Kacimi, Wolfgang Neuhaus, Franz-Josef Schuermann
Aufsichtsrat/Supervisory Board: Michael Neuhaus (Vors./chairman), Harald Goertz, Eric Swehla
Sitz der Gesellschaft/Registered Office: Am Brambusch 15-24, 44536 Lünen (Germany)
Registergericht/Registry Court: Amtsgericht Dortmund | HRB 20621

alex

unread,
Aug 31, 2021, 4:38:24 AM8/31/21
to YAKINDU User
Hello and thanks for your help,

In case of ,always / doX()' is it possible to get access to the event that caused it?
e.g. somehow print out the value of enum 'MyStatechartStates' for the corresponding event that has triggered the reaction.

Regards

Axel Terfloth

unread,
Aug 31, 2021, 5:00:04 AM8/31/21
to YAKINDU User
Hello Alex,

accessing the ‚current event‘ or ‚current state‘ is not possible within the statechart. Nevertheless providing an API function to access the current active states is on the roadmap but we did not plan to make it accessible inside the statechart so far. So what is your concrete use case? Additionally you may consider the tracing feature wich is provided by the code generators. This may fit your needs if you just want to implement a generic logging of state transitions.

Regards,
Axel   

alex

unread,
Aug 31, 2021, 9:18:41 AM8/31/21
to YAKINDU User
Hello axel, and thanks for your time,

1- I need it for logging/debugging so Yakindu's tracing feature might help (i should give it a try).
A more important question :
2- An event posted to the statemachine is first handled by the child state & then the parent state (!!!) (or the other way around based on the @Parent/ChildFirstExecution order set in the definition section)
2-1- My assumption was that, should the child state handle the event, the parent state would no further react to the same event in the same RTC.
2-2- this is how SCXML (and its Qt implementation works)
2-3- BUT in Yakindu statecharts both the child & the parent react to the event in the same RTC (!!!). Is my understanding right or have i done sth. wrong?

3- BTW, regarding the concrete use-case, in Qt we can log/debug unexpected/unhandled events like:
3-1- Add a root error handler state
3-2- Add a local transition to this root error handler state: , */ <script>'
3-3- Then in the <script> part we could print out the event's name
3-4- for that we can use the scxmlEvent().name() api in Qt's cppDataModel.
3-5- otherwise unhandled events would be silently ignored (which depending on the case might not be what we want ...)

Thanks again in advance
Reply all
Reply to author
Forward
0 new messages