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

Typedefs

typedef void(* CC_MqttsnDisconnectCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status)
 Callback used to report completion of the disconnect operation.
 
typedef struct CC_MqttsnDisconnect * CC_MqttsnDisconnectHandle
 Handle for "disconnect" operation.
 

Functions

CC_MqttsnErrorCode cc_mqttsn_client_disconnect (CC_MqttsnClientHandle client, CC_MqttsnDisconnectCompleteCb cb, void *cbData)
 Prepare and send "disconnect" request in one go.
 
CC_MqttsnErrorCode cc_mqttsn_client_disconnect_cancel (CC_MqttsnDisconnectHandle handle)
 Cancel the allocated "disconnect" operation.
 
unsigned cc_mqttsn_client_disconnect_get_retry_count (CC_MqttsnDisconnectHandle handle)
 Retrieve the configured retry count for the "disconnect" operation.
 
unsigned cc_mqttsn_client_disconnect_get_retry_period (CC_MqttsnDisconnectHandle handle)
 Retrieve the configured retry period for the "disconnect" operation.
 
CC_MqttsnDisconnectHandle cc_mqttsn_client_disconnect_prepare (CC_MqttsnClientHandle client, CC_MqttsnErrorCode *ec)
 Prepare "disconnect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_disconnect_send (CC_MqttsnDisconnectHandle handle, CC_MqttsnDisconnectCompleteCb cb, void *cbData)
 Send the "disconnect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_disconnect_set_retry_count (CC_MqttsnDisconnectHandle handle, unsigned count)
 Configure the retry count for the "disconnect" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_disconnect_set_retry_period (CC_MqttsnDisconnectHandle handle, unsigned ms)
 Configure the retry period for the "disconnect" operation.
 

Detailed Description

Typedef Documentation

◆ CC_MqttsnDisconnectCompleteCb

typedef void(* CC_MqttsnDisconnectCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status)

Callback used to report completion of the disconnect operation.

Parameters
[in]dataPointer to user data object, passed as the last parameter to the request call.
[in]statusStatus of the "disconnect" operation.
Postcondition
The data members of the reported response can NOT be accessed after the function returns.

◆ CC_MqttsnDisconnectHandle

typedef struct CC_MqttsnDisconnect* CC_MqttsnDisconnectHandle

Handle for "disconnect" operation.

Returned by cc_mqttsn_client_disconnect_prepare() function.

Function Documentation

◆ cc_mqttsn_client_disconnect()

CC_MqttsnErrorCode cc_mqttsn_client_disconnect ( CC_MqttsnClientHandle  client,
CC_MqttsnDisconnectCompleteCb  cb,
void *  cbData 
)

Prepare and send "disconnect" request in one go.

Abstracts away sequence of the following functions invocation:

Parameters
[in]clientHandle returned by cc_mqttsn_client_alloc() function.
[in]cbCallback to be invoked when "disconnect" 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_disconnect_cancel()

CC_MqttsnErrorCode cc_mqttsn_client_disconnect_cancel ( CC_MqttsnDisconnectHandle  handle)

Cancel the allocated "disconnect" operation.

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

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

◆ cc_mqttsn_client_disconnect_get_retry_count()

unsigned cc_mqttsn_client_disconnect_get_retry_count ( CC_MqttsnDisconnectHandle  handle)

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

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

◆ cc_mqttsn_client_disconnect_get_retry_period()

unsigned cc_mqttsn_client_disconnect_get_retry_period ( CC_MqttsnDisconnectHandle  handle)

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

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

◆ cc_mqttsn_client_disconnect_prepare()

CC_MqttsnDisconnectHandle cc_mqttsn_client_disconnect_prepare ( CC_MqttsnClientHandle  client,
CC_MqttsnErrorCode ec 
)

Prepare "disconnect" 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 "disconnect" operation, will be NULL in case of failure. To analyze the reason failure use "ec" output parameter.
Postcondition
The "disconnect" operation is allocated, use either cc_mqttsn_client_disconnect_send() or cc_mqttsn_client_disconnect_cancel() to prevent memory leaks.

◆ cc_mqttsn_client_disconnect_send()

CC_MqttsnErrorCode cc_mqttsn_client_disconnect_send ( CC_MqttsnDisconnectHandle  handle,
CC_MqttsnDisconnectCompleteCb  cb,
void *  cbData 
)

Send the "disconnect" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_disconnect_prepare() function.
[in]cbCallback to be invoked when "disconnect" 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 "disconnect" operation can be discarded.
The provided callback will be invoked when the "disconnect" operation is complete if and only if the function returns CC_MqttsnErrorCode_Success.

◆ cc_mqttsn_client_disconnect_set_retry_count()

CC_MqttsnErrorCode cc_mqttsn_client_disconnect_set_retry_count ( CC_MqttsnDisconnectHandle  handle,
unsigned  count 
)

Configure the retry count for the "disconnect" operation.

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

◆ cc_mqttsn_client_disconnect_set_retry_period()

CC_MqttsnErrorCode cc_mqttsn_client_disconnect_set_retry_period ( CC_MqttsnDisconnectHandle  handle,
unsigned  ms 
)

Configure the retry period for the "disconnect" operation.

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