Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 1.31 KB

README.md

File metadata and controls

55 lines (42 loc) · 1.31 KB

echo

statechart: echo.scxml

The statechart receives one or more echo events and prints out the event parameter onto the console. It terminates upon a quit event. See also README.md in the dsl4sc repository.

statechart

transmitting events to the the statechart directly

$ cat <<EOF | scxmlrun echo.scxml  
{"event" : {"name":"echo", "data":"hello"}}  
{"event" : {"name":"echo", "data":"world"}}  
{"event" : {"name":"quit"}}  
EOF

then we immediately get the following console messages:

hello  
world

transmitting events to the the statechart via MQTT

events can be passed over the network:

$ scxmlrun echo.scxml --sub echo &  
$ cat <<EOF | mosquitto_pub -t echo -l  
{"event" : {"name":"echo", "data":"hello"}}  
{"event" : {"name":"echo", "data":"world"}}  
{"event" : {"name":"quit"}}  
EOF

test automation using shelltest

for convenience, the above examples are defined respectively in echo.conf and echo_mqtt.conf, and can be tested, using the shelltest tool, as follows

$ shelltest echo.conf  
:echo.conf: [OK]  
...  
$ shelltest echo_mqtt.conf  
:echo_mqtt.conf: [OK]  
...