Skip to content

Latest commit

 

History

History
160 lines (130 loc) · 7.29 KB

README.md

File metadata and controls

160 lines (130 loc) · 7.29 KB
Contents Overview Editor Forum

SCXML Examples

W3C Examples

Qt SCXML Examples

uSCXML Examples

Preview

This SCXML document gives an overview of the SCXML language and shows the use of its state machine transition flows LangOverview

The example below shows the implementation of a simple microwave oven using SCXML MicrowaveSimple

The example below shows the implementation of a simple microwave oven using <parallel> and the SCXML 'In()' predicate MicrowaveParallel

The example below shows the implementation of a simple calculator in SCXML Calculator

Qt SCXML Examples

This project is intended to test Qt QML SCXML module for designing in-vehicle infotainment systems

BoleroPreview

Resource hierarchy solution of dining philosophers problem intended to show usage of communication between invoked submachines.

PhilProb

This example demonstrates different techniques of using SCXML data models in applications

morse_widget

Salus RT500 (Digital Room Thermostat) Simulator is a widget-based application that demonstrates usage of Qt SCXML CPP DataModel

AppPreview

Classical StopWatch with 2 buttons. All internal logic is written with SCXML EcmaScript Datamodel StopWatchPreview

Qt widget-based application that executes W3C SCXML tests and custom tests in sequence, and is able to build a report in Markdown format

Preview

The BendixKing KT 76C transponder - radio transmitter/receiver which operates on radar frequencies

KT76C_Orig

Qt widget-based application that executes W3C SCXML tests for Lua Datamodel in sequence

qt

Qt widget-based application that demonstrates how to invoke child state machines with QScxmlCppDataModel

cpp_inv_demo

uSCXML Examples

ArduinoPump

Source code

<scxml datamodel="native" initial="dark" name="ScxmlWaterPump" version="1.0" xmlns="http://www.w3.org/2005/07/scxml"><!--we provide the datamodel inline in the scaffolding-->
	<script><![CDATA[pinMode(LED, OUTPUT);
for (char i = 0; i < 4; ++i) {
  pinMode(pump[i], OUTPUT);
  digitalWrite(pump[i], PUMP_OFF);
  bed[i].set_CS_AutocaL_Millis(0xFFFFFFFF);
}]]>
	</script>
	<state id="dark"><!--it is too dark to water flowers--><!--start to take measurements and activate single pumps if too dry-->
		<onentry>
			<script><![CDATA[for (char i = 0; i < 4; ++i) {
  digitalWrite(pump[i], PUMP_OFF);
}]]>
			</script>
		</onentry>
		<transition cond="_event-&gt;data.light &gt; LIGHT_THRES" event="light" target="light"/>
	</state>
	<state id="light"><!--delivers events for all the capsense measurements-->
		<invoke id="cap" type="capsense"/>
		<transition cond="_event-&gt;data.light &lt; LIGHT_THRES" event="light" target="dark"/>
		<state id="idle">
			<transition cond="soil[0] &lt; 0 &amp;&amp;
soil[0] &lt;= soil[1] &amp;&amp;
soil[0] &lt;= soil[2] &amp;&amp;
soil[0] &lt;= soil[3]" event="pump" target="pump1"/>
			<transition cond="soil[1] &lt; 0 &amp;&amp;
soil[1] &lt;= soil[0] &amp;&amp;
soil[1] &lt;= soil[2] &amp;&amp;
soil[1] &lt;= soil[3]" event="pump" target="pump2"/>
			<transition cond="soil[2] &lt; 0 &amp;&amp;
soil[2] &lt;= soil[0] &amp;&amp;
soil[2] &lt;= soil[1] &amp;&amp;
soil[2] &lt;= soil[3]" event="pump" target="pump3"/>
			<transition cond="soil[3] &lt; 0 &amp;&amp;
soil[3] &lt;= soil[0] &amp;&amp;
soil[3] &lt;= soil[1] &amp;&amp;
soil[3] &lt;= soil[2]" event="pump" target="pump4"/>
		</state>
		<state id="pumping">
			<onentry>
				<send delay="8000ms" event="idle"/>
			</onentry>
			<transition event="idle" target="idle"/>
			<state id="pump1">
				<invoke id="1" type="pump"/>
			</state>
			<state id="pump2">
				<invoke id="2" type="pump"/>
			</state>
			<state id="pump3">
				<invoke id="3" type="pump"/>
			</state>
			<state id="pump4">
				<invoke id="4" type="pump"/>
			</state>
		</state>
	</state>
</scxml>

TOP Contents Overview Editor Forum