PdecHandler adapted

This commit is contained in:
Ulrich Mohr 2022-07-26 21:23:41 +02:00
parent a2910a401e
commit eeaef13916
3 changed files with 40 additions and 22 deletions

View File

@ -0,0 +1,24 @@
#include <fsfw/action/MinMaxParameter.h>
#include <fsfw/action/TemplateAction.h>
#include <fsfw/introspection/Enum.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
class PdecHandler;
FSFW_ENUM(PdecCommands, DeviceCommandId_t,((PRINT_CLCW, "Print CLCW")) ((PRINT_PDEC_MON, "Print PDEC Mon Status")))
class PdecPrintClcwAction
: public TemplateAction<PdecHandler, PdecPrintClcwAction,
PdecCommands> {
public:
PdecPrintClcwAction(PdecHandler *owner)
: TemplateAction(owner, PdecCommands::PRINT_CLCW) {};
};
class PdecPrintMonAction
: public TemplateAction<PdecHandler, PdecPrintMonAction,
PdecCommands> {
public:
PdecPrintMonAction(PdecHandler *owner)
: TemplateAction(owner, PdecCommands::PRINT_PDEC_MON) {};
};

View File

@ -509,16 +509,16 @@ std::string PdecHandler::getMonStatusString(uint32_t status) {
}
}
ReturnValue_t PdecHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
switch (actionId) {
case PRINT_CLCW:
printClcw();
return EXECUTION_FINISHED;
case PRINT_PDEC_MON:
printPdecMon();
return EXECUTION_FINISHED;
default:
return COMMAND_NOT_IMPLEMENTED;
}
ReturnValue_t PdecHandler::executeAction(Action* action) {
return action->handle();
}
ReturnValue_t PdecHandler::handleAction(PdecPrintClcwAction* action) {
printClcw();
return EXECUTION_FINISHED;
}
ReturnValue_t PdecHandler::handleAction(PdecPrintMonAction* action) {
printPdecMon();
return EXECUTION_FINISHED;
}

View File

@ -3,6 +3,7 @@
#include "OBSWConfig.h"
#include "PdecConfig.h"
#include "PdecDefinitions.h"
#include "fsfw/action/ActionHelper.h"
#include "fsfw/action/HasActionsIF.h"
#include "fsfw/objectmanager/SystemObject.h"
@ -57,8 +58,9 @@ class PdecHandler : public SystemObject,
MessageQueueId_t getCommandQueue() const;
ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) override;
ReturnValue_t executeAction(Action* action) override;
ReturnValue_t handleAction(PdecPrintClcwAction * action);
ReturnValue_t handleAction(PdecPrintMonAction * action);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PDEC_HANDLER;
@ -85,9 +87,6 @@ class PdecHandler : public SystemObject,
static const ReturnValue_t AD_DISCARDED_WAIT = MAKE_RETURN_CODE(0xA4);
static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5);
//! [EXPORT] : [COMMENT] Received action message with unknown action id
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xB0);
static const ReturnValue_t NO_REPORT = MAKE_RETURN_CODE(0xA6);
//! Error in version number and reserved A and B fields
static const ReturnValue_t ERROR_VERSION_NUMBER = MAKE_RETURN_CODE(0xA7);
@ -106,11 +105,6 @@ class PdecHandler : public SystemObject,
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
// Action IDs
static const ActionId_t PRINT_CLCW = 0;
// Print PDEC monitor register
static const ActionId_t PRINT_PDEC_MON = 1;
static const uint8_t STAT_POSITION = 31;
static const uint8_t FRAME_ANA_POSITION = 28;
static const uint8_t IREASON_POSITION = 25;