CommsChampion Ecosystem MQTT v3.1.1 Client
MQTT v3.1.1 Client Library.
Functions
client.h File Reference

Functions of the CommsChampion MQTT v3.1.1 client library. More...

#include "cc_mqtt311_client/common.h"

Go to the source code of this file.

Functions

CC_Mqtt311ClientHandle cc_mqtt311_client_alloc ()
 Allocate new client. More...
 
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. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_cancel (CC_Mqtt311ConnectHandle handle)
 Cancel the allocated "connect" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_config (CC_Mqtt311ConnectHandle handle, const CC_Mqtt311ConnectConfig *config)
 Perform basic configuration of the "connect" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_config_will (CC_Mqtt311ConnectHandle handle, const CC_Mqtt311ConnectWillConfig *config)
 Perform will configuration of the "connect" operation. More...
 
unsigned cc_mqtt311_client_connect_get_response_timeout (CC_Mqtt311ConnectHandle handle)
 Retrieve the configured the broker response timeout for the "connect" operation. More...
 
void cc_mqtt311_client_connect_init_config (CC_Mqtt311ConnectConfig *config)
 Intialize the CC_Mqtt311ConnectConfig configuration structure. More...
 
void cc_mqtt311_client_connect_init_config_will (CC_Mqtt311ConnectWillConfig *config)
 Intialize the CC_Mqtt311ConnectWillConfig configuration structure. More...
 
CC_Mqtt311ConnectHandle cc_mqtt311_client_connect_prepare (CC_Mqtt311ClientHandle handle, CC_Mqtt311ErrorCode *ec)
 Prepare "connect" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_send (CC_Mqtt311ConnectHandle handle, CC_Mqtt311ConnectCompleteCb cb, void *cbData)
 Send the configured "connect" operation to broker. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_connect_set_response_timeout (CC_Mqtt311ConnectHandle handle, unsigned ms)
 Configure the broker response timeout for the "connect" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_disconnect (CC_Mqtt311ClientHandle handle)
 Prepare, and send "disconnect" request in one go. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_disconnect_cancel (CC_Mqtt311DisconnectHandle handle)
 Cancel the allocated "disconnect" operation. More...
 
CC_Mqtt311DisconnectHandle cc_mqtt311_client_disconnect_prepare (CC_Mqtt311ClientHandle handle, CC_Mqtt311ErrorCode *ec)
 Prepare "disconnect" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_disconnect_send (CC_Mqtt311DisconnectHandle handle)
 Send the configured "disconnect" operation to broker. More...
 
void cc_mqtt311_client_free (CC_Mqtt311ClientHandle handle)
 Free previously allocated client. More...
 
unsigned cc_mqtt311_client_get_default_response_timeout (CC_Mqtt311ClientHandle handle)
 Retrieved currently configured default response timeout period. More...
 
bool cc_mqtt311_client_get_verify_incoming_msg_subscribed (CC_Mqtt311ClientHandle handle)
 Retrieve current incoming message being correctly subscribed control. More...
 
bool cc_mqtt311_client_get_verify_incoming_topic_enabled (CC_Mqtt311ClientHandle handle)
 Retrieve current incoming topic format verification control. More...
 
bool cc_mqtt311_client_get_verify_outgoing_topic_enabled (CC_Mqtt311ClientHandle handle)
 Retrieve current outgoing topic format verification control. More...
 
bool cc_mqtt311_client_is_connected (CC_Mqtt311ClientHandle handle)
 Check the inner state of the library of whether it's connected to the broker. More...
 
bool cc_mqtt311_client_is_network_disconnected (CC_Mqtt311ClientHandle handle)
 Check current network disconnected status. More...
 
void cc_mqtt311_client_notify_network_disconnected (CC_Mqtt311ClientHandle handle)
 Report network disconnected. More...
 
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. More...
 
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. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_cancel (CC_Mqtt311PublishHandle handle)
 Cancel the allocated "publish" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_config (CC_Mqtt311PublishHandle handle, const CC_Mqtt311PublishConfig *config)
 Perform basic configuration of the "publish" operation. More...
 
unsigned cc_mqtt311_client_publish_count (CC_Mqtt311ClientHandle handle)
 Get amount incomplete "publish" operations. More...
 
CC_Mqtt311PublishOrdering cc_mqtt311_client_publish_get_ordering (CC_Mqtt311ClientHandle handle)
 Retrieve the configured the publish operations ordering. More...
 
unsigned cc_mqtt311_client_publish_get_resend_attempts (CC_Mqtt311PublishHandle handle)
 Retrieve the configured the amount of resend attempts for the "publish" operation. More...
 
unsigned cc_mqtt311_client_publish_get_response_timeout (CC_Mqtt311PublishHandle handle)
 Retrieve the configured the broker response timeout for the "publish" operation. More...
 
void cc_mqtt311_client_publish_init_config (CC_Mqtt311PublishConfig *config)
 Intialize the CC_Mqtt311PublishConfig configuration structure. More...
 
CC_Mqtt311PublishHandle cc_mqtt311_client_publish_prepare (CC_Mqtt311ClientHandle handle, CC_Mqtt311ErrorCode *ec)
 Prepare "publish" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_send (CC_Mqtt311PublishHandle handle, CC_Mqtt311PublishCompleteCb cb, void *cbData)
 Send the configured "publish" operation to broker. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_set_ordering (CC_Mqtt311ClientHandle handle, CC_Mqtt311PublishOrdering ordering)
 Configure the ordering of the published messages. More...
 
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. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_publish_set_response_timeout (CC_Mqtt311PublishHandle handle, unsigned ms)
 Configure the broker response timeout for the "publish" operation. More...
 
bool cc_mqtt311_client_publish_was_initiated (CC_Mqtt311PublishHandle handle)
 Check whether the "publish" operation was actually initiated (PUBLISH was sent) More...
 
void cc_mqtt311_client_set_broker_disconnect_report_callback (CC_Mqtt311ClientHandle handle, CC_Mqtt311BrokerDisconnectReportCb cb, void *data)
 Set callback to report unsolicited disconnection of the broker. More...
 
void cc_mqtt311_client_set_cancel_next_tick_wait_callback (CC_Mqtt311ClientHandle handle, CC_Mqtt311CancelNextTickWaitCb cb, void *data)
 Set callback to terminate current time measurement. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_set_default_response_timeout (CC_Mqtt311ClientHandle handle, unsigned ms)
 Configure default response timeout period. More...
 
void cc_mqtt311_client_set_error_log_callback (CC_Mqtt311ClientHandle handle, CC_Mqtt311ErrorLogCb cb, void *data)
 Set callback to report error messages. More...
 
void cc_mqtt311_client_set_message_received_report_callback (CC_Mqtt311ClientHandle handle, CC_Mqtt311MessageReceivedReportCb cb, void *data)
 Set callback to report received message from the broker. More...
 
void cc_mqtt311_client_set_next_tick_program_callback (CC_Mqtt311ClientHandle handle, CC_Mqtt311NextTickProgramCb cb, void *data)
 Set callback to call when time measurement is required. More...
 
void cc_mqtt311_client_set_send_output_data_callback (CC_Mqtt311ClientHandle handle, CC_Mqtt311SendOutputDataCb cb, void *data)
 Set callback to send raw data over I/O link. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_set_verify_incoming_msg_subscribed (CC_Mqtt311ClientHandle handle, bool enabled)
 Control verification of the incoming message being correctly subscribed. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_set_verify_incoming_topic_enabled (CC_Mqtt311ClientHandle handle, bool enabled)
 Control incoming topic format verification. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_set_verify_outgoing_topic_enabled (CC_Mqtt311ClientHandle handle, bool enabled)
 Control outgoing topic format verification. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_subscribe (CC_Mqtt311ClientHandle handle, const CC_Mqtt311SubscribeTopicConfig *topicConfigs, unsigned topicConfigsCount, CC_Mqtt311SubscribeCompleteCb cb, void *cbData)
 Prepare, configure, and send "subscribe" request in one go. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_subscribe_cancel (CC_Mqtt311SubscribeHandle handle)
 Cancel the allocated "subscribe" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_subscribe_config_topic (CC_Mqtt311SubscribeHandle handle, const CC_Mqtt311SubscribeTopicConfig *config)
 Add topic configuration of the "subscribe" operation. More...
 
unsigned cc_mqtt311_client_subscribe_get_response_timeout (CC_Mqtt311SubscribeHandle handle)
 Retrieve the configured the broker response timeout for the "subscribe" operation. More...
 
void cc_mqtt311_client_subscribe_init_config_topic (CC_Mqtt311SubscribeTopicConfig *config)
 Intialize the CC_Mqtt311SubscribeTopicConfig configuration structure. More...
 
CC_Mqtt311SubscribeHandle cc_mqtt311_client_subscribe_prepare (CC_Mqtt311ClientHandle handle, CC_Mqtt311ErrorCode *ec)
 Prepare "subscribe" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_subscribe_send (CC_Mqtt311SubscribeHandle handle, CC_Mqtt311SubscribeCompleteCb cb, void *cbData)
 Send the configured "subscribe" operation to broker. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_subscribe_set_response_timeout (CC_Mqtt311SubscribeHandle handle, unsigned ms)
 Configure the broker response timeout for the "subscribe" operation. More...
 
void cc_mqtt311_client_tick (CC_Mqtt311ClientHandle handle, unsigned ms)
 Notify client about requested time expiry. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_unsubscribe (CC_Mqtt311ClientHandle handle, const CC_Mqtt311UnsubscribeTopicConfig *topicConfigs, unsigned topicConfigsCount, CC_Mqtt311UnsubscribeCompleteCb cb, void *cbData)
 Prepare, configure, and send "unsubscribe" request in one go. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_unsubscribe_cancel (CC_Mqtt311UnsubscribeHandle handle)
 Cancel the allocated "unsubscribe" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_unsubscribe_config_topic (CC_Mqtt311UnsubscribeHandle handle, const CC_Mqtt311UnsubscribeTopicConfig *config)
 Add topic configuration of the "unsubscribe" operation. More...
 
unsigned cc_mqtt311_client_unsubscribe_get_response_timeout (CC_Mqtt311UnsubscribeHandle handle)
 Retrieve the configured the broker response timeout for the "unsubscribe" operation. More...
 
void cc_mqtt311_client_unsubscribe_init_config_topic (CC_Mqtt311UnsubscribeTopicConfig *config)
 Intialize the CC_Mqtt311UnsubscribeTopicConfig configuration structure. More...
 
CC_Mqtt311UnsubscribeHandle cc_mqtt311_client_unsubscribe_prepare (CC_Mqtt311ClientHandle handle, CC_Mqtt311ErrorCode *ec)
 Prepare "unsubscribe" operation. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_unsubscribe_send (CC_Mqtt311UnsubscribeHandle handle, CC_Mqtt311UnsubscribeCompleteCb cb, void *cbData)
 Send the configured "unsubscribe" operation to broker. More...
 
CC_Mqtt311ErrorCode cc_mqtt311_client_unsubscribe_set_response_timeout (CC_Mqtt311UnsubscribeHandle handle, unsigned ms)
 Configure the broker response timeout for the "unsubscribe" operation. More...
 

Detailed Description

Functions of the CommsChampion MQTT v3.1.1 client library.

Function Documentation

◆ cc_mqtt311_client_set_broker_disconnect_report_callback()

void cc_mqtt311_client_set_broker_disconnect_report_callback ( CC_Mqtt311ClientHandle  handle,
CC_Mqtt311BrokerDisconnectReportCb  cb,
void *  data 
)

Set callback to report unsolicited disconnection of the broker.

Parameters
[in]handleHandle returned by cc_mqtt311_client_alloc() function.
[in]cbCallback function.
[in]dataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.

◆ cc_mqtt311_client_set_cancel_next_tick_wait_callback()

void cc_mqtt311_client_set_cancel_next_tick_wait_callback ( CC_Mqtt311ClientHandle  handle,
CC_Mqtt311CancelNextTickWaitCb  cb,
void *  data 
)

Set callback to terminate current time measurement.

The client may request termination of currently running time measurement, previously requested via callback, which was set using cc_mqtt311_client_set_next_tick_program_callback() function. This function sets appropriate callback. When invoked, it must return number of elapsed milliseconds since previoius time measurement request.

Parameters
[in]handleHandle returned by cc_mqtt311_client_alloc() function.
[in]cbCallback function.
[in]dataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.

◆ cc_mqtt311_client_set_error_log_callback()

void cc_mqtt311_client_set_error_log_callback ( CC_Mqtt311ClientHandle  handle,
CC_Mqtt311ErrorLogCb  cb,
void *  data 
)

Set callback to report error messages.

Parameters
[in]handleHandle returned by cc_mqtt311_client_alloc() function.
[in]cbCallback function.
[in]dataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.

◆ cc_mqtt311_client_set_message_received_report_callback()

void cc_mqtt311_client_set_message_received_report_callback ( CC_Mqtt311ClientHandle  handle,
CC_Mqtt311MessageReceivedReportCb  cb,
void *  data 
)

Set callback to report received message from the broker.

Parameters
[in]handleHandle returned by cc_mqtt311_client_alloc() function.
[in]cbCallback function.
[in]dataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.

◆ cc_mqtt311_client_set_next_tick_program_callback()

void cc_mqtt311_client_set_next_tick_program_callback ( CC_Mqtt311ClientHandle  handle,
CC_Mqtt311NextTickProgramCb  cb,
void *  data 
)

Set callback to call when time measurement is required.

The MQTT311 client may require to measure time. When such measurement is required, the provided callback will be invoked with the timeout duration in milliseconds. After requested time expires, the cc_mqtt311_client_tick() function must be invoked.

Parameters
[in]handleHandle returned by cc_mqtt311_client_alloc() function.
[in]cbCallback function.
[in]dataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.

◆ cc_mqtt311_client_set_send_output_data_callback()

void cc_mqtt311_client_set_send_output_data_callback ( CC_Mqtt311ClientHandle  handle,
CC_Mqtt311SendOutputDataCb  cb,
void *  data 
)

Set callback to send raw data over I/O link.

The callback is invoked when there is a need to send data to the broker. The callback is invoked for every single message that need to be sent.

Parameters
[in]handleHandle returned by cc_mqtt311_client_alloc() function.
[in]cbCallback function.
[in]dataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.