commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Brule" <>
Subject Re: [SCXML] Conditional transitions into a composite state
Date Sun, 17 Sep 2006 14:10:58 GMT
I was able to resolved the sticky points of navigation into and out
from the "task" states by using both history and a generic task event
with an associated task variable. The following is the state machine

<scxml xmlns=""

 <state id="S1">
     <transition target="S1history"/>
   <history type="deep" id="S1history">
     <transition target="S11"/>
   <state id="S11">
     <transition event="event" target="S12"/>
   <state id="S12">
       <log label="mode" expr="mode"/>
       <log label="task" expr="task"/>
     <transition event="event" target="S13"/>
     <transition event="task" cond="mode eq 'S2' and task ne null" target="S2"/>
   <state id="S13">
     <transition event="event" target="S11"/>

 <state id="S2">
     <transition target="S2Router"/>
   <transition event="S2.done" target="S1history"/>

   <state id="S2Router">
     <transition cond="task eq 'S21'" target="S21"/>
     <transition cond="task eq 'S22'" target="S22"/>

   <state id="S21">
       <transition target="S21a"/>
     <state id="S21a">
       <transition event="event" target="S21b"/>
     <state id="S21b">
       <transition event="event" target="S2final"/>

   <state id="S22">
     <transition event="event" target="S2final"/>

   <state id="S2final" final="true"/>



I configured state S1 to have history, thus allowing final substates
within S2 to return to the approriate calling state. Also, instead of
attempting to understand the event thrown within S12 when the S2Router
runs, I throw a generic "task" event and set the "task" variable with
the corresponding task. Within the router, I am easily able to
determine the appropriate task and route to the proper substate

This approach should also allow me to move the entire S2 state
definition into an external file, which has been my plan from the
beginning... This is why I wanted to keep the knowledge of the
inner-workings of state S2 out of state S1.

Thanks for your pointers, especially the history one.

Jon Brule

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message