eive-obsw/linux/payload/FreshSupvHandler.cpp

56 lines
2.0 KiB
C++
Raw Normal View History

2023-11-09 11:35:28 +01:00
#include "FreshSupvHandler.h"
2023-11-09 11:11:47 +01:00
2023-11-09 11:35:28 +01:00
FreshSupvHandler::FreshSupvHandler(DhbConfig cfg) : FreshDeviceHandlerBase(cfg) {}
2023-11-09 11:11:47 +01:00
2023-11-09 11:35:28 +01:00
void FreshSupvHandler::performDeviceOperation(uint8_t opCode) {
if (!transitionActive and mode == MODE_OFF) {
// Nothing to do for now.
return;
}
if (opCode == OpCode::DEFAULT_OPERATION) {
if (transitionActive) {
// TODO: Perform transition handling: OFF to ON and ON to OFF.
2023-11-09 11:11:47 +01:00
2023-11-09 11:35:28 +01:00
} else {
if (mode == MODE_NORMAL) {
// Normal mode handling. Request normal datasets and add them to command map.
}
}
// TODO: Check whether any active commands have timeouted.
} else if (opCode == OpCode::HANDLE_ACTIVE_CMDS) {
// TODO: Parse TM from ring buffer and check whether they complete any active commands.
// If they do, check whether anyone needs to be informed.
}
}
2023-11-09 11:11:47 +01:00
2023-11-09 11:35:28 +01:00
ReturnValue_t FreshSupvHandler::handleCommandMessage(CommandMessage *message) {
// No custom messages.
return returnvalue::FAILED;
}
LocalPoolDataSetBase *FreshSupvHandler::getDataSetHandle(sid_t sid) {
// TODO: return all relevant datasets.
return nullptr;
}
ReturnValue_t FreshSupvHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
// TODO: Copy code from god handler here.
return returnvalue::OK;
}
ReturnValue_t FreshSupvHandler::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t *data, size_t size) {
// TODO: Handle all commands here. Need to add them to some command map. Send command immediately
// then.
return returnvalue::OK;
}
ReturnValue_t FreshSupvHandler::checkModeCommand(Mode_t mode_, Submode_t submode_,
uint32_t *msToReachTheMode) {
if (mode_ != HasModesIF::MODE_OFF and mode_ != HasModesIF::MODE_ON and mode_ != MODE_NORMAL) {
return returnvalue::FAILED;
}
return returnvalue::OK;
}