MQTT-SN Client
MQTT-SN client library.
|
Common definition for MQTT-SN clients. More...
Go to the source code of this file.
Classes | |
struct | CC_MqttsnClientHandle |
Handler used to access client specific data structures. More... | |
struct | CC_MqttsnWillInfo |
Will Information. More... | |
struct | CC_MqttsnMessageInfo |
Incoming message information. More... | |
Macros | |
#define | CC_MQTTSN_CLIENT_MAJOR_VERSION 1U |
Major verion of the library. More... | |
#define | CC_MQTTSN_CLIENT_MINOR_VERSION 0U |
Minor verion of the library. More... | |
#define | CC_MQTTSN_CLIENT_PATCH_VERSION 8U |
Patch level of the library. More... | |
#define | CC_MQTTSN_CLIENT_MAKE_VERSION(major_, minor_, patch_) |
Macro to create numeric version as single unsigned number. More... | |
#define | CC_MQTTSN_CLIENT_VERSION CC_MQTTSN_CLIENT_MAKE_VERSION(CC_MQTTSN_CLIENT_MAJOR_VERSION, CC_MQTTSN_CLIENT_MINOR_VERSION, CC_MQTTSN_CLIENT_PATCH_VERSION) |
Version of the library as single numeric value. More... | |
Typedefs | |
typedef unsigned short | CC_MqttsnTopicId |
Type used to hold Topic ID value. More... | |
typedef void(* | CC_MqttsnNextTickProgramFn) (void *data, unsigned duration) |
Callback used to request time measurement. More... | |
typedef unsigned(* | CC_MqttsnCancelNextTickWaitFn) (void *data) |
Callback used to request termination of existing time measurement. More... | |
typedef void(* | CC_MqttsnSendOutputDataFn) (void *data, const unsigned char *buf, unsigned bufLen, bool broadcast) |
Callback used to request to send data to the gateway. More... | |
typedef void(* | CC_MqttsnGwStatusReportFn) (void *data, unsigned char gwId, CC_MqttsnGwStatus status) |
Callback used to report gateway status. More... | |
typedef void(* | CC_MqttsnGwDisconnectReportFn) (void *data) |
Callback used to report unsolicited disconnection of the gateway. More... | |
typedef void(* | CC_MqttsnAsyncOpCompleteReportFn) (void *data, CC_MqttsnAsyncOpStatus status) |
Callback used to report completion of the asynchronous operation. More... | |
typedef void(* | CC_MqttsnSubscribeCompleteReportFn) (void *data, CC_MqttsnAsyncOpStatus status, CC_MqttsnQoS qos) |
Callback used to report completion of the subscribe operation. More... | |
typedef void(* | CC_MqttsnMessageReportFn) (void *data, const CC_MqttsnMessageInfo *msgInfo) |
Callback used to report incoming messages. More... | |
Common definition for MQTT-SN clients.
#define CC_MQTTSN_CLIENT_MAJOR_VERSION 1U |
Major verion of the library.
#define CC_MQTTSN_CLIENT_MAKE_VERSION | ( | major_, | |
minor_, | |||
patch_ | |||
) |
Macro to create numeric version as single unsigned number.
#define CC_MQTTSN_CLIENT_MINOR_VERSION 0U |
Minor verion of the library.
#define CC_MQTTSN_CLIENT_PATCH_VERSION 8U |
Patch level of the library.
#define CC_MQTTSN_CLIENT_VERSION CC_MQTTSN_CLIENT_MAKE_VERSION(CC_MQTTSN_CLIENT_MAJOR_VERSION, CC_MQTTSN_CLIENT_MINOR_VERSION, CC_MQTTSN_CLIENT_PATCH_VERSION) |
Version of the library as single numeric value.
typedef void(* CC_MqttsnAsyncOpCompleteReportFn) (void *data, CC_MqttsnAsyncOpStatus status) |
Callback used to report completion of the asynchronous operation.
[in] | data | Pointer to user data object, passed as the last parameter to the request call. |
[in] | status | Status of the asynchronous operation. |
typedef unsigned(* CC_MqttsnCancelNextTickWaitFn) (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 void(* CC_MqttsnGwDisconnectReportFn) (void *data) |
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. |
typedef void(* CC_MqttsnGwStatusReportFn) (void *data, unsigned char gwId, CC_MqttsnGwStatus status) |
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] | gwId | ID of the gateway. |
[in] | status | Status of the gateway. |
typedef void(* CC_MqttsnMessageReportFn) (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_MqttsnNextTickProgramFn) (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_MqttsnSendOutputDataFn) (void *data, const unsigned char *buf, unsigned bufLen, bool broadcast) |
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] | broadcast | Indication whether data needs to be broadcasted or sent directly to the gateway. |
typedef void(* CC_MqttsnSubscribeCompleteReportFn) (void *data, CC_MqttsnAsyncOpStatus status, CC_MqttsnQoS qos) |
Callback used to report completion of the subscribe operation.
[in] | data | Pointer to user data object, passed as the last parameter to the subscribe request. |
[in] | status | Status of the subscribe operation. |
[in] | qos | Maximal level of quality of service, the gateway/broker is going to use to publish incoming messages. |
typedef unsigned short CC_MqttsnTopicId |
Type used to hold Topic ID value.
Status of the asynchronous operation.
Enumerator | |
---|---|
CC_MqttsnAsyncOpStatus_Invalid | Invalid value, should never be used. |
CC_MqttsnAsyncOpStatus_Successful | The operation was successful. |
CC_MqttsnAsyncOpStatus_Congestion | The gateway/broker was busy and could not handle the request, try again. |
CC_MqttsnAsyncOpStatus_InvalidId | Publish message used invalid topic ID. |
CC_MqttsnAsyncOpStatus_NotSupported | The issued request is not supported by the gateway. |
CC_MqttsnAsyncOpStatus_NoResponse | The gateway/broker didn't respond the the request. |
CC_MqttsnAsyncOpStatus_Aborted | The operation was cancelled using cc_mqttsn_client_cancel() call. |
enum CC_MqttsnErrorCode |
Error code returned by various API functions.
Enumerator | |
---|---|
CC_MqttsnErrorCode_Success | The requested operation was successfully started. |
CC_MqttsnErrorCode_AlreadyStarted | Returned by cc_mqttsn_client_start() function if invoked twice. |
CC_MqttsnErrorCode_NotStarted | Returned by various operations if issued prior to successful start using cc_mqttsn_client_start(). |
CC_MqttsnErrorCode_Busy | The client library is in the middle of previous operation, cannot start a new one. |
CC_MqttsnErrorCode_AlreadyConnected | The client library is already connected to the gateway. Returned when cc_mqttsn_client_connect() invoked second time. |
CC_MqttsnErrorCode_NotConnected | The client library is not connected to the gateway. Returned by operations that require connection to the gateway. |
CC_MqttsnErrorCode_NotSleeping | The client is not in ASLEEP mode. |
CC_MqttsnErrorCode_BadParam | Bad parameter is passed to the function. |
enum CC_MqttsnGwStatus |
Status of the gateway.
Enumerator | |
---|---|
CC_MqttsnGwStatus_Invalid | Invalid value, should never be used. |
CC_MqttsnGwStatus_Available | The gateway is available. |
CC_MqttsnGwStatus_TimedOut | The gateway hasn't advertised its presence in time, assumed disconnected. |
CC_MqttsnGwStatus_Discarded | The gateway info was discarded using cc_mqttsn_client_discard_gw() or cc_mqttsn_client_discard_all_gw(). |
enum CC_MqttsnQoS |
Quality of Service.