summaryrefslogtreecommitdiffstats
path: root/test/samples/uscxml/test-mmi-im.scxml
blob: 4b130bd5eb1d8308db82ec9abac9fa77a6f339d8 (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
<scxml datamodel="ecmascript" name="mmi-test"
	xmlns:mmi="http://www.w3.org/2008/04/mmi-arch" 
	xmlns:html="http://www.w3.org/1999/xhtml" 
	xmlns="http://www.w3.org/2005/07/scxml">

	<script>
<![CDATA[

		function dump(object, level) {
		    if (!level) level = 0;

		    var padding = "";
		    for (var j=0;j < level+1;j++) padding += "    ";

		    if (typeof(object) == 'object') {  
		        for (var item in object) {
              if (item === "lastChild") continue;
              if (item === "firstChild") continue;
              if (item === "ownerDocument") continue;
		            var value = object[item];

		            if(typeof(value) == 'object') { 
		                print (padding + "'" + item + "' ...\n");
		                dump (value, level+1);
		            } else {
		                print (padding + "'" + item + "' => \"" + value + "\"\n");
		            }
		        }
		    } else { 
		        print("===> " + object + " <===(" + typeof(object) + ")");
		    }
		}
]]>
	</script>

	<state id="startmc">
		<!-- invoke type="vxml" id="mc.vxml" / -->
		
		<!-- Idle here and wait for events -->
		<state id="idle">
			
			<!-- setup session -->
			<transition event="mmi.newcontextrequest" target="idle">

				<send type="mmi.event">
					<content>
						<mmi:NewContextResponse mmi:Status="success" />
					</content>
				</send>
				
				<send type="mmi.event">
					<content>
						<mmi:StartRequest>
							<mmi:Content>
								<html:button>Click Me</html:button>
							</mmi:Content>
						</mmi:StartRequest>
					</content>
				</send>
			</transition>
			
			<transition event="mmi.extensionnotification" target="idle">
				<script>dump(_event)</script>
			</transition>
			
		</state>
	</state>
	<final id="terminate" />
</scxml>