2016-06-15 23:48:41 +02:00
|
|
|
#ifndef CONTROLLERBASE_H_
|
|
|
|
#define CONTROLLERBASE_H_
|
|
|
|
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../health/HasHealthIF.h"
|
|
|
|
#include "../health/HealthHelper.h"
|
|
|
|
#include "../modes/HasModesIF.h"
|
|
|
|
#include "../modes/ModeHelper.h"
|
|
|
|
#include "../objectmanager/SystemObject.h"
|
|
|
|
#include "../tasks/ExecutableObjectIF.h"
|
|
|
|
#include "../datapool/HkSwitchHelper.h"
|
2018-07-12 16:29:32 +02:00
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
class ControllerBase: public HasModesIF,
|
|
|
|
public HasHealthIF,
|
|
|
|
public ExecutableObjectIF,
|
|
|
|
public SystemObject,
|
|
|
|
public HasReturnvaluesIF {
|
|
|
|
public:
|
|
|
|
|
|
|
|
static const Mode_t MODE_NORMAL = 2;
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
ControllerBase(uint32_t setObjectId, uint32_t parentId,
|
|
|
|
size_t commandQueueDepth = 3);
|
2016-06-15 23:48:41 +02:00
|
|
|
virtual ~ControllerBase();
|
|
|
|
|
|
|
|
ReturnValue_t initialize();
|
|
|
|
|
|
|
|
virtual MessageQueueId_t getCommandQueue() const;
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
virtual ReturnValue_t performOperation(uint8_t opCode);
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
virtual ReturnValue_t setHealth(HealthState health);
|
|
|
|
|
|
|
|
virtual HasHealthIF::HealthState getHealth();
|
2018-07-13 18:28:26 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of ExecutableObjectIF function
|
|
|
|
*
|
|
|
|
* Used to setup the reference of the task, that executes this component
|
|
|
|
* @param task_ Pointer to the taskIF of this task
|
|
|
|
*/
|
|
|
|
virtual void setTaskIF(PeriodicTaskIF* task_);
|
|
|
|
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
protected:
|
|
|
|
const uint32_t parentId;
|
|
|
|
|
|
|
|
Mode_t mode;
|
|
|
|
|
|
|
|
Submode_t submode;
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
MessageQueueIF* commandQueue;
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
ModeHelper modeHelper;
|
|
|
|
|
|
|
|
HealthHelper healthHelper;
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
HkSwitchHelper hkSwitcher;
|
|
|
|
|
2018-07-13 18:28:26 +02:00
|
|
|
/**
|
|
|
|
* Pointer to the task which executes this component, is invalid before setTaskIF was called.
|
|
|
|
*/
|
|
|
|
PeriodicTaskIF* executingTask;
|
|
|
|
|
2016-06-15 23:48:41 +02:00
|
|
|
void handleQueue();
|
|
|
|
|
|
|
|
virtual ReturnValue_t handleCommandMessage(CommandMessage *message) = 0;
|
|
|
|
virtual void performControlOperation() = 0;
|
|
|
|
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
|
|
|
uint32_t *msToReachTheMode) = 0;
|
|
|
|
virtual void modeChanged(Mode_t mode, Submode_t submode);
|
|
|
|
virtual void startTransition(Mode_t mode, Submode_t submode);
|
|
|
|
virtual void getMode(Mode_t *mode, Submode_t *submode);
|
|
|
|
virtual void setToExternalControl();
|
|
|
|
virtual void announceMode(bool recursive);
|
2018-07-12 16:29:32 +02:00
|
|
|
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable);
|
2016-06-15 23:48:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* CONTROLLERBASE_H_ */
|