blob: f6e0f70a1f7fc5568fc19a8e65cf05a188322e82 (
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
|
<?xml version="1.0"?>
<scxml datamodel="ecmascript">
<script>
function dump(thingy) {
if (typeof(thingy) == 'object') {
for (var key in thingy) {
print(key + ": ")
dump(thingy[key]);
}
} else {
print(thingy + "\n");
}
};
</script>
<state id="start">
<!-- Invoke umundo with a service query -->
<invoke type="umundo" id="umundo.eventSvc">
<param name="types" expr="'proto'"/>
<param name="service" expr="'EchoService'"/>
<finalize>
<log expr="'Calling finalize on returned event'"/>
</finalize>
</invoke>
<state id="idle">
<transition target="service.added" event="umundo.eventSvc.added"/>
<transition target="service.removed" event="umundo.eventSvc.removed"/>
<transition target="service.reply" event="umundo.eventSvc.reply.echo"/>
</state>
<state id="service.reply">
<onentry>
<log expr="'RPC Reply:'"/>
<script>dump(_event);</script>
</onentry>
<transition target="idle"/>
</state>
<state id="service.added">
<onentry>
<log expr="'Log Service found:'"/>
<script>dump(_event);</script>
<send target="#_umundo.eventSvc" event="echo">
<param name="type" expr="'EchoRequest'"/>
<content>
({
"name": "This is foo!"
})
</content>
</send>
</onentry>
<transition target="idle"/>
</state>
<state id="service.removed">
<onentry>
<log expr="'Log Service lost:'"/>
<script>dump(_event);</script>
</onentry>
<transition target="idle"/>
</state>
</state>
</scxml>
|