Demo application for using the AT&T IoT Starter Kit Powered by AWS.

Dependencies:   SDFileSystem

Fork of ATT_AWS_IoT_demo by Anthony Phillips

Embed: (wiki syntax)

« Back to documentation index

aws_iot_mqtt_interface.h File Reference

aws_iot_mqtt_interface.h File Reference

Interface definition for MQTT client. More...

Go to the source code of this file.

Data Structures

struct  MQTTwillOptions
 Last Will and Testament Definition. More...
struct  MQTTConnectParams
 MQTT Connection Parameters. More...
struct  MQTTMessageParams
 MQTT Message Parameters. More...
struct  MQTTCallbackParams
 MQTT Callback Function Parameters. More...
struct  MQTTSubscribeParams
 MQTT Subscription Parameters. More...
struct  MQTTPublishParams
 MQTT Publish Parameters. More...
struct  MQTTClient_t
 MQTT Client Type Definition. More...

Typedefs

typedef void(* iot_disconnect_handler )(void)
 Disconnect Callback Handler Type.
typedef int32_t(* iot_message_handler )(MQTTCallbackParams params)
 MQTT Callback Function.

Enumerations

enum  MQTT_Ver_t { MQTT_3_1 = 3, MQTT_3_1_1 = 4 }
 

MQTT Version Type.

More...
enum  QoSLevel { QOS_0, QOS_1, QOS_2 }
 

Quality of Service Type.

More...

Functions

IoT_Error_t aws_iot_mqtt_connect (MQTTConnectParams *pParams)
 MQTT Connection Function.
IoT_Error_t aws_iot_mqtt_publish (MQTTPublishParams *pParams)
 Publish an MQTT message on a topic.
IoT_Error_t aws_iot_mqtt_subscribe (MQTTSubscribeParams *pParams)
 Subscribe to an MQTT topic.
IoT_Error_t aws_iot_mqtt_unsubscribe (char *pTopic)
 Unsubscribe to an MQTT topic.
IoT_Error_t aws_iot_mqtt_attempt_reconnect (void)
 MQTT Manual Re-Connection Function.
IoT_Error_t aws_iot_mqtt_disconnect (void)
 Disconnect an MQTT Connection.
IoT_Error_t aws_iot_mqtt_yield (int timeout)
 Yield to the MQTT client.
bool aws_iot_is_mqtt_connected (void)
 Is the MQTT client currently connected?
bool aws_iot_is_autoreconnect_enabled (void)
 Is the MQTT client set to reconnect automatically?
IoT_Error_t aws_iot_mqtt_autoreconnect_set_status (bool value)
 Enable or Disable AutoReconnect on Network Disconnect.
void aws_iot_mqtt_init (MQTTClient_t *pClient)
 Set the MQTT client.

Detailed Description

Interface definition for MQTT client.

Definition in file aws_iot_mqtt_interface.h.


Typedef Documentation

typedef void(* iot_disconnect_handler)(void)

Disconnect Callback Handler Type.

Defining a TYPE for definition of disconnect callback function pointers.

Definition at line 74 of file aws_iot_mqtt_interface.h.

typedef int32_t(* iot_message_handler)(MQTTCallbackParams params)

MQTT Callback Function.

Defines a type for the function pointer which stores the message callback function. A pointer to the desired callback function to be invoked upon receipt of a message on a subscribed toipc. Supplied upon subscribing to a topic.

Definition at line 140 of file aws_iot_mqtt_interface.h.


Enumeration Type Documentation

enum MQTT_Ver_t

MQTT Version Type.

Defining an MQTT version type.

Enumerator:
MQTT_3_1 

MQTT 3.1 (protocol message byte = 3)

MQTT_3_1_1 

MQTT 3.1.1 (protocol message byte = 4)

Definition at line 35 of file aws_iot_mqtt_interface.h.

enum QoSLevel

Quality of Service Type.

Defining a QoS type.

Note:
QoS 2 is NOT supported by the AWS IoT Service at the time of this SDK release.
Enumerator:
QOS_0 

QoS 0 = at most once delivery.

QOS_1 

QoS 1 = at least once delivery.

QOS_2 

QoS 2 is NOT supported.

Definition at line 47 of file aws_iot_mqtt_interface.h.


Function Documentation

bool aws_iot_is_autoreconnect_enabled ( void   )

Is the MQTT client set to reconnect automatically?

Called to determine if the MQTT client is set to reconnect automatically. Used to support logic in the device application around reconnecting

Returns:
true = enabled, false = disabled

Definition at line 299 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

bool aws_iot_is_mqtt_connected ( void   )

Is the MQTT client currently connected?

Called to determine if the MQTT client is currently connected. Used to support logic in the device application around reconnecting and managing offline state.

Returns:
true = connected, false = not currently connected

Definition at line 295 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_attempt_reconnect ( void   )

MQTT Manual Re-Connection Function.

Called to establish an MQTT connection with the AWS IoT Service using parameters from the last time a connection was attempted Use after disconnect to start the reconnect process manually Makes only one reconnect attempt

Returns:
An IoT Error Type defining successful/failed connection

Definition at line 265 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_autoreconnect_set_status ( bool  value )

Enable or Disable AutoReconnect on Network Disconnect.

Called to enable or disabled the auto reconnect features provided with the SDK

Parameters:
valueset to true for enabling and false for disabling
Returns:
IoT_Error_t Type defining successful/failed API call

Definition at line 285 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_connect ( MQTTConnectParams pParams )

MQTT Connection Function.

Called to establish an MQTT connection with the AWS IoT Service

Parameters:
pParamsPointer to MQTT connection parameters
Returns:
An IoT Error Type defining successful/failed connection

Definition at line 112 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_disconnect ( void   )

Disconnect an MQTT Connection.

Called to send a disconnect message to the broker.

Returns:
An IoT Error Type defining successful/failed send of the disconnect control packet.

Definition at line 220 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

void aws_iot_mqtt_init ( MQTTClient_t pClient )

Set the MQTT client.

This function provides a way to pass in an MQTT client implementation to the AWS IoT MQTT wrapper layer. This is done through function pointers to the interface functions.

Definition at line 303 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_publish ( MQTTPublishParams pParams )

Publish an MQTT message on a topic.

Called to publish an MQTT message on a topic.

Note:
Call is blocking. In the case of a QoS 0 message the function returns after the message was successfully passed to the TLS layer. In the case of QoS 1 the function returns after the receipt of the PUBACK control packet.
Parameters:
pParamsPointer to MQTT publish parameters
Returns:
An IoT Error Type defining successful/failed publish

Definition at line 193 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_subscribe ( MQTTSubscribeParams pParams )

Subscribe to an MQTT topic.

Called to send a subscribe message to the broker requesting a subscription to an MQTT topic.

Note:
Call is blocking. The call returns after the receipt of the SUBACK control packet.
Parameters:
pParamsPointer to MQTT subscribe parameters
Returns:
An IoT Error Type defining successful/failed subscription

Definition at line 184 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_unsubscribe ( char *  pTopic )

Unsubscribe to an MQTT topic.

Called to send an usubscribe message to the broker requesting removal of a subscription to an MQTT topic.

Note:
Call is blocking. The call returns after the receipt of the UNSUBACK control packet.
Parameters:
pTopicPointer to the requested topic string. Ensure the string is null terminated
Returns:
An IoT Error Type defining successful/failed unsubscription

Definition at line 211 of file aws_iot_mqtt_embedded_client_wrapper.cpp.

IoT_Error_t aws_iot_mqtt_yield ( int  timeout )

Yield to the MQTT client.

Called to yield the current thread to the underlying MQTT client. This time is used by the MQTT client to manage PING requests to monitor the health of the TCP connection as well as periodically check the socket receive buffer for subscribe messages. Yield() must be called at a rate faster than the keepalive interval. It must also be called at a rate faster than the incoming message rate as this is the only way the client receives processing time to manage incoming messages.

Parameters:
timeoutMaximum number of milliseconds to pass thread execution to the client.
Returns:
An IoT Error Type defining successful/failed client processing. If this call results in an error it is likely the MQTT connection has dropped. iot_is_mqtt_connected can be called to confirm.

Definition at line 230 of file aws_iot_mqtt_embedded_client_wrapper.cpp.