Jim Flynn / Mbed OS aws-iot-device-sdk-mbed-c
Embed: (wiki syntax)

« Back to documentation index

aws_iot_mqtt_client_connect.c File Reference

aws_iot_mqtt_client_connect.c File Reference

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

Go to the source code of this file.

Functions

static uint32_t _aws_iot_get_connect_packet_length (IoT_Client_Connect_Params *pConnectParams)
 Determines the length of the MQTT connect packet that would be produced using the supplied connect options.
static IoT_Error_t _aws_iot_mqtt_serialize_connect (unsigned char *pTxBuf, size_t txBufLen, IoT_Client_Connect_Params *pConnectParams, size_t *pSerializedLen)
 Serializes the connect options into the buffer.
static IoT_Error_t _aws_iot_mqtt_deserialize_connack (unsigned char *pSessionPresent, IoT_Error_t *pConnackRc, unsigned char *pRxBuf, size_t rxBufLen)
 Deserializes the supplied (wire) buffer into connack data - return code.
static bool _aws_iot_mqtt_is_client_state_valid_for_connect (ClientState clientState)
 Check if client state is valid for a connect request.
static IoT_Error_t _aws_iot_mqtt_internal_connect (AWS_IoT_Client *pClient, IoT_Client_Connect_Params *pConnectParams)
 MQTT Connection Function.
IoT_Error_t aws_iot_mqtt_connect (AWS_IoT_Client *pClient, IoT_Client_Connect_Params *pConnectParams)
 MQTT Connection Function.
IoT_Error_t _aws_iot_mqtt_internal_disconnect (AWS_IoT_Client *pClient)
 Disconnect an MQTT Connection.
IoT_Error_t aws_iot_mqtt_disconnect (AWS_IoT_Client *pClient)
 Disconnect an MQTT Connection.
IoT_Error_t aws_iot_mqtt_attempt_reconnect (AWS_IoT_Client *pClient)
 MQTT Manual Re-Connection Function.

Detailed Description

MQTT client connect API definition and related functions.

Definition in file aws_iot_mqtt_client_connect.c.


Function Documentation

static uint32_t _aws_iot_get_connect_packet_length ( IoT_Client_Connect_Params pConnectParams ) [static]

Determines the length of the MQTT connect packet that would be produced using the supplied connect options.

Parameters:
optionsthe options to be used to build the connect packet
thelength of buffer needed to contain the serialized version of the packet
Returns:
IoT_Error_t indicating function execution status

Definition at line 115 of file aws_iot_mqtt_client_connect.c.

static IoT_Error_t _aws_iot_mqtt_deserialize_connack ( unsigned char *  pSessionPresent,
IoT_Error_t pConnackRc,
unsigned char *  pRxBuf,
size_t  rxBufLen 
) [static]

Deserializes the supplied (wire) buffer into connack data - return code.

Parameters:
sessionPresentthe session present flag returned (only for MQTT 3.1.1)
connack_rcreturned integer value of the connack return code
bufthe raw buffer data, of the correct length determined by the remaining length field
buflenthe length in bytes of the data in the supplied buffer
Returns:
IoT_Error_t indicating function execution status

Definition at line 256 of file aws_iot_mqtt_client_connect.c.

static IoT_Error_t _aws_iot_mqtt_internal_connect ( AWS_IoT_Client pClient,
IoT_Client_Connect_Params pConnectParams 
) [static]

MQTT Connection Function.

Called to establish an MQTT connection with the AWS IoT Service This is the internal function which is called by the connect API to perform the operation. Not meant to be called directly as it doesn't do validations or client state changes

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

Definition at line 384 of file aws_iot_mqtt_client_connect.c.

IoT_Error_t _aws_iot_mqtt_internal_disconnect ( AWS_IoT_Client pClient )

Disconnect an MQTT Connection.

Called to send a disconnect message to the broker. This is the internal function which is called by the disconnect API to perform the operation. Not meant to be called directly as it doesn't do validations or client state changes

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

Definition at line 503 of file aws_iot_mqtt_client_connect.c.

static bool _aws_iot_mqtt_is_client_state_valid_for_connect ( ClientState  clientState ) [static]

Check if client state is valid for a connect request.

Called to check if client state is valid for a connect request

Parameters:
pClientReference to the IoT Client
Returns:
bool true = state is valid, false = not valid

Definition at line 339 of file aws_iot_mqtt_client_connect.c.

static IoT_Error_t _aws_iot_mqtt_serialize_connect ( unsigned char *  pTxBuf,
size_t  txBufLen,
IoT_Client_Connect_Params pConnectParams,
size_t *  pSerializedLen 
) [static]

Serializes the connect options into the buffer.

Parameters:
bufthe buffer into which the packet will be serialized
lenthe length in bytes of the supplied buffer
optionsthe options to be used to build the connect packet
serializedlength
Returns:
IoT_Error_t indicating function execution status

Definition at line 152 of file aws_iot_mqtt_client_connect.c.

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

Definition at line 594 of file aws_iot_mqtt_client_connect.c.

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

Definition at line 458 of file aws_iot_mqtt_client_connect.c.

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.

Definition at line 548 of file aws_iot_mqtt_client_connect.c.