action helper update

This commit is contained in:
Robin Müller 2020-10-29 13:52:52 +01:00
parent 4557a2eb36
commit 352296d200
2 changed files with 11 additions and 3 deletions

View File

@ -65,6 +65,11 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy,
}
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
ipcStore->deleteData(dataAddress);
if(result == HasActionsIF::EXECUTION_FINISHED) {
CommandMessage reply;
ActionMessage::setCompletionReply(&reply, actionId, result);
queueToUse->sendMessage(commandedBy, &reply);
}
if (result != HasReturnvaluesIF::RETURN_OK) {
CommandMessage reply;
ActionMessage::setStepReply(&reply, actionId, 0, result);

View File

@ -47,9 +47,12 @@ public:
virtual MessageQueueId_t getCommandQueue() const = 0;
/**
* Execute or initialize the execution of a certain function.
* When used in conjunction with the ActionHelper class, returning
* a return code which is not equal to RETURN_OK will trigger a step reply
* with step 0.
* The ActionHelpers will execute this function and behave differently
* depending on the returnvalue.
*
* @return
* -@c EXECUTION_FINISHED Finish reply will be generated
* -@c Not RETURN_OK Step failure reply will be generated
*/
virtual ReturnValue_t executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) = 0;