CommsChampion Ecosystem MQTT v5 Client
MQTT v5 Client Library.
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
"Subscribe Operation Data Type and Functions"

Classes

struct  CC_Mqtt5SubscribeExtraConfig
 Extra subscription properties configuration structure. More...
 
struct  CC_Mqtt5SubscribeResponse
 Response information from broker to "subscribe" request. More...
 
struct  CC_Mqtt5SubscribeTopicConfig
 Topic filter configuration structure of the "subscribe" operation. More...
 

Typedefs

typedef void(* CC_Mqtt5SubscribeCompleteCb) (void *data, CC_Mqtt5SubscribeHandle handle, CC_Mqtt5AsyncOpStatus status, const CC_Mqtt5SubscribeResponse *response)
 Callback used to report completion of the "subscribe" operation.
 
typedef struct CC_Mqtt5Subscribe * CC_Mqtt5SubscribeHandle
 Handle for "subscribe" operation.
 

Enumerations

enum  CC_Mqtt5RetainHandling { CC_Mqtt5RetainHandling_Send = 0 , CC_Mqtt5RetainHandling_SendIfDoesNotExist = 1 , CC_Mqtt5RetainHandling_DoNotSend = 2 , CC_Mqtt5RetainHandling_ValuesLimit }
 "Retain Handling" option as defined by the MQTT v5 specification. More...
 

Functions

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_add_user_prop (CC_Mqtt5SubscribeHandle handle, const CC_Mqtt5UserProp *prop)
 Add user property to the configuration of the "subscribe" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_cancel (CC_Mqtt5SubscribeHandle handle)
 Cancel the allocated "subscribe" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_config_extra (CC_Mqtt5SubscribeHandle handle, const CC_Mqtt5SubscribeExtraConfig *config)
 Perform extra properties configuration of the "subscribe" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_config_topic (CC_Mqtt5SubscribeHandle handle, const CC_Mqtt5SubscribeTopicConfig *config)
 Add topic configuration of the "subscribe" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_full (CC_Mqtt5ClientHandle handle, const CC_Mqtt5SubscribeTopicConfig *topicConfigs, unsigned topicConfigsCount, const CC_Mqtt5SubscribeExtraConfig *extraConfig, CC_Mqtt5SubscribeCompleteCb cb, void *cbData)
 Prepare, configure, and send "subscribe" request in one go (full version)
 
unsigned cc_mqtt5_client_subscribe_get_response_timeout (CC_Mqtt5SubscribeHandle handle)
 Retrieve the configured the broker response timeout for the "subscribe" operation.
 
void cc_mqtt5_client_subscribe_init_config_extra (CC_Mqtt5SubscribeExtraConfig *config)
 Intialize the CC_Mqtt5SubscribeExtraConfig configuration structure.
 
void cc_mqtt5_client_subscribe_init_config_topic (CC_Mqtt5SubscribeTopicConfig *config)
 Intialize the CC_Mqtt5SubscribeTopicConfig configuration structure.
 
CC_Mqtt5SubscribeHandle cc_mqtt5_client_subscribe_prepare (CC_Mqtt5ClientHandle handle, CC_Mqtt5ErrorCode *ec)
 Prepare "subscribe" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_send (CC_Mqtt5SubscribeHandle handle, CC_Mqtt5SubscribeCompleteCb cb, void *cbData)
 Send the configured "subscribe" operation to broker.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_set_response_timeout (CC_Mqtt5SubscribeHandle handle, unsigned ms)
 Configure the broker response timeout for the "subscribe" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_simple (CC_Mqtt5ClientHandle handle, const CC_Mqtt5SubscribeTopicConfig *topicConfig, CC_Mqtt5SubscribeCompleteCb cb, void *cbData)
 Prepare, configure, and send "subscribe" request in one go (simple version)
 

Detailed Description

Typedef Documentation

◆ CC_Mqtt5SubscribeCompleteCb

typedef void(* CC_Mqtt5SubscribeCompleteCb) (void *data, CC_Mqtt5SubscribeHandle handle, CC_Mqtt5AsyncOpStatus status, const CC_Mqtt5SubscribeResponse *response)

Callback used to report completion of the "subscribe" operation.

Parameters
[in]dataPointer to user data object passed as last parameter to the cc_mqtt5_client_subscribe_send().
[in]handleHandle returned by cc_mqtt5_client_subscribe_prepare() function. When the callback is invoked the handle is already invalid and cannot be used in any relevant function invocation, but it allows end application to identify the original "subscribe" operation and use the same callback function in parallel requests.
[in]statusStatus of the "subscribe" operation.
[in]responseResponse information from the broker. Not-NULL is reported if and onfly if the "status" is equal to CC_Mqtt5AsyncOpStatus_Complete.
Postcondition
The data members of the reported response can NOT be accessed after the function returns.

◆ CC_Mqtt5SubscribeHandle

typedef struct CC_Mqtt5Subscribe* CC_Mqtt5SubscribeHandle

Handle for "subscribe" operation.

Returned by cc_mqtt5_client_subscribe_prepare() function.

Enumeration Type Documentation

◆ CC_Mqtt5RetainHandling

"Retain Handling" option as defined by the MQTT v5 specification.

It is used during the "subscribe" operation topic configuration.

Enumerator
CC_Mqtt5RetainHandling_Send 

Send retained messages at the time of the subscribe.

CC_Mqtt5RetainHandling_SendIfDoesNotExist 

Send retained messages at subscribe only if the subscription does not currently exist.

CC_Mqtt5RetainHandling_DoNotSend 

Do not send retained messages at the time of the subscribe.

CC_Mqtt5RetainHandling_ValuesLimit 

Limit for the values.

Function Documentation

◆ cc_mqtt5_client_subscribe_add_user_prop()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_add_user_prop ( CC_Mqtt5SubscribeHandle  handle,
const CC_Mqtt5UserProp prop 
)

Add user property to the configuration of the "subscribe" operation.

Parameters
[in]handleHandle returned by cc_mqtt5_client_subscribe_prepare() function.
[in]propSingle user property info. Must NOT be NULL. Does not need to be preserved after invocation.
Returns
Result code of the call.

◆ cc_mqtt5_client_subscribe_cancel()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_cancel ( CC_Mqtt5SubscribeHandle  handle)

Cancel the allocated "subscribe" operation.

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

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

◆ cc_mqtt5_client_subscribe_config_extra()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_config_extra ( CC_Mqtt5SubscribeHandle  handle,
const CC_Mqtt5SubscribeExtraConfig config 
)

Perform extra properties configuration of the "subscribe" operation.

Parameters
[in]handleHandle returned by cc_mqtt5_client_subscribe_prepare() function.
[in]configExtra properties configuration structure. Must NOT be NULL. Does not need to be preserved after invocation.
Returns
Result code of the call.
Precondition
Mustn't be called more than once for a single "subscribe" operation.

◆ cc_mqtt5_client_subscribe_config_topic()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_config_topic ( CC_Mqtt5SubscribeHandle  handle,
const CC_Mqtt5SubscribeTopicConfig config 
)

Add topic configuration of the "subscribe" operation.

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

◆ cc_mqtt5_client_subscribe_full()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_full ( CC_Mqtt5ClientHandle  handle,
const CC_Mqtt5SubscribeTopicConfig topicConfigs,
unsigned  topicConfigsCount,
const CC_Mqtt5SubscribeExtraConfig extraConfig,
CC_Mqtt5SubscribeCompleteCb  cb,
void *  cbData 
)

Prepare, configure, and send "subscribe" request in one go (full version)

Abstracts away sequence of the following functions invocation:

Parameters
[in]handleHandle returned by cc_mqtt5_client_alloc() function.
[in]topicConfigsPointer to array of the topic configurations.
[in]topicConfigsCountAmount of the topic configurations in the array.
[in]extraConfigExtra configuration. Can be NULL.
[in]cbCallback to be invoked when "subscribe" 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_mqtt5_client_subscribe_get_response_timeout()

unsigned cc_mqtt5_client_subscribe_get_response_timeout ( CC_Mqtt5SubscribeHandle  handle)

Retrieve the configured the broker response timeout for the "subscribe" operation.

Parameters
[in]handleHandle returned by cc_mqtt5_client_subscribe_prepare() function.
Returns
Response timeout duration in milliseconds.

◆ cc_mqtt5_client_subscribe_init_config_extra()

void cc_mqtt5_client_subscribe_init_config_extra ( CC_Mqtt5SubscribeExtraConfig config)

Intialize the CC_Mqtt5SubscribeExtraConfig configuration structure.

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

◆ cc_mqtt5_client_subscribe_init_config_topic()

void cc_mqtt5_client_subscribe_init_config_topic ( CC_Mqtt5SubscribeTopicConfig config)

Intialize the CC_Mqtt5SubscribeTopicConfig configuration structure.

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

◆ cc_mqtt5_client_subscribe_prepare()

CC_Mqtt5SubscribeHandle cc_mqtt5_client_subscribe_prepare ( CC_Mqtt5ClientHandle  handle,
CC_Mqtt5ErrorCode ec 
)

Prepare "subscribe" operation.

For successful operation the client needs to be in the "connected" state.

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

◆ cc_mqtt5_client_subscribe_send()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_send ( CC_Mqtt5SubscribeHandle  handle,
CC_Mqtt5SubscribeCompleteCb  cb,
void *  cbData 
)

Send the configured "subscribe" operation to broker.

Parameters
[in]handleHandle returned by cc_mqtt5_client_subscribe_prepare() function.
[in]cbCallback to be invoked when "subscribe" 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.
Precondition
At least one topic has been configured using cc_mqtt5_client_subscribe_config_topic.
Postcondition
The handle of the "subscribe" operation can be discarded.
The provided callback will be invoked when the "subscribe" operation is complete if and only if the function returns CC_Mqtt5ErrorCode_Success.

◆ cc_mqtt5_client_subscribe_set_response_timeout()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_set_response_timeout ( CC_Mqtt5SubscribeHandle  handle,
unsigned  ms 
)

Configure the broker response timeout for the "subscribe" operation.

Parameters
[in]handleHandle returned by cc_mqtt5_client_subscribe_prepare() function.
[in]msResponse timeout duration in milliseconds.
Returns
Result code of the call.

◆ cc_mqtt5_client_subscribe_simple()

CC_Mqtt5ErrorCode cc_mqtt5_client_subscribe_simple ( CC_Mqtt5ClientHandle  handle,
const CC_Mqtt5SubscribeTopicConfig topicConfig,
CC_Mqtt5SubscribeCompleteCb  cb,
void *  cbData 
)

Prepare, configure, and send "subscribe" request in one go (simple version)

Abstracts away sequence of the following functions invocation:

Parameters
[in]handleHandle returned by cc_mqtt5_client_alloc() function.
[in]topicConfigTopic configuration. Can be NULL.
[in]cbCallback to be invoked when "subscribe" 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.