CommsChampion Ecosystem MQTT-SN Client
MQTT-SN client library.
|
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. | |
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.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqttsn_client_set_cancel_next_tick_wait_callback() function. |
typedef struct CC_MqttsnClient* CC_MqttsnClientHandle |
Handler used to access client specific data structures.
Returned by cc_mqttsn_client_alloc() function.
typedef void(* CC_MqttsnErrorLogCb) (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_MqttsnGwDisconnectedReportCb) (void *data, CC_MqttsnGatewayDisconnectReason reason) |
Callback used to report unsolicited disconnection of the gateway.
[in] | data | Pointer to user data object, passed as the last parameter to the request call. |
[in] | reason | Reason of the disconnection. |
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.
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.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqttsn_client_set_gw_status_report_callback() function. |
[in] | status | Current status of the gateway. |
[in] | info | Currently stored gateway information. |
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.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqttsn_client_set_message_report_callback() function. |
[in] | msgInfo | Information about incoming message. |
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.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqttsn_client_set_next_tick_program_callback() function. |
[in] | duration | Time duration in milliseconds. After the requested time expires, the cc_mqttsn_client_tick() function is expected to be invoked. |
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.
[in] | data | Pointer to user data object, passed as last parameter to cc_mqttsn_client_set_send_output_data_callback() function. |
[in] | buf | Pointer to the buffer containing data to send |
[in] | bufLen | Number of bytes to send |
[in] | broadcastRadius | Broadcast radius. When 0, means unicast to the connected gateway. |
CC_MqttsnClientHandle cc_mqttsn_client_alloc | ( | ) |
Allocate new client.
When work with the client is complete, cc_mqttsn_client_free() function must be invoked.
CC_MqttsnErrorCode cc_mqttsn_client_asleep_check_messages | ( | CC_MqttsnClientHandle | client | ) |
Check messages when in "asleep" state.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
void cc_mqttsn_client_discard_all_gateway_infos | ( | CC_MqttsnClientHandle | client | ) |
Discard stored information on all available gateways.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | gwId | Gateway ID. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
unsigned cc_mqttsn_client_get_allowed_adv_losses | ( | CC_MqttsnClientHandle | client | ) |
Get current configuration of allowed ADVERTISE message misses.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
CC_MqttsnErrorCode cc_mqttsn_client_get_available_gateway_info | ( | CC_MqttsnClientHandle | client, |
unsigned | idx, | ||
CC_MqttsnGatewayInfo * | info | ||
) |
Retrieve stored available gateway information.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | idx | Index of the available gateway information. |
[out] | info | Stored gateway information. |
unsigned cc_mqttsn_client_get_available_gateways_count | ( | CC_MqttsnClientHandle | client | ) |
Get number of available gateways.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
unsigned cc_mqttsn_client_get_default_broadcast_radius | ( | CC_MqttsnClientHandle | client | ) |
Get current broadcast radius configuration.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
unsigned cc_mqttsn_client_get_default_gw_adv_duration | ( | CC_MqttsnClientHandle | client | ) |
Get current default gateway advertise configuration.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
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).
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
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).
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
bool cc_mqttsn_client_get_verify_incoming_msg_subscribed | ( | CC_MqttsnClientHandle | client | ) |
Retrieve current incoming message being correctly subscribed control.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
bool cc_mqttsn_client_get_verify_incoming_topic_enabled | ( | CC_MqttsnClientHandle | client | ) |
Retrieve current incoming topic format verification control.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
bool cc_mqttsn_client_get_verify_outgoing_topic_enabled | ( | CC_MqttsnClientHandle | client | ) |
Retrieve current outgoing topic format verification control.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
void cc_mqttsn_client_init_gateway_info | ( | CC_MqttsnGatewayInfo * | info | ) |
Initialize the CC_MqttsnGatewayInfo structure.
Zeroes all the member fields.
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | buf | Pointer to the buffer of data to process. |
[in] | bufLen | Number of bytes in the data buffer. |
[in] | origin | Origin of the data, helps to ignore unsolicited messages on the network. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | count | Number of allowed ADVERTISE message losses. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | info | Updated 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.
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | value | Broadcast radius. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | ms | Default advertise duration in milliseconds. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | value | Number of retry attempts. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | value | Number of seconds to wait before making an attempt to resend. |
void cc_mqttsn_client_set_error_log_callback | ( | CC_MqttsnClientHandle | client, |
CC_MqttsnErrorLogCb | cb, | ||
void * | data | ||
) |
Set callback to report error messages.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
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_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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | limit | Limit for the topic ids stored. 0 means previously set limit is removed. i.e reset to default |
void cc_mqttsn_client_set_message_report_callback | ( | CC_MqttsnClientHandle | client, |
CC_MqttsnMessageReportCb | cb, | ||
void * | data | ||
) |
Set callback to report incoming messages.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | limit | Limit for the topic ids stored. 0 means previously set limit is removed. i.e reset to default |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | cb | Callback function. |
[in] | data | Pointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL. |
CC_MqttsnErrorCode cc_mqttsn_client_set_verify_incoming_msg_subscribed | ( | CC_MqttsnClientHandle | client, |
bool | enabled | ||
) |
Control verification of the incoming message being correctly subscribed.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | enabled | true to enable topic format verification, false to disable. |
CC_MqttsnErrorCode cc_mqttsn_client_set_verify_incoming_topic_enabled | ( | CC_MqttsnClientHandle | client, |
bool | enabled | ||
) |
Control incoming topic format verification.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | enabled | true to enable topic format verification, false to disable. |
CC_MqttsnErrorCode cc_mqttsn_client_set_verify_outgoing_topic_enabled | ( | CC_MqttsnClientHandle | client, |
bool | enabled | ||
) |
Control outgoing topic format verification.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | enabled | true to enable topic format verification, false to disable. |
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.
[in] | client | Handle returned by cc_mqttsn_client_alloc() function. |
[in] | ms | Number of elapsed milliseconds. |