summaryrefslogtreecommitdiff
path: root/tools/dfagen/examples/ex2.fsm
blob: 8142ad88b9a24ef6aa0c0ea91b79534dcf49c3d7 (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
# Second FSM example.
Example 2
  A barman robot.

States:
 IDLE [in=hello out=goodbye]
  waiting for a command
 DROPPING_ICE [in=hi]
 FILLING_GLASS

Events:
 command
 ice dropped
 glass filled
 replace bottle

IDLE:
 command: with ice -> DROPPING_ICE [ex2_idle_command]
  open the ice door
 command: without ice -> FILLING_GLASS
  start filling
 command: empty bottle -> .
  display "empty bottle, please replace it"
 replace bottle -> . [ex2_idle_replace]
  reset glass counter

DROPPING_ICE:
 ice dropped -> FILLING_GLASS
  close the ice door
  start filling

FILLING_GLASS:
 glass filled -> IDLE
  stop filling

DROPPING_ICE, FILLING_GLASS:
 command -> .
  ignored
 replace bottle -> .
  ignored