summaryrefslogtreecommitdiffstats
path: root/test/uscxml/test-mmi-events.scxml
blob: 9460a6eb512d26bb8ea7ad7720e9750bc528917d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<scxml datamodel="ecmascript" 
	xmlns:mmi="http://www.w3.org/2008/04/mmi-arch" 
	xmlns="http://www.w3.org/2005/07/scxml">
	<!-- 
		This is a sample implementation for a modality component in the W3C MMI Architecture using SCXML
	-->
	<state id="idle">
		<onentry>
			<log expr="'Entering idle state'" />
			<send targetexpr="_ioprocessors['mmihttp'].location">
				<mmi:PrepareRequest 
					<mmi:content>
						<scxml datamodel="ecmascript">
							<state>
								<onentry>
									<log expr="" />
								</onentry>
							</state>
						</scxml>
					</mmi:content>
		   </mmi:PrepareRequest>
	   </send>
		</onentry>
		
		<transition event="mmi.prepare.request" target="idle">
			<log expr="'Received PrepareRequest'" />
			<mmi:mmi xmlns:mmi="http://www.w3.org/2008/04/mmi-arch" version="1.0">
				<mmi:PrepareResponse 
					mmi:SourceExpr="_ioprocessors['basichttp'].location" 
					mmi:TargetExpr="someOtherURI" 
					mmi:ContextExpr="someURI" 
					mmi:RequestIDExpr="_event.data.getElementsByTagName('PrepareRequest')[0].getAttribute('RequestID')" 
					mmi:Status="success"/>
			</mmi:mmi>
		</transition>
		<transition event="mmi.start.request" target="running">
			<log expr="'Received StartRequest'" />
		</transition>
		<transition event="mmi.clearcontext.request" target="terminate">
			<log expr="'Received ClearContextRequest'" />
		</transition>
	</state>
	
	<state id="paused">
		<onentry>
			<log expr="'Entering pause state'">
		</onentry>
		<transition event="mmi.prepare.request" target="paused">
			<log expr="'Received PrepareRequest'" />
		</transition>
		<transition event="mmi.start.request" target="running">
			<log expr="'Received StartRequest'" />
		</transition>
		<transition event="mmi.resume.request" target="running">
			<log expr="'Received ResumeRequest'" />
		</transition>
		<transition event="mmi.cancel.request" target="idle">
			<log expr="'Received CancelRequest'" />
		</transition>
		<transition event="mmi.clearcontext.request" target="terminate">
			<log expr="'Received ClearContextRequest'" />
		</transition>
	</state>
	
	<state id="running">
		<onentry>
			<log expr="'Entering running state'">
		</onentry>
		<transition event="mmi.prepare.request" target="running">
			<log expr="'Received PrepareRequest'" />
		</transition>
		<transition event="mmi.pause.request" target="paused">
			<log expr="'Received PauseRequest'" />
		</transition>
		<transition event="mmi.cancel.request" target="idle">
			<log expr="'Received CancelRequest'" />
		</transition>
		<transition event="mmi.clearcontext.request" target="terminate">
			<log expr="'Received ClearContextRequest'" />
		</transition>
	</state>
	
	<final id="terminate">
		<onentry>
			<log expr="'Entering terminate state'">
		</onentry>
	</final>
</scxml>