IPC Module API

MessageQueueIF

class MessageQueueIF

Subclassed by MessageQueueBase

Public Functions

virtual ReturnValue_t reply(MessageQueueMessageIF *message) = 0

This operation sends a message to the last communication partner.

This operation simplifies answering an incoming message by using the stored lastParnter information as destination. If there was no message received yet (i.e. lastPartner is zero), an error code is returned.

Parameters:

message – A pointer to a previously created message, which is sent.

Returns:

-returnvalue::OK if ok -NO_REPLY_PARTNER Should return NO_REPLY_PARTNER if partner was found.

virtual ReturnValue_t receiveMessage(MessageQueueMessageIF *message, MessageQueueId_t *receivedFrom) = 0

This function reads available messages from the message queue and returns the sender.

It works identically to the other receiveMessage call, but in addition returns the sender’s queue id.

Parameters:
  • message – A pointer to a message in which the received data is stored.

  • receivedFrom – A pointer to a queue id in which the sender’s id is stored.

virtual ReturnValue_t receiveMessage(MessageQueueMessageIF *message) = 0

This function reads available messages from the message queue.

If data is available it is stored in the passed message pointer. The message’s original content is overwritten and the sendFrom information is stored in theblastPartner attribute. Else, the lastPartner information remains untouched, the message’s content is cleared and the function returns immediately.

Parameters:

message – A pointer to a message in which the received data is stored.

Returns:

-returnvalue::OK on success -MessageQueueIF::EMPTY if queue is empty

virtual ReturnValue_t flush(uint32_t *count) = 0

Deletes all pending messages in the queue.

Parameters:

count – The number of flushed messages.

Returns:

returnvalue::OK on success.

virtual MessageQueueId_t getLastPartner() const = 0

This method returns the message queue ID of the last communication partner.

virtual MessageQueueId_t getId() const = 0

This method returns the message queue ID of this class’s message queue.

virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF *message, MessageQueueId_t sentFrom, bool ignoreFault = false) = 0

With the sendMessage call, a queue message is sent to a receiving queue.

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 returnvalue is returned.

Parameters:
  • sendTo – This parameter specifies the message queue id to send the message to.

  • message – This is a pointer to a previously created message, which is sent.

  • 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.

  • ignoreFault – If set to true, the internal software fault counter is not incremented if queue is full (if implemented).

Returns:

-returnvalue::OK on success -MessageQueueIF::FULL if queue is full

virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF *message, bool ignoreFault = false) = 0

This operation sends a message to the given destination.

It directly uses the sendMessage call of the MessageQueueSender parent, but passes its queue id as “sentFrom” parameter.

Parameters:
  • sendTo – This parameter specifies the message queue id of the destination message queue.

  • message – A pointer to a previously created message, which is sent.

  • ignoreFault – If set to true, the internal software fault counter is not incremented if queue is full.

virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF *message, MessageQueueId_t sentFrom, bool ignoreFault = false) = 0

The sendToDefaultFrom method sends a queue message to the default destination.

In all other aspects, it works identical to the sendMessage method.

Parameters:
  • message – This is a pointer to a previously created message, which is sent.

  • 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.

Returns:

-returnvalue::OK on success -MessageQueueIF::FULL if queue is full

virtual ReturnValue_t sendToDefault(MessageQueueMessageIF *message) = 0

This operation sends a message to the default destination.

As in the sendMessage method, this function uses the sendToDefault call of the Implementation class and adds its queue id as “sentFrom” information.

Parameters:

message – A pointer to a previously created message, which is sent.

Returns:

-returnvalue::OK on success -MessageQueueIF::FULL if queue is full

virtual void setDefaultDestination(MessageQueueId_t defaultDestination) = 0

This method is a simple setter for the default destination.

virtual MessageQueueId_t getDefaultDestination() const = 0

This method is a simple getter for the default destination.

Public Static Attributes

static const ReturnValue_t EMPTY = MAKE_RETURN_CODE(1)

No new messages on the queue.

static const ReturnValue_t FULL = MAKE_RETURN_CODE(2)

[EXPORT] : [COMMENT] No space left for more messages

static const ReturnValue_t NO_REPLY_PARTNER = MAKE_RETURN_CODE(3)

[EXPORT] : [COMMENT] Returned if a reply method was called without partner

static constexpr ReturnValue_t DESTINATION_INVALID = MAKE_RETURN_CODE(4)

[EXPORT] : [COMMENT] Returned if the target destination is invalid.