CommsChampion Ecosystem MQTT v3.1.1 Client
MQTT v3.1.1 Client Library.
|
Classes | |
struct | CC_Mqtt311ConnectConfig |
Configuration structure to be passed to the cc_mqtt311_client_connect_config(). More... | |
struct | CC_Mqtt311ConnectResponse |
Response information from broker to "connect" request. More... | |
struct | CC_Mqtt311ConnectWillConfig |
Configuration structure to be passed to the cc_mqtt311_client_connect_config_will(). More... | |
Typedefs | |
typedef void(* | CC_Mqtt311ConnectCompleteCb) (void *data, CC_Mqtt311AsyncOpStatus status, const CC_Mqtt311ConnectResponse *response) |
Callback used to report completion of the "connect" operation. | |
typedef struct CC_Mqtt311Connect * | CC_Mqtt311ConnectHandle |
Handle for "connect" operation. | |
Enumerations | |
enum | CC_Mqtt311ConnectReturnCode { CC_Mqtt311ConnectReturnCode_Accepted = 0 , CC_Mqtt311ConnectReturnCode_InvalidProtocolVersion = 1 , CC_Mqtt311ConnectReturnCode_IdRejected = 2 , CC_Mqtt311ConnectReturnCode_ServerUnavailable = 3 , CC_Mqtt311ConnectReturnCode_BadAuth = 4 , CC_Mqtt311ConnectReturnCode_NotAuthorized = 5 , CC_Mqtt311ConnectReturnCode_ValuesLimit } |
"Connect Return Code" as defined in MQTT v3.1.1 specification More... | |
typedef void(* CC_Mqtt311ConnectCompleteCb) (void *data, CC_Mqtt311AsyncOpStatus status, const CC_Mqtt311ConnectResponse *response) |
Callback used to report completion of the "connect" operation.
[in] | data | Pointer to user data object passed as last parameter to the cc_mqtt311_client_connect_send(). |
[in] | status | Status of the "connect" operation. |
[in] | response | Response information from the broker. Not-NULL is reported if and onfly if the "status" is equal to CC_Mqtt311AsyncOpStatus_Complete. |
typedef struct CC_Mqtt311Connect* CC_Mqtt311ConnectHandle |
Handle for "connect" operation.
Returned by cc_mqtt311_client_connect_prepare() function.
"Connect Return Code" as defined in MQTT v3.1.1 specification
CC_Mqtt311ErrorCode cc_mqtt311_client_connect | ( | CC_Mqtt311ClientHandle | handle, |
const CC_Mqtt311ConnectConfig * | config, | ||
const CC_Mqtt311ConnectWillConfig * | willConfig, | ||
CC_Mqtt311ConnectCompleteCb | cb, | ||
void * | cbData | ||
) |
Prepare, configure, and send "connect" request in one go.
Abstracts away sequence of the following functions invocation:
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | config | Connection configuration. Can be NULL. |
[in] | willConfig | Will configuration. Can be NULL. |
[in] | cb | Callback to be invoked when "connect" operation is complete. |
[in] | cbData | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_cancel | ( | CC_Mqtt311ConnectHandle | handle | ) |
Cancel the allocated "connect" operation.
In case the cc_mqtt311_client_connect_send() function was successfully called before, the operation is cancelled without callback invocation.
[in] | handle | Handle returned by cc_mqtt311_client_connect_prepare() function. |
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_config | ( | CC_Mqtt311ConnectHandle | handle, |
const CC_Mqtt311ConnectConfig * | config | ||
) |
Perform basic configuration of the "connect" operation.
[in] | handle | Handle returned by cc_mqtt311_client_connect_prepare() function. |
[in] | config | Configuration structure. Must NOT be NULL. Does not need to be preserved after invocation. |
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_config_will | ( | CC_Mqtt311ConnectHandle | handle, |
const CC_Mqtt311ConnectWillConfig * | config | ||
) |
Perform will configuration of the "connect" operation.
[in] | handle | Handle returned by cc_mqtt311_client_connect_prepare() function. |
[in] | config | Will configuration structure. Must NOT be NULL. Does not need to be preserved after invocation. |
unsigned cc_mqtt311_client_connect_get_response_timeout | ( | CC_Mqtt311ConnectHandle | handle | ) |
Retrieve the configured the broker response timeout for the "connect" operation.
[in] | handle | Handle returned by cc_mqtt311_client_connect_prepare() function. |
void cc_mqtt311_client_connect_init_config | ( | CC_Mqtt311ConnectConfig * | config | ) |
Intialize the CC_Mqtt311ConnectConfig configuration structure.
[out] | config | Configuration structure. Must not be NULL. |
void cc_mqtt311_client_connect_init_config_will | ( | CC_Mqtt311ConnectWillConfig * | config | ) |
Intialize the CC_Mqtt311ConnectWillConfig configuration structure.
[out] | config | Configuration structure. Must not be NULL. |
CC_Mqtt311ConnectHandle cc_mqtt311_client_connect_prepare | ( | CC_Mqtt311ClientHandle | handle, |
CC_Mqtt311ErrorCode * | ec | ||
) |
Prepare "connect" operation.
For successful operation the client needs to be in the "disconnected" state and there are no other incomplete "connect" operation
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[out] | ec | Error code reporting result of the operation. Can be NULL. |
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_send | ( | CC_Mqtt311ConnectHandle | handle, |
CC_Mqtt311ConnectCompleteCb | cb, | ||
void * | cbData | ||
) |
Send the configured "connect" operation to broker.
[in] | handle | Handle returned by cc_mqtt311_client_connect_prepare() function. |
[in] | cb | Callback to be invoked when "connect" operation is complete. |
[in] | cbData | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_set_response_timeout | ( | CC_Mqtt311ConnectHandle | handle, |
unsigned | ms | ||
) |
Configure the broker response timeout for the "connect" operation.
[in] | handle | Handle returned by cc_mqtt311_client_connect_prepare() function. |
[in] | ms | Response timeout duration in milliseconds. |
bool cc_mqtt311_client_is_connected | ( | CC_Mqtt311ClientHandle | handle | ) |
Check the inner state of the library of whether it's connected to the broker.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |