CommsChampion Ecosystem MQTT v3.1.1 Client
MQTT v3.1.1 Client Library.
|
Classes | |
struct | CC_Mqtt311PublishConfig |
Configuration structure to be passed to the cc_mqtt311_client_publish_config(). More... | |
Typedefs | |
typedef void(* | CC_Mqtt311PublishCompleteCb) (void *data, CC_Mqtt311PublishHandle handle, CC_Mqtt311AsyncOpStatus status) |
Callback used to report completion of the "publish" operation. | |
typedef struct CC_Mqtt311Publish * | CC_Mqtt311PublishHandle |
Handle for "publish" operation. | |
Enumerations | |
enum | CC_Mqtt311PublishOrdering { CC_Mqtt311PublishOrdering_SameQos , CC_Mqtt311PublishOrdering_Full , CC_Mqtt311PublishOrdering_ValuesLimit } |
Publish ordering configuration. More... | |
typedef void(* CC_Mqtt311PublishCompleteCb) (void *data, CC_Mqtt311PublishHandle handle, CC_Mqtt311AsyncOpStatus status) |
Callback used to report completion of the "publish" operation.
[in] | data | Pointer to user data object passed as last parameter to the cc_mqtt311_client_publish_send(). |
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. When the callback is invoked the handle is already invalid and cannot be used in any relevant function invocation, but it allows end application to identify the original "publish" operation and use the same callback function in parallel requests. |
[in] | status | Status of the "publish" operation. |
typedef struct CC_Mqtt311Publish* CC_Mqtt311PublishHandle |
Handle for "publish" operation.
Returned by cc_mqtt311_client_publish_prepare() function.
CC_Mqtt311ErrorCode cc_mqtt311_client_publish | ( | CC_Mqtt311ClientHandle | handle, |
const CC_Mqtt311PublishConfig * | config, | ||
CC_Mqtt311PublishCompleteCb | cb, | ||
void * | cbData | ||
) |
Prepare, configure, and send "publish" request in one go.
Abstracts away sequence of the following functions invocation:
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | config | Publish configuration. |
[in] | cb | Callback to be invoked when "publish" 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_publish_cancel | ( | CC_Mqtt311PublishHandle | handle | ) |
Cancel the allocated "publish" operation.
In case the cc_mqtt311_client_publish_send() function was successfully called before, the operation is cancelled without callback invocation.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_config | ( | CC_Mqtt311PublishHandle | handle, |
const CC_Mqtt311PublishConfig * | config | ||
) |
Perform basic configuration of the "publish" operation.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
[in] | config | Basic configuration structure. Must NOT be NULL. Does not need to be preserved after invocation. |
unsigned cc_mqtt311_client_publish_count | ( | CC_Mqtt311ClientHandle | handle | ) |
Get amount incomplete "publish" operations.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
CC_Mqtt311PublishOrdering cc_mqtt311_client_publish_get_ordering | ( | CC_Mqtt311ClientHandle | handle | ) |
Retrieve the configured the publish operations ordering.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
unsigned cc_mqtt311_client_publish_get_resend_attempts | ( | CC_Mqtt311PublishHandle | handle | ) |
Retrieve the configured the amount of resend attempts for the "publish" operation.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
unsigned cc_mqtt311_client_publish_get_response_timeout | ( | CC_Mqtt311PublishHandle | handle | ) |
Retrieve the configured the broker response timeout for the "publish" operation.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
void cc_mqtt311_client_publish_init_config | ( | CC_Mqtt311PublishConfig * | config | ) |
Intialize the CC_Mqtt311PublishConfig configuration structure.
[out] | config | Configuration structure. Must not be NULL. |
CC_Mqtt311PublishHandle cc_mqtt311_client_publish_prepare | ( | CC_Mqtt311ClientHandle | handle, |
CC_Mqtt311ErrorCode * | ec | ||
) |
Prepare "publish" operation.
For successful operation the client needs to be in the "connected" state.
[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_publish_send | ( | CC_Mqtt311PublishHandle | handle, |
CC_Mqtt311PublishCompleteCb | cb, | ||
void * | cbData | ||
) |
Send the configured "publish" operation to broker.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
[in] | cb | Callback to be invoked when "publish" operation is complete, can be NULL. |
[in] | cbData | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. Can be NULL. |
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_set_ordering | ( | CC_Mqtt311ClientHandle | handle, |
CC_Mqtt311PublishOrdering | ordering | ||
) |
Configure the ordering of the published messages.
The ordering configuration is expected to be performed before any "publish" operation is issued. The configuration is persistent between re-connects.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
[in] | ordering | Ordering configuration. |
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_set_resend_attempts | ( | CC_Mqtt311PublishHandle | handle, |
unsigned | attempts | ||
) |
Configure the amount of attempts to resend "publish" operation until the acknowledgement is received.
When resending a second and further time, the DUP flags is set in the PUBLISH message to indicate duplicate.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
[in] | attempts | Amount of resend attempts. |
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_set_response_timeout | ( | CC_Mqtt311PublishHandle | handle, |
unsigned | ms | ||
) |
Configure the broker response timeout for the "publish" operation.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |
[in] | ms | Response timeout duration in milliseconds. |
bool cc_mqtt311_client_publish_was_initiated | ( | CC_Mqtt311PublishHandle | handle | ) |
Check whether the "publish" operation was actually initiated (PUBLISH was sent)
Sometimes due to message ordering configuration, the requested "publish" operation can be paused. This API call checks whether the PUBLISH message was already sent to the broker.
[in] | handle | Handle returned by cc_mqtt311_client_publish_prepare() function. |