32 #ifndef _AWS_MQTT_LIB_H_ 33 #define _AWS_MQTT_LIB_H_ 38 #ifndef mqttDO_NOT_USE_CUSTOM_CONFIG 39 #include "aws_mqtt_config.h" 41 #include "aws_mqtt_config_defaults.h" 44 #include "aws_mqtt_buffer.h" 56 #define mqttREMAINING_LENGTH_MAX_BYTES 4 57 #define mqttREMAINING_LENGTH_MIN_BYTES 1 58 #define mqttFIXED_HEADER_MAX_SIZE ( 1 + mqttREMAINING_LENGTH_MAX_BYTES ) 59 #define mqttFIXED_HEADER_MIN_SIZE ( 1 + mqttREMAINING_LENGTH_MIN_BYTES ) 349 #if ( mqttconfigENABLE_SUBSCRIPTION_MANAGEMENT == 1 ) 351 typedef MQTTBool_t ( * MQTTPublishCallback_t ) (
void * pvPublishCallbackContext,
369 const uint8_t *
const pucData,
370 uint32_t ulDataLength );
399 typedef uint8_t * ( * MQTTGetFreeBuffer_t ) ( uint32_t * pulBufferLength );
416 #if ( mqttconfigENABLE_SUBSCRIPTION_MANAGEMENT == 1 ) 418 typedef struct MQTTSubscription
420 uint8_t ucTopicFilter[ mqttconfigSUBSCRIPTION_MANAGER_MAX_TOPIC_LENGTH ];
421 uint16_t usTopicFilterLength;
422 void * pvPublishCallbackContext;
423 MQTTPublishCallback_t pxPublishCallback;
426 } MQTTSubscription_t;
434 #if ( mqttconfigENABLE_SUBSCRIPTION_MANAGEMENT == 1 ) 436 typedef struct MQTTSubscriptionManager
438 MQTTSubscription_t xSubscriptions[ mqttconfigSUBSCRIPTION_MANAGER_MAX_SUBSCRIPTIONS ];
439 uint32_t ulInUseSubscriptions;
440 } MQTTSubscriptionManager_t;
478 uint8_t ucRxFixedHeaderBuffer[ mqttFIXED_HEADER_MAX_SIZE ];
492 #if ( mqttconfigENABLE_SUBSCRIPTION_MANAGEMENT == 1 ) 493 MQTTSubscriptionManager_t xSubscriptionManager;
542 #if ( mqttconfigENABLE_SUBSCRIPTION_MANAGEMENT == 1 ) 543 void * pvPublishCallbackContext;
544 MQTTPublishCallback_t pxPublishCallback;
702 const uint8_t * pucReceivedData,
703 size_t xReceivedDataLength );
719 MQTTBufferHandle_t xBufferHandle );
735 uint64_t xCurrentTickCount );
uint16_t usPacketIdentifier
MQTTReturnCode_t MQTT_Publish(MQTTContext_t *pxMQTTContext, const MQTTPublishParams_t *const pxPublishParams)
Initiates the Publish operation.
struct MQTTSubACKData MQTTSubACKData_t
The data sent by the MQTT library in the user supplied callback when a SUBACK message is received...
The data sent by the MQTT library in the user supplied callback when a PUBACK message is received...
MQTTEventCallback_t pxCallback
struct MQTTPublishParams MQTTPublishParams_t
MQTT Publish Parameters.
MQTTEventType_t
Various events reported by the library in the user supplied callback.
MQTTGetTicks_t pxGetTicksFxn
Represents one connection to an MQTT broker.
void(* MQTTGetTicks_t)(uint64_t *pxCurrentTickCount)
Signature of the callback to get the current tick count.
MQTT Subscribe Parameters.
uint16_t usClientIdLength
MQTTSubACKData_t xMQTTSubACKData
uint32_t ulRxMessageReceivedLength
struct MQTTUnsubscribeParams MQTTUnsubscribeParams_t
MQTT Unsubscribe Parameters.
MQTTReturnCode_t MQTT_ParseReceivedData(MQTTContext_t *pxMQTTContext, const uint8_t *pucReceivedData, size_t xReceivedDataLength)
Decodes the incoming messages.
MQTTUnSubACKData_t xMQTTUnSubACKData
The data sent by the MQTT library in the user supplied callback when a publish message from the broke...
MQTTConnACKData_t xMQTTConnACKData
MQTTReturnCode_t MQTT_Connect(MQTTContext_t *pxMQTTContext, const MQTTConnectParams_t *const pxConnectParams)
Initiates the Connect operation.
struct MQTTContext MQTTContext_t
Represents one connection to an MQTT broker.
MQTTRxMessageState_t xRxMessageState
uint16_t usKeepAliveIntervalSeconds
MQTTQoS_t
Quality of Service (QoS).
uint32_t ulPingRequestTimeoutTicks
MQTTRxNextByte_t xRxNextByte
const uint8_t * pucClientId
MQTTRxNextByte_t
The next expected byte.
struct MQTTTimeoutData MQTTTimeoutData_t
The data sent by the MQTT library in the user supplied callback when an operation times out...
MQTTBufferPoolInterface_t xBufferPoolInterface
The data sent by the MQTT library in the user supplied callback when a CONNACK message is received...
uint32_t ulPingRequestTimeoutTicks
MQTTRxMessageAction_t xRxMessageAction
uint16_t usPacketIdentifier
uint16_t usPacketIdentifier
uint32_t ulKeepAliveActualIntervalTicks
MQTTBufferPoolInterface_t xBufferPoolInterface
MQTTTopicFilterType_t
Represents the type of the topic filter.
struct MQTTDisconnectData MQTTDisconnectData_t
The data sent by the MQTT library in the user supplied callback when the client is disconnected...
struct MQTTRxMessageState MQTTRxMessageState_t
Represents the state of the message currently being received.
struct MQTTBufferPoolInterface MQTTBufferPoolInterface_t
Represents a subscription entry in the subscription manager.
struct MQTTConnACKData MQTTConnACKData_t
The data sent by the MQTT library in the user supplied callback when a CONNACK message is received...
uint16_t usPacketIdentifier
const uint8_t * pucUserName
MQTTEventType_t xEventType
The parameters sent by the MQTT library in the user supplied callback.
MQTTPublishData_t xPublishData
uint16_t usPacketIdentifier
uint16_t usPacketIdentifier
MQTTDisconnectReason_t
The reason of disconnect.
uint32_t ulTotalMessageLength
MQTTBool_t(* MQTTEventCallback_t)(void *pvCallbackContext, const MQTTEventCallbackParams_t *const pxParams)
Signature of the user supplied callback to get notified of various events.
MQTTDisconnectReason_t xDisconnectReason
Represents a subscription entry in the subscription manager.
uint32_t MQTT_Periodic(MQTTContext_t *pxMQTTContext, uint64_t xCurrentTickCount)
Manages timeout and keep alive messages.
The data sent by the MQTT library in the user supplied callback when a SUBACK message is received...
The data sent by the MQTT library in the user supplied callback when an operation times out...
uint32_t(* MQTTSend_t)(void *pvSendContext, const uint8_t *const pucData, uint32_t ulDataLength)
Signature of the user supplied topic specific publish callback which gets called whenever a publish m...
MQTTReturnBuffer_t pxReturnBufferFxn
The data sent by the MQTT library in the user supplied callback when an UNSUBACK message is received...
The data sent by the MQTT library in the user supplied callback when the client is disconnected...
uint16_t usPacketIdentifier
MQTTGetFreeBuffer_t pxGetBufferFxn
MQTTReturnCode_t MQTT_Init(MQTTContext_t *pxMQTTContext, const MQTTInitParams_t *const pxInitParams)
Initializes the given MQTT Context.
uint16_t usPacketIdentifier
struct MQTTCallbackParams MQTTEventCallbackParams_t
The parameters sent by the MQTT library in the user supplied callback.
MQTTReturnCode_t MQTT_ReturnBuffer(MQTTContext_t *pxMQTTContext, MQTTBufferHandle_t xBufferHandle)
Returns the buffer provided in the publish callback.
struct MQTTSubscribeParams MQTTSubscribeParams_t
MQTT Subscribe Parameters.
MQTTBool_t xWaitingForPingResp
MQTTSubACKReturnCode_t
Return codes sent by the broker in the SUBACK message.
MQTTConnACKReturnCode_t
Return codes sent by the broker in the CONNACK message.
MQTTDisconnectData_t xDisconnectData
MQTTConnectionState_t
The connection state.
uint16_t usUserNameLength
MQTTBufferHandle_t xRxBuffer
uint8_t ucRemaingingLengthFieldBytes
MQTTGetTicks_t pxGetTicksFxn
Represents the state of the message currently being received.
struct MQTTPublishData MQTTPublishData_t
The data sent by the MQTT library in the user supplied callback when a publish message from the broke...
MQTTTimeoutData_t xTimeoutData
MQTTConnectionState_t xConnectionState
MQTTReturnCode_t MQTT_Subscribe(MQTTContext_t *pxMQTTContext, const MQTTSubscribeParams_t *const pxSubscribeParams)
Initiates the Subscribe operation.
struct MQTTPubACKData MQTTPubACKData_t
The data sent by the MQTT library in the user supplied callback when a PUBACK message is received...
MQTTPubACKData_t xMQTTPubACKData
MQTT Unsubscribe Parameters.
void(* MQTTReturnBuffer_t)(uint8_t *pucBuffer)
Signature of the callback supplied by the user as part of MQTTBufferPoolInterface_t to return the buf...
struct MQTTConnectParams MQTTConnectParams_t
MQTT Connect Parameters.
uint16_t usPacketIdentifier
struct MQTTUnSubACKData MQTTUnSubACKData_t
The data sent by the MQTT library in the user supplied callback when an UNSUBACK message is received...
MQTTReturnCode_t MQTT_Unsubscribe(MQTTContext_t *pxMQTTContext, const MQTTUnsubscribeParams_t *const pxUnsubscribeParams)
Initiates the Unsubscribe operation.
uint64_t xLastSentMessageTimestamp
uint32_t ulKeepAliveActualIntervalTicks
uint32_t ulNextPeriodicInvokeTicks
MQTTReturnCode_t
Return codes from various APIs.
uint8_t *(* MQTTGetFreeBuffer_t)(uint32_t *pulBufferLength)
Signature of the callback supplied by the user as part of MQTTBufferPoolInterface_t to get a free buf...
MQTTRxMessageAction_t
The action taken on the message being received.
MQTTBufferHandle_t xBuffer
struct MQTTInitParams MQTTInitParams_t
MQTT Init Parameters.
MQTTConnACKReturnCode_t xConnACKReturnCode
MQTTReturnCode_t MQTT_Disconnect(MQTTContext_t *pxMQTTContext)
Disconnects the connection to the broker.
MQTTSubACKReturnCode_t xSubACKReturnCode
MQTTEventCallback_t pxCallback