SmartBox-Sortic
SmartFactory
|
The BoxLevel Controll class contains the FSM for the BoxLevel. More...
#include <BoxLevelCtrl.h>
Public Types | |
enum | Event { Event::PackageDetected, Event::NoPackageDetected, Event::CheckForPackage, Event::Error, Event::Resume, Event::NoEvent } |
Enum holds all possible events. More... | |
enum | State { State::emptyState, State::fullState, State::checking, State::errorState } |
Enum holds all possible states. More... | |
Public Member Functions | |
BoxLevelCtrl () | |
Construct a new Box Level Ctrl object and initailize the currentState with emptyState. More... | |
void | loop () |
Calls the do-function of the active state and hence generates Events. More... | |
void | loop (Event currentEvent) |
procceses the current Event and calls the do-function of the active state More... | |
const State | getcurrentState () |
Get the current State. More... | |
Private Member Functions | |
void | process (Event e) |
changes the state of the FSM based on the event More... | |
void | entryAction_emptyState () |
executes the entry action of the emptyState More... | |
BoxLevelCtrl::Event | doAction_emptyState () |
executes the main action of the emptyState More... | |
void | exitAction_emptyState () |
executes the exit action of the emptyState More... | |
void | entryAction_checking () |
executes the entry action of the checking More... | |
BoxLevelCtrl::Event | doAction_checking () |
executes the main action of the checking More... | |
void | exitAction_checking () |
executes the exit action of the checking More... | |
void | entryAction_fullState () |
executes the entry action of the fullState More... | |
BoxLevelCtrl::Event | doAction_fullState () |
executes the main action of the fullState More... | |
void | exitAction_fullState () |
executes the exit action of the fullState More... | |
void | entryAction_errorState () |
entry action of the errorState More... | |
BoxLevelCtrl::Event | doAction_errorState () |
main action of the errorState More... | |
void | exitAction_errorState () |
exit action of the errorState More... | |
String | decodeState (State state) |
Decodes the State-Enum and returns a description. More... | |
String | decodeEvent (Event event) |
Decodes the Event-Enum and returns a description. More... | |
Private Attributes | |
State | lastStateBevorError |
holds the last state of the FSM so it's possible to resume after error More... | |
State | currentState |
holds the current state of the FSM More... | |
Event | currentEvent |
holds the current event of the FSM More... | |
Event(BoxLevelCtrl::* | doActionFPtr )(void) = nullptr |
Functionpointer to call the current states do-function. More... | |
SensorArray | pSensorArray = SensorArray(LB1, LB2, LB3, LOADINDICATOR_LED) |
SensorArray Object. More... | |
The BoxLevel Controll class contains the FSM for the BoxLevel.
Definition at line 28 of file BoxLevelCtrl.h.
|
strong |
Enum holds all possible events.
Definition at line 35 of file BoxLevelCtrl.h.
|
strong |
Enum holds all possible states.
Enumerator | |
---|---|
emptyState | Empty State. |
fullState | Full State. |
checking | check Boxlevel |
errorState | Error-state. |
Definition at line 47 of file BoxLevelCtrl.h.
BoxLevelCtrl::BoxLevelCtrl | ( | ) |
Construct a new Box Level Ctrl object and initailize the currentState with emptyState.
Definition at line 16 of file BoxLevelCtrl.cpp.
void BoxLevelCtrl::loop | ( | ) |
Calls the do-function of the active state and hence generates Events.
Definition at line 19 of file BoxLevelCtrl.cpp.
void BoxLevelCtrl::loop | ( | Event | currentEvent | ) |
procceses the current Event and calls the do-function of the active state
currentEvent | - Event |
Definition at line 24 of file BoxLevelCtrl.cpp.
const BoxLevelCtrl::State BoxLevelCtrl::getcurrentState | ( | ) |
|
private |
changes the state of the FSM based on the event
e | - Event |
Definition at line 34 of file BoxLevelCtrl.cpp.
|
private |
executes the entry action of the emptyState
Turns on the Loadindicator-LED
Definition at line 90 of file BoxLevelCtrl.cpp.
|
private |
executes the main action of the emptyState
Definition at line 97 of file BoxLevelCtrl.cpp.
|
private |
executes the exit action of the emptyState
Definition at line 103 of file BoxLevelCtrl.cpp.
|
private |
executes the entry action of the checking
Definition at line 108 of file BoxLevelCtrl.cpp.
|
private |
executes the main action of the checking
checks if the sensor has a package detected and generates the appropriate event
Definition at line 114 of file BoxLevelCtrl.cpp.
|
private |
executes the exit action of the checking
Definition at line 124 of file BoxLevelCtrl.cpp.
|
private |
executes the entry action of the fullState
Turns off the Loadindicator-LED
Definition at line 129 of file BoxLevelCtrl.cpp.
|
private |
executes the main action of the fullState
Definition at line 136 of file BoxLevelCtrl.cpp.
|
private |
executes the exit action of the fullState
Definition at line 143 of file BoxLevelCtrl.cpp.
|
private |
entry action of the errorState
Definition at line 148 of file BoxLevelCtrl.cpp.
|
private |
main action of the errorState
Definition at line 155 of file BoxLevelCtrl.cpp.
|
private |
exit action of the errorState
Definition at line 162 of file BoxLevelCtrl.cpp.
|
private |
Decodes the State-Enum and returns a description.
state | - enum State |
Definition at line 168 of file BoxLevelCtrl.cpp.
|
private |
Decodes the Event-Enum and returns a description.
event | - enum Event |
Definition at line 188 of file BoxLevelCtrl.cpp.
|
private |
holds the last state of the FSM so it's possible to resume after error
Definition at line 89 of file BoxLevelCtrl.h.
|
private |
holds the current state of the FSM
Definition at line 90 of file BoxLevelCtrl.h.
|
private |
holds the current event of the FSM
Definition at line 91 of file BoxLevelCtrl.h.
|
private |
Functionpointer to call the current states do-function.
https://stackoverflow.com/questions/1485983/calling-c-class-methods-via-a-function-pointer
Definition at line 98 of file BoxLevelCtrl.h.
|
private |
SensorArray Object.
Definition at line 100 of file BoxLevelCtrl.h.