55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#include <mission/devices/PlocUpdater.h>
|
|
|
|
PlocUpdater::PlocUpdater() : commandActionHelper(this) {
|
|
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
|
}
|
|
|
|
PlocUpdater::~PlocUpdater() {
|
|
}
|
|
|
|
ReturnValue_t PlocUpdater::executeAction(ActionId_t actionId,
|
|
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) {
|
|
ReturnValue_t result = RETURN_FAILED;
|
|
|
|
if (state == BUSY) {
|
|
return IS_BUSY;
|
|
}
|
|
|
|
if (size > MAX_PLOC_UPDATE_PATH) {
|
|
return PATH_TOO_LONG;
|
|
}
|
|
|
|
switch (actionId) {
|
|
case UPDATE_NVM0_A:
|
|
result = prepareNvm0AUpdate(std::string(data, size));
|
|
break;
|
|
case UPDATE_NVM0_B:
|
|
result = prepareNvm0BUpdate();
|
|
break;
|
|
case UPDATE_NVM1_A:
|
|
result = prepareNvm1AUpdate();
|
|
break;
|
|
case UPDATE_NVM1_B:
|
|
result = prepareNvm1BUpdate();
|
|
break;
|
|
default:
|
|
return INVALID_ACTION_ID;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
MessageQueueId_t PlocUpdater::getCommandQueue() const {
|
|
return commandQueue.getId();
|
|
}
|
|
|
|
ReturnValue_t PlocUpdater::checkPath(size_t size) {
|
|
if (size > MAX_PLOC_UPDATE_PATH) {
|
|
return PATH_TOO_LONG;
|
|
}
|
|
return RETURN_OK;
|
|
}
|
|
|
|
PlocUpdater::prepare
|
|
getCurrentMountPrefix
|
|
|