diff --git a/mission/system/objects/CamSwitcher.cpp b/mission/system/objects/CamSwitcher.cpp index 90a78945..93b67646 100644 --- a/mission/system/objects/CamSwitcher.cpp +++ b/mission/system/objects/CamSwitcher.cpp @@ -1,6 +1,6 @@ #include "CamSwitcher.h" -CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, +CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF& pwrSwitcher, power::Switch_t pwrSwitch) : PowerSwitcherComponent(objectId, &pwrSwitcher, pwrSwitch) {} void CamSwitcher::performFaultyOperation() { @@ -8,3 +8,17 @@ void CamSwitcher::performFaultyOperation() { switcher.turnOff(); } } + +ReturnValue_t CamSwitcher::checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode, + uint32_t* msToReachTheMode) { + if (commandedMode != MODE_OFF) { + PoolReadGuard pg(&enablePl); + if (pg.getReadResult() == returnvalue::OK) { + if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) { + return TRANS_NOT_ALLOWED; + } + } + } + return PowerSwitcherComponent::checkModeCommand(commandedMode, commandedSubmode, + msToReachTheMode); +} diff --git a/mission/system/objects/CamSwitcher.h b/mission/system/objects/CamSwitcher.h index 57f371ce..a0d1b242 100644 --- a/mission/system/objects/CamSwitcher.h +++ b/mission/system/objects/CamSwitcher.h @@ -1,13 +1,19 @@ #ifndef MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ #define MISSION_SYSTEM_OBJECTS_CAMSWITCHER_H_ +#include #include +#include class CamSwitcher : public PowerSwitcherComponent { public: - CamSwitcher(object_id_t objectId, PowerSwitchIF &pwrSwitcher, power::Switch_t pwrSwitch); + CamSwitcher(object_id_t objectId, PowerSwitchIF& pwrSwitcher, power::Switch_t pwrSwitch); private: + pwrctrl::EnablePl enablePl = pwrctrl::EnablePl(objects::POWER_CONTROLLER); + ReturnValue_t checkModeCommand(Mode_t commandedMode, Submode_t commandedSubmode, + uint32_t* msToReachTheMode) override; + void performFaultyOperation() override; };