CommsChampion Ecosystem MQTT v5 Client
MQTT v5 Client Library.
|
Classes | |
struct | CC_Mqtt5PublishBasicConfig |
Configuration structure to be passed to the cc_mqtt5_client_publish_config_basic(). More... | |
struct | CC_Mqtt5PublishExtraConfig |
Configuration structure to be passed to the cc_mqtt5_client_publish_config_extra(). More... | |
struct | CC_Mqtt5PublishResponse |
Response information from broker to "publish" request. More... | |
Typedefs | |
typedef void(* | CC_Mqtt5PublishCompleteCb) (void *data, CC_Mqtt5PublishHandle handle, CC_Mqtt5AsyncOpStatus status, const CC_Mqtt5PublishResponse *response) |
Callback used to report completion of the "publish" operation. | |
typedef struct CC_Mqtt5Publish * | CC_Mqtt5PublishHandle |
Handle for "publish" operation. | |
Enumerations | |
enum | CC_Mqtt5PublishOrdering { CC_Mqtt5PublishOrdering_SameQos , CC_Mqtt5PublishOrdering_Full , CC_Mqtt5PublishOrdering_ValuesLimit } |
Publish ordering configuration. More... | |
enum | CC_Mqtt5TopicAliasPreference { CC_Mqtt5TopicAliasPreference_UseAliasIfAvailable = 0 , CC_Mqtt5TopicAliasPreference_ForceAliasOnly = 1 , CC_Mqtt5TopicAliasPreference_ForceTopicOnly = 2 , CC_Mqtt5TopicAliasPreference_ForceTopicWithAlias = 3 , CC_Mqtt5TopicAliasPreference_ValuesLimit } |
Preference of whether to use numeric "Topic Alias" instead of string topic during publish operation. More... | |
Functions | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_add_user_prop (CC_Mqtt5PublishHandle handle, const CC_Mqtt5UserProp *prop) |
Add user property to the configuration of the "publish" operation. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_cancel (CC_Mqtt5PublishHandle handle) |
Cancel the allocated "publish" operation. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_config_basic (CC_Mqtt5PublishHandle handle, const CC_Mqtt5PublishBasicConfig *config) |
Perform basic configuration of the "publish" operation. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_config_extra (CC_Mqtt5PublishHandle handle, const CC_Mqtt5PublishExtraConfig *config) |
Perform extra properties configuration of the "publish" operation. | |
unsigned | cc_mqtt5_client_publish_count (CC_Mqtt5ClientHandle handle) |
Get amount incomplete "publish" operations. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_full (CC_Mqtt5ClientHandle handle, const CC_Mqtt5PublishBasicConfig *basicConfig, const CC_Mqtt5PublishExtraConfig *extraConfig, CC_Mqtt5PublishCompleteCb cb, void *cbData) |
Prepare, configure, and send "publish" request in one go (full version) | |
CC_Mqtt5PublishOrdering | cc_mqtt5_client_publish_get_ordering (CC_Mqtt5ClientHandle handle) |
Retrieve the configured the publish operations ordering. | |
unsigned | cc_mqtt5_client_publish_get_resend_attempts (CC_Mqtt5PublishHandle handle) |
Retrieve the configured the amount of resend attempts for the "publish" operation. | |
unsigned | cc_mqtt5_client_publish_get_response_timeout (CC_Mqtt5PublishHandle handle) |
Retrieve the configured the broker response timeout for the "publish" operation. | |
void | cc_mqtt5_client_publish_init_config_basic (CC_Mqtt5PublishBasicConfig *config) |
Intialize the CC_Mqtt5PublishBasicConfig configuration structure. | |
void | cc_mqtt5_client_publish_init_config_extra (CC_Mqtt5PublishExtraConfig *config) |
Intialize the CC_Mqtt5PublishExtraConfig configuration structure. | |
CC_Mqtt5PublishHandle | cc_mqtt5_client_publish_prepare (CC_Mqtt5ClientHandle handle, CC_Mqtt5ErrorCode *ec) |
Prepare "publish" operation. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_send (CC_Mqtt5PublishHandle handle, CC_Mqtt5PublishCompleteCb cb, void *cbData) |
Send the configured "publish" operation to broker. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_set_ordering (CC_Mqtt5ClientHandle handle, CC_Mqtt5PublishOrdering ordering) |
Configure the ordering of the published messages. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_set_resend_attempts (CC_Mqtt5PublishHandle handle, unsigned attempts) |
Configure the amount of attempts to resend "publish" operation until the acknowledgement is received. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_set_response_timeout (CC_Mqtt5PublishHandle handle, unsigned ms) |
Configure the broker response timeout for the "publish" operation. | |
CC_Mqtt5ErrorCode | cc_mqtt5_client_publish_simple (CC_Mqtt5ClientHandle handle, const CC_Mqtt5PublishBasicConfig *basicConfig, CC_Mqtt5PublishCompleteCb cb, void *cbData) |
Prepare, configure, and send "publish" request in one go (simple version) | |
bool | cc_mqtt5_client_publish_was_initiated (CC_Mqtt5PublishHandle handle) |
Check whether the "publish" operation was actually initiated (PUBLISH was sent) | |
typedef void(* CC_Mqtt5PublishCompleteCb) (void *data, CC_Mqtt5PublishHandle handle, CC_Mqtt5AsyncOpStatus status, const CC_Mqtt5PublishResponse *response) |
Callback used to report completion of the "publish" operation.
[in] | data | Pointer to user data object passed as last parameter to the cc_mqtt5_client_publish_send(). |
[in] | handle | Handle returned by cc_mqtt5_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. |
[in] | response | Response information from the broker. Not-NULL is reported if and onfly if the "status" is equal to CC_Mqtt5AsyncOpStatus_Complete. |
typedef struct CC_Mqtt5Publish* CC_Mqtt5PublishHandle |
Handle for "publish" operation.
Returned by cc_mqtt5_client_publish_prepare() function.
Preference of whether to use numeric "Topic Alias" instead of string topic during publish operation.
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_add_user_prop | ( | CC_Mqtt5PublishHandle | handle, |
const CC_Mqtt5UserProp * | prop | ||
) |
Add user property to the configuration of the "publish" operation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
[in] | prop | Single user property info. Must NOT be NULL. Does not need to be preserved after invocation. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_cancel | ( | CC_Mqtt5PublishHandle | handle | ) |
Cancel the allocated "publish" operation.
In case the cc_mqtt5_client_publish_send() function was successfully called before, the operation is cancelled without callback invocation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_config_basic | ( | CC_Mqtt5PublishHandle | handle, |
const CC_Mqtt5PublishBasicConfig * | config | ||
) |
Perform basic configuration of the "publish" operation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
[in] | config | Basic configuration structure. Must NOT be NULL. Does not need to be preserved after invocation. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_config_extra | ( | CC_Mqtt5PublishHandle | handle, |
const CC_Mqtt5PublishExtraConfig * | config | ||
) |
Perform extra properties configuration of the "publish" operation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
[in] | config | Extra properties configuration structure. Must NOT be NULL. Does not need to be preserved after invocation. |
unsigned cc_mqtt5_client_publish_count | ( | CC_Mqtt5ClientHandle | handle | ) |
Get amount incomplete "publish" operations.
[in] | handle | Handle returned by cc_mqtt5_client_alloc() function. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_full | ( | CC_Mqtt5ClientHandle | handle, |
const CC_Mqtt5PublishBasicConfig * | basicConfig, | ||
const CC_Mqtt5PublishExtraConfig * | extraConfig, | ||
CC_Mqtt5PublishCompleteCb | cb, | ||
void * | cbData | ||
) |
Prepare, configure, and send "publish" request in one go (full version)
Abstracts away sequence of the following functions invocation:
[in] | handle | Handle returned by cc_mqtt5_client_alloc() function. |
[in] | basicConfig | Basic configuration. |
[in] | extraConfig | Extra configuration. Can be NULL. |
[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_Mqtt5PublishOrdering cc_mqtt5_client_publish_get_ordering | ( | CC_Mqtt5ClientHandle | handle | ) |
Retrieve the configured the publish operations ordering.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
unsigned cc_mqtt5_client_publish_get_resend_attempts | ( | CC_Mqtt5PublishHandle | handle | ) |
Retrieve the configured the amount of resend attempts for the "publish" operation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
unsigned cc_mqtt5_client_publish_get_response_timeout | ( | CC_Mqtt5PublishHandle | handle | ) |
Retrieve the configured the broker response timeout for the "publish" operation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
void cc_mqtt5_client_publish_init_config_basic | ( | CC_Mqtt5PublishBasicConfig * | config | ) |
Intialize the CC_Mqtt5PublishBasicConfig configuration structure.
[out] | config | Configuration structure. Must not be NULL. |
void cc_mqtt5_client_publish_init_config_extra | ( | CC_Mqtt5PublishExtraConfig * | config | ) |
Intialize the CC_Mqtt5PublishExtraConfig configuration structure.
[out] | config | Configuration structure. Must not be NULL. |
CC_Mqtt5PublishHandle cc_mqtt5_client_publish_prepare | ( | CC_Mqtt5ClientHandle | handle, |
CC_Mqtt5ErrorCode * | ec | ||
) |
Prepare "publish" operation.
For successful operation the client needs to be in the "connected" state.
[in] | handle | Handle returned by cc_mqtt5_client_alloc() function. |
[out] | ec | Error code reporting result of the operation. Can be NULL. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_send | ( | CC_Mqtt5PublishHandle | handle, |
CC_Mqtt5PublishCompleteCb | cb, | ||
void * | cbData | ||
) |
Send the configured "publish" operation to broker.
[in] | handle | Handle returned by cc_mqtt5_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_Mqtt5ErrorCode cc_mqtt5_client_publish_set_ordering | ( | CC_Mqtt5ClientHandle | handle, |
CC_Mqtt5PublishOrdering | 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_mqtt5_client_publish_prepare() function. |
[in] | ordering | Ordering configuration. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_set_resend_attempts | ( | CC_Mqtt5PublishHandle | 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_mqtt5_client_publish_prepare() function. |
[in] | attempts | Amount of resend attempts. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_set_response_timeout | ( | CC_Mqtt5PublishHandle | handle, |
unsigned | ms | ||
) |
Configure the broker response timeout for the "publish" operation.
[in] | handle | Handle returned by cc_mqtt5_client_publish_prepare() function. |
[in] | ms | Response timeout duration in milliseconds. |
CC_Mqtt5ErrorCode cc_mqtt5_client_publish_simple | ( | CC_Mqtt5ClientHandle | handle, |
const CC_Mqtt5PublishBasicConfig * | basicConfig, | ||
CC_Mqtt5PublishCompleteCb | cb, | ||
void * | cbData | ||
) |
Prepare, configure, and send "publish" request in one go (simple version)
Abstracts away sequence of the following functions invocation:
[in] | handle | Handle returned by cc_mqtt5_client_alloc() function. |
[in] | basicConfig | Basic 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. |
bool cc_mqtt5_client_publish_was_initiated | ( | CC_Mqtt5PublishHandle | handle | ) |
Check whether the "publish" operation was actually initiated (PUBLISH was sent)
In case the amount of outgoing publish messages exceeds the "Receive Maximum" limit set by the broker, or 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_mqtt5_client_publish_prepare() function. |