eive-obsw/dummies/PlocSupervisorDummy.cpp

68 lines
2.6 KiB
C++
Raw Permalink Normal View History

2023-02-13 17:59:08 +01:00
#include "PlocSupervisorDummy.h"
PlocSupervisorDummy::PlocSupervisorDummy(object_id_t objectId, object_id_t comif,
2023-03-16 18:52:32 +01:00
CookieIF *comCookie, PowerSwitchIF &pwrSwitcher)
: DeviceHandlerBase(objectId, comif, comCookie) {
setPowerSwitcher(&pwrSwitcher);
}
2023-02-13 17:59:08 +01:00
PlocSupervisorDummy::~PlocSupervisorDummy() {}
2023-03-14 11:33:14 +01:00
void PlocSupervisorDummy::doStartUp() { setMode(MODE_ON); }
2023-02-13 17:59:08 +01:00
2023-03-14 11:33:14 +01:00
void PlocSupervisorDummy::doShutDown() { setMode(_MODE_POWER_DOWN); }
2023-02-13 17:59:08 +01:00
ReturnValue_t PlocSupervisorDummy::buildNormalDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PlocSupervisorDummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
return NOTHING_TO_SEND;
}
ReturnValue_t PlocSupervisorDummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
const uint8_t *commandData,
size_t commandDataLen) {
return returnvalue::OK;
}
ReturnValue_t PlocSupervisorDummy::scanForReply(const uint8_t *start, size_t len,
DeviceCommandId_t *foundId, size_t *foundLen) {
return returnvalue::OK;
}
ReturnValue_t PlocSupervisorDummy::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) {
return returnvalue::OK;
}
void PlocSupervisorDummy::fillCommandAndReplyMap() {}
uint32_t PlocSupervisorDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; }
ReturnValue_t PlocSupervisorDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return returnvalue::OK;
}
2023-03-16 18:52:32 +01:00
ReturnValue_t PlocSupervisorDummy::getSwitches(const uint8_t **switches,
uint8_t *numberOfSwitches) {
*numberOfSwitches = 1;
*switches = reinterpret_cast<const uint8_t *>(&switchId);
return returnvalue::OK;
}
2023-10-10 10:06:10 +02:00
ReturnValue_t PlocSupervisorDummy::checkModeCommand(Mode_t commandedMode,
Submode_t commandedSubmode,
uint32_t *msToReachTheMode) {
if (commandedMode != MODE_OFF) {
PoolReadGuard pg(&enablePl);
if (pg.getReadResult() == returnvalue::OK) {
2023-10-10 11:54:32 +02:00
if (enablePl.plUseAllowed.isValid() and not enablePl.plUseAllowed.value) {
return NON_OP_STATE_OF_CHARGE;
2023-10-10 10:06:10 +02:00
}
}
}
return DeviceHandlerBase::checkModeCommand(commandedMode, commandedSubmode, msToReachTheMode);
}