Changes to enabled on-line compiler

Embed: (wiki syntax)

« Back to documentation index

aws_iot_mqtt_client.c File Reference

aws_iot_mqtt_client.c File Reference

MQTT client API definitions. More...

Go to the source code of this file.

Functions

ClientState aws_iot_mqtt_get_client_state (AWS_IoT_Client *pClient)
 Get the current state of the client.
IoT_Error_t aws_iot_mqtt_set_connect_params (AWS_IoT_Client *pClient, IoT_Client_Connect_Params *pNewConnectParams)
 Set the connection parameters for the IoT Client.
IoT_Error_t aws_iot_mqtt_free (AWS_IoT_Client *pClient)
 Clean mqtt client from all dynamic memory allocate.
IoT_Error_t aws_iot_mqtt_init (AWS_IoT_Client *pClient, IoT_Client_Init_Params *pInitParams)
 MQTT Client Initialization Function.
uint16_t aws_iot_mqtt_get_next_packet_id (AWS_IoT_Client *pClient)
 What is the next available packet Id.
bool aws_iot_mqtt_is_client_connected (AWS_IoT_Client *pClient)
 Is the MQTT client currently connected?
bool aws_iot_is_autoreconnect_enabled (AWS_IoT_Client *pClient)
 Is the MQTT client set to reconnect automatically?
IoT_Error_t aws_iot_mqtt_autoreconnect_set_status (AWS_IoT_Client *pClient, bool newStatus)
 Enable or Disable AutoReconnect on Network Disconnect.
IoT_Error_t aws_iot_mqtt_set_disconnect_handler (AWS_IoT_Client *pClient, iot_disconnect_handler pDisconnectHandler, void *pDisconnectHandlerData)
 Set the IoT Client disconnect handler.
uint32_t aws_iot_mqtt_get_network_disconnected_count (AWS_IoT_Client *pClient)
 Get count of Network Disconnects.
void aws_iot_mqtt_reset_network_disconnected_count (AWS_IoT_Client *pClient)
 Reset Network Disconnect conter.

Detailed Description

MQTT client API definitions.

Definition in file aws_iot_mqtt_client.c.


Function Documentation

bool aws_iot_is_autoreconnect_enabled ( AWS_IoT_Client pClient )

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

Parameters:
pClientReference to the IoT Client
Returns:
true = enabled, false = disabled

Definition at line 326 of file aws_iot_mqtt_client.c.

IoT_Error_t aws_iot_mqtt_autoreconnect_set_status ( AWS_IoT_Client pClient,
bool  newStatus 
)

Enable or Disable AutoReconnect on Network Disconnect.

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

Parameters:
pClientReference to the IoT Client
newStatusset to true for enabling and false for disabling
Returns:
IoT_Error_t Type defining successful/failed API call

Definition at line 336 of file aws_iot_mqtt_client.c.

IoT_Error_t aws_iot_mqtt_free ( AWS_IoT_Client pClient )

Clean mqtt client from all dynamic memory allocate.

This function will free up memory that was dynamically allocated for the client.

Parameters:
pClientMQTT Client that was previously created by calling aws_iot_mqtt_init
Returns:
An IoT Error Type defining successful/failed freeing

Definition at line 172 of file aws_iot_mqtt_client.c.

ClientState aws_iot_mqtt_get_client_state ( AWS_IoT_Client pClient )

Get the current state of the client.

Called to get the current state of the client

Parameters:
pClientReference to the IoT Client
Returns:
ClientState value equal to the current state of the client

Definition at line 62 of file aws_iot_mqtt_client.c.

uint32_t aws_iot_mqtt_get_network_disconnected_count ( AWS_IoT_Client pClient )

Get count of Network Disconnects.

Called to get the number of times a network disconnect occurred due to errors

Parameters:
pClientReference to the IoT Client
Returns:
uint32_t the disconnect count

Definition at line 357 of file aws_iot_mqtt_client.c.

uint16_t aws_iot_mqtt_get_next_packet_id ( AWS_IoT_Client pClient )

What is the next available packet Id.

Called to retrieve the next packet id to be used for outgoing packets. Automatically increments the last sent packet id variable

Parameters:
pClientReference to the IoT Client
Returns:
next packet id as a 16 bit unsigned integer

Definition at line 284 of file aws_iot_mqtt_client.c.

IoT_Error_t aws_iot_mqtt_init ( AWS_IoT_Client pClient,
IoT_Client_Init_Params pInitParams 
)

MQTT Client Initialization Function.

Called to initialize the MQTT Client

Parameters:
pClientReference to the IoT Client
pInitParamsPointer to MQTT connection parameters
Returns:
IoT_Error_t Type defining successful/failed API call

Definition at line 205 of file aws_iot_mqtt_client.c.

bool aws_iot_mqtt_is_client_connected ( AWS_IoT_Client pClient )

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.

Parameters:
pClientReference to the IoT Client
Returns:
true = connected, false = not currently connected

Definition at line 289 of file aws_iot_mqtt_client.c.

void aws_iot_mqtt_reset_network_disconnected_count ( AWS_IoT_Client pClient )

Reset Network Disconnect conter.

Called to reset the Network Disconnect counter to zero

Parameters:
pClientReference to the IoT Client

Definition at line 361 of file aws_iot_mqtt_client.c.

IoT_Error_t aws_iot_mqtt_set_connect_params ( AWS_IoT_Client pClient,
IoT_Client_Connect_Params pNewConnectParams 
)

Set the connection parameters for the IoT Client.

Called to set the connection parameters for the IoT Client. Used to update the connection parameters provided before the last connect. Won't take effect until the next time connect is called

Parameters:
pClientReference to the IoT Client
pNewConnectParamsReference to the new Connection Parameters structure
Returns:
IoT_Error_t Type defining successful/failed API call

Definition at line 138 of file aws_iot_mqtt_client.c.

IoT_Error_t aws_iot_mqtt_set_disconnect_handler ( AWS_IoT_Client pClient,
iot_disconnect_handler  pDisconnectHandler,
void *  pDisconnectHandlerData 
)

Set the IoT Client disconnect handler.

Called to set the IoT Client disconnect handler The disconnect handler is called whenever the client disconnects with error

Parameters:
pClientReference to the IoT Client
pConnectHandlerReference to the new Disconnect Handler
pDisconnectHandlerDataReference to the data to be passed as argument when disconnect handler is called
Returns:
IoT_Error_t Type defining successful/failed API call

Definition at line 345 of file aws_iot_mqtt_client.c.