coreMQTT Agent v1.2.0
Thread safe MQTT 3.1.1 Client
core_mqtt_agent_message_interface.h File Reference

Functions to interact with queues. More...

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  MQTTAgentMessageInterface_t
 Function pointers and contexts used for sending and receiving commands, and allocating memory for them. More...
 

Typedefs

typedef struct MQTTAgentMessageContext MQTTAgentMessageContext_t
 Context with which tasks may deliver messages to the agent.
 
typedef bool(* MQTTAgentMessageSend_t) (MQTTAgentMessageContext_t *pMsgCtx, MQTTAgentCommand_t *const *pCommandToSend, uint32_t blockTimeMs)
 Send a message to the specified context. Must be thread safe. More...
 
typedef bool(* MQTTAgentMessageRecv_t) (MQTTAgentMessageContext_t *pMsgCtx, MQTTAgentCommand_t **pReceivedCommand, uint32_t blockTimeMs)
 Receive a message from the specified context. Must be thread safe. More...
 
typedef MQTTAgentCommand_t *(* MQTTAgentCommandGet_t) (uint32_t blockTimeMs)
 Obtain a MQTTAgentCommand_t structure. More...
 
typedef bool(* MQTTAgentCommandRelease_t) (MQTTAgentCommand_t *pCommandToRelease)
 Give a MQTTAgentCommand_t structure back to the application. More...
 

Detailed Description

Functions to interact with queues.

Typedef Documentation

◆ MQTTAgentMessageSend_t

typedef bool(* MQTTAgentMessageSend_t) (MQTTAgentMessageContext_t *pMsgCtx, MQTTAgentCommand_t *const *pCommandToSend, uint32_t blockTimeMs)

Send a message to the specified context. Must be thread safe.

Parameters
[in]pMsgCtxAn MQTTAgentMessageContext_t.
[in]pCommandToSendPointer to address to send to queue.
[in]blockTimeMsBlock time to wait for a send.
Returns
true if send was successful, else false.

◆ MQTTAgentMessageRecv_t

typedef bool(* MQTTAgentMessageRecv_t) (MQTTAgentMessageContext_t *pMsgCtx, MQTTAgentCommand_t **pReceivedCommand, uint32_t blockTimeMs)

Receive a message from the specified context. Must be thread safe.

Parameters
[in]pMsgCtxAn MQTTAgentMessageContext_t.
[out]pReceivedCommandPointer to write address of received command.
[in]blockTimeMsBlock time to wait for a receive.
Returns
true if receive was successful, else false.

◆ MQTTAgentCommandGet_t

typedef MQTTAgentCommand_t *(* MQTTAgentCommandGet_t) (uint32_t blockTimeMs)

Obtain a MQTTAgentCommand_t structure.

Note
MQTTAgentCommand_t structures hold everything the MQTT agent needs to process a command that originates from application. Examples of commands are PUBLISH and SUBSCRIBE. The MQTTAgentCommand_t structure must persist for the duration of the command's operation.
Parameters
[in]blockTimeMsThe length of time the calling task should remain in the Blocked state (so not consuming any CPU time) to wait for a MQTTAgentCommand_t structure to become available should one not be immediately at the time of the call.
Returns
A pointer to a MQTTAgentCommand_t structure if one becomes available before blockTimeMs time expired, otherwise NULL.

◆ MQTTAgentCommandRelease_t

typedef bool(* MQTTAgentCommandRelease_t) (MQTTAgentCommand_t *pCommandToRelease)

Give a MQTTAgentCommand_t structure back to the application.

Note
MQTTAgentCommand_t structures hold everything the MQTT agent needs to process a command that originates from application. Examples of commands are PUBLISH and SUBSCRIBE. The MQTTAgentCommand_t structure must persist for the duration of the command's operation.
Parameters
[in]pCommandToReleaseA pointer to the MQTTAgentCommand_t structure to return to the application. The structure must first have been obtained by calling an MQTTAgentCommandGet_t, otherwise it will have no effect.
Returns
true if the MQTTAgentCommand_t structure was returned to the application, otherwise false.