message queue IF return values

This commit is contained in:
Robin Müller 2020-02-27 19:00:51 +01:00
parent abccd81fdf
commit c93ee5c6cd
4 changed files with 43 additions and 22 deletions

View File

@ -36,9 +36,7 @@ public:
static const ReturnValue_t PROTOCOL_ERROR = MAKE_RETURN_CODE(0x06);
static const ReturnValue_t CANT_CHANGE_REPLY_LEN = MAKE_RETURN_CODE(0x07);
virtual ~DeviceCommunicationIF() {
}
virtual ~DeviceCommunicationIF() {}
virtual ReturnValue_t open(Cookie **cookie, uint32_t address,
uint32_t maxReplyLen) = 0;
@ -93,8 +91,20 @@ public:
virtual uint32_t getAddress(Cookie *cookie) = 0;
/**
* Can be used by DeviceHandlerBase getParameter() call to set DeviceComIF parameters
* @param cookie
* @param parameter
* @return
*/
virtual ReturnValue_t setParameter(Cookie *cookie, uint32_t parameter) = 0;
/**
* Can be used by DeviceHandlerBase getParameter() call to set DeviceComIF parameters
* @param cookie
* @param parameter
* @return
*/
virtual uint32_t getParameter(Cookie *cookie) = 0;
};

View File

@ -17,6 +17,9 @@
#define MAKE_COMMAND_ID( number ) ((MESSAGE_ID << 8) + (number))
typedef ReturnValue_t Command_t;
/**
* @brief Used to pass command messages between tasks
*/
class CommandMessage : public MessageQueueMessage {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::COMMAND_MESSAGE;

View File

@ -58,6 +58,8 @@ public:
* lastPartner attribute. Else, the lastPartner information remains untouched, the
* message's content is cleared and the function returns immediately.
* @param message A pointer to a message in which the received data is stored.
* @return -@c RETURN_OK on success
* -@c MessageQueueIF::EMPTY if queue is empty
*/
virtual ReturnValue_t receiveMessage(MessageQueueMessage* message) = 0;
/**
@ -76,17 +78,20 @@ public:
virtual MessageQueueId_t getId() const = 0;
/**
* \brief With the sendMessage call, a queue message is sent to a receiving queue.
* \details This method takes the message provided, adds the sentFrom information and passes
* @brief With the sendMessage call, a queue message is sent to a receiving queue.
* @details This method takes the message provided, adds the sentFrom information and passes
* it on to the destination provided with an operating system call. The OS's return
* value is returned.
* \param sendTo This parameter specifies the message queue id to send the message to.
* \param message This is a pointer to a previously created message, which is sent.
* \param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
* @param sendTo This parameter specifies the message queue id to send the message to.
* @param message This is a pointer to a previously created message, which is sent.
* @param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
* This variable is set to zero by default.
* \param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full (if implemented).
* @param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full (if implemented).
* @return -@c RETURN_OK on success
* -@c MessageQueueIF::FULL if queue is full
*/
virtual ReturnValue_t sendMessageFrom( MessageQueueId_t sendTo, MessageQueueMessage* message, MessageQueueId_t sentFrom, bool ignoreFault = false ) = 0;
/**
* @brief This operation sends a message to the given destination.
* @details It directly uses the sendMessage call of the MessageQueueSender parent, but passes its
@ -98,11 +103,13 @@ public:
virtual ReturnValue_t sendMessage( MessageQueueId_t sendTo, MessageQueueMessage* message, bool ignoreFault = false ) = 0;
/**
* \brief The sendToDefaultFrom method sends a queue message to the default destination.
* \details In all other aspects, it works identical to the sendMessage method.
* \param message This is a pointer to a previously created message, which is sent.
* \param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
* @brief The sendToDefaultFrom method sends a queue message to the default destination.
* @details In all other aspects, it works identical to the sendMessage method.
* @param message This is a pointer to a previously created message, which is sent.
* @param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
* This variable is set to zero by default.
* @return -@c RETURN_OK on success
* -@c MessageQueueIF::FULL if queue is full
*/
virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessage* message, MessageQueueId_t sentFrom, bool ignoreFault = false ) = 0;
/**
@ -110,6 +117,8 @@ public:
* @details As in the sendMessage method, this function uses the sendToDefault call of the
* Implementation class and adds its queue id as "sentFrom" information.
* @param message A pointer to a previously created message, which is sent.
* @return -@c RETURN_OK on success
* -@c MessageQueueIF::FULL if queue is full
*/
virtual ReturnValue_t sendToDefault( MessageQueueMessage* message ) = 0;
/**

View File

@ -1,6 +1,5 @@
#include <framework/ipc/MutexFactory.h>
#include "../FreeRTOS/Mutex.h"
#include <framework/osal/FreeRTOS/Mutex.h>
//TODO: Different variant than the lazy loading in QueueFactory. What's better and why? -> one is on heap the other on bss/data
//MutexFactory* MutexFactory::factoryInstance = new MutexFactory();