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

Classes

struct  CC_Mqtt5DisconnectConfig
 Configuration structure of the "disconnect" operation. More...
 

Typedefs

typedef struct CC_Mqtt5Disconnect * CC_Mqtt5DisconnectHandle
 Handle for "disconnect" operation.
 

Functions

CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect (CC_Mqtt5ClientHandle handle, const CC_Mqtt5DisconnectConfig *config)
 Prepare, configure, and send "disconnect" request in one go.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_add_user_prop (CC_Mqtt5DisconnectHandle handle, const CC_Mqtt5UserProp *prop)
 Add user property to the configuration of the "disconnect" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_cancel (CC_Mqtt5DisconnectHandle handle)
 Cancel the allocated "disconnect" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_config (CC_Mqtt5DisconnectHandle handle, const CC_Mqtt5DisconnectConfig *config)
 Perform configuration of the "disconnect" operation.
 
void cc_mqtt5_client_disconnect_init_config (CC_Mqtt5DisconnectConfig *config)
 Intialize the CC_Mqtt5DisconnectConfig configuration structure.
 
CC_Mqtt5DisconnectHandle cc_mqtt5_client_disconnect_prepare (CC_Mqtt5ClientHandle handle, CC_Mqtt5ErrorCode *ec)
 Prepare "disconnect" operation.
 
CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_send (CC_Mqtt5DisconnectHandle handle)
 Send the configured "disconnect" operation to broker.
 

Detailed Description

Typedef Documentation

◆ CC_Mqtt5DisconnectHandle

typedef struct CC_Mqtt5Disconnect* CC_Mqtt5DisconnectHandle

Handle for "disconnect" operation.

Returned by cc_mqtt5_client_disconnect_prepare() function.

Function Documentation

◆ cc_mqtt5_client_disconnect()

CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect ( CC_Mqtt5ClientHandle  handle,
const CC_Mqtt5DisconnectConfig config 
)

Prepare, configure, and send "disconnect" request in one go.

Abstracts away sequence of the following functions invocation:

Parameters
[in]handleHandle returned by cc_mqtt5_client_alloc() function.
[in]configConfiguration. Can be NULL.
Returns
Result code of the call.

◆ cc_mqtt5_client_disconnect_add_user_prop()

CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_add_user_prop ( CC_Mqtt5DisconnectHandle  handle,
const CC_Mqtt5UserProp prop 
)

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

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

CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_cancel ( CC_Mqtt5DisconnectHandle  handle)

Cancel the allocated "disconnect" operation.

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

CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_config ( CC_Mqtt5DisconnectHandle  handle,
const CC_Mqtt5DisconnectConfig config 
)

Perform configuration of the "disconnect" operation.

Parameters
[in]handleHandle returned by cc_mqtt5_client_disconnect_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 "disconnect" operation.
Postcondition
Some of the properties can get assigned regardless of the return value.

◆ cc_mqtt5_client_disconnect_init_config()

void cc_mqtt5_client_disconnect_init_config ( CC_Mqtt5DisconnectConfig config)

Intialize the CC_Mqtt5DisconnectConfig configuration structure.

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

◆ cc_mqtt5_client_disconnect_prepare()

CC_Mqtt5DisconnectHandle cc_mqtt5_client_disconnect_prepare ( CC_Mqtt5ClientHandle  handle,
CC_Mqtt5ErrorCode ec 
)

Prepare "disconnect" operation.

For successful operation the client needs to be in the "connected" state and there were no other prepared or complete "disconnect" operation since last "connect" operation.

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 "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_mqtt5_client_disconnect_send() or cc_mqtt5_client_disconnect_cancel() to prevent memory leaks.

◆ cc_mqtt5_client_disconnect_send()

CC_Mqtt5ErrorCode cc_mqtt5_client_disconnect_send ( CC_Mqtt5DisconnectHandle  handle)

Send the configured "disconnect" operation to broker.

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