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

Classes

struct  CC_MqttsnSleepConfig
 Configuration the "sleep" operation. More...
 

Typedefs

typedef void(* CC_MqttsnSleepCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status)
 Callback used to report completion of the sleep operation.
 
typedef struct CC_MqttsnSleep * CC_MqttsnSleepHandle
 Handle for "sleep" operation.
 

Functions

CC_MqttsnErrorCode cc_mqttsn_client_sleep (CC_MqttsnClientHandle client, const CC_MqttsnSleepConfig *config, CC_MqttsnSleepCompleteCb cb, void *cbData)
 Prepare and send "sleep" request in one go.
 
CC_MqttsnErrorCode cc_mqttsn_client_sleep_cancel (CC_MqttsnSleepHandle handle)
 Cancel the allocated "sleep" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_sleep_config (CC_MqttsnSleepHandle handle, const CC_MqttsnSleepConfig *config)
 Perform configuration of the "sleep" operation.
 
unsigned cc_mqttsn_client_sleep_get_retry_count (CC_MqttsnSleepHandle handle)
 Retrieve the configured retry count for the "sleep" operation.
 
unsigned cc_mqttsn_client_sleep_get_retry_period (CC_MqttsnSleepHandle handle)
 Retrieve the configured retry period for the "sleep" operation.
 
void cc_mqttsn_client_sleep_init_config (CC_MqttsnSleepConfig *config)
 Intialize the CC_MqttsnSleepConfig configuration structure.
 
CC_MqttsnSleepHandle cc_mqttsn_client_sleep_prepare (CC_MqttsnClientHandle client, CC_MqttsnErrorCode *ec)
 Prepare "sleep" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_sleep_send (CC_MqttsnSleepHandle handle, CC_MqttsnSleepCompleteCb cb, void *cbData)
 Send the "sleep" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_sleep_set_retry_count (CC_MqttsnSleepHandle handle, unsigned count)
 Configure the retry count for the "sleep" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_sleep_set_retry_period (CC_MqttsnSleepHandle handle, unsigned ms)
 Configure the retry period for the "sleep" operation.
 

Detailed Description

Typedef Documentation

◆ CC_MqttsnSleepCompleteCb

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

Callback used to report completion of the sleep operation.

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

◆ CC_MqttsnSleepHandle

typedef struct CC_MqttsnSleep* CC_MqttsnSleepHandle

Handle for "sleep" operation.

Returned by cc_mqttsn_client_sleep_prepare() function.

Function Documentation

◆ cc_mqttsn_client_sleep()

CC_MqttsnErrorCode cc_mqttsn_client_sleep ( CC_MqttsnClientHandle  client,
const CC_MqttsnSleepConfig config,
CC_MqttsnSleepCompleteCb  cb,
void *  cbData 
)

Prepare and send "sleep" request in one go.

Abstracts away sequence of the following functions invocation:

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

CC_MqttsnErrorCode cc_mqttsn_client_sleep_cancel ( CC_MqttsnSleepHandle  handle)

Cancel the allocated "sleep" operation.

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

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

◆ cc_mqttsn_client_sleep_config()

CC_MqttsnErrorCode cc_mqttsn_client_sleep_config ( CC_MqttsnSleepHandle  handle,
const CC_MqttsnSleepConfig config 
)

Perform configuration of the "sleep" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_sleep_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_sleep_get_retry_count()

unsigned cc_mqttsn_client_sleep_get_retry_count ( CC_MqttsnSleepHandle  handle)

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

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

◆ cc_mqttsn_client_sleep_get_retry_period()

unsigned cc_mqttsn_client_sleep_get_retry_period ( CC_MqttsnSleepHandle  handle)

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

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

◆ cc_mqttsn_client_sleep_init_config()

void cc_mqttsn_client_sleep_init_config ( CC_MqttsnSleepConfig config)

Intialize the CC_MqttsnSleepConfig configuration structure.

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

◆ cc_mqttsn_client_sleep_prepare()

CC_MqttsnSleepHandle cc_mqttsn_client_sleep_prepare ( CC_MqttsnClientHandle  client,
CC_MqttsnErrorCode ec 
)

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

◆ cc_mqttsn_client_sleep_send()

CC_MqttsnErrorCode cc_mqttsn_client_sleep_send ( CC_MqttsnSleepHandle  handle,
CC_MqttsnSleepCompleteCb  cb,
void *  cbData 
)

Send the "sleep" operation.

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

◆ cc_mqttsn_client_sleep_set_retry_count()

CC_MqttsnErrorCode cc_mqttsn_client_sleep_set_retry_count ( CC_MqttsnSleepHandle  handle,
unsigned  count 
)

Configure the retry count for the "sleep" operation.

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

◆ cc_mqttsn_client_sleep_set_retry_period()

CC_MqttsnErrorCode cc_mqttsn_client_sleep_set_retry_period ( CC_MqttsnSleepHandle  handle,
unsigned  ms 
)

Configure the retry period for the "sleep" operation.

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