CommsChampion Ecosystem MQTT-SN Client
MQTT-SN client library.
Loading...
Searching...
No Matches
Typedefs | Functions
"Client Data Types and Functions"

Typedefs

typedef unsigned(* CC_MqttsnCancelNextTickWaitCb) (void *data)
 Callback used to request termination of existing time measurement.
 
typedef struct CC_MqttsnClient * CC_MqttsnClientHandle
 Handler used to access client specific data structures.
 
typedef void(* CC_MqttsnErrorLogCb) (void *data, const char *msg)
 Callback used to report discovered errors.
 
typedef void(* CC_MqttsnGwDisconnectedReportCb) (void *data, CC_MqttsnGatewayDisconnectReason reason)
 Callback used to report unsolicited disconnection of the gateway.
 
typedef unsigned(* CC_MqttsnGwinfoDelayRequestCb) (void *data)
 Callback used to request delay (in ms) to wait before responding with GWINFO message on behalf of a gateway.
 
typedef void(* CC_MqttsnGwStatusReportCb) (void *data, CC_MqttsnGwStatus status, const CC_MqttsnGatewayInfo *info)
 Callback used to report gateway status.
 
typedef void(* CC_MqttsnMessageReportCb) (void *data, const CC_MqttsnMessageInfo *msgInfo)
 Callback used to report incoming messages.
 
typedef void(* CC_MqttsnNextTickProgramCb) (void *data, unsigned duration)
 Callback used to request time measurement.
 
typedef void(* CC_MqttsnSendOutputDataCb) (void *data, const unsigned char *buf, unsigned bufLen, unsigned broadcastRadius)
 Callback used to request to send data to the gateway.
 

Functions

CC_MqttsnClientHandle cc_mqttsn_client_alloc ()
 Allocate new client.
 
CC_MqttsnErrorCode cc_mqttsn_client_asleep_check_messages (CC_MqttsnClientHandle client)
 Check messages when in "asleep" state.
 
void cc_mqttsn_client_discard_all_gateway_infos (CC_MqttsnClientHandle client)
 Discard stored information on all available gateways.
 
CC_MqttsnErrorCode cc_mqttsn_client_discard_available_gateway_info (CC_MqttsnClientHandle client, unsigned char gwId)
 Discard stored available gateway information.
 
void cc_mqttsn_client_free (CC_MqttsnClientHandle client)
 Free previously allocated client.
 
unsigned cc_mqttsn_client_get_allowed_adv_losses (CC_MqttsnClientHandle client)
 Get current configuration of allowed ADVERTISE message misses.
 
CC_MqttsnErrorCode cc_mqttsn_client_get_available_gateway_info (CC_MqttsnClientHandle client, unsigned idx, CC_MqttsnGatewayInfo *info)
 Retrieve stored available gateway information.
 
unsigned cc_mqttsn_client_get_available_gateways_count (CC_MqttsnClientHandle client)
 Get number of available gateways.
 
unsigned cc_mqttsn_client_get_default_broadcast_radius (CC_MqttsnClientHandle client)
 Get current broadcast radius configuration.
 
unsigned cc_mqttsn_client_get_default_gw_adv_duration (CC_MqttsnClientHandle client)
 Get current default gateway advertise configuration.
 
unsigned cc_mqttsn_client_get_default_retry_count (CC_MqttsnClientHandle client)
 Get configured number of retry attempts to perform before reporting unsuccessful result of the operation (Nretry from spec).
 
unsigned cc_mqttsn_client_get_default_retry_period (CC_MqttsnClientHandle client)
 Set configured retry period to wait between resending unacknowledged message to the gateway (Tretry from spec).
 
unsigned long long cc_mqttsn_client_get_incoming_topic_id_storage_limit (CC_MqttsnClientHandle client)
 Retrieve currently configured limit of the topic IDs stored for the incoming messages.
 
unsigned long long cc_mqttsn_client_get_outgoing_topic_id_storage_limit (CC_MqttsnClientHandle client)
 Retrieve currently configured limit of the topic IDs stored for the outgoing messages.
 
bool cc_mqttsn_client_get_verify_incoming_msg_subscribed (CC_MqttsnClientHandle client)
 Retrieve current incoming message being correctly subscribed control.
 
bool cc_mqttsn_client_get_verify_incoming_topic_enabled (CC_MqttsnClientHandle client)
 Retrieve current incoming topic format verification control.
 
bool cc_mqttsn_client_get_verify_outgoing_topic_enabled (CC_MqttsnClientHandle client)
 Retrieve current outgoing topic format verification control.
 
void cc_mqttsn_client_init_gateway_info (CC_MqttsnGatewayInfo *info)
 Initialize the CC_MqttsnGatewayInfo structure.
 
void cc_mqttsn_client_process_data (CC_MqttsnClientHandle client, const unsigned char *buf, unsigned bufLen, CC_MqttsnDataOrigin origin)
 Provide data, received over I/O link, to the library for processing.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_allowed_adv_losses (CC_MqttsnClientHandle client, unsigned count)
 Set number of allowed ADVERTISE message misses.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_available_gateway_info (CC_MqttsnClientHandle client, const CC_MqttsnGatewayInfo *info)
 Update stored available gateway information.
 
void cc_mqttsn_client_set_cancel_next_tick_wait_callback (CC_MqttsnClientHandle client, CC_MqttsnCancelNextTickWaitCb cb, void *data)
 Set callback to terminate current time measurement.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_default_broadcast_radius (CC_MqttsnClientHandle client, unsigned value)
 Set broadcast radius.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_default_gw_adv_duration (CC_MqttsnClientHandle client, unsigned ms)
 Set default gateway advertise duration.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_default_retry_count (CC_MqttsnClientHandle client, unsigned value)
 Set number of retry attempts to perform before reporting unsuccessful result of the operation (Nretry from spec).
 
CC_MqttsnErrorCode cc_mqttsn_client_set_default_retry_period (CC_MqttsnClientHandle client, unsigned value)
 Set retry period to wait between resending unacknowledged message to the gateway (Tretry from spec).
 
void cc_mqttsn_client_set_error_log_callback (CC_MqttsnClientHandle client, CC_MqttsnErrorLogCb cb, void *data)
 Set callback to report error messages.
 
void cc_mqttsn_client_set_gw_disconnect_report_callback (CC_MqttsnClientHandle client, CC_MqttsnGwDisconnectedReportCb cb, void *data)
 Set callback to report unsolicited disconnection of the gateway.
 
void cc_mqttsn_client_set_gw_status_report_callback (CC_MqttsnClientHandle client, CC_MqttsnGwStatusReportCb cb, void *data)
 Set callback to report status of the gateway.
 
void cc_mqttsn_client_set_gwinfo_delay_request_callback (CC_MqttsnClientHandle client, CC_MqttsnGwinfoDelayRequestCb cb, void *data)
 Set callback to request a random timeout to send GWINFO as a response to the SEARCHGW from other client.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_incoming_topic_id_storage_limit (CC_MqttsnClientHandle client, unsigned long long limit)
 Specify limit of the topic IDs stored for the incoming messages.
 
void cc_mqttsn_client_set_message_report_callback (CC_MqttsnClientHandle client, CC_MqttsnMessageReportCb cb, void *data)
 Set callback to report incoming messages.
 
void cc_mqttsn_client_set_next_tick_program_callback (CC_MqttsnClientHandle client, CC_MqttsnNextTickProgramCb cb, void *data)
 Set callback to call when time measurement is required.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_outgoing_topic_id_storage_limit (CC_MqttsnClientHandle client, unsigned long long limit)
 Specify limit of the topic IDs stored for the outgoing messages.
 
void cc_mqttsn_client_set_send_output_data_callback (CC_MqttsnClientHandle client, CC_MqttsnSendOutputDataCb cb, void *data)
 Set callback to send raw data over I/O link.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_verify_incoming_msg_subscribed (CC_MqttsnClientHandle client, bool enabled)
 Control verification of the incoming message being correctly subscribed.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_verify_incoming_topic_enabled (CC_MqttsnClientHandle client, bool enabled)
 Control incoming topic format verification.
 
CC_MqttsnErrorCode cc_mqttsn_client_set_verify_outgoing_topic_enabled (CC_MqttsnClientHandle client, bool enabled)
 Control outgoing topic format verification.
 
void cc_mqttsn_client_tick (CC_MqttsnClientHandle client, unsigned ms)
 Notify client about requested time expiry.
 

Detailed Description

Typedef Documentation

◆ CC_MqttsnCancelNextTickWaitCb

typedef unsigned(* CC_MqttsnCancelNextTickWaitCb) (void *data)

Callback used to request termination of existing time measurement.

The callback is set using cc_mqttsn_client_set_cancel_next_tick_wait_callback() function.

Parameters
[in]dataPointer to user data object, passed as last parameter to cc_mqttsn_client_set_cancel_next_tick_wait_callback() function.
Returns
Number of elapsed milliseconds since last time measurement request.

◆ CC_MqttsnClientHandle

typedef struct CC_MqttsnClient* CC_MqttsnClientHandle

Handler used to access client specific data structures.

Returned by cc_mqttsn_client_alloc() function.

◆ CC_MqttsnErrorLogCb

typedef void(* CC_MqttsnErrorLogCb) (void *data, const char *msg)

Callback used to report discovered errors.

Parameters
[in]dataPointer to user data object, passed as the last parameter to the request call.
[in]msgError log message.

◆ CC_MqttsnGwDisconnectedReportCb

typedef void(* CC_MqttsnGwDisconnectedReportCb) (void *data, CC_MqttsnGatewayDisconnectReason reason)

Callback used to report unsolicited disconnection of the gateway.

Parameters
[in]dataPointer to user data object, passed as the last parameter to the request call.
[in]reasonReason of the disconnection.

◆ CC_MqttsnGwinfoDelayRequestCb

typedef unsigned(* CC_MqttsnGwinfoDelayRequestCb) (void *data)

Callback used to request delay (in ms) to wait before responding with GWINFO message on behalf of a gateway.

In case function return 0U, the response on behalf of the gateway is disabled.

Returns
Number of milliseconds to wait for another GWINFO to cancel the intended send of GWINFO on behalf of the gateway.

◆ CC_MqttsnGwStatusReportCb

typedef void(* CC_MqttsnGwStatusReportCb) (void *data, CC_MqttsnGwStatus status, const CC_MqttsnGatewayInfo *info)

Callback used to report gateway status.

The callback is set using cc_mqttsn_client_set_gw_status_report_callback() function.

Parameters
[in]dataPointer to user data object, passed as last parameter to cc_mqttsn_client_set_gw_status_report_callback() function.
[in]statusCurrent status of the gateway.
[in]infoCurrently stored gateway information.

◆ CC_MqttsnMessageReportCb

typedef void(* CC_MqttsnMessageReportCb) (void *data, const CC_MqttsnMessageInfo *msgInfo)

Callback used to report incoming messages.

The callback is set using cc_mqttsn_client_set_message_report_callback() function. The reported data resides in internal data structures of the client library, and it can be updated right after the callback function returns.

Parameters
[in]dataPointer to user data object, passed as last parameter to cc_mqttsn_client_set_message_report_callback() function.
[in]msgInfoInformation about incoming message.

◆ CC_MqttsnNextTickProgramCb

typedef void(* CC_MqttsnNextTickProgramCb) (void *data, unsigned duration)

Callback used to request time measurement.

The callback is set using cc_mqttsn_client_set_next_tick_program_callback() function.

Parameters
[in]dataPointer to user data object, passed as last parameter to cc_mqttsn_client_set_next_tick_program_callback() function.
[in]durationTime duration in milliseconds. After the requested time expires, the cc_mqttsn_client_tick() function is expected to be invoked.

◆ CC_MqttsnSendOutputDataCb

typedef void(* CC_MqttsnSendOutputDataCb) (void *data, const unsigned char *buf, unsigned bufLen, unsigned broadcastRadius)

Callback used to request to send data to the gateway.

The callback is set using cc_mqttsn_client_set_send_output_data_callback() function. The reported data resides in internal data structures of the client library, and it can be updated 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.

Parameters
[in]dataPointer to user data object, passed as last parameter to cc_mqttsn_client_set_send_output_data_callback() function.
[in]bufPointer to the buffer containing data to send
[in]bufLenNumber of bytes to send
[in]broadcastRadiusBroadcast radius. When 0, means unicast to the connected gateway.

Function Documentation

◆ cc_mqttsn_client_alloc()

CC_MqttsnClientHandle cc_mqttsn_client_alloc ( )

Allocate new client.

When work with the client is complete, cc_mqttsn_client_free() function must be invoked.

Returns
Handle to allocated client object. This handle needs to be passed as first parameter to all other API functions.

◆ cc_mqttsn_client_asleep_check_messages()

CC_MqttsnErrorCode cc_mqttsn_client_asleep_check_messages ( CC_MqttsnClientHandle  client)

Check messages when in "asleep" state.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.

◆ cc_mqttsn_client_discard_all_gateway_infos()

void cc_mqttsn_client_discard_all_gateway_infos ( CC_MqttsnClientHandle  client)

Discard stored information on all available gateways.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.

◆ cc_mqttsn_client_discard_available_gateway_info()

CC_MqttsnErrorCode cc_mqttsn_client_discard_available_gateway_info ( CC_MqttsnClientHandle  client,
unsigned char  gwId 
)

Discard stored available gateway information.

The library will look for the inner data structure for the information containing the reported gateway id and remove it if dound.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]gwIdGateway ID.
Returns
Result code of the call.

◆ cc_mqttsn_client_free()

void cc_mqttsn_client_free ( CC_MqttsnClientHandle  client)

Free previously allocated client.

When used communication channel to the gateway is no longer needed, the client data structes allocated with cc_mqttsn_client_alloc() must be released using this function.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.

◆ cc_mqttsn_client_get_allowed_adv_losses()

unsigned cc_mqttsn_client_get_allowed_adv_losses ( CC_MqttsnClientHandle  client)

Get current configuration of allowed ADVERTISE message misses.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_allowed_adv_losses()

◆ cc_mqttsn_client_get_available_gateway_info()

CC_MqttsnErrorCode cc_mqttsn_client_get_available_gateway_info ( CC_MqttsnClientHandle  client,
unsigned  idx,
CC_MqttsnGatewayInfo info 
)

Retrieve stored available gateway information.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]idxIndex of the available gateway information.
[out]infoStored gateway information.
Returns
Result code of the call.

◆ cc_mqttsn_client_get_available_gateways_count()

unsigned cc_mqttsn_client_get_available_gateways_count ( CC_MqttsnClientHandle  client)

Get number of available gateways.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_get_available_gateway_info()

◆ cc_mqttsn_client_get_default_broadcast_radius()

unsigned cc_mqttsn_client_get_default_broadcast_radius ( CC_MqttsnClientHandle  client)

Get current broadcast radius configuration.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_default_broadcast_radius()

◆ cc_mqttsn_client_get_default_gw_adv_duration()

unsigned cc_mqttsn_client_get_default_gw_adv_duration ( CC_MqttsnClientHandle  client)

Get current default gateway advertise configuration.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_default_gw_adv_duration()

◆ cc_mqttsn_client_get_default_retry_count()

unsigned cc_mqttsn_client_get_default_retry_count ( CC_MqttsnClientHandle  client)

Get configured number of retry attempts to perform before reporting unsuccessful result of the operation (Nretry from spec).

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_default_retry_count()

◆ cc_mqttsn_client_get_default_retry_period()

unsigned cc_mqttsn_client_get_default_retry_period ( CC_MqttsnClientHandle  client)

Set configured retry period to wait between resending unacknowledged message to the gateway (Tretry from spec).

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_default_retry_period().

◆ cc_mqttsn_client_get_incoming_topic_id_storage_limit()

unsigned long long cc_mqttsn_client_get_incoming_topic_id_storage_limit ( CC_MqttsnClientHandle  client)

Retrieve currently configured limit of the topic IDs stored for the incoming messages.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_incoming_topic_id_storage_limit()

◆ cc_mqttsn_client_get_outgoing_topic_id_storage_limit()

unsigned long long cc_mqttsn_client_get_outgoing_topic_id_storage_limit ( CC_MqttsnClientHandle  client)

Retrieve currently configured limit of the topic IDs stored for the outgoing messages.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
See also
cc_mqttsn_client_set_outgoing_topic_id_storage_limit()

◆ cc_mqttsn_client_get_verify_incoming_msg_subscribed()

bool cc_mqttsn_client_get_verify_incoming_msg_subscribed ( CC_MqttsnClientHandle  client)

Retrieve current incoming message being correctly subscribed control.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
Returns
true when enabled, false when disabled

◆ cc_mqttsn_client_get_verify_incoming_topic_enabled()

bool cc_mqttsn_client_get_verify_incoming_topic_enabled ( CC_MqttsnClientHandle  client)

Retrieve current incoming topic format verification control.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
Returns
true when enabled, false when disabled

◆ cc_mqttsn_client_get_verify_outgoing_topic_enabled()

bool cc_mqttsn_client_get_verify_outgoing_topic_enabled ( CC_MqttsnClientHandle  client)

Retrieve current outgoing topic format verification control.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
Returns
true when enabled, false when disabled

◆ cc_mqttsn_client_init_gateway_info()

void cc_mqttsn_client_init_gateway_info ( CC_MqttsnGatewayInfo info)

Initialize the CC_MqttsnGatewayInfo structure.

Zeroes all the member fields.

◆ cc_mqttsn_client_process_data()

void cc_mqttsn_client_process_data ( CC_MqttsnClientHandle  client,
const unsigned char *  buf,
unsigned  bufLen,
CC_MqttsnDataOrigin  origin 
)

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 gateway, report incoming application message, and (re)start time measurement.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]bufPointer to the buffer of data to process.
[in]bufLenNumber of bytes in the data buffer.
[in]originOrigin of the data, helps to ignore unsolicited messages on the network.
Note
According to the MQTT-SN specification every message should be sent in a separate single datagram packet. This function assumes such behaviour and "consumes" all the provided data discarding any additional bytes after the message (if exist).

◆ cc_mqttsn_client_set_allowed_adv_losses()

CC_MqttsnErrorCode cc_mqttsn_client_set_allowed_adv_losses ( CC_MqttsnClientHandle  client,
unsigned  count 
)

Set number of allowed ADVERTISE message misses.

When the client doesn't receive ADVERTISE message in time, it maybe due to packet loss and not necessarily because gateway is offline. This function configures number of ADVERTISE packet losses before the gateway is considered to be offline. When set to 0, means gateway is offline if the next expected ADVERTISE doesn't arrive in time. When set to 1, means one ADVERTISE can be missed and if the second one doesn't arrive in time the gateway is considered to be offline. Defaults to 1.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]countNumber of allowed ADVERTISE message losses.
Returns
Result code of the call.

◆ cc_mqttsn_client_set_available_gateway_info()

CC_MqttsnErrorCode cc_mqttsn_client_set_available_gateway_info ( CC_MqttsnClientHandle  client,
const CC_MqttsnGatewayInfo info 
)

Update stored available gateway information.

The library will look for the inner data structure for the information containing the reported gateway id and update it accordingly. If no such information is present, new entry is going to be added.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]infoUpdated gateway information.
Returns
Result code of the call.

◆ cc_mqttsn_client_set_cancel_next_tick_wait_callback()

void cc_mqttsn_client_set_cancel_next_tick_wait_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnCancelNextTickWaitCb  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_mqttsn_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]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_default_broadcast_radius()

CC_MqttsnErrorCode cc_mqttsn_client_set_default_broadcast_radius ( CC_MqttsnClientHandle  client,
unsigned  value 
)

Set broadcast radius.

When searching for gateways, the client library broadcasts SEARCHGW messages. It contains the broadcast radius value. This value can be set using this function. Default radius value is 3.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]valueBroadcast radius.
Returns
Result code of the call.
Precondition
The broadcast value cannot exceed 255.

◆ cc_mqttsn_client_set_default_gw_adv_duration()

CC_MqttsnErrorCode cc_mqttsn_client_set_default_gw_adv_duration ( CC_MqttsnClientHandle  client,
unsigned  ms 
)

Set default gateway advertise duration.

When the client receives GWINFO message before ADVERTISE, the gateway is "alive", but its expiry timeout is not known yet. There is a need to assume some default value. Use this function to update it. Defaults to 15 * 60 * 1000 = 15 minutes.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]msDefault advertise duration in milliseconds.
Returns
Result code of the call.

◆ cc_mqttsn_client_set_default_retry_count()

CC_MqttsnErrorCode cc_mqttsn_client_set_default_retry_count ( CC_MqttsnClientHandle  client,
unsigned  value 
)

Set number of retry attempts to perform before reporting unsuccessful result of the operation (Nretry from spec).

Some messages, sent to the gateway, may require acknowledgement by the latter. The amount of retry attempts before reporting unsuccessful result of the operation may be specified using this function. The default value is 3.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]valueNumber of retry attempts.
Returns
Result code of the call.

◆ cc_mqttsn_client_set_default_retry_period()

CC_MqttsnErrorCode cc_mqttsn_client_set_default_retry_period ( CC_MqttsnClientHandle  client,
unsigned  value 
)

Set retry period to wait between resending unacknowledged message to the gateway (Tretry from spec).

Some messages, sent to the gateway, may require acknowledgement by the latter. The delay (in seconds) between such attempts to resend the message may be specified using this function. The default value is 10 seconds.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]valueNumber of seconds to wait before making an attempt to resend.
Returns
Result code of the call.

◆ cc_mqttsn_client_set_error_log_callback()

void cc_mqttsn_client_set_error_log_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnErrorLogCb  cb,
void *  data 
)

Set callback to report error messages.

Parameters
[in]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_gw_disconnect_report_callback()

void cc_mqttsn_client_set_gw_disconnect_report_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnGwDisconnectedReportCb  cb,
void *  data 
)

Set callback to report unsolicited disconnection of the gateway.

The callback will be invoked when gateway sends unsolicited DISCONNECT message or does not reply to PINGREQ message.

Parameters
[in]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_gw_status_report_callback()

void cc_mqttsn_client_set_gw_status_report_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnGwStatusReportCb  cb,
void *  data 
)

Set callback to report status of the gateway.

The callback is invoked when gateway status has changed.

Parameters
[in]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_gwinfo_delay_request_callback()

void cc_mqttsn_client_set_gwinfo_delay_request_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnGwinfoDelayRequestCb  cb,
void *  data 
)

Set callback to request a random timeout to send GWINFO as a response to the SEARCHGW from other client.

According to the MQTT-SN specification, the client can send GWINFO message on behalf of a gateway after some randrom amount of time. Use this function to allow the library to request such timeout. If not set, sending GWINFO on behalf of the gateway is disabled.

◆ cc_mqttsn_client_set_incoming_topic_id_storage_limit()

CC_MqttsnErrorCode cc_mqttsn_client_set_incoming_topic_id_storage_limit ( CC_MqttsnClientHandle  client,
unsigned long long  limit 
)

Specify limit of the topic IDs stored for the incoming messages.

When receiving messages from the gateway, the latter may register topic IDs. Use this function to set the runtime limit of how many such registration are stored. When the specified limit reached the least recently used mapping will be dropped to accomodate the new one.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]limitLimit for the topic ids stored. 0 means previously set limit is removed. i.e reset to default
Returns
Error code of the operation

◆ cc_mqttsn_client_set_message_report_callback()

void cc_mqttsn_client_set_message_report_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnMessageReportCb  cb,
void *  data 
)

Set callback to report incoming messages.

Parameters
[in]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_next_tick_program_callback()

void cc_mqttsn_client_set_next_tick_program_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnNextTickProgramCb  cb,
void *  data 
)

Set callback to call when time measurement is required.

The MQTT-SN 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_mqttsn_client_tick() function must be invoked.

Parameters
[in]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_outgoing_topic_id_storage_limit()

CC_MqttsnErrorCode cc_mqttsn_client_set_outgoing_topic_id_storage_limit ( CC_MqttsnClientHandle  client,
unsigned long long  limit 
)

Specify limit of the topic IDs stored for the outgoing messages.

When performing publish operations with the normal topic string there is a need to be able to store the topic string <-> topic id mapping, which can be used in the future publish operations as well. Use this function to set the runtime limit. When the specified limit reached the least recently used mapping will be dropped to accomodate the new one.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]limitLimit for the topic ids stored. 0 means previously set limit is removed. i.e reset to default
Returns
Error code of the operation

◆ cc_mqttsn_client_set_send_output_data_callback()

void cc_mqttsn_client_set_send_output_data_callback ( CC_MqttsnClientHandle  client,
CC_MqttsnSendOutputDataCb  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 gateway. The callback is invoked for every single message that need to be sent as a single datagram.

Parameters
[in]clientHandle returned by cc_mqttsn_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_mqttsn_client_set_verify_incoming_msg_subscribed()

CC_MqttsnErrorCode cc_mqttsn_client_set_verify_incoming_msg_subscribed ( CC_MqttsnClientHandle  client,
bool  enabled 
)

Control verification of the incoming message being correctly subscribed.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]enabledtrue to enable topic format verification, false to disable.
Returns
Error code of the operation

◆ cc_mqttsn_client_set_verify_incoming_topic_enabled()

CC_MqttsnErrorCode cc_mqttsn_client_set_verify_incoming_topic_enabled ( CC_MqttsnClientHandle  client,
bool  enabled 
)

Control incoming topic format verification.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]enabledtrue to enable topic format verification, false to disable.
Returns
Error code of the operation

◆ cc_mqttsn_client_set_verify_outgoing_topic_enabled()

CC_MqttsnErrorCode cc_mqttsn_client_set_verify_outgoing_topic_enabled ( CC_MqttsnClientHandle  client,
bool  enabled 
)

Control outgoing topic format verification.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]enabledtrue to enable topic format verification, false to disable.
Returns
Error code of the operation

◆ cc_mqttsn_client_tick()

void cc_mqttsn_client_tick ( CC_MqttsnClientHandle  client,
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_mqttsn_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 gateway.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]msNumber of elapsed milliseconds.