summaryrefslogtreecommitdiffstats
path: root/test/samples/uscxml/test-umundo-s11n.scxml
blob: f4a9a02bac3294ae3fad6865c06133405b75e0eb (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<scxml datamodel="ecmascript">
  <script>
	<![CDATA[
    function dump(object, level) {
        if (!level) level = 0;

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

        if (typeof(obj) == 'object') {  
            for (var item in obj) {
                var value = obj[item];

                if(typeof(value) == 'object') { 
                    print (padding + "'" + item + "' ...\n");
                    print (dump (value, level+1));
                } else {
                    print (padding + "'" + item + "' => \"" + value + "\"\n");
                }
            }
        } else { 
            print("===> " + object + " <===(" + typeof(object) + ")");
        }
    }
	]]>
  </script>
  <state id="start">
		<invoke type="umundo" id="scxml.umundo">
		  <param name="types" expr="'proto/Test.proto'" />
		  <param name="channel" expr="'types'" />
			<finalize>
	      <script>
	        dump(_event);
	      </script>
	      <send target="#_scxml.umundo" delay="0s" event="dump.event">
	        <param name="type" expr="_event.data.type" />
					<content>_event.data</content>
				</send>
			</finalize>
		</invoke>
		<onentry-off>
      <!-- The round brackets are needed to evaluate the JSON object as an expression! -->
      <send target="#_scxml.umundo" delay="3s" event="dump.event">
        <param name="type" expr="'AllTypes'" />
        <content>
          ({
            "doubleType": 1.0,
            "floatType": 2.0,
            "int32Type": -3,
            "int64Type": -4,
            "uint32Type": 5,
            "uint64Type": 6,
            "sint32Type": -7,
            "sint64Type": -8,
            "fixed32Type": 9,
            "fixed64Type": 10,
            "sfixed32Type": -11,
            "sfixed64Type": -12,
            "boolType": false,
            "stringType": 'string',
            "bytesType": 'bytes',
          })
        </content>
      </send>
      <send target="#_scxml.umundo" delay="3s" event="dump.event">
        <param name="type" expr="'RepeatedTypes'" />
        <content>
          ({
            "doubleType": [ 1.0, 2.0 ],
            "floatType": [ 2.0, 3.0 ],
            "int32Type": [ -3, -4 ],
            "int64Type": [ -4, -5 ],
            "uint32Type": [ 5, 6 ],
            "uint64Type": [ 6, 7 ],
            "sint32Type": [ -7, -8 ],
            "sint64Type": [ -8, -9 ],
            "fixed32Type": [ 9, 10 ],
            "fixed64Type": [ 10, 11 ],
            "sfixed32Type": [ -11, -12 ],
            "sfixed64Type": [ -12, -13 ],
            "boolType": [ false, true ],
            "stringType": [ '1st string', '2nd string' ],
            "bytesType": [ '1st bytes', '2nd bytes' ],
            "repeatedMessage": [{
              "doubleType": [ 1.0, 2.0 ],
              "floatType": [ 2.0, 3.0 ],
              "int32Type": [ -3, -4 ],
              "int64Type": [ -4, -5 ],
              "uint32Type": [ 5, 6 ],
              "uint64Type": [ 6, 7 ],
              "sint32Type": [ -7, -8 ],
              "sint64Type": [ -8, -9 ],
              "fixed32Type": [ 9, 10 ],
              "fixed64Type": [ 10, 11 ],
              "sfixed32Type": [ -11, -12 ],
              "sfixed64Type": [ -12, -13 ],
              "boolType": [ false, true ],
              "stringType": [ '1st string', '2nd string' ],
              "bytesType": [ '1st bytes', '2nd bytes' ],
            }],
          })
        </content>
      </send>
		</onentry-off>
		<transition target="dump" event="dump.event" />
  </state>
  <state id="dump">
    <onentry>
      <script>
        dump(_event);
      </script>
    </onentry>
		<transition target="dump" event="dump.event" />
  </state>
</scxml>