fsfw/modes/ModeHelper.h

54 lines
1.2 KiB
C
Raw Normal View History

2020-09-26 14:59:40 +02:00
#ifndef FSFW_MODES_MODEHELPER_H_
#define FSFW_MODES_MODEHELPER_H_
2020-08-28 18:33:29 +02:00
2020-09-26 14:59:40 +02:00
#include "ModeMessage.h"
2020-08-28 18:33:29 +02:00
#include "../ipc/MessageQueueIF.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../timemanager/Countdown.h"
class HasModesIF;
class ModeHelper {
public:
MessageQueueId_t theOneWhoCommandedAMode = MessageQueueIF::NO_QUEUE;
Mode_t commandedMode;
Submode_t commandedSubmode;
ModeHelper(HasModesIF *owner);
virtual ~ModeHelper();
ReturnValue_t handleModeCommand(CommandMessage *message);
/**
2020-09-26 14:59:40 +02:00
* @param parentQueue the Queue id of the parent object.
* Set to 0 if no parent present
2020-08-28 18:33:29 +02:00
*/
void setParentQueue(MessageQueueId_t parentQueueId);
ReturnValue_t initialize(MessageQueueId_t parentQueueId);
2020-09-26 14:59:40 +02:00
ReturnValue_t initialize(void);
2020-08-28 18:33:29 +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 = MessageQueueIF::NO_QUEUE;
Countdown countdown;
bool forced;
private:
void sendModeReplyMessage(Mode_t ownerMode, Submode_t ownerSubmode);
void sendModeInfoMessage(Mode_t ownerMode, Submode_t ownerSubmode);
};
2020-09-26 14:59:40 +02:00
#endif /* FSFW_MODES_MODEHELPER_H_ */