|
SmartBox-Sortic
SmartFactory
|
The Box Controll class contains the FSM for the complete Box. More...
#include <BoxCtrl.h>

Classes | |
| struct | Box |
| Box class contains all relevant information about the box and its actual state. More... | |
Public Types | |
| enum | Sector { Sector::SorticHandover, Sector::SorticToHandover, Sector::SorticWaitForGateway, Sector::SorticGateway, Sector::TransitWaitForGatewaySortic, Sector::TransitToSortic, Sector::TransitToTransfer, Sector::Parking, Sector::TransitWaitForGatewayTransfer, Sector::TransferGateway, Sector::TransferWaitForGateway, Sector::TransferToHandover, Sector::TransferHandover, Sector::error } |
| Sector class holds all possible position on the gametable. More... | |
| enum | Event { Event::SBReadyForTransport, Event::SBReady, Event::CalcOptVal, Event::AnswerReceived, Event::NoAnswerReceived, Event::Error, Event::Reset, Event::Resume, Event::NoEvent } |
| Enum holds all possible events. More... | |
Public Member Functions | |
| BoxCtrl () | |
| Construct a new Box Ctrl object. 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... | |
Public Attributes | |
| struct BoxCtrl::Box | box |
Private Types | |
| enum | State { State::readSensorVal, State::waitForVehicle, State::calculateOptVehicle, State::publishOptVehicle, State::waitForAck, State::waitForTransport, State::resetState, State::errorState } |
| Enum holds all possible state's. More... | |
Private Member Functions | |
| void | process (Event e) |
| changes the state of the FSM based on the event More... | |
| void | entryAction_readSensorVal () |
| entry action of the readSensorVal More... | |
| BoxCtrl::Event | doAction_readSensorVal () |
| main action of the readSensorVal More... | |
| void | exitAction_readSensorVal () |
| exit action of the readSensorVal More... | |
| void | entryAction_waitForVehicle () |
| entry action of the waitForVehicle More... | |
| BoxCtrl::Event | doAction_waitForVehicle () |
| main action of the waitForVehicle More... | |
| void | exitAction_waitForVehicle () |
| exit action of the waitForVehicle More... | |
| void | entryAction_calculateOptVehicle () |
| entry action of the calculateOptVehicle More... | |
| BoxCtrl::Event | doAction_calculateOptVehicle () |
| main action of the calculateOptVehicle More... | |
| void | exitAction_calculateOptVehicle () |
| exit action of the calculateOptVehicle More... | |
| void | entryAction_publishOptVehicle () |
| entry action of the publishOptVehicle More... | |
| BoxCtrl::Event | doAction_publishOptVehicle () |
| main action of the publishOptVehicle More... | |
| void | exitAction_publishOptVehicle () |
| exit action of the publishOptVehicle More... | |
| void | entryAction_waitForAck () |
| entry action of the waitForAck publish state to "Box/box.id/status" More... | |
| BoxCtrl::Event | doAction_waitForAck () |
| main action of the waitForAck More... | |
| void | exitAction_waitForAck () |
| exit action of the waitForAck More... | |
| void | entryAction_waitForTransport () |
| entry action of the waitForTransport More... | |
| BoxCtrl::Event | doAction_waitForTransport () |
| main action of the waitForTransport More... | |
| void | exitAction_waitForTransport () |
| exit action of the waitForTransport More... | |
| void | entryAction_errorState () |
| entry action of the errorState More... | |
| BoxCtrl::Event | doAction_errorState () |
| main action of the errorState More... | |
| void | exitAction_errorState () |
| exit action of the errorState More... | |
| void | entryAction_resetState () |
| entry action of the resetState More... | |
| BoxCtrl::Event | doAction_resetState () |
| main action of the resetState More... | |
| void | exitAction_resetState () |
| exit action of the resetState 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... | |
| String | decodeSector (Sector sector) |
| Decodes the Sector-Enum and returns a description. More... | |
| BoxCtrl::Sector | decodeSector (String sector) |
| Decodes the Sector-Enum and returns a description. More... | |
| void | publishPosition () |
| publish actual position via communication More... | |
| void | publishState (State state) |
| Publish actual state via communication. More... | |
| bool | checkForError () |
| Check if the last message was an error. More... | |
| void | clearGui () |
| clear all box related gui entrys 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(BoxCtrl::* | doActionFPtr )(void) = nullptr |
| Functionpointer to call the current states do-function. More... | |
| BoxLevelCtrl | pBoxlevelctrl |
| instance ot BoxLevelCtrl More... | |
| Communication | pComm = Communication(DEFAULT_HOSTNAME) |
| instance of Communication with Box.id/hostname More... | |
| unsigned long | currentMillis = 0 |
| store current time More... | |
| unsigned long | previousMillis = 0 |
| store last time More... | |
| unsigned long | previousMillisPublish = 0 |
| store last publish time More... | |
|
strong |
Sector class holds all possible position on the gametable.
|
strong |
Enum holds all possible events.
|
strongprivate |
Enum holds all possible state's.
https://stackoverflow.com/questions/18335861/why-is-enum-class-preferred-over-plain-enum
| BoxCtrl::BoxCtrl | ( | ) |
Construct a new Box Ctrl object.
Definition at line 15 of file BoxCtrl.cpp.
| void BoxCtrl::loop | ( | ) |
Calls the do-function of the active state and hence generates Events.
Definition at line 29 of file BoxCtrl.cpp.
| void BoxCtrl::loop | ( | Event | currentEvent | ) |
procceses the current Event and calls the do-function of the active state
| currentEvent | - Event |
Definition at line 34 of file BoxCtrl.cpp.
|
private |
changes the state of the FSM based on the event
| e | - Event |
Definition at line 41 of file BoxCtrl.cpp.
|
private |
entry action of the readSensorVal
publish actual state to "Box/box.id/status"
Definition at line 150 of file BoxCtrl.cpp.
|
private |
main action of the readSensorVal
Definition at line 165 of file BoxCtrl.cpp.
|
private |
exit action of the readSensorVal
Definition at line 209 of file BoxCtrl.cpp.
|
private |
entry action of the waitForVehicle
Definition at line 215 of file BoxCtrl.cpp.
|
private |
main action of the waitForVehicle
wait for SMARTBOX_WAITFOR_VEHICLES_SECONDS seconds
Definition at line 235 of file BoxCtrl.cpp.
|
private |
exit action of the waitForVehicle
unsubscribe from "Vehicle/+/available"
Definition at line 262 of file BoxCtrl.cpp.
|
private |
entry action of the calculateOptVehicle
publish state to "Box/box.id/status"
Definition at line 268 of file BoxCtrl.cpp.
|
private |
main action of the calculateOptVehicle
if not valid
Definition at line 275 of file BoxCtrl.cpp.
|
private |
exit action of the calculateOptVehicle
Definition at line 316 of file BoxCtrl.cpp.
|
private |
entry action of the publishOptVehicle
Definition at line 322 of file BoxCtrl.cpp.
|
private |
main action of the publishOptVehicle
Definition at line 334 of file BoxCtrl.cpp.
|
private |
exit action of the publishOptVehicle
Definition at line 374 of file BoxCtrl.cpp.
|
private |
entry action of the waitForAck publish state to "Box/box.id/status"
Definition at line 379 of file BoxCtrl.cpp.
|
private |
main action of the waitForAck
if acknoledge vehicle also ack box in time
Definition at line 389 of file BoxCtrl.cpp.
|
private |
exit action of the waitForAck
unsubscribe from "Vehicle/box.req/handshake"
Definition at line 423 of file BoxCtrl.cpp.
|
private |
entry action of the waitForTransport
Definition at line 430 of file BoxCtrl.cpp.
|
private |
main action of the waitForTransport
Definition at line 439 of file BoxCtrl.cpp.
|
private |
exit action of the waitForTransport
unsubscribe from "Box/box.id/position"
Definition at line 462 of file BoxCtrl.cpp.
|
private |
entry action of the errorState
Definition at line 469 of file BoxCtrl.cpp.
|
private |
main action of the errorState
Definition at line 478 of file BoxCtrl.cpp.
|
private |
exit action of the errorState
Definition at line 498 of file BoxCtrl.cpp.
|
private |
entry action of the resetState
Definition at line 504 of file BoxCtrl.cpp.
|
private |
main action of the resetState
Definition at line 514 of file BoxCtrl.cpp.
|
private |
exit action of the resetState
Definition at line 529 of file BoxCtrl.cpp.
|
private |
Decodes the State-Enum and returns a description.
| state | - enum State |
Definition at line 538 of file BoxCtrl.cpp.
|
private |
Decodes the Event-Enum and returns a description.
| event | - enum Event |
Definition at line 570 of file BoxCtrl.cpp.
|
private |
Decodes the Sector-Enum and returns a description.
| sector | - Sector to decode |
Definition at line 605 of file BoxCtrl.cpp.
|
private |
Decodes the Sector-Enum and returns a description.
| sector | - String to decode |
Definition at line 653 of file BoxCtrl.cpp.
|
private |
publish actual position via communication
Definition at line 701 of file BoxCtrl.cpp.
|
private |
Publish actual state via communication.
| state | - State of type enum State |
Definition at line 696 of file BoxCtrl.cpp.
|
private |
Check if the last message was an error.
Definition at line 683 of file BoxCtrl.cpp.
|
private |
clear all box related gui entrys
Definition at line 705 of file BoxCtrl.cpp.
| struct BoxCtrl::Box BoxCtrl::box |
|
private |
|
private |
|
private |
|
private |
Functionpointer to call the current states do-function.
https://stackoverflow.com/questions/1485983/calling-c-class-methods-via-a-function-pointer
|
private |
instance ot BoxLevelCtrl
|
private |
|
private |
|
private |
|
private |