added startup and shutdown sequence
This commit is contained in:
parent
16066b4cf9
commit
78cb72d12d
@ -8,11 +8,24 @@ GPSHandler::GPSHandler(object_id_t objectId, object_id_t deviceCommunication,
|
||||
GPSHandler::~GPSHandler() {}
|
||||
|
||||
void GPSHandler::doStartUp() {
|
||||
if(internalState == InternalStates::NONE) {
|
||||
commandExecuted = false;
|
||||
internalState = InternalStates::WAIT_FIRST_MESSAGE;
|
||||
}
|
||||
|
||||
if(internalState == InternalStates::WAIT_FIRST_MESSAGE) {
|
||||
if(commandExecuted) {
|
||||
internalState = InternalStates::IDLE;
|
||||
setMode(MODE_ON);
|
||||
commandExecuted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GPSHandler::doShutDown() {
|
||||
|
||||
internalState = InternalStates::NONE;
|
||||
commandExecuted = false;
|
||||
setMode(MODE_OFF);
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||
|
@ -16,6 +16,13 @@ public:
|
||||
virtual ~GPSHandler();
|
||||
|
||||
protected:
|
||||
enum class InternalStates {
|
||||
NONE,
|
||||
WAIT_FIRST_MESSAGE,
|
||||
IDLE
|
||||
};
|
||||
InternalStates internalState = InternalStates::NONE;
|
||||
bool commandExecuted = false;
|
||||
|
||||
/* DeviceHandlerBase overrides */
|
||||
ReturnValue_t buildTransitionDeviceCommand(
|
||||
|
Loading…
Reference in New Issue
Block a user