CommsChampion Ecosystem MQTT v3.1.1 Client
MQTT v3.1.1 Client Library.
|
Typedefs | |
typedef void(* | CC_Mqtt311BrokerDisconnectReportCb) (void *data, CC_Mqtt311BrokerDisconnectReason reason) |
Callback used to report unsolicited disconnection of the broker. | |
typedef unsigned(* | CC_Mqtt311CancelNextTickWaitCb) (void *data) |
Callback used to request termination of existing time measurement. | |
typedef struct CC_Mqtt311Client * | CC_Mqtt311ClientHandle |
Handle used to access client specific data structures. | |
typedef void(* | CC_Mqtt311ErrorLogCb) (void *data, const char *msg) |
Callback used to report discovered errors. | |
typedef void(* | CC_Mqtt311MessageReceivedReportCb) (void *data, const CC_Mqtt311MessageInfo *info) |
Callback used to report new message received of the broker. | |
typedef void(* | CC_Mqtt311NextTickProgramCb) (void *data, unsigned duration) |
Callback used to request time measurement. | |
typedef void(* | CC_Mqtt311SendOutputDataCb) (void *data, const unsigned char *buf, unsigned bufLen) |
Callback used to request to send data to the broker. | |
Functions | |
CC_Mqtt311ClientHandle | cc_mqtt311_client_alloc () |
Allocate new client. | |
void | cc_mqtt311_client_free (CC_Mqtt311ClientHandle handle) |
Free previously allocated client. | |
unsigned | cc_mqtt311_client_get_default_response_timeout (CC_Mqtt311ClientHandle handle) |
Retrieved currently configured default response timeout period. | |
bool | cc_mqtt311_client_get_verify_incoming_msg_subscribed (CC_Mqtt311ClientHandle handle) |
Retrieve current incoming message being correctly subscribed control. | |
bool | cc_mqtt311_client_get_verify_incoming_topic_enabled (CC_Mqtt311ClientHandle handle) |
Retrieve current incoming topic format verification control. | |
bool | cc_mqtt311_client_get_verify_outgoing_topic_enabled (CC_Mqtt311ClientHandle handle) |
Retrieve current outgoing topic format verification control. | |
bool | cc_mqtt311_client_is_network_disconnected (CC_Mqtt311ClientHandle handle) |
Check current network disconnected status. | |
void | cc_mqtt311_client_notify_network_disconnected (CC_Mqtt311ClientHandle handle) |
Report network disconnected. | |
unsigned | cc_mqtt311_client_process_data (CC_Mqtt311ClientHandle handle, const unsigned char *buf, unsigned bufLen) |
Provide data (received over I/O link), to the library for processing. | |
CC_Mqtt311ErrorCode | cc_mqtt311_client_set_default_response_timeout (CC_Mqtt311ClientHandle handle, unsigned ms) |
Configure default response timeout period. | |
CC_Mqtt311ErrorCode | cc_mqtt311_client_set_verify_incoming_msg_subscribed (CC_Mqtt311ClientHandle handle, bool enabled) |
Control verification of the incoming message being correctly subscribed. | |
CC_Mqtt311ErrorCode | cc_mqtt311_client_set_verify_incoming_topic_enabled (CC_Mqtt311ClientHandle handle, bool enabled) |
Control incoming topic format verification. | |
CC_Mqtt311ErrorCode | cc_mqtt311_client_set_verify_outgoing_topic_enabled (CC_Mqtt311ClientHandle handle, bool enabled) |
Control outgoing topic format verification. | |
void | cc_mqtt311_client_tick (CC_Mqtt311ClientHandle handle, unsigned ms) |
Notify client about requested time expiry. | |
typedef void(* CC_Mqtt311BrokerDisconnectReportCb) (void *data, CC_Mqtt311BrokerDisconnectReason reason) |
Callback used to report unsolicited disconnection of the broker.
[in] | data | Pointer to user data object, passed as the last parameter to the request call. |
[in] | reason | Reson for reporting unsolicited broker disconnection. |
typedef unsigned(* CC_Mqtt311CancelNextTickWaitCb) (void *data) |
Callback used to request termination of existing time measurement.
The callback is set using cc_mqtt311_client_set_cancel_next_tick_wait_callback() function.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqtt311_client_set_cancel_next_tick_wait_callback() function. |
typedef struct CC_Mqtt311Client* CC_Mqtt311ClientHandle |
Handle used to access client specific data structures.
Returned by cc_mqtt311_client_alloc() function.
typedef void(* CC_Mqtt311ErrorLogCb) (void *data, const char *msg) |
Callback used to report discovered errors.
[in] | data | Pointer to user data object, passed as the last parameter to the request call. |
[in] | msg | Error log message. |
typedef void(* CC_Mqtt311MessageReceivedReportCb) (void *data, const CC_Mqtt311MessageInfo *info) |
Callback used to report new message received of the broker.
[in] | data | Pointer to user data object, passed as the last parameter to the request call. |
[in] | info | Message information. Will NOT be NULL. |
typedef void(* CC_Mqtt311NextTickProgramCb) (void *data, unsigned duration) |
Callback used to request time measurement.
The callback is set using cc_mqtt311_client_set_next_tick_program_callback() function.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqtt311_client_set_next_tick_program_callback() function. |
[in] | duration | Time duration in milliseconds. After the requested time expires, the cc_mqtt311_client_tick() function is expected to be invoked. |
typedef void(* CC_Mqtt311SendOutputDataCb) (void *data, const unsigned char *buf, unsigned bufLen) |
Callback used to request to send data to the broker.
The callback is set using cc_mqtt311_client_set_send_output_data_callback() function. The reported data resides in internal data structures of the client library, which can be updated / deleted right after the callback function returns. It means the data may need to be copied into some other buffer which will be held intact until the send over I/O link operation is complete.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqtt311_client_set_send_output_data_callback() function. |
[in] | buf | Pointer to the buffer containing data to send |
[in] | bufLen | Number of bytes in the buffer |
CC_Mqtt311ClientHandle cc_mqtt311_client_alloc | ( | ) |
Allocate new client.
When work with the client is complete, cc_mqtt311_client_free() function must be invoked.
void cc_mqtt311_client_free | ( | CC_Mqtt311ClientHandle | handle | ) |
Free previously allocated client.
The callbacks of the incomplete operations will be invoked with CC_Mqtt311AsyncOpStatus_Aborted status.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
unsigned cc_mqtt311_client_get_default_response_timeout | ( | CC_Mqtt311ClientHandle | handle | ) |
Retrieved currently configured default response timeout period.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
bool cc_mqtt311_client_get_verify_incoming_msg_subscribed | ( | CC_Mqtt311ClientHandle | handle | ) |
Retrieve current incoming message being correctly subscribed control.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
bool cc_mqtt311_client_get_verify_incoming_topic_enabled | ( | CC_Mqtt311ClientHandle | handle | ) |
Retrieve current incoming topic format verification control.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
bool cc_mqtt311_client_get_verify_outgoing_topic_enabled | ( | CC_Mqtt311ClientHandle | handle | ) |
Retrieve current outgoing topic format verification control.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
bool cc_mqtt311_client_is_network_disconnected | ( | CC_Mqtt311ClientHandle | handle | ) |
Check current network disconnected status.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
void cc_mqtt311_client_notify_network_disconnected | ( | CC_Mqtt311ClientHandle | handle | ) |
Report network disconnected.
To notify the client that the network is connected again use cc_mqtt311_client_connect_prepare()
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
unsigned cc_mqtt311_client_process_data | ( | CC_Mqtt311ClientHandle | handle, |
const unsigned char * | buf, | ||
unsigned | bufLen | ||
) |
Provide data (received over I/O link), to the library for processing.
This call may cause invocation of some callbacks, such as request to cancel the currently running time measurement, send some messages to the broker, report incoming application message, and (re)start time measurement.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | buf | Pointer to the buffer of data to process. |
[in] | bufLen | Number of bytes in the data buffer. |
CC_Mqtt311ErrorCode cc_mqtt311_client_set_default_response_timeout | ( | CC_Mqtt311ClientHandle | handle, |
unsigned | ms | ||
) |
Configure default response timeout period.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | ms | Response timeout duration in milliseconds. |
CC_Mqtt311ErrorCode cc_mqtt311_client_set_verify_incoming_msg_subscribed | ( | CC_Mqtt311ClientHandle | handle, |
bool | enabled | ||
) |
Control verification of the incoming message being correctly subscribed.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | enabled | true to enable topic format verification, false to disable. |
CC_Mqtt311ErrorCode cc_mqtt311_client_set_verify_incoming_topic_enabled | ( | CC_Mqtt311ClientHandle | handle, |
bool | enabled | ||
) |
Control incoming topic format verification.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | enabled | true to enable topic format verification, false to disable. |
CC_Mqtt311ErrorCode cc_mqtt311_client_set_verify_outgoing_topic_enabled | ( | CC_Mqtt311ClientHandle | handle, |
bool | enabled | ||
) |
Control outgoing topic format verification.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | enabled | true to enable topic format verification, false to disable. |
void cc_mqtt311_client_tick | ( | CC_Mqtt311ClientHandle | handle, |
unsigned | ms | ||
) |
Notify client about requested time expiry.
The reported amount of milliseconds needs to be from the last request to program timer via callback (set by cc_mqtt311_client_set_next_tick_program_callback()). It can be less than actually requested via the callback. If this function is called, the library assumes that previously requested timeout measurement is not in progress any more, and will request new measurement if needed. This call may cause invocation of some other callbacks, such as a request to send new data to the broker.
[in] | handle | Handle returned by cc_mqtt311_client_alloc() function. |
[in] | ms | Number of elapsed milliseconds. |