MQTT-SN Gateway Library
Library that allows implementation of MQTT-SN gateway.
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
gateway_all.h File Reference

C interface for MQTT-SN Gateway library. More...

Go to the source code of this file.

Classes

struct  CC_MqttsnPredefinedTopicInfo
 Info about single predefined topic. More...
 
struct  CC_MqttsnAuthInfo
 Authentication infor for a single client. More...
 

Typedefs

typedef struct CC_MqttsnGateway * CC_MqttsnGatewayHandle
 Handle for gateway object used in all cc_mqttsn_gw_* functions.
 
typedef void(* CC_MqttsnGwTickReqCb) (void *userData, unsigned duration)
 Type of callback function, to be used to request time measurement for the Gateway object.
 
typedef void(* CC_MqttsnGwBroadcastReqCb) (void *userData, const unsigned char *buf, unsigned bufLen)
 Type of callback function, to be used to request broadcast of serialised ADVERTISE message.
 
typedef struct CC_MqttsnSession * CC_MqttsnSessionHandle
 Handle for session object used in all cc_mqttsn_gw_session_* functions.
 
typedef void(* CC_MqttsnSessionTickReqCb) (void *userData, CC_MqttsnSessionHandle session, unsigned duration)
 Type of callback, used to request new time measurement.
 
typedef unsigned(* CC_MqttsnSessionCancelTickReqCb) (void *userData, CC_MqttsnSessionHandle session)
 Type of callback, used to cancel existing time measurement.
 
typedef void(* CC_MqttsnSessionClientSendDataReqCb) (void *userData, CC_MqttsnSessionHandle session, const unsigned char *buf, unsigned bufLen, unsigned broadcastRadius)
 Type of callback, used to request delivery of serialised message to the client.
 
typedef void(* CC_MqttsnSessionBrokerSendDataReqCb) (void *userData, CC_MqttsnSessionHandle session, const unsigned char *buf, unsigned bufLen)
 Type of callback, used to request delivery of serialised message to the broker.
 
typedef void(* CC_MqttsnSessionTermReqCb) (void *userData, CC_MqttsnSessionHandle session)
 Type of callback, used to request session termination.
 
typedef void(* CC_MqttsnSessionBrokerReconnectReqCb) (void *userData, CC_MqttsnSessionHandle session)
 Type of callback used to request reconnection to the broker.
 
typedef void(* CC_MqttsnSessionClientConnectReportCb) (void *userData, CC_MqttsnSessionHandle session, const char *clientId)
 Type of callback used to report client ID of the newly connected MQTT-SN client.
 
typedef void(* CC_MqttsnSessionAuthInfoReqCb) (void *userData, CC_MqttsnSessionHandle session, const char *clientId, const char **username, const unsigned char **password, unsigned *passwordLen)
 Type of callback used to request authentication information of the client that is trying to connect.
 
typedef void(* CC_MqttsnSessionErrorReportCb) (void *userData, CC_MqttsnSessionHandle session, const char *msg)
 Type of callback used to report error messages detected by the session.
 
typedef bool(* CC_MqttsnSessionFwdEncSessionCreatedCb) (void *userData, CC_MqttsnSessionHandle session)
 Type of callback used to report forwarding encapsulated session creation.
 
typedef void(* CC_MqttsnSessionFwdEncSessionDeletedCb) (void *userData, CC_MqttsnSessionHandle session)
 Type of callback used to report forwarding encapsulated session about to be deleted.
 
typedef struct CC_MqttsnConfig * CC_MqttsnConfigHandle
 Handle for session object used in all cc_mqttsn_gw_config_* functions.
 

Enumerations

enum  CC_MqttsnClientConnectionType { CC_MqttsnClientConnectionType_Udp , CC_MqttsnClientConnectionType_ValuesLimit }
 Client I/O socket connection type. More...
 
enum  CC_MqttsnBrokerConnectionType { CC_MqttsnBrokerConnectionType_Tcp , CC_MqttsnBrokerConnectionType_ValuesLimit }
 Broker I/O socket connection type. More...
 

Functions

CC_MqttsnGatewayHandle cc_mqttsn_gw_alloc (void)
 Allocate Gateway object.
 
void cc_mqttsn_gw_free (CC_MqttsnGatewayHandle gw)
 Free allocated Gateway object.
 
void cc_mqttsn_gw_set_advertise_period (CC_MqttsnGatewayHandle gw, unsigned short value)
 Set the advertise period.
 
unsigned short cc_mqttsn_gw_get_advertise_period (CC_MqttsnGatewayHandle gw)
 Get current configuration of the advertise period.
 
void cc_mqttsn_gw_set_id (CC_MqttsnGatewayHandle gw, unsigned char id)
 Set the numeric gateway ID.
 
unsigned char cc_mqttsn_gw_get_id (CC_MqttsnGatewayHandle gw)
 Get current configuration of the numeric gateway id.
 
void cc_mqttsn_gw_set_tick_req_cb (CC_MqttsnGatewayHandle gw, CC_MqttsnGwTickReqCb cb, void *data)
 Set callback that requests to perform time measurement.
 
void cc_mqttsn_gw_set_advertise_broadcast_req_cb (CC_MqttsnGatewayHandle gw, CC_MqttsnGwBroadcastReqCb cb, void *data)
 Set callback that requests to send serialised ADVERTISE message.
 
bool cc_mqttsn_gw_start (CC_MqttsnGatewayHandle gw)
 Start operation of the Gateway object.
 
void cc_mqttsn_gw_stop (CC_MqttsnGatewayHandle gw)
 Stop operation of the Gateway object.
 
void cc_mqttsn_gw_tick (CC_MqttsnGatewayHandle gw)
 Notify the Gateway object about requested time expiry.
 
CC_MqttsnSessionHandle cc_mqttsn_gw_session_alloc (void)
 Allocate Session object.
 
void cc_mqttsn_gw_session_free (CC_MqttsnSessionHandle session)
 Free allocated Session object.
 
void cc_mqttsn_gw_session_set_tick_req_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionTickReqCb cb, void *data)
 Set the callback to be invoked when new time measurement is required.
 
void cc_mqttsn_gw_session_set_cancel_tick_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionCancelTickReqCb cb, void *data)
 Set the callback to be invoked when previously requested time measurement needs to be cancelled.
 
void cc_mqttsn_gw_session_set_send_data_to_client_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionClientSendDataReqCb cb, void *data)
 Set the callback to be invoked when new data needs to be sent to the client.
 
void cc_mqttsn_gw_session_set_send_data_to_broker_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionBrokerSendDataReqCb cb, void *data)
 Set the callback to be invoked when new data needs to be sent to the broker.
 
void cc_mqttsn_gw_session_set_term_req_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionTermReqCb cb, void *data)
 Set the callback to be invoked when the Session needs to be terminated and the calling Session object deleted.
 
void cc_mqttsn_gw_session_set_broker_reconnect_req_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionBrokerReconnectReqCb cb, void *data)
 Set the callback to be invoked when the Session needs to close existing TCP/IP connection to the broker and open a new one.
 
void cc_mqttsn_gw_session_set_client_connect_report_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionClientConnectReportCb cb, void *data)
 Set the callback to be invoked when MQTT-SN client is successfully connected to the broker.
 
void cc_mqttsn_gw_session_set_auth_info_req_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionAuthInfoReqCb cb, void *data)
 Set the callback to be used to request authentication information for specific client.
 
void cc_mqttsn_gw_session_set_error_report_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionErrorReportCb cb, void *data)
 Set the callback to be used to report error messages detected by the session.
 
void cc_mqttsn_gw_session_set_fwd_enc_session_created_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionFwdEncSessionCreatedCb cb, void *data)
 Set the callback to be invoked when the forwarding encapsulation session is detected and to notify application about such session creation.
 
void cc_mqttsn_gw_session_set_fwd_enc_session_deleted_cb (CC_MqttsnSessionHandle session, CC_MqttsnSessionFwdEncSessionDeletedCb cb, void *data)
 Set the callback to be invoked when the forwarding encapsulation session is about to be deleted.
 
void cc_mqttsn_gw_session_set_id (CC_MqttsnSessionHandle session, unsigned char id)
 Set gateway numeric ID to be reported when requested.
 
unsigned char cc_mqttsn_gw_session_get_id (CC_MqttsnSessionHandle session)
 Get current gateway numeric ID configuration.
 
void cc_mqttsn_gw_session_set_retry_period (CC_MqttsnSessionHandle session, unsigned value)
 Set retry period to wait between resending unacknowledged message to the client and/or broker.
 
unsigned cc_mqttsn_gw_session_get_retry_period (CC_MqttsnSessionHandle session)
 Get the current configuration of the retry period.
 
void cc_mqttsn_gw_session_set_retry_count (CC_MqttsnSessionHandle session, unsigned value)
 Set number of retry attempts to perform before abandoning attempt to send unacknowledged message.
 
unsigned cc_mqttsn_gw_session_get_retry_count (CC_MqttsnSessionHandle session)
 Get the current configuration of the retry count.
 
void cc_mqttsn_gw_session_set_sleeping_client_msg_limit (CC_MqttsnSessionHandle session, unsigned long long value)
 Provide limit to number pending messages being accumulated for the sleeping client.
 
unsigned long long cc_mqttsn_gw_session_get_sleeping_client_msg_limit (CC_MqttsnSessionHandle session)
 Get currenly configured limit to pending messages being accumulated for the sleeping client.
 
void cc_mqttsn_gw_session_set_default_client_id (CC_MqttsnSessionHandle session, const char *clientId)
 Provide default client ID for clients that report empty one in their attempt to connect.
 
const char * cc_mqttsn_gw_session_get_default_client_id (CC_MqttsnSessionHandle session)
 Get current default client ID configuration.
 
void cc_mqttsn_gw_session_set_pub_only_keep_alive (CC_MqttsnSessionHandle session, unsigned value)
 Provide default "keep alive" period for "publish only" clients, that do not make an attempt to connect to the gateway.
 
unsigned cc_mqttsn_gw_session_get_pub_only_keep_alive (CC_MqttsnSessionHandle session)
 Get current configuration of the default "keep alive" period for "publish only" clients.
 
bool cc_mqttsn_gw_session_start (CC_MqttsnSessionHandle session)
 Start the Session's object's operation.
 
void cc_mqttsn_gw_session_stop (CC_MqttsnSessionHandle session)
 Stop the operation of the Session object.
 
void cc_mqttsn_gw_session_tick (CC_MqttsnSessionHandle session)
 Notify the Session object about requested time period expiry.
 
unsigned cc_mqttsn_gw_session_data_from_client (CC_MqttsnSessionHandle session, const unsigned char *buf, unsigned bufLen)
 Provide data received from the client for processing.
 
unsigned cc_mqttsn_gw_session_data_from_broker (CC_MqttsnSessionHandle session, const unsigned char *buf, unsigned bufLen)
 Provide data received from the broker for processing.
 
void cc_mqttsn_gw_session_set_broker_connected (CC_MqttsnSessionHandle session, bool connected)
 Notify the Session object about broker being connected / disconnected.
 
bool cc_mqttsn_gw_session_get_broker_connected (CC_MqttsnSessionHandle session)
 Get currently recorded broker connection status.
 
bool cc_mqttsn_gw_session_add_predefined_topic (CC_MqttsnSessionHandle session, const char *topic, unsigned short topicId)
 Add predefined topic string and ID information.
 
bool cc_mqttsn_gw_session_set_topic_id_alloc_range (CC_MqttsnSessionHandle session, unsigned short minTopicId, unsigned short maxTopicId)
 Limit range of topic IDs allocated for newly registered topics.
 
CC_MqttsnConfigHandle cc_mqttsn_gw_config_alloc (void)
 Allocate Config object.
 
void cc_mqttsn_gw_config_free (CC_MqttsnConfigHandle config)
 Free allocated Config object.
 
void cc_mqttsn_gw_config_parse (CC_MqttsnConfigHandle config, const char *str)
 Parse configuration contents from string.
 
bool cc_mqttsn_gw_config_read (CC_MqttsnConfigHandle config, const char *filename)
 Read configuration file.
 
unsigned char cc_mqttsn_gw_config_id (CC_MqttsnConfigHandle config)
 Get gateway numeric ID.
 
unsigned short cc_mqttsn_gw_config_advertise_period (CC_MqttsnConfigHandle config)
 Get advertise period.
 
unsigned cc_mqttsn_gw_config_retry_period (CC_MqttsnConfigHandle config)
 Get retry period.
 
unsigned cc_mqttsn_gw_config_retry_count (CC_MqttsnConfigHandle config)
 Get number of retry attempts.
 
const char * cc_mqttsn_gw_config_default_client_id (CC_MqttsnConfigHandle config)
 Get default client ID.
 
unsigned cc_mqttsn_gw_config_pub_only_keep_alive (CC_MqttsnConfigHandle config)
 Get keep alive period for publish only clients.
 
unsigned cc_mqttsn_gw_config_sleeping_client_msg_limit (CC_MqttsnConfigHandle config)
 Get limit for max number of messages to accumulate for sleeping clients.
 
unsigned cc_mqttsn_gw_config_available_predefined_topics (CC_MqttsnConfigHandle config)
 Get number of available predefined topic IDs.
 
unsigned cc_mqttsn_gw_config_get_predefined_topics (CC_MqttsnConfigHandle config, CC_MqttsnPredefinedTopicInfo *buf, unsigned bufLen)
 Read information about available topic IDs into a buffer.
 
unsigned cc_mqttsn_gw_config_available_auth_infos (CC_MqttsnConfigHandle config)
 Get number of available authenticatin infos for all the clients.
 
unsigned cc_mqttsn_gw_config_get_auth_infos (CC_MqttsnConfigHandle config, CC_MqttsnAuthInfo *buf, unsigned bufLen)
 Read clients' authentication information into a buffer.
 
void cc_mqttsn_gw_config_topic_id_alloc_range (CC_MqttsnConfigHandle config, unsigned short *min, unsigned short *max)
 Get range of allowed topic IDs for allocation.
 
const char * cc_mqttsn_gw_config_broker_address (CC_MqttsnConfigHandle config)
 Get TCP/IP address of the broker.
 
unsigned short cc_mqttsn_gw_config_broker_port (CC_MqttsnConfigHandle config)
 Get TCP/IP port of the broker.
 
const char * cc_mqttsn_gw_config_log_file (CC_MqttsnConfigHandle config)
 Get log file.
 
CC_MqttsnClientConnectionType cc_mqttsn_gw_config_client_connection_type (CC_MqttsnConfigHandle config)
 Get client I/O socket connection type.
 
CC_MqttsnBrokerConnectionType cc_mqttsn_gw_config_broker_connection_type (CC_MqttsnConfigHandle config)
 Get broker I/O socket connection type.
 
unsigned cc_mqttsn_gw_config_values_count (CC_MqttsnConfigHandle config, const char *key)
 Get number of available configuration values for the provided key.
 
const char * cc_mqttsn_gw_config_get_value (CC_MqttsnConfigHandle config, const char *key, unsigned idx)
 Get the available value for the configuration key.
 

Detailed Description

C interface for MQTT-SN Gateway library.

Typedef Documentation

◆ CC_MqttsnGwBroadcastReqCb

typedef void(* CC_MqttsnGwBroadcastReqCb) (void *userData, const unsigned char *buf, unsigned bufLen)

Type of callback function, to be used to request broadcast of serialised ADVERTISE message.

The callback is set using cc_mqttsn_gw_set_advertise_broadcast_req_cb().

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]bufPointer to the buffer of data, that needs to be sent.
[in]bufLenNumber of bytes in the buffer.
Note
The provided buffer resides in private data structres of the Gateway object and can be updated right after the callback function returns. The driving code may require to copy the buffer to its own data structures and preserve it intact until send over I/O link is complete.

◆ CC_MqttsnGwTickReqCb

typedef void(* CC_MqttsnGwTickReqCb) (void *userData, unsigned duration)

Type of callback function, to be used to request time measurement for the Gateway object.

The callback is set using cc_mqttsn_gw_set_tick_req_cb(). When the required time expires, the driving code is responsible to invoke cc_mqttsn_gw_tick() function.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]durationRequested time measurement duration in milliseconds.

◆ CC_MqttsnSessionAuthInfoReqCb

typedef void(* CC_MqttsnSessionAuthInfoReqCb) (void *userData, CC_MqttsnSessionHandle session, const char *clientId, const char **username, const unsigned char **password, unsigned *passwordLen)

Type of callback used to request authentication information of the client that is trying to connect.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request
[in]clientIdClient ID
[out]usernameUsername string
[out]passwordBinary password buffer
[out]passwordLenLength of the binary password

◆ CC_MqttsnSessionBrokerReconnectReqCb

typedef void(* CC_MqttsnSessionBrokerReconnectReqCb) (void *userData, CC_MqttsnSessionHandle session)

Type of callback used to request reconnection to the broker.

When the callback is invoked, the driving code must close existing TCP/IP connection to the broker and create a new one.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request

◆ CC_MqttsnSessionBrokerSendDataReqCb

typedef void(* CC_MqttsnSessionBrokerSendDataReqCb) (void *userData, CC_MqttsnSessionHandle session, const unsigned char *buf, unsigned bufLen)

Type of callback, used to request delivery of serialised message to the broker.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request
[in]bufBuffer containing serialised message.
[in]bufLenNumber of bytes in the buffer

◆ CC_MqttsnSessionCancelTickReqCb

typedef unsigned(* CC_MqttsnSessionCancelTickReqCb) (void *userData, CC_MqttsnSessionHandle session)

Type of callback, used to cancel existing time measurement.

When invoked the existing time measurement needs to be cancelled. The function also needs to return amount of milliseconds elapsed since last timer programming request.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request
Returns
Number of elapsed milliseconds since last timer programming request.

◆ CC_MqttsnSessionClientConnectReportCb

typedef void(* CC_MqttsnSessionClientConnectReportCb) (void *userData, CC_MqttsnSessionHandle session, const char *clientId)

Type of callback used to report client ID of the newly connected MQTT-SN client.

The callback can be used to provide additional client specific information, such as predefined topic IDs.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the report
[in]clientIdClient ID

◆ CC_MqttsnSessionClientSendDataReqCb

typedef void(* CC_MqttsnSessionClientSendDataReqCb) (void *userData, CC_MqttsnSessionHandle session, const unsigned char *buf, unsigned bufLen, unsigned broadcastRadius)

Type of callback, used to request delivery of serialised message to the client.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request
[in]bufBuffer containing serialised message.
[in]bufLenNumber of bytes in the buffer
[in]broadcastRadiusBroadcast radius. 0 means unicast.

◆ CC_MqttsnSessionErrorReportCb

typedef void(* CC_MqttsnSessionErrorReportCb) (void *userData, CC_MqttsnSessionHandle session, const char *msg)

Type of callback used to report error messages detected by the session.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request
[in]msgError message

◆ CC_MqttsnSessionFwdEncSessionCreatedCb

typedef bool(* CC_MqttsnSessionFwdEncSessionCreatedCb) (void *userData, CC_MqttsnSessionHandle session)

Type of callback used to report forwarding encapsulated session creation.

The application is responsible to perform the necessary session configuration as well as set all the callbacks except the one set by the cc_mqttsn_gw_session_set_send_data_to_client_cb() and cc_mqttsn_gw_session_set_term_req_cb(). The data sent to the client as well as the session termination are managed by the calling session object. The application is responsible to manage the timer as well as broker connection of the reported session.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of created session object
Returns
true in case of success, false in case of falure.

◆ CC_MqttsnSessionFwdEncSessionDeletedCb

typedef void(* CC_MqttsnSessionFwdEncSessionDeletedCb) (void *userData, CC_MqttsnSessionHandle session)

Type of callback used to report forwarding encapsulated session about to be deleted.

The application is responsible to remove any reference to the session object from its internal data structes.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session object about to be deleted

◆ CC_MqttsnSessionTermReqCb

typedef void(* CC_MqttsnSessionTermReqCb) (void *userData, CC_MqttsnSessionHandle session)

Type of callback, used to request session termination.

When the callback is invoked, the driving code must flush all the previously sent messages to appropriate I/O links and delete this session object.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request

◆ CC_MqttsnSessionTickReqCb

typedef void(* CC_MqttsnSessionTickReqCb) (void *userData, CC_MqttsnSessionHandle session, unsigned duration)

Type of callback, used to request new time measurement.

When the requested time is due, the driving code is expected to call cc_mqttsn_gw_session_tick() member function.

Parameters
[in]userDataUser data passed as the last parameter to the setting function.
[in]sessionHandle of session performing the request
[in]durationNumber of milliseconds to measure.

Enumeration Type Documentation

◆ CC_MqttsnBrokerConnectionType

Broker I/O socket connection type.

Enumerator
CC_MqttsnBrokerConnectionType_Tcp 

TCP/IP.

CC_MqttsnBrokerConnectionType_ValuesLimit 

Limit to available values, must be last.

◆ CC_MqttsnClientConnectionType

Client I/O socket connection type.

Enumerator
CC_MqttsnClientConnectionType_Udp 

UDP/IP.

CC_MqttsnClientConnectionType_ValuesLimit 

Limit to available values, must be last.

Function Documentation

◆ cc_mqttsn_gw_alloc()

CC_MqttsnGatewayHandle cc_mqttsn_gw_alloc ( void  )

Allocate Gateway object.

The returned handle need to be passed as first parameter to all relevant functions. Note that the Gateway object is dynamically allocated and needs to be freed using cc_mqttsn_gw_free() function.

Returns
Handler to the allocated Gateway object.

◆ cc_mqttsn_gw_config_advertise_period()

unsigned short cc_mqttsn_gw_config_advertise_period ( CC_MqttsnConfigHandle  config)

Get advertise period.

Default value is 900 seconds (15 minutes).

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Advertise period in seconds.

◆ cc_mqttsn_gw_config_alloc()

CC_MqttsnConfigHandle cc_mqttsn_gw_config_alloc ( void  )

Allocate Config object.

The returned handle need to be passed as first parameter to all relevant functions. Note that the Config object is dynamically allocated and needs to be freed using cc_mqttsn_gw_config_free() function.

Returns
Handler to the allocated Config object.

◆ cc_mqttsn_gw_config_available_auth_infos()

unsigned cc_mqttsn_gw_config_available_auth_infos ( CC_MqttsnConfigHandle  config)

Get number of available authenticatin infos for all the clients.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_available_predefined_topics()

unsigned cc_mqttsn_gw_config_available_predefined_topics ( CC_MqttsnConfigHandle  config)

Get number of available predefined topic IDs.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_broker_address()

const char * cc_mqttsn_gw_config_broker_address ( CC_MqttsnConfigHandle  config)

Get TCP/IP address of the broker.

Default address is 127.0.0.1

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_broker_connection_type()

CC_MqttsnBrokerConnectionType cc_mqttsn_gw_config_broker_connection_type ( CC_MqttsnConfigHandle  config)

Get broker I/O socket connection type.

Parameters
configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_broker_port()

unsigned short cc_mqttsn_gw_config_broker_port ( CC_MqttsnConfigHandle  config)

Get TCP/IP port of the broker.

Default value is 1883

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_client_connection_type()

CC_MqttsnClientConnectionType cc_mqttsn_gw_config_client_connection_type ( CC_MqttsnConfigHandle  config)

Get client I/O socket connection type.

Parameters
configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_default_client_id()

const char * cc_mqttsn_gw_config_default_client_id ( CC_MqttsnConfigHandle  config)

Get default client ID.

Default value is empty string.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Default client ID.

◆ cc_mqttsn_gw_config_free()

void cc_mqttsn_gw_config_free ( CC_MqttsnConfigHandle  config)

Free allocated Config object.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.

◆ cc_mqttsn_gw_config_get_auth_infos()

unsigned cc_mqttsn_gw_config_get_auth_infos ( CC_MqttsnConfigHandle  config,
CC_MqttsnAuthInfo buf,
unsigned  bufLen 
)

Read clients' authentication information into a buffer.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
[out]bufBuffer to write information into
[in]bufLenMax number of element to write into the buffer.
Returns
Actual number of elements that have been written into a buffer.

◆ cc_mqttsn_gw_config_get_predefined_topics()

unsigned cc_mqttsn_gw_config_get_predefined_topics ( CC_MqttsnConfigHandle  config,
CC_MqttsnPredefinedTopicInfo buf,
unsigned  bufLen 
)

Read information about available topic IDs into a buffer.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
[out]bufBuffer to write information into
[in]bufLenMax number of element to write into the buffer.
Returns
Actual number of elements that have been written into a buffer.

◆ cc_mqttsn_gw_config_get_value()

const char * cc_mqttsn_gw_config_get_value ( CC_MqttsnConfigHandle  config,
const char *  key,
unsigned  idx 
)

Get the available value for the configuration key.

The key is the first word in the configuration line, and the value is rest of the string until the end of the line. If the configuration value doesn't exist, NULL is returned.

◆ cc_mqttsn_gw_config_id()

unsigned char cc_mqttsn_gw_config_id ( CC_MqttsnConfigHandle  config)

Get gateway numeric ID.

Default value is 0.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Numeric gateway ID.

◆ cc_mqttsn_gw_config_log_file()

const char * cc_mqttsn_gw_config_log_file ( CC_MqttsnConfigHandle  config)

Get log file.

Expected to be an aboslute file path or one of the special values: "stdout", "stderr". Defaults to "stdout"

◆ cc_mqttsn_gw_config_parse()

void cc_mqttsn_gw_config_parse ( CC_MqttsnConfigHandle  config,
const char *  str 
)

Parse configuration contents from string.

Updates the default values with values read from string buffer.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
[in]strPointer to the string buffer, containing configuration.

◆ cc_mqttsn_gw_config_pub_only_keep_alive()

unsigned cc_mqttsn_gw_config_pub_only_keep_alive ( CC_MqttsnConfigHandle  config)

Get keep alive period for publish only clients.

Default value is 60 seconds.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Keep alive period for publish only clients.

◆ cc_mqttsn_gw_config_read()

bool cc_mqttsn_gw_config_read ( CC_MqttsnConfigHandle  config,
const char *  filename 
)

Read configuration file.

Updates the default values with values read from the file.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
[in]filenamePath to the file.

◆ cc_mqttsn_gw_config_retry_count()

unsigned cc_mqttsn_gw_config_retry_count ( CC_MqttsnConfigHandle  config)

Get number of retry attempts.

Default value is 3.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Number of retry attempts

◆ cc_mqttsn_gw_config_retry_period()

unsigned cc_mqttsn_gw_config_retry_period ( CC_MqttsnConfigHandle  config)

Get retry period.

Default value is 10 seconds.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Retry period in seconds

◆ cc_mqttsn_gw_config_sleeping_client_msg_limit()

unsigned cc_mqttsn_gw_config_sleeping_client_msg_limit ( CC_MqttsnConfigHandle  config)

Get limit for max number of messages to accumulate for sleeping clients.

Default value is MAX_UINT seconds.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
Returns
Max number of accumulated messages for sleeping clients.

◆ cc_mqttsn_gw_config_topic_id_alloc_range()

void cc_mqttsn_gw_config_topic_id_alloc_range ( CC_MqttsnConfigHandle  config,
unsigned short *  min,
unsigned short *  max 
)

Get range of allowed topic IDs for allocation.

Default range is [1, 0xfffe]

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
[out]minMinimal allowed topic ID.
[out]maxMaximal allowed topic ID.

◆ cc_mqttsn_gw_config_values_count()

unsigned cc_mqttsn_gw_config_values_count ( CC_MqttsnConfigHandle  config,
const char *  key 
)

Get number of available configuration values for the provided key.

The key is the first word in the configuration line, and the value is rest of the string until the end of the line.

Parameters
[in]configHandle returned by cc_mqttsn_gw_config_alloc() function.
[in]keyKey string.

◆ cc_mqttsn_gw_free()

void cc_mqttsn_gw_free ( CC_MqttsnGatewayHandle  gw)

Free allocated Gateway object.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.

◆ cc_mqttsn_gw_get_advertise_period()

unsigned short cc_mqttsn_gw_get_advertise_period ( CC_MqttsnGatewayHandle  gw)

Get current configuration of the advertise period.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.

◆ cc_mqttsn_gw_get_id()

unsigned char cc_mqttsn_gw_get_id ( CC_MqttsnGatewayHandle  gw)

Get current configuration of the numeric gateway id.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.

◆ cc_mqttsn_gw_session_add_predefined_topic()

bool cc_mqttsn_gw_session_add_predefined_topic ( CC_MqttsnSessionHandle  session,
const char *  topic,
unsigned short  topicId 
)

Add predefined topic string and ID information.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]topicTopic string
[in]topicIdNumeric topic ID.
Returns
success/failure status

◆ cc_mqttsn_gw_session_alloc()

CC_MqttsnSessionHandle cc_mqttsn_gw_session_alloc ( void  )

Allocate Session object.

The returned handle need to be passed as first parameter to all relevant functions. Note that the Session object is dynamically allocated and needs to be freed using cc_mqttsn_gw_session_free() function.

Returns
Handler to the allocated Session object.

◆ cc_mqttsn_gw_session_data_from_broker()

unsigned cc_mqttsn_gw_session_data_from_broker ( CC_MqttsnSessionHandle  session,
const unsigned char *  buf,
unsigned  bufLen 
)

Provide data received from the broker for processing.

This call may cause invocation of some callbacks, such as request to cancel the currently running time measurement, send new message(s) and/or (re)start time measurement.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]bufPointer to the buffer of data to process.
[in]bufLenNumber of bytes in the data buffer.
Returns
Number of processed bytes.
Note
The function returns number of bytes that were actually consumed, and can be removed from the holding buffer.

◆ cc_mqttsn_gw_session_data_from_client()

unsigned cc_mqttsn_gw_session_data_from_client ( CC_MqttsnSessionHandle  session,
const unsigned char *  buf,
unsigned  bufLen 
)

Provide data received from the client for processing.

This call may cause invocation of some callbacks, such as request to cancel the currently running time measurement, send new message(s) and/or (re)start time measurement.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]bufPointer to the buffer of data to process.
[in]bufLenNumber of bytes in the data buffer.
Returns
Number of processed bytes.
Note
The function returns number of bytes that were actually consumed, and can be removed from the holding buffer.

◆ cc_mqttsn_gw_session_free()

void cc_mqttsn_gw_session_free ( CC_MqttsnSessionHandle  session)

Free allocated Session object.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_broker_connected()

bool cc_mqttsn_gw_session_get_broker_connected ( CC_MqttsnSessionHandle  session)

Get currently recorded broker connection status.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_default_client_id()

const char * cc_mqttsn_gw_session_get_default_client_id ( CC_MqttsnSessionHandle  session)

Get current default client ID configuration.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_id()

unsigned char cc_mqttsn_gw_session_get_id ( CC_MqttsnSessionHandle  session)

Get current gateway numeric ID configuration.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_pub_only_keep_alive()

unsigned cc_mqttsn_gw_session_get_pub_only_keep_alive ( CC_MqttsnSessionHandle  session)

Get current configuration of the default "keep alive" period for "publish only" clients.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_retry_count()

unsigned cc_mqttsn_gw_session_get_retry_count ( CC_MqttsnSessionHandle  session)

Get the current configuration of the retry count.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_retry_period()

unsigned cc_mqttsn_gw_session_get_retry_period ( CC_MqttsnSessionHandle  session)

Get the current configuration of the retry period.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_get_sleeping_client_msg_limit()

unsigned long long cc_mqttsn_gw_session_get_sleeping_client_msg_limit ( CC_MqttsnSessionHandle  session)

Get currenly configured limit to pending messages being accumulated for the sleeping client.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_set_auth_info_req_cb()

void cc_mqttsn_gw_session_set_auth_info_req_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionAuthInfoReqCb  cb,
void *  data 
)

Set the callback to be used to request authentication information for specific client.

This is an optional callback. It can be used when there is a need to provide authentication details (username/password) for specific clients.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_broker_connected()

void cc_mqttsn_gw_session_set_broker_connected ( CC_MqttsnSessionHandle  session,
bool  connected 
)

Notify the Session object about broker being connected / disconnected.

The report of broker being connected or disconnected must be performed only when the session's operation has been successfully started (see cc_mqttsn_gw_session_start()). Otherwise the call to this function gets ignored.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]connectedConnection status - true means connected, false disconnected.

◆ cc_mqttsn_gw_session_set_broker_reconnect_req_cb()

void cc_mqttsn_gw_session_set_broker_reconnect_req_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionBrokerReconnectReqCb  cb,
void *  data 
)

Set the callback to be invoked when the Session needs to close existing TCP/IP connection to the broker and open a new one.

This is a must have callback, without it the object can not be started (see cc_mqttsn_gw_session_start()).

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_cancel_tick_cb()

void cc_mqttsn_gw_session_set_cancel_tick_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionCancelTickReqCb  cb,
void *  data 
)

Set the callback to be invoked when previously requested time measurement needs to be cancelled.

This is a must have callback, without it the object can not be started (see cc_mqttsn_gw_session_start()).

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_client_connect_report_cb()

void cc_mqttsn_gw_session_set_client_connect_report_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionClientConnectReportCb  cb,
void *  data 
)

Set the callback to be invoked when MQTT-SN client is successfully connected to the broker.

This is an optional callback. It can be used when there is a need to provide client specific configuration, such as predefined topic IDs, valid only for specific client.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_default_client_id()

void cc_mqttsn_gw_session_set_default_client_id ( CC_MqttsnSessionHandle  session,
const char *  clientId 
)

Provide default client ID for clients that report empty one in their attempt to connect.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]clientIdDefault client ID string.

◆ cc_mqttsn_gw_session_set_error_report_cb()

void cc_mqttsn_gw_session_set_error_report_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionErrorReportCb  cb,
void *  data 
)

Set the callback to be used to report error messages detected by the session.

This is an optional callback.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_fwd_enc_session_created_cb()

void cc_mqttsn_gw_session_set_fwd_enc_session_created_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionFwdEncSessionCreatedCb  cb,
void *  data 
)

Set the callback to be invoked when the forwarding encapsulation session is detected and to notify application about such session creation.

When not set, the forwarding enapsulation messages will be ignored

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_fwd_enc_session_deleted_cb()

void cc_mqttsn_gw_session_set_fwd_enc_session_deleted_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionFwdEncSessionDeletedCb  cb,
void *  data 
)

Set the callback to be invoked when the forwarding encapsulation session is about to be deleted.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_id()

void cc_mqttsn_gw_session_set_id ( CC_MqttsnSessionHandle  session,
unsigned char  id 
)

Set gateway numeric ID to be reported when requested.

If not set, default value 0 is assumed.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]idGateway numeric ID.

◆ cc_mqttsn_gw_session_set_pub_only_keep_alive()

void cc_mqttsn_gw_session_set_pub_only_keep_alive ( CC_MqttsnSessionHandle  session,
unsigned  value 
)

Provide default "keep alive" period for "publish only" clients, that do not make an attempt to connect to the gateway.

MQTT-SN protocol allows "publish only" clients that don't make any attempt to connect to the gateway/broker and send all their messages with QoS=-1. In this case, the gateway must connect to the broker on behalf of the "publish only" client. Such connection attempt requires to specify "keep alive" period. Use this function to set the value.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]valueMax number of seconds between messages the "publish only" client is going to send.
Precondition
The provided value mustn't exceed 65535.

◆ cc_mqttsn_gw_session_set_retry_count()

void cc_mqttsn_gw_session_set_retry_count ( CC_MqttsnSessionHandle  session,
unsigned  value 
)

Set number of retry attempts to perform before abandoning attempt to send unacknowledged message.

Some messages, may require acknowledgement by the client and/or broker. The amount of retry attempts before abandoning the attempt to deliver the message may be specified using this function. The default value is 3.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]valueNumber of retry attempts.

◆ cc_mqttsn_gw_session_set_retry_period()

void cc_mqttsn_gw_session_set_retry_period ( CC_MqttsnSessionHandle  session,
unsigned  value 
)

Set retry period to wait between resending unacknowledged message to the client and/or broker.

Some messages, may require acknowledgement by the client and/or broker. 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]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]valueNumber of seconds to wait before making an attempt to resend.

◆ cc_mqttsn_gw_session_set_send_data_to_broker_cb()

void cc_mqttsn_gw_session_set_send_data_to_broker_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionBrokerSendDataReqCb  cb,
void *  data 
)

Set the callback to be invoked when new data needs to be sent to the broker.

This is a must have callback, without it the object can not be started (see cc_mqttsn_gw_session_start()).

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_send_data_to_client_cb()

void cc_mqttsn_gw_session_set_send_data_to_client_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionClientSendDataReqCb  cb,
void *  data 
)

Set the callback to be invoked when new data needs to be sent to the client.

This is a must have callback, without it the object can not be started (see cc_mqttsn_gw_session_start()).

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_sleeping_client_msg_limit()

void cc_mqttsn_gw_session_set_sleeping_client_msg_limit ( CC_MqttsnSessionHandle  session,
unsigned long long  value 
)

Provide limit to number pending messages being accumulated for the sleeping client.

When client is known to be in "ASLEEP" state, the gateway must accumulate all the messages the broker sends until client wakes up or explicitly requests to send them. This function may be used to limit amount of such messages to prevent acquiring lots of RAM by the gateway application.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]valueMax number of pending messages.

◆ cc_mqttsn_gw_session_set_term_req_cb()

void cc_mqttsn_gw_session_set_term_req_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionTermReqCb  cb,
void *  data 
)

Set the callback to be invoked when the Session needs to be terminated and the calling Session object deleted.

This is a must have callback, without it the object can not be started (see cc_mqttsn_gw_session_start()).

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_tick_req_cb()

void cc_mqttsn_gw_session_set_tick_req_cb ( CC_MqttsnSessionHandle  session,
CC_MqttsnSessionTickReqCb  cb,
void *  data 
)

Set the callback to be invoked when new time measurement is required.

This is a must have callback, without it the object can not be started (see cc_mqttsn_gw_session_start()).

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]cbPointer to callback function
[in]dataPointer to any user data, will be passed back as first parameter to the callback.

◆ cc_mqttsn_gw_session_set_topic_id_alloc_range()

bool cc_mqttsn_gw_session_set_topic_id_alloc_range ( CC_MqttsnSessionHandle  session,
unsigned short  minTopicId,
unsigned short  maxTopicId 
)

Limit range of topic IDs allocated for newly registered topics.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
[in]minTopicIdMin topic ID.
[in]maxTopicIdMax topic ID.
Returns
success/failure status

◆ cc_mqttsn_gw_session_start()

bool cc_mqttsn_gw_session_start ( CC_MqttsnSessionHandle  session)

Start the Session's object's operation.

The function will check whether all necessary callbacks have been set.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.
Returns
true if the operation has been successfully started, false in case some necessary callback hasn't been set.

◆ cc_mqttsn_gw_session_stop()

void cc_mqttsn_gw_session_stop ( CC_MqttsnSessionHandle  session)

Stop the operation of the Session object.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_session_tick()

void cc_mqttsn_gw_session_tick ( CC_MqttsnSessionHandle  session)

Notify the Session object about requested time period expiry.

This function needs to be called from the driving code after the requested time measurement has expired.

Parameters
[in]sessionHandle returned by cc_mqttsn_gw_session_alloc() function.

◆ cc_mqttsn_gw_set_advertise_broadcast_req_cb()

void cc_mqttsn_gw_set_advertise_broadcast_req_cb ( CC_MqttsnGatewayHandle  gw,
CC_MqttsnGwBroadcastReqCb  cb,
void *  data 
)

Set callback that requests to send serialised ADVERTISE message.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.
[in]cbPointer to callback function
[in]dataAny user data, to be passed as first parameter to the callback

◆ cc_mqttsn_gw_set_advertise_period()

void cc_mqttsn_gw_set_advertise_period ( CC_MqttsnGatewayHandle  gw,
unsigned short  value 
)

Set the advertise period.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.
[in]valueAdvertise period in seconds.

◆ cc_mqttsn_gw_set_id()

void cc_mqttsn_gw_set_id ( CC_MqttsnGatewayHandle  gw,
unsigned char  id 
)

Set the numeric gateway ID.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.
[in]idNumeric gateway ID.

◆ cc_mqttsn_gw_set_tick_req_cb()

void cc_mqttsn_gw_set_tick_req_cb ( CC_MqttsnGatewayHandle  gw,
CC_MqttsnGwTickReqCb  cb,
void *  data 
)

Set callback that requests to perform time measurement.

The Gateway object will invoke the callback to request time measurement. When requested time expires, the driving code is responsible to call cc_mqttsn_gw_tick().

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.
[in]cbPointer to callback function
[in]dataAny user data, to be passed as first parameter to the callback

◆ cc_mqttsn_gw_start()

bool cc_mqttsn_gw_start ( CC_MqttsnGatewayHandle  gw)

Start operation of the Gateway object.

The function check whether all callbacks and proper advertise period were set properly and start the operation if everything is in place. If start is successful, the callbacks of requesting data send as well as data measurement request will be invoked.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.
Returns
true if the operation was successfully started, false otherwise.

◆ cc_mqttsn_gw_stop()

void cc_mqttsn_gw_stop ( CC_MqttsnGatewayHandle  gw)

Stop operation of the Gateway object.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.

◆ cc_mqttsn_gw_tick()

void cc_mqttsn_gw_tick ( CC_MqttsnGatewayHandle  gw)

Notify the Gateway object about requested time expiry.

Invocation of this function will cause invocation of the send data request callback as well as new time measurement request.

Parameters
[in]gwHandle returned by cc_mqttsn_gw_alloc() function.