Client definition for MQTT.
More...
#include "stdio.h"
#include "stdbool.h"
#include "stdint.h"
#include "stddef.h"
#include "aws_iot_error.h"
#include "aws_iot_config.h"
#include "network_interface.h"
#include "timer_interface.h"
Go to the source code of this file.
|
|
#define | MAX_PACKET_ID 65535 |
| |
|
#define | IoT_MQTT_Will_Options_Initializer { {'M', 'Q', 'T', 'W'}, NULL, 0, NULL, 0, false, QOS0 } |
| |
| #define | IoT_Client_Connect_Params_initializer |
| |
|
| enum | QoS { QOS0 = 0,
QOS1 = 1
} |
| | Quality of Service Type. More...
|
| |
| enum | MQTT_Ver_t { MQTT_3_1_1 = 4
} |
| | MQTT Version Type. More...
|
| |
| enum | _ClientState {
CLIENT_STATE_INVALID = 0,
CLIENT_STATE_INITIALIZED = 1,
CLIENT_STATE_CONNECTING = 2,
CLIENT_STATE_CONNECTED_IDLE = 3,
CLIENT_STATE_CONNECTED_YIELD_IN_PROGRESS = 4,
CLIENT_STATE_CONNECTED_PUBLISH_IN_PROGRESS = 5,
CLIENT_STATE_CONNECTED_SUBSCRIBE_IN_PROGRESS = 6,
CLIENT_STATE_CONNECTED_UNSUBSCRIBE_IN_PROGRESS = 7,
CLIENT_STATE_CONNECTED_RESUBSCRIBE_IN_PROGRESS = 8,
CLIENT_STATE_CONNECTED_WAIT_FOR_CB_RETURN = 9,
CLIENT_STATE_DISCONNECTING = 10,
CLIENT_STATE_DISCONNECTED_ERROR = 11,
CLIENT_STATE_DISCONNECTED_MANUALLY = 12,
CLIENT_STATE_PENDING_RECONNECT = 13
} |
| | MQTT Client State Type. More...
|
| |
| #define IoT_Client_Connect_Params_initializer |
Value:{ {
'M',
'Q',
'T',
'C'},
MQTT_3_1_1, NULL, 0, 60,
true,
false, \
IoT_MQTT_Will_Options_Initializer, NULL, 0, NULL, 0 }
MQTT 3.1.1 (protocol message byte = 4)
Definition: aws_iot_mqtt_client.h:98
Defining a type for MQTT Client Data Contains data used by the MQTT Client
Defining a type for MQTT Client State
Defining a type for MQTT Client Status Contains information about the state of the MQTT Client
Defining a TYPE for definition of disconnect callback function pointers.
Defining a type for MQTT Message Handlers. Used to pass incoming data back to the application
Defining a TYPE for definition of application callback function pointers. Used to send incoming data to the application
Defining a QoS type.
- Note
- QoS 2 is NOT supported by the AWS IoT Service at the time of this SDK release.
Defining a type for MQTT Client State
Defining an MQTT version type. Only 3.1.1 is supported at this time
| Enumerator |
|---|
| MQTT_3_1_1 |
MQTT 3.1.1 (protocol message byte = 4)
|
Defining a QoS type.
- Note
- QoS 2 is NOT supported by the AWS IoT Service at the time of this SDK release.
Called to determine if the MQTT client is set to reconnect automatically. Used to support logic in the device application around reconnecting
- Parameters
-
| pClient | Reference to the IoT Client |
- Returns
- true = enabled, false = disabled
Called to enable or disabled the auto reconnect features provided with the SDK
- Parameters
-
| pClient | Reference to the IoT Client |
| newStatus | set to true for enabling and false for disabling |
- Returns
- IoT_Error_t Type defining successful/failed API call
Called to get the current state of the client
- Parameters
-
| pClient | Reference to the IoT Client |
- Returns
- ClientState value equal to the current state of the client
| uint32_t aws_iot_mqtt_get_network_disconnected_count |
( |
AWS_IoT_Client * |
pClient | ) |
|
Called to get the number of times a network disconnect occurred due to errors
- Parameters
-
| pClient | Reference to the IoT Client |
- Returns
- uint32_t the disconnect count
Called to retrieve the next packet id to be used for outgoing packets. Automatically increments the last sent packet id variable
- Parameters
-
| pClient | Reference to the IoT Client |
- Returns
- next packet id as a 16 bit unsigned integer
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
-
| pClient | Reference to the IoT Client |
- Returns
- true = connected, false = not currently connected
| void aws_iot_mqtt_reset_network_disconnected_count |
( |
AWS_IoT_Client * |
pClient | ) |
|
Called to reset the Network Disconnect counter to zero
- Parameters
-
| pClient | Reference to 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
-
| pClient | Reference to the IoT Client |
| pNewConnectParams | Reference to the new Connection Parameters structure |
- Returns
- IoT_Error_t Type defining successful/failed API call
Called to set the IoT Client disconnect handler The disconnect handler is called whenever the client disconnects with error
- Parameters
-
| pClient | Reference to the IoT Client |
| pConnectHandler | Reference to the new Disconnect Handler |
| pDisconnectHandlerData | Reference to the data to be passed as argument when disconnect handler is called |
- Returns
- IoT_Error_t Type defining successful/failed API call