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

Classes

struct  CC_MqttsnGatewayInfo
 Gateway information. More...
 

Typedefs

typedef void(* CC_MqttsnSearchCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status, const CC_MqttsnGatewayInfo *info)
 Callback used to report completion of the asynchronous operation.
 
typedef struct CC_MqttsnSearch * CC_MqttsnSearchHandle
 Handle for "search" operation.
 

Functions

CC_MqttsnErrorCode cc_mqttsn_client_search (CC_MqttsnClientHandle handle, CC_MqttsnSearchCompleteCb cb, void *cbData)
 Prepare and send "search" request in one go.
 
CC_MqttsnErrorCode cc_mqttsn_client_search_cancel (CC_MqttsnSearchHandle handle)
 Cancel the allocated "search" operation.
 
unsigned cc_mqttsn_client_search_get_broadcast_radius (CC_MqttsnSearchHandle handle)
 Retrieve the configured broadcast radius for the "search" operation.
 
unsigned cc_mqttsn_client_search_get_retry_count (CC_MqttsnSearchHandle handle)
 Retrieve the configured retry count for the "search" operation.
 
unsigned cc_mqttsn_client_search_get_retry_period (CC_MqttsnSearchHandle handle)
 Retrieve the configured retry period for the "search" operation.
 
CC_MqttsnSearchHandle cc_mqttsn_client_search_prepare (CC_MqttsnClientHandle client, CC_MqttsnErrorCode *ec)
 Prepare "search" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_search_send (CC_MqttsnSearchHandle handle, CC_MqttsnSearchCompleteCb cb, void *cbData)
 Send the "search" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_search_set_broadcast_radius (CC_MqttsnSearchHandle handle, unsigned broadcastRadius)
 Configure the broadcast radius for the "search" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_search_set_retry_count (CC_MqttsnSearchHandle handle, unsigned count)
 Configure the retry count for the "search" operation.
 
CC_MqttsnErrorCode cc_mqttsn_client_search_set_retry_period (CC_MqttsnSearchHandle handle, unsigned ms)
 Configure the retry period for the "search" operation.
 

Detailed Description

Typedef Documentation

◆ CC_MqttsnSearchCompleteCb

typedef void(* CC_MqttsnSearchCompleteCb) (void *data, CC_MqttsnAsyncOpStatus status, const CC_MqttsnGatewayInfo *info)

Callback used to report completion of the asynchronous operation.

Parameters
[in]dataPointer to user data object, passed as the last parameter to the request call.
[in]statusStatus of the asynchronous operation.
[in]infoDiscovered gateway information. Not NULL if and only if status is CC_MqttsnAsyncOpStatus_Complete.

◆ CC_MqttsnSearchHandle

typedef struct CC_MqttsnSearch* CC_MqttsnSearchHandle

Handle for "search" operation.

Returned by cc_mqttsn_client_search_prepare() function.

Function Documentation

◆ cc_mqttsn_client_search()

CC_MqttsnErrorCode cc_mqttsn_client_search ( CC_MqttsnClientHandle  handle,
CC_MqttsnSearchCompleteCb  cb,
void *  cbData 
)

Prepare and send "search" request in one go.

Abstracts away sequence of the following functions invocation:

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

CC_MqttsnErrorCode cc_mqttsn_client_search_cancel ( CC_MqttsnSearchHandle  handle)

Cancel the allocated "search" operation.

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

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

◆ cc_mqttsn_client_search_get_broadcast_radius()

unsigned cc_mqttsn_client_search_get_broadcast_radius ( CC_MqttsnSearchHandle  handle)

Retrieve the configured broadcast radius for the "search" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_search_prepare() function.
Returns
Broadcast radius.

◆ cc_mqttsn_client_search_get_retry_count()

unsigned cc_mqttsn_client_search_get_retry_count ( CC_MqttsnSearchHandle  handle)

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

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

◆ cc_mqttsn_client_search_get_retry_period()

unsigned cc_mqttsn_client_search_get_retry_period ( CC_MqttsnSearchHandle  handle)

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

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

◆ cc_mqttsn_client_search_prepare()

CC_MqttsnSearchHandle cc_mqttsn_client_search_prepare ( CC_MqttsnClientHandle  client,
CC_MqttsnErrorCode ec 
)

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

◆ cc_mqttsn_client_search_send()

CC_MqttsnErrorCode cc_mqttsn_client_search_send ( CC_MqttsnSearchHandle  handle,
CC_MqttsnSearchCompleteCb  cb,
void *  cbData 
)

Send the "search" operation.

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

◆ cc_mqttsn_client_search_set_broadcast_radius()

CC_MqttsnErrorCode cc_mqttsn_client_search_set_broadcast_radius ( CC_MqttsnSearchHandle  handle,
unsigned  broadcastRadius 
)

Configure the broadcast radius for the "search" operation.

Parameters
[in]handleHandle returned by cc_mqttsn_client_search_prepare() function.
[in]broadcastRadiusBroadcast radius.
Returns
Result code of the call.

◆ cc_mqttsn_client_search_set_retry_count()

CC_MqttsnErrorCode cc_mqttsn_client_search_set_retry_count ( CC_MqttsnSearchHandle  handle,
unsigned  count 
)

Configure the retry count for the "search" operation.

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

◆ cc_mqttsn_client_search_set_retry_period()

CC_MqttsnErrorCode cc_mqttsn_client_search_set_retry_period ( CC_MqttsnSearchHandle  handle,
unsigned  ms 
)

Configure the retry period for the "search" operation.

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