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

Classes

struct  CC_MqttsnConnectConfig
 Configuration the "connect" operation. More...
 
struct  CC_MqttsnConnectInfo
 Information on the "connect" operation completion. More...
 
struct  CC_MqttsnWillConfig
 Configuration the will for "connect" and "will" operations. More...
 

Typedefs

typedef void(* CC_MqttsnConnectCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status, const CC_MqttsnConnectInfo *info)
 Callback used to report completion of the connect operation.
 
typedef struct CC_MqttsnConnect * CC_MqttsnConnectHandle
 Handle for "connect" operation.
 

Functions

CC_MqttsnErrorCode cc_mqttsn_client_connect (CC_MqttsnClientHandle client, const CC_MqttsnConnectConfig *config, const CC_MqttsnWillConfig *willConfig, CC_MqttsnConnectCompleteCb cb, void *cbData)
 Prepare and send "connect" request in one go.
 
CC_MqttsnErrorCode cc_mqttsn_client_connect_cancel (CC_MqttsnConnectHandle handle)
 Cancel the allocated "connect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_connect_config (CC_MqttsnConnectHandle handle, const CC_MqttsnConnectConfig *config)
 Perform configuration of the "connect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_connect_config_will (CC_MqttsnConnectHandle handle, const CC_MqttsnWillConfig *config)
 Perform will configuration of the "connect" operation.
 
unsigned cc_mqttsn_client_connect_get_retry_count (CC_MqttsnConnectHandle handle)
 Retrieve the configured retry count for the "connect" operation.
 
unsigned cc_mqttsn_client_connect_get_retry_period (CC_MqttsnConnectHandle handle)
 Retrieve the configured retry period for the "connect" operation.
 
void cc_mqttsn_client_connect_init_config (CC_MqttsnConnectConfig *config)
 Intialize the CC_MqttsnConnectConfig configuration structure.
 
void cc_mqttsn_client_connect_init_config_will (CC_MqttsnWillConfig *config)
 Intialize the CC_MqttsnWillConfig configuration structure.
 
CC_MqttsnConnectHandle cc_mqttsn_client_connect_prepare (CC_MqttsnClientHandle client, CC_MqttsnErrorCode *ec)
 Prepare "connect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_connect_send (CC_MqttsnConnectHandle handle, CC_MqttsnConnectCompleteCb cb, void *cbData)
 Send the "connect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_connect_set_retry_count (CC_MqttsnConnectHandle handle, unsigned count)
 Configure the retry count for the "connect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_connect_set_retry_period (CC_MqttsnConnectHandle handle, unsigned ms)
 Configure the retry period for the "connect" operation.
 
CC_MqttsnConnectionStatus cc_mqttsn_client_get_connection_status (CC_MqttsnClientHandle client)
 Check the inner state of the library of whether it's connected to the gateway.
 

Detailed Description

Typedef Documentation

◆ CC_MqttsnConnectCompleteCb

typedef void(* CC_MqttsnConnectCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status, const CC_MqttsnConnectInfo *info)

Callback used to report completion of the connect operation.

Parameters
[in]dataPointer to user data object, passed as the last parameter to the request call.
[in]statusStatus of the "connect" operation.
[in]infoInformation about op completion. Not-NULL is reported if and onfly if the "status" is equal to CC_MqttsnAsyncOpStatus_Complete.
Postcondition
The data members of the reported response can NOT be accessed after the function returns.

◆ CC_MqttsnConnectHandle

typedef struct CC_MqttsnConnect* CC_MqttsnConnectHandle

Handle for "connect" operation.

Returned by cc_mqttsn_client_connect_prepare() function.

Function Documentation

◆ cc_mqttsn_client_connect()

CC_MqttsnErrorCode cc_mqttsn_client_connect ( CC_MqttsnClientHandle  client,
const CC_MqttsnConnectConfig config,
const CC_MqttsnWillConfig willConfig,
CC_MqttsnConnectCompleteCb  cb,
void *  cbData 
)

Prepare and send "connect" request in one go.

Abstracts away sequence of the following functions invocation:

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]configConnection configuration. Can be NULL.
[in]willConfigWill configuration. Can be NULL.
[in]cbCallback to be invoked when "connect" operation is complete.
[in]cbDataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.
Returns
Result code of the call.

◆ cc_mqttsn_client_connect_cancel()

CC_MqttsnErrorCode cc_mqttsn_client_connect_cancel ( CC_MqttsnConnectHandle  handle)

Cancel the allocated "connect" operation.

In case the cc_mqttsn_client_connect_send() function was successfully called before, the operation is cancelled without callback invocation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
Returns
Result code of the call.
Postcondition
The handle of the "connect" operation is no longer valid and must be discarded.

◆ cc_mqttsn_client_connect_config()

CC_MqttsnErrorCode cc_mqttsn_client_connect_config ( CC_MqttsnConnectHandle  handle,
const CC_MqttsnConnectConfig config 
)

Perform configuration of the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
[in]configConfiguration structure. Must NOT be NULL. Does not need to be preserved after invocation.
Returns
Result code of the call.

◆ cc_mqttsn_client_connect_config_will()

CC_MqttsnErrorCode cc_mqttsn_client_connect_config_will ( CC_MqttsnConnectHandle  handle,
const CC_MqttsnWillConfig config 
)

Perform will configuration of the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
[in]configConfiguration structure. Must NOT be NULL. Does not need to be preserved after invocation.
Returns
Result code of the call.

◆ cc_mqttsn_client_connect_get_retry_count()

unsigned cc_mqttsn_client_connect_get_retry_count ( CC_MqttsnConnectHandle  handle)

Retrieve the configured retry count for the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
Returns
Number of retries.

◆ cc_mqttsn_client_connect_get_retry_period()

unsigned cc_mqttsn_client_connect_get_retry_period ( CC_MqttsnConnectHandle  handle)

Retrieve the configured retry period for the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
Returns
Retry period duration in milliseconds.

◆ cc_mqttsn_client_connect_init_config()

void cc_mqttsn_client_connect_init_config ( CC_MqttsnConnectConfig config)

Intialize the CC_MqttsnConnectConfig configuration structure.

Parameters
[out]configConfiguration structure. Must not be NULL.

◆ cc_mqttsn_client_connect_init_config_will()

void cc_mqttsn_client_connect_init_config_will ( CC_MqttsnWillConfig config)

Intialize the CC_MqttsnWillConfig configuration structure.

Parameters
[out]configConfiguration structure. Must not be NULL.

◆ cc_mqttsn_client_connect_prepare()

CC_MqttsnConnectHandle cc_mqttsn_client_connect_prepare ( CC_MqttsnClientHandle  client,
CC_MqttsnErrorCode ec 
)

Prepare "connect" operation.

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[out]ecError code reporting result of the operation. Can be NULL.
Returns
Handle of the "connect" operation, will be NULL in case of failure. To analyze the reason failure use "ec" output parameter.
Postcondition
The "connect" operation is allocated, use either cc_mqttsn_client_connect_send() or cc_mqttsn_client_connect_cancel() to prevent memory leaks.

◆ cc_mqttsn_client_connect_send()

CC_MqttsnErrorCode cc_mqttsn_client_connect_send ( CC_MqttsnConnectHandle  handle,
CC_MqttsnConnectCompleteCb  cb,
void *  cbData 
)

Send the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
[in]cbCallback to be invoked when "connect" operation is complete.
[in]cbDataPointer to any user data structure. It will passed as one of the parameters in callback invocation. May be NULL.
Returns
Result code of the call.
Postcondition
The handle of the "connect" operation can be discarded.
The provided callback will be invoked when the "connect" operation is complete if and only if the function returns CC_MqttsnErrorCode_Success.

◆ cc_mqttsn_client_connect_set_retry_count()

CC_MqttsnErrorCode cc_mqttsn_client_connect_set_retry_count ( CC_MqttsnConnectHandle  handle,
unsigned  count 
)

Configure the retry count for the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
[in]countNumber of retries.
Returns
Result code of the call.

◆ cc_mqttsn_client_connect_set_retry_period()

CC_MqttsnErrorCode cc_mqttsn_client_connect_set_retry_period ( CC_MqttsnConnectHandle  handle,
unsigned  ms 
)

Configure the retry period for the "connect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_connect_prepare() function.
[in]msRetry period in milliseconds.
Returns
Result code of the call.

◆ cc_mqttsn_client_get_connection_status()

CC_MqttsnConnectionStatus cc_mqttsn_client_get_connection_status ( CC_MqttsnClientHandle  client)

Check the inner state of the library of whether it's connected to the gateway.

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