coreMQTT Agent v1.2.0
Thread safe MQTT 3.1.1 Client
core_mqtt_agent_message_interface.h
Go to the documentation of this file.
1/*
2 * coreMQTT Agent v1.2.0
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 * this software and associated documentation files (the "Software"), to deal in
7 * the Software without restriction, including without limitation the rights to
8 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 * the Software, and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in all
13 * copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
27#ifndef CORE_MQTT_AGENT_MESSAGE_INTERFACE_H
28#define CORE_MQTT_AGENT_MESSAGE_INTERFACE_H
29
30#include <stddef.h>
31#include <stdint.h>
32#include <stdbool.h>
33
34/* *INDENT-OFF* */
35#ifdef __cplusplus
36 extern "C" {
37#endif
38/* *INDENT-ON* */
39
40/* Declare here so interface functions can use. */
41struct MQTTAgentCommand;
42struct MQTTAgentMessageContext;
43
47typedef struct MQTTAgentCommand MQTTAgentCommand_t;
48
53/* @[define_messagectx] */
54typedef struct MQTTAgentMessageContext MQTTAgentMessageContext_t;
55/* @[define_messagectx] */
56
67/* @[define_messagesend] */
69 MQTTAgentCommand_t * const * pCommandToSend,
70 uint32_t blockTimeMs );
71/* @[define_messagesend] */
72
83/* @[define_messagerecv] */
85 MQTTAgentCommand_t ** pReceivedCommand,
86 uint32_t blockTimeMs );
87/* @[define_messagerecv] */
88
104/* @[define_messageget] */
105typedef MQTTAgentCommand_t * ( * MQTTAgentCommandGet_t )( uint32_t blockTimeMs );
106/* @[define_messageget] */
107
122/* @[define_messagerelease] */
123typedef bool ( * MQTTAgentCommandRelease_t )( MQTTAgentCommand_t * pCommandToRelease );
124/* @[define_messagerelease] */
125
131/* @[define_messageinterface] */
132typedef struct MQTTAgentMessageInterface
133{
140/* @[define_messageinterface] */
141
142/* *INDENT-OFF* */
143#ifdef __cplusplus
144 }
145#endif
146/* *INDENT-ON* */
147
148#endif /* CORE_MQTT_AGENT_MESSAGE_INTERFACE_H */
MQTTAgentCommand_t *(* MQTTAgentCommandGet_t)(uint32_t blockTimeMs)
Obtain a MQTTAgentCommand_t structure.
Definition: core_mqtt_agent_message_interface.h:105
bool(* MQTTAgentMessageSend_t)(MQTTAgentMessageContext_t *pMsgCtx, MQTTAgentCommand_t *const *pCommandToSend, uint32_t blockTimeMs)
Send a message to the specified context. Must be thread safe.
Definition: core_mqtt_agent_message_interface.h:68
bool(* MQTTAgentCommandRelease_t)(MQTTAgentCommand_t *pCommandToRelease)
Give a MQTTAgentCommand_t structure back to the application.
Definition: core_mqtt_agent_message_interface.h:123
bool(* MQTTAgentMessageRecv_t)(MQTTAgentMessageContext_t *pMsgCtx, MQTTAgentCommand_t **pReceivedCommand, uint32_t blockTimeMs)
Receive a message from the specified context. Must be thread safe.
Definition: core_mqtt_agent_message_interface.h:84
struct MQTTAgentMessageContext MQTTAgentMessageContext_t
Context with which tasks may deliver messages to the agent.
Definition: core_mqtt_agent_message_interface.h:54
The commands sent from the APIs to the MQTT agent task.
Definition: core_mqtt_agent.h:111
Function pointers and contexts used for sending and receiving commands, and allocating memory for the...
Definition: core_mqtt_agent_message_interface.h:133
MQTTAgentMessageContext_t * pMsgCtx
Definition: core_mqtt_agent_message_interface.h:134
MQTTAgentMessageRecv_t recv
Definition: core_mqtt_agent_message_interface.h:136
MQTTAgentCommandGet_t getCommand
Definition: core_mqtt_agent_message_interface.h:137
MQTTAgentMessageSend_t send
Definition: core_mqtt_agent_message_interface.h:135
MQTTAgentCommandRelease_t releaseCommand
Definition: core_mqtt_agent_message_interface.h:138