Controller API
ControllerBase
-
class ControllerBase : public HasModesIF, public HasHealthIF, public ExecutableObjectIF, public SystemObject
Generic base class for controller classes.
Implements common interfaces for controllers, which generally have a mode and a health state. This avoids boilerplate code.
Subclassed by ExtendedControllerBase
Public Functions
-
virtual ReturnValue_t initialize() override
SystemObject override
-
virtual ReturnValue_t setHealth(HealthState health) override
HasHealthIF overrides
-
virtual HasHealthIF::HealthState getHealth() override
Get Health State.
- Returns:
Health State of the object
-
virtual ReturnValue_t performOperation(uint8_t opCode) override
ExecutableObjectIF overrides
-
virtual void setTaskIF(PeriodicTaskIF *task) override
Function called during setup assignment of object to task.
Has to be called from the function that assigns the object to a task and enables the object implementation to overwrite this function and get a reference to the executing task
- Parameters:
task_ – Pointer to the taskIF of this task
-
virtual ReturnValue_t initializeAfterTaskCreation() override
This function should be called after the object was assigned to a specific task.
Example: Can be used to get task execution frequency. The task is created after initialize() and the object ctors have been called so the execution frequency can’t be cached in initialize()
- Returns:
Protected Functions
-
virtual ReturnValue_t handleCommandMessage(CommandMessage *message) = 0
Implemented by child class. Handle command messages which are not mode or health messages.
- Parameters:
message –
- Returns:
-
virtual void performControlOperation() = 0
Periodic helper, implemented by child class.
-
virtual void handleQueue()
Handle mode and health messages
-
virtual void modeChanged(Mode_t mode, Submode_t submode)
Mode helpers
-
virtual void changeHK(Mode_t mode, Submode_t submode, bool enable)
HK helpers
Protected Attributes
-
PeriodicTaskIF *executingTask = nullptr
Pointer to the task which executes this component, is invalid before setTaskIF was called.
-
virtual ReturnValue_t initialize() override
ExtendedControllerBase
-
class ExtendedControllerBase : public ControllerBase, public HasActionsIF, public HasLocalDataPoolIF
Extends the basic ControllerBase with commonly used components.
HasActionsIF for commandability and HasLocalDataPoolIF to keep a pool of local data pool variables. Default implementations required for the interfaces will be empty and have to be implemented by child class.
Subclassed by TestController
Public Functions
-
virtual ReturnValue_t initialize() override
SystemObject override
-
virtual MessageQueueId_t getCommandQueue() const override
Function to get the MessageQueueId_t of the implementing object
- Returns:
MessageQueueId_t of the object
-
virtual ReturnValue_t performOperation(uint8_t opCode) override
ExecutableObjectIF overrides
-
virtual ReturnValue_t initializeAfterTaskCreation() override
This function should be called after the object was assigned to a specific task.
Example: Can be used to get task execution frequency. The task is created after initialize() and the object ctors have been called so the execution frequency can’t be cached in initialize()
- Returns:
Protected Functions
-
virtual ReturnValue_t handleCommandMessage(CommandMessage *message) override = 0
Implemented by child class. Handle all command messages which are not health, mode, action or housekeeping messages.
- Parameters:
message –
- Returns:
-
virtual void performControlOperation() override = 0
Periodic helper from ControllerBase, implemented by child class.
-
virtual void handleQueue() override
Handle mode and health messages
-
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override
Execute or initialize the execution of a certain function. The ActionHelpers will execute this function and behave differently depending on the returnvalue.
- Returns:
-
EXECUTION_FINISHEDFinish reply will be generated -Notreturnvalue::OK Step failure reply will be generated
-
virtual LocalDataPoolManager *getHkManagerHandle() override
Every class implementing this interface should have a local data pool manager. This function will return a reference to the manager.
- Returns:
-
virtual uint32_t getPeriodicOperationFrequency() const override
Returns the minimum sampling frequency in milliseconds, which will usually be the period the pool owner performs its periodic operation.
- Returns:
-
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override = 0
Is used by pool owner to initialize the pool map once The manager instance shall also be passed to this function. It can be used to subscribe for periodic packets for for updates.
-
virtual LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override = 0
This function is used by the pool manager to get a valid dataset from a SID. This function is protected to prevent users from using raw data set pointers which could not be thread-safe. Users should use the ProvidesDataPoolSubscriptionIF.
- Parameters:
sid – Corresponding structure ID
- Returns:
-
virtual ReturnValue_t initialize() override