Merge remote-tracking branch 'sidestream/mohr_introspection' into mohr/introspection
This commit is contained in:
commit
c7e6f01f9b
@ -103,6 +103,12 @@ ReturnValue_t ControllerBase::performOperation(uint8_t opCode) {
|
|||||||
|
|
||||||
void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {}
|
void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {}
|
||||||
|
|
||||||
|
const ModeHelper * ControllerBase::getModeHelper() const {
|
||||||
|
return &modeHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ControllerBase::modeChanged(Mode_t mode, Submode_t submode) { return; }
|
||||||
|
|
||||||
ReturnValue_t ControllerBase::setHealth(HealthState health) {
|
ReturnValue_t ControllerBase::setHealth(HealthState health) {
|
||||||
switch (health) {
|
switch (health) {
|
||||||
case HEALTHY:
|
case HEALTHY:
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "fsfw/health/HasHealthIF.h"
|
#include "fsfw/health/HasHealthIF.h"
|
||||||
#include "fsfw/health/HealthHelper.h"
|
#include "fsfw/health/HealthHelper.h"
|
||||||
|
#include "fsfw/introspection/ClasslessEnum.h"
|
||||||
#include "fsfw/modes/HasModesIF.h"
|
#include "fsfw/modes/HasModesIF.h"
|
||||||
#include "fsfw/modes/ModeHelper.h"
|
#include "fsfw/modes/ModeHelper.h"
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
@ -21,7 +22,9 @@ class ControllerBase : public HasModesIF,
|
|||||||
public SystemObject,
|
public SystemObject,
|
||||||
public HasReturnvaluesIF {
|
public HasReturnvaluesIF {
|
||||||
public:
|
public:
|
||||||
static const Mode_t MODE_NORMAL = 2;
|
FSFW_CLASSLESS_ENUM(ControllerModes, Mode_t,
|
||||||
|
((CONTROLLER_MODE_ON, MODE_ON, "On"))((CONTROLLER_MODE_OFF, MODE_OFF,
|
||||||
|
"Off"))((MODE_NORMAL, 2, "Normal")))
|
||||||
|
|
||||||
ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3);
|
ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3);
|
||||||
~ControllerBase() override;
|
~ControllerBase() override;
|
||||||
@ -40,6 +43,9 @@ class ControllerBase : public HasModesIF,
|
|||||||
void setTaskIF(PeriodicTaskIF *task) override;
|
void setTaskIF(PeriodicTaskIF *task) override;
|
||||||
ReturnValue_t initializeAfterTaskCreation() override;
|
ReturnValue_t initializeAfterTaskCreation() override;
|
||||||
|
|
||||||
|
/** HasModeIF override */
|
||||||
|
const ModeHelper *getModeHelper() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Implemented by child class. Handle command messages which are not
|
* Implemented by child class. Handle command messages which are not
|
||||||
|
@ -1325,11 +1325,9 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionHelper *DeviceHandlerBase::getActionHelper() {
|
ActionHelper* DeviceHandlerBase::getActionHelper() { return &actionHelper; }
|
||||||
return &actionHelper;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t DeviceHandlerBase::executeAction(Action *action) {
|
ReturnValue_t DeviceHandlerBase::executeAction(Action* action) {
|
||||||
ReturnValue_t result = acceptExternalDeviceCommands();
|
ReturnValue_t result = acceptExternalDeviceCommands();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
@ -1605,3 +1603,10 @@ void DeviceHandlerBase::disableCommandsAndReplies() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModeHelper const* DeviceHandlerBase::getModeHelper() const { return &modeHelper; }
|
||||||
|
|
||||||
|
ModeDefinitionHelper DeviceHandlerBase::getModeDefinitionHelper() {
|
||||||
|
return ModeDefinitionHelper::create<DeviceHandlerMode, DefaultSubmode>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
|
|
||||||
Mode_t getTransitionSourceMode() const;
|
Mode_t getTransitionSourceMode() const;
|
||||||
Submode_t getTransitionSourceSubMode() const;
|
Submode_t getTransitionSourceSubMode() const;
|
||||||
virtual void getMode(Mode_t *mode, Submode_t *submode);
|
void getMode(Mode_t *mode, Submode_t *submode) override;
|
||||||
|
ModeHelper const * getModeHelper() const override;
|
||||||
|
ModeDefinitionHelper getModeDefinitionHelper() override;
|
||||||
HealthState getHealth();
|
HealthState getHealth();
|
||||||
ReturnValue_t setHealth(HealthState health);
|
ReturnValue_t setHealth(HealthState health);
|
||||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../action/HasActionsIF.h"
|
#include "../action/HasActionsIF.h"
|
||||||
#include "../datapoollocal/localPoolDefinitions.h"
|
#include "../datapoollocal/localPoolDefinitions.h"
|
||||||
#include "../events/Event.h"
|
#include "../events/Event.h"
|
||||||
|
#include "../introspection/ClasslessEnum.h"
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
#include "../modes/HasModesIF.h"
|
#include "../modes/HasModesIF.h"
|
||||||
#include "DeviceHandlerMessage.h"
|
#include "DeviceHandlerMessage.h"
|
||||||
@ -37,23 +38,30 @@ class DeviceHandlerIF {
|
|||||||
* The mode of the device itself is transparent to the user but related to the mode of the
|
* The mode of the device itself is transparent to the user but related to the mode of the
|
||||||
* handler. MODE_ON and MODE_OFF are included in hasModesIF.h
|
* handler. MODE_ON and MODE_OFF are included in hasModesIF.h
|
||||||
*/
|
*/
|
||||||
|
FSFW_CLASSLESS_ENUM(
|
||||||
|
DeviceHandlerMode, Mode_t,
|
||||||
|
//! The device is powered and ready to perform operations. In this mode, no
|
||||||
|
//! commands are sent by the device handler itself, but direct commands can be
|
||||||
|
//! commanded and will be executed/forwarded to the device
|
||||||
|
//! This is an alias of MODE_ON to have the FSFW_ENUM complete for introspection
|
||||||
|
((DEVICEHANDLER_MODE_ON, HasModesIF::MODE_ON, "On"))
|
||||||
|
//! The device is powered off. The only command accepted in this
|
||||||
|
//! mode is a mode change to on.
|
||||||
|
//! This is an alias of MODE_OFF to have the FSFW_ENUM complete for introspection
|
||||||
|
((DEVICEHANDLER_MODE_OFF, HasModesIF::MODE_OFF, "Off"))
|
||||||
|
//! The device is powered on and the device handler periodically sends
|
||||||
|
//! commands. The commands to be sent are selected by the handler
|
||||||
|
//! according to the submode.
|
||||||
|
((MODE_NORMAL, 2, "Normal"))
|
||||||
|
//! The device is powered on and ready to perform operations. In this mode,
|
||||||
|
//! raw commands can be sent. The device handler will send all replies
|
||||||
|
//! received from the command back to the commanding object as raw TM
|
||||||
|
((MODE_RAW, 3, "Raw"))
|
||||||
|
//! The device is shut down but the switch could not be turned off, so the
|
||||||
|
//! device still is powered. In this mode, only a mode change to @c MODE_OFF
|
||||||
|
//! can be commanded, which tries to switch off the device again.
|
||||||
|
((MODE_ERROR_ON, 4, "Error")))
|
||||||
|
|
||||||
// MODE_ON = 0, //!< The device is powered and ready to perform operations. In this mode, no
|
|
||||||
// commands are sent by the device handler itself, but direct commands van be commanded and will
|
|
||||||
// be interpreted MODE_OFF = 1, //!< The device is powered off. The only command accepted in this
|
|
||||||
// mode is a mode change to on.
|
|
||||||
//! The device is powered on and the device handler periodically sends
|
|
||||||
//! commands. The commands to be sent are selected by the handler
|
|
||||||
//! according to the submode.
|
|
||||||
static const Mode_t MODE_NORMAL = 2;
|
|
||||||
//! The device is powered on and ready to perform operations. In this mode,
|
|
||||||
//! raw commands can be sent. The device handler will send all replies
|
|
||||||
//! received from the command back to the commanding object.
|
|
||||||
static const Mode_t MODE_RAW = 3;
|
|
||||||
//! The device is shut down but the switch could not be turned off, so the
|
|
||||||
//! device still is powered. In this mode, only a mode change to @c MODE_OFF
|
|
||||||
//! can be commanded, which tries to switch off the device again.
|
|
||||||
static const Mode_t MODE_ERROR_ON = 4;
|
|
||||||
//! This is a transitional state which can not be commanded. The device
|
//! This is a transitional state which can not be commanded. The device
|
||||||
//! handler performs all commands to get the device in a state ready to
|
//! handler performs all commands to get the device in a state ready to
|
||||||
//! perform commands. When this is completed, the mode changes to @c MODE_ON.
|
//! perform commands. When this is completed, the mode changes to @c MODE_ON.
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "../events/Event.h"
|
#include "../events/Event.h"
|
||||||
|
#include "../introspection/ClasslessEnum.h"
|
||||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||||
#include "ModeHelper.h"
|
|
||||||
#include "ModeDefinitionHelper.h"
|
#include "ModeDefinitionHelper.h"
|
||||||
|
#include "ModeHelper.h"
|
||||||
#include "ModeMessage.h"
|
#include "ModeMessage.h"
|
||||||
|
|
||||||
class HasModesIF {
|
class HasModesIF {
|
||||||
@ -35,8 +36,9 @@ class HasModesIF {
|
|||||||
//! A mode command was rejected by the called object. Par1: called object id, Par2: return code.
|
//! A mode command was rejected by the called object. Par1: called object id, Par2: return code.
|
||||||
static const Event MODE_CMD_REJECTED = MAKE_EVENT(7, severity::LOW);
|
static const Event MODE_CMD_REJECTED = MAKE_EVENT(7, severity::LOW);
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
//! The device is powered and ready to perform operations. In this mode, no commands are
|
//! The device is powered and ready to perform operations. In this mode, no commands are
|
||||||
//! sent by the device handler itself, but direct commands van be commanded and will be
|
//! sent by the device handler itself, but direct commands can be commanded and will be
|
||||||
//! interpreted
|
//! interpreted
|
||||||
static constexpr Mode_t MODE_ON = 1;
|
static constexpr Mode_t MODE_ON = 1;
|
||||||
//! The device is powered off. The only command accepted in this mode is a mode change to on.
|
//! The device is powered off. The only command accepted in this mode is a mode change to on.
|
||||||
@ -45,12 +47,14 @@ class HasModesIF {
|
|||||||
static constexpr Mode_t MODE_INVALID = -1;
|
static constexpr Mode_t MODE_INVALID = -1;
|
||||||
static constexpr Mode_t MODE_UNDEFINED = -2;
|
static constexpr Mode_t MODE_UNDEFINED = -2;
|
||||||
|
|
||||||
//! To avoid checks against magic number "0".
|
FSFW_CLASSLESS_ENUM(DefaultSubmode, Submode_t,
|
||||||
static const Submode_t SUBMODE_NONE = 0;
|
((SUBMODE_NONE, 0,
|
||||||
|
"Default"))) //!< To avoid checks against magic number "0".
|
||||||
|
|
||||||
virtual ~HasModesIF() {}
|
virtual ~HasModesIF() {}
|
||||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||||
virtual ModeDefinitionHelper getModeDefinitionHelper()= 0;
|
virtual const ModeHelper * getModeHelper() const = 0;
|
||||||
|
virtual ModeDefinitionHelper getModeDefinitionHelper() = 0;
|
||||||
virtual void getMode(Mode_t *mode, Submode_t *submode) = 0;
|
virtual void getMode(Mode_t *mode, Submode_t *submode) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -327,3 +327,7 @@ ReturnValue_t SubsystemBase::setHealth(HealthState health) {
|
|||||||
HasHealthIF::HealthState SubsystemBase::getHealth() { return healthHelper.getHealth(); }
|
HasHealthIF::HealthState SubsystemBase::getHealth() { return healthHelper.getHealth(); }
|
||||||
|
|
||||||
void SubsystemBase::modeChanged() {}
|
void SubsystemBase::modeChanged() {}
|
||||||
|
|
||||||
|
const ModeHelper * SubsystemBase::getModeHelper() const {
|
||||||
|
return &modeHelper;
|
||||||
|
}
|
@ -41,7 +41,9 @@ class SubsystemBase : public SystemObject,
|
|||||||
uint16_t commandQueueDepth = 8);
|
uint16_t commandQueueDepth = 8);
|
||||||
virtual ~SubsystemBase();
|
virtual ~SubsystemBase();
|
||||||
|
|
||||||
virtual MessageQueueId_t getCommandQueue() const override;
|
MessageQueueId_t getCommandQueue() const override;
|
||||||
|
|
||||||
|
const ModeHelper * getModeHelper() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to register the child objects.
|
* Function to register the child objects.
|
||||||
@ -56,13 +58,13 @@ class SubsystemBase : public SystemObject,
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t registerChild(object_id_t objectId);
|
ReturnValue_t registerChild(object_id_t objectId);
|
||||||
|
|
||||||
virtual ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
virtual ReturnValue_t performOperation(uint8_t opCode) override;
|
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||||
|
|
||||||
virtual ReturnValue_t setHealth(HealthState health) override;
|
ReturnValue_t setHealth(HealthState health) override;
|
||||||
|
|
||||||
virtual HasHealthIF::HealthState getHealth() override;
|
HasHealthIF::HealthState getHealth() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct ChildInfo {
|
struct ChildInfo {
|
||||||
|
Loading…
Reference in New Issue
Block a user