On 9/15/06, Jon Brule <[EMAIL PROTECTED]> wrote:
Let me try another model to see if I can better convey what I am trying to do. Consider the following SCXL:
<snip/> Thanks for taking time to post another example, it helped me better understand what you were after. I see you've found one solution (in the next email on this thread). -Rahul
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initialstate="S1"> <state id="S1"> <initial> <transition target="S11"/> </initial> <state id="S11"> <transition event="E1" target="S12"/> </state> <state id="S12"> <transition event="E2" target="S13"/> <transition event="*" cond="_eventdata.mode eq 'S2'" target="S2"/> <transition event="*" cond="_eventdata.mode eq 'S3'" target="S3"/> </state> <state id="S13"> <transition event="E3" target="S11"/> </state> </state> <state id="S2"> <initial> <transition target="S2Router"/> </initial> <state id="S2Router"> <transition cond="_eventdata.id eq 'E_S21'" target="S21a"/> <transition cond="_eventdata.id eq 'E_S22'" target="S22"/> <transition cond="_eventdata.id eq 'E_S23'" target="S23"/> </state> <state id="S21a"> <transition event="event" target="S21b"/> </state> <state id="S21b" final="yes"/> <state id="S22" final="yes"/> <state id="S23a"> <transition event="event" target="S23b"/> </state> <state id="S23b"> <transition event="event" target="S23c"/> </state> <state id="S23c" final="yes"/> <transition event="S2.done" target="S13"/> </state> <state id="S3"> <initial> <transition target="S3Router"/> </initial> <state id="S3Router"> <transition cond="_eventdata.id eq 'E_S31'" target="S31"/> </state> <state id="S31a"> <transition event="event" target="S31b"/> </state> <state id="S31b" final="yes"/> <transition event="S3.done" target="S13"/> </state> </scxml> Within this XML, I have three distinct composite states. S1 represents a generic engine. It has three child states that execute a certain standard flow. While in state S12, it is possible to call out to either states S2 or S3 with any event providing the corresponding mode has been set. If the mode is set to "S2", then any event thrown will transition to the S2-specific machine. The same parallel goes for the "S3" mode. My intent is to place the state machines for S2 and S3 in their own individual files, binding them into the engine using the <state> tag's "src" attribute. This effectively would separate the main engine from the secondary, mode-specific state machines. With this in mind, I am not crazy about coding the events specific to the S2 and S3 state machines within the S1 engine, thus my use of the event="*" attribute. Within each mode-specific state machine, I need to route control to the appropriate "task". For example, if the engine's mode is set to "S2" and the "E_S21" event is thrown from within the engine's S12 state, then control is transitioned to S21a; however, this is not determined by the configuration within the S1 engine. Instead, it is delegated to the S2 state machine which has an inbound event router, which in turn passes it to the appropriate substate. The sticky point for me is the "router" state within each of the mode-specific state machines. The S2Router needs to be able to access the name of the incoming event in order to properly route it to the appropriate task substate. Again, I do not want to code any event-specific information from the S2 state machine within the S1 engine. It would be nice if I could access the current event from within the _eventdata collection, but it does not sound like it is currently in there. Is there another place from which I can obtain the current event? Would it be appropriate to add the current event into the _eventdata collection for a usage such as this? Finally, I would love to use final states within the mode-specific state machines to generically return to the engine. From S2's perspective, I see that I can encode final="yes" onto any substate and configure a transition directly within the S2 state machine to catch the S2.done event and pass it on appropriately. Ideally, I would not like to encode a specific S1 engine state within S2. Instead, I would love to use a history within S1 to which I could return once the event-specific task completes within the S2 state machine. Is this use of history possible? I hope this explanation helps to better explain what I am attempting to do. Assuming we can find generic binding solutions to these challenges, I would be happy to write this one up as a use case for the project. Thanks for all your help. Regards, Jon Brule tricolorcat-at-gmail.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
