2016-06-15 23:48:41 +02:00
|
|
|
#ifndef MODEHELPER_H_
|
|
|
|
#define MODEHELPER_H_
|
|
|
|
|
|
|
|
#include <framework/modes/ModeMessage.h>
|
|
|
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
|
|
|
#include <framework/timemanager/Countdown.h>
|
|
|
|
|
|
|
|
class HasModesIF;
|
|
|
|
|
|
|
|
class ModeHelper {
|
|
|
|
public:
|
|
|
|
MessageQueueId_t theOneWhoCommandedAMode;
|
|
|
|
Mode_t commandedMode;
|
|
|
|
Submode_t commandedSubmode;
|
|
|
|
|
|
|
|
ModeHelper(HasModesIF *owner);
|
|
|
|
virtual ~ModeHelper();
|
|
|
|
|
2019-11-04 00:47:46 +01:00
|
|
|
/**
|
|
|
|
* This is used by DHB to handle all mode messages issued by a service
|
|
|
|
* @param message
|
|
|
|
* @return
|
|
|
|
*/
|
2016-06-15 23:48:41 +02:00
|
|
|
ReturnValue_t handleModeCommand(CommandMessage *message);
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
2019-11-04 00:47:46 +01:00
|
|
|
* @param parentQueue the Queue id of the parent object (assembly or subsystem object).
|
|
|
|
* Set to 0 if no parent present
|
2016-06-15 23:48:41 +02:00
|
|
|
*/
|
|
|
|
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
|
|
|
|
|
2019-11-04 00:47:46 +01:00
|
|
|
/**
|
|
|
|
* Used to notify
|
|
|
|
* @param mode
|
|
|
|
* @param submode
|
|
|
|
*/
|
2016-06-15 23:48:41 +02:00
|
|
|
void modeChanged(Mode_t mode, Submode_t submode);
|
|
|
|
|
|
|
|
void startTimer(uint32_t timeoutMs);
|
|
|
|
|
|
|
|
bool isTimedOut();
|
|
|
|
|
|
|
|
bool isForced();
|
|
|
|
|
|
|
|
void setForced(bool forced);
|
|
|
|
protected:
|
|
|
|
HasModesIF *owner;
|
|
|
|
MessageQueueId_t parentQueueId;
|
|
|
|
|
|
|
|
Countdown countdown;
|
|
|
|
|
|
|
|
bool forced;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* MODEHELPER_H_ */
|