2016-06-15 23:48:41 +02:00
|
|
|
#ifndef COMMANDSACTIONSIF_H_
|
|
|
|
#define COMMANDSACTIONSIF_H_
|
|
|
|
|
|
|
|
#include <framework/action/CommandActionHelper.h>
|
|
|
|
#include <framework/returnvalues/HasReturnvaluesIF.h>
|
2018-07-12 16:29:32 +02:00
|
|
|
#include <framework/ipc/MessageQueueIF.h>
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface to separate commanding actions of other objects.
|
|
|
|
* In next iteration, IF should be shortened to three calls:
|
|
|
|
* - dataReceived(data)
|
|
|
|
* - successReceived(id, step)
|
|
|
|
* - failureReceived(id, step, cause)
|
|
|
|
* or even
|
|
|
|
* - replyReceived(id, step, cause) (if cause == OK, it's a success).
|
|
|
|
*/
|
|
|
|
class CommandsActionsIF {
|
|
|
|
friend class CommandActionHelper;
|
|
|
|
public:
|
2018-07-12 16:29:32 +02:00
|
|
|
static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF;
|
2016-06-15 23:48:41 +02:00
|
|
|
static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1);
|
|
|
|
static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2);
|
|
|
|
virtual ~CommandsActionsIF() {}
|
2018-07-12 16:29:32 +02:00
|
|
|
virtual MessageQueueIF* getCommandQueuePtr() = 0;
|
2016-06-15 23:48:41 +02:00
|
|
|
protected:
|
|
|
|
virtual void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) = 0;
|
|
|
|
virtual void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) = 0;
|
|
|
|
virtual void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) = 0;
|
|
|
|
virtual void completionSuccessfulReceived(ActionId_t actionId) = 0;
|
|
|
|
virtual void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* COMMANDSACTIONSIF_H_ */
|