2022-11-03 22:59:51 +01:00
|
|
|
#include "CamSwitcher.h"
|
|
|
|
|
2023-09-29 15:26:21 +02:00
|
|
|
CamSwitcher::CamSwitcher(object_id_t objectId, PowerSwitchIF& pwrSwitcher,
|
2022-11-03 22:59:51 +01:00
|
|
|
power::Switch_t pwrSwitch)
|
2022-11-10 13:09:31 +01:00
|
|
|
: PowerSwitcherComponent(objectId, &pwrSwitcher, pwrSwitch) {}
|
2023-03-13 15:59:19 +01:00
|
|
|
void CamSwitcher::performFaultyOperation() {
|
|
|
|
if (not switcher.active() and switcher.getState() != PowerSwitcher::SWITCH_IS_OFF) {
|
|
|
|
switcher.turnOff();
|
|
|
|
}
|
|
|
|
}
|
2023-09-29 15:26:21 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|