-
Notifications
You must be signed in to change notification settings - Fork 1
/
Closed.cpp
54 lines (44 loc) · 987 Bytes
/
Closed.cpp
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
//
// Closed.cpp
// StateMachine
//
// Created by Andrew III Lyne on 3/19/14.
// Copyright (c) 2014 Andrew III Lyne. All rights reserved.
//
#include "Closed.h"
void Closed::onEntry(){
NOP();
}
void Closed::onReEntry(){
NOP();
}
void Closed::onExit(){
NOP();
}
int Closed::transition(int event_id){
switch( event_id ){
case EVENT_PUSHBUTTON:
return 4;
break;
case EVENT_IR:
std::printf( "No transition for IR beam interrupt event in Closed state.\n");
return -1;
break;
case EVENT_DOOROPEN:
std::printf( "No transition for DoorOpen event in Closed state.\n");
return -1;
break;
case EVENT_DOORCLOSED:
std::printf("No transition for DoorClosed event in Closed state.\n");
return -1;
break;
case EVENT_MOTOROVERCURRENT:
std::printf("No transition for MotorOvercurrent event in Closed state.\n");
return -1;
break;
default:
std::printf( "ERROR: no event definition for idle code:%d\n", event_id);
return -1;
}
return -1;
}