aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtScxml/trafficlight.scxml
blob: 699409e68d3264792795cf43903792a2538c8dc4 (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
<?xml version="1.0" encoding="UTF-8"?>
<!--
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-->
<scxml
    xmlns="http://www.w3.org/2005/07/scxml"
    xmlns:qt="http://theqtcompany.com/scxml/2015/06/"
    version="1.0"
    name="TrafficLightStateMachine"
    initial="working"
>
    <state id="working" initial="yellow">
        <state id="red">
            <onentry>
                <send event="startGoingGreen" delay="3s"/>
            </onentry>
            <transition event="startGoingGreen" target="redGoingGreen"/>
        </state>

        <state id="yellow" initial="greenGoingRed">
            <state id="redGoingGreen">
                <onentry>
                    <send event="goGreen" delay="1s"/>
                </onentry>
                <transition event="goGreen" target="green"/>
            </state>

            <state id="greenGoingRed">
                <onentry>
                    <send event="goRed" delay="1s"/>
                </onentry>
                <transition event="goRed" target="red"/>
            </state>
        </state>

        <state id="green">
            <onentry>
                <send event="startGoingRed" delay="3s"/>
            </onentry>
            <transition event="startGoingRed" target="greenGoingRed"/>
        </state>

        <transition event="smash" target="broken"/>
    </state>

    <state id="broken" initial="blinking">
        <state id="blinking">
            <onentry>
                <send event="unblink" delay="1s"/>
            </onentry>
            <transition event="unblink" target="unblinking"/>
        </state>

        <state id="unblinking">
            <onentry>
                <send event="blink" delay="1s"/>
            </onentry>
            <transition event="blink" target="blinking"/>
        </state>

        <transition event="repair" target="working"/>
    </state>
</scxml>