eive-obsw/bsp_q7s/core/CoreActions.h
2022-08-18 16:33:53 +02:00

88 lines
3.5 KiB
C++

#pragma once
#include <fsfw/action/MinMaxParameter.h>
#include <fsfw/action/TemplateAction.h>
#include <fsfw/introspection/Enum.h>
class CoreController;
namespace core {
FSFW_ENUM(ActionId, ActionId_t,
((LIST_DIRECTORY_INTO_FILE, 0, "List Directory into file"))(
(SWITCH_REBOOT_FILE_HANDLING, 5,
"Switch Reboot File Handling"))((RESET_REBOOT_COUNTERS, 6, "Reset Boot Counters"))(
(SWITCH_IMG_LOCK, 7, "Switch Image Lock"))((SET_MAX_REBOOT_CNT, 8,
"Set maximum reboot Count"))(
(XSC_REBOOT_OBC, 32, "Reboot using the xsc_boot_copy command"))(
(MOUNT_OTHER_COPY, 33, "Mount Other Copy"))((REBOOT_OBC, 34,
"Reboot using the reboot command")))
FSFW_ENUM(Boolenum, uint8_t, ((NO, 0, "NO"))((YES, 1, "Yes")))
class ListDirectoryIntoFileAction
: public TemplateAction<CoreController, ListDirectoryIntoFileAction, ActionId> {
public:
ListDirectoryIntoFileAction(CoreController *owner)
: TemplateAction(owner, ActionId::LIST_DIRECTORY_INTO_FILE){};
};
class SwitchRebootFileHandlingAction
: public TemplateAction<CoreController, SwitchRebootFileHandlingAction, ActionId> {
public:
SwitchRebootFileHandlingAction(CoreController *owner)
: TemplateAction(owner, ActionId::SWITCH_REBOOT_FILE_HANDLING){};
Parameter<Boolenum> enableRebootFile =
Parameter<Boolenum>::createParameter(this, "Enable Reboot File");
};
class ResetRebootCountersAction
: public TemplateAction<CoreController, ResetRebootCountersAction, ActionId> {
public:
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1"))((ALL, "All")))
ResetRebootCountersAction(CoreController *owner)
: TemplateAction(owner, ActionId::RESET_REBOOT_COUNTERS){};
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
};
class SwitchImageLockAction
: public TemplateAction<CoreController, SwitchImageLockAction, ActionId> {
public:
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1")))
SwitchImageLockAction(CoreController *owner) : TemplateAction(owner, ActionId::SWITCH_IMG_LOCK){};
Parameter<Boolenum> lock = Parameter<Boolenum>::createParameter(this, "Lock Image");
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
};
class SetMaxRebootCntAction
: public TemplateAction<CoreController, SetMaxRebootCntAction, ActionId> {
public:
SetMaxRebootCntAction(CoreController *owner)
: TemplateAction(owner, ActionId::SET_MAX_REBOOT_CNT){};
Parameter<uint8_t> maxCount = Parameter<uint8_t>::createParameter(this, "Count");
};
class XscRebootObcAction : public TemplateAction<CoreController, XscRebootObcAction, ActionId> {
public:
FSFW_ENUM(Selection, uint8_t, ((ZERO, "0"))((ONE, "1"))((SAME, "Same")))
XscRebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::XSC_REBOOT_OBC){};
Parameter<Selection> chip = Parameter<Selection>::createParameter(this, "Chip");
Parameter<Selection> copy = Parameter<Selection>::createParameter(this, "Copy");
};
class RebootObcAction : public TemplateAction<CoreController, RebootObcAction, ActionId> {
public:
RebootObcAction(CoreController *owner) : TemplateAction(owner, ActionId::REBOOT_OBC){};
};
} // namespace core