kmMqtt 0.0.1
MQTT Client Library
Loading...
Searching...
No Matches
kmMqtt::MqttClientOptions Struct Reference

Options for configuring the MQTT client behavior. More...

#include <MqttClientOptions.h>

Public Member Functions

MqttClientOptions & tickMode (TickMode mode)
 Set the tick mode for the MQTT client.
MqttClientOptions & callbackDispatcher (const std::shared_ptr< ICallbackDispatcher > &callbackDispatcher)
 Set a custom callback dispatcher for handling MQTT client callbacks.
TickMode getTickMode () const
 Get the current tick mode of the MQTT client.
std::shared_ptr< ICallbackDispatchergetCallbackDispatcher () const
 Get the current callback dispatcher used by the MQTT client.
bool isUsingInternalCallbackDeferrer () const
 Check if the internal callback deferrer is being used.

Detailed Description

Options for configuring the MQTT client behavior.

Member Function Documentation

◆ callbackDispatcher()

MqttClientOptions & kmMqtt::MqttClientOptions::callbackDispatcher ( const std::shared_ptr< ICallbackDispatcher > & callbackDispatcher)
inline

Set a custom callback dispatcher for handling MQTT client callbacks.

Works with both async and sync tick modes. If no dispatcher is provided, the default dispatcher will be used.

In ASYNC tick mode, if DefaultDispatcher is provided or no dispatcher is provided, ImmediateDispatcher will be used instead.

In SYNC tick mode, if DefaultDispatcher is provided or no dispatcher is provided, DefaultDispatcher will be used which is dependent on the user calling tick() to process callbacks.

Parameters
callbackDispatcherThe custom callback dispatcher to use.
Returns
Reference to the updated MqttClientOptions object.

◆ getCallbackDispatcher()

std::shared_ptr< ICallbackDispatcher > kmMqtt::MqttClientOptions::getCallbackDispatcher ( ) const
inline

Get the current callback dispatcher used by the MQTT client.

Returns
Shared pointer to the ICallbackDispatcher instance.

◆ getTickMode()

TickMode kmMqtt::MqttClientOptions::getTickMode ( ) const
inline

Get the current tick mode of the MQTT client.

Returns
The current TickMode.

◆ isUsingInternalCallbackDeferrer()

bool kmMqtt::MqttClientOptions::isUsingInternalCallbackDeferrer ( ) const
inline

Check if the internal callback deferrer is being used.

Returns
true if the internal callback deferrer is used, false otherwise.

◆ tickMode()

MqttClientOptions & kmMqtt::MqttClientOptions::tickMode ( TickMode mode)
inline

Set the tick mode for the MQTT client.

The tick mode determines how the client processes incoming messages and events. The ASYNC mode runs the tick function in a separate thread, while the SYNC mode requires the user to call the tick function manually in their application loop.

Parameters
modeThe desired tick mode (ASYNC or SYNC). Default is ASYNC.
Returns
Reference to the updated MqttClientOptions object.

The documentation for this struct was generated from the following file: