AWS IoT Device SDK C: MQTT
MQTT 3.1.1 client library
Return to main page ↑
aws_iot_mqtt_client_connect.c File Reference

MQTT client connect API definition and related functions. More...

Data Structures

union  MQTT_Connect_Header_Flags
 
union  MQTT_Connack_Header_Flags
 

Enumerations

enum  MQTT_Connack_Return_Codes {
  CONNACK_CONNECTION_ACCEPTED = 0, CONNACK_UNACCEPTABLE_PROTOCOL_VERSION_ERROR = 1, CONNACK_IDENTIFIER_REJECTED_ERROR = 2, CONNACK_SERVER_UNAVAILABLE_ERROR = 3,
  CONNACK_BAD_USERDATA_ERROR = 4, CONNACK_NOT_AUTHORIZED_ERROR = 5
}
 Connect request response codes from server. More...
 

Functions

IoT_Error_t aws_iot_mqtt_connect (AWS_IoT_Client *pClient, IoT_Client_Connect_Params *pConnectParams)
 MQTT Connection Function. More...
 
IoT_Error_t aws_iot_mqtt_disconnect (AWS_IoT_Client *pClient)
 Disconnect an MQTT Connection. More...
 
IoT_Error_t aws_iot_mqtt_attempt_reconnect (AWS_IoT_Client *pClient)
 MQTT Manual Re-Connection Function. More...
 

Detailed Description

MQTT client connect API definition and related functions.

Enumeration Type Documentation

◆ MQTT_Connack_Return_Codes

Connect request response codes from server.

Enumerator
CONNACK_CONNECTION_ACCEPTED 

Connection accepted

CONNACK_UNACCEPTABLE_PROTOCOL_VERSION_ERROR 

Unacceptable protocol version

CONNACK_IDENTIFIER_REJECTED_ERROR 

Client identifier rejected

CONNACK_SERVER_UNAVAILABLE_ERROR 

Server unavailable

CONNACK_BAD_USERDATA_ERROR 

Bad username

CONNACK_NOT_AUTHORIZED_ERROR 

Not authorized

Function Documentation

◆ aws_iot_mqtt_connect()

IoT_Error_t aws_iot_mqtt_connect ( AWS_IoT_Client *  pClient,
IoT_Client_Connect_Params pConnectParams 
)

MQTT Connection Function.

Called to establish an MQTT connection with the AWS IoT Service This is the outer function which does the validations and calls the internal connect above to perform the actual operation. It is also responsible for client state changes

Parameters
pClientReference to the IoT Client
pConnectParamsPointer to MQTT connection parameters
Returns
An IoT Error Type defining successful/failed connection

◆ aws_iot_mqtt_disconnect()

IoT_Error_t aws_iot_mqtt_disconnect ( AWS_IoT_Client *  pClient)

Disconnect an MQTT Connection.

Called to send a disconnect message to the broker. This is the outer function which does the validations and calls the internal disconnect above to perform the actual operation. It is also responsible for client state changes

Parameters
pClientReference to the IoT Client
Returns
An IoT Error Type defining successful/failed send of the disconnect control packet.

◆ aws_iot_mqtt_attempt_reconnect()

IoT_Error_t aws_iot_mqtt_attempt_reconnect ( AWS_IoT_Client *  pClient)

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. Sets the client state to pending reconnect in case of failure

Parameters
pClientReference to the IoT Client
Returns
An IoT Error Type defining successful/failed connection