accepts action commands without ipc data

This commit is contained in:
Robin Müller 2023-04-06 22:34:57 +02:00
parent 6650c293da
commit 5a9304765f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -59,17 +59,24 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; }
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
store_address_t dataAddress) { store_address_t dataAddress) {
bool hasAdditionalData = false;
const uint8_t* dataPtr = nullptr; const uint8_t* dataPtr = nullptr;
size_t size = 0; size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); ReturnValue_t result;
if (result != returnvalue::OK) { if(dataAddress != store_address_t::invalid()) {
CommandMessage reply; hasAdditionalData = true;
ActionMessage::setStepReply(&reply, actionId, 0, result); ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
queueToUse->sendMessage(commandedBy, &reply); if (result != returnvalue::OK) {
return; CommandMessage reply;
ActionMessage::setStepReply(&reply, actionId, 0, result);
queueToUse->sendMessage(commandedBy, &reply);
return;
}
} }
result = owner->executeAction(actionId, commandedBy, dataPtr, size); result = owner->executeAction(actionId, commandedBy, dataPtr, size);
ipcStore->deleteData(dataAddress); if(hasAdditionalData) {
ipcStore->deleteData(dataAddress);
}
if (result == HasActionsIF::EXECUTION_FINISHED) { if (result == HasActionsIF::EXECUTION_FINISHED) {
CommandMessage reply; CommandMessage reply;
ActionMessage::setCompletionReply(&reply, actionId, true, result); ActionMessage::setCompletionReply(&reply, actionId, true, result);