2016-06-15 23:48:41 +02:00
|
|
|
#ifndef MODEHELPER_H_
|
|
|
|
#define MODEHELPER_H_
|
|
|
|
|
2020-09-26 14:51:00 +02:00
|
|
|
#include "../ipc/MessageQueueIF.h"
|
|
|
|
#include "../modes/ModeMessage.h"
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
|
|
|
#include "../timemanager/Countdown.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class HasModesIF;
|
|
|
|
|
|
|
|
class ModeHelper {
|
|
|
|
public:
|
2020-09-26 14:51:00 +02:00
|
|
|
MessageQueueId_t theOneWhoCommandedAMode = MessageQueueIF::NO_QUEUE;
|
2016-06-15 23:48:41 +02:00
|
|
|
Mode_t commandedMode;
|
|
|
|
Submode_t commandedSubmode;
|
|
|
|
|
|
|
|
ModeHelper(HasModesIF *owner);
|
|
|
|
virtual ~ModeHelper();
|
|
|
|
|
|
|
|
ReturnValue_t handleModeCommand(CommandMessage *message);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
|
|
|
|
*/
|
|
|
|
void setParentQueue(MessageQueueId_t parentQueueId);
|
|
|
|
|
|
|
|
ReturnValue_t initialize(MessageQueueId_t parentQueueId);
|
|
|
|
|
|
|
|
ReturnValue_t initialize(void); //void is there to stop eclipse CODAN from falsely reporting an error
|
|
|
|
|
|
|
|
void modeChanged(Mode_t mode, Submode_t submode);
|
|
|
|
|
|
|
|
void startTimer(uint32_t timeoutMs);
|
|
|
|
|
|
|
|
bool isTimedOut();
|
|
|
|
|
|
|
|
bool isForced();
|
|
|
|
|
|
|
|
void setForced(bool forced);
|
|
|
|
protected:
|
|
|
|
HasModesIF *owner;
|
2020-09-26 14:51:00 +02:00
|
|
|
MessageQueueId_t parentQueueId = MessageQueueIF::NO_QUEUE;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
Countdown countdown;
|
|
|
|
|
|
|
|
bool forced;
|
2020-09-26 14:51:00 +02:00
|
|
|
private:
|
|
|
|
void sendModeReplyMessage(Mode_t ownerMode, Submode_t ownerSubmode);
|
|
|
|
void sendModeInfoMessage(Mode_t ownerMode, Submode_t ownerSubmode);
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* MODEHELPER_H_ */
|