NetBurner 3.5.6
PDF Version
MQTT::ConfiguredClient Class Reference

Easy MQTT Client wrapper for interacting with MQTT brokers. The client handles all network communications with the Broker and handles local message queueing and dispatching to topic handlers. Adds ConfigObj for automatically configuring all Client settings via the Config System. More...

#include <mqtt.h>

Inherits config_MqttClient, and MQTT::Client.

Public Member Functions

 ConfiguredClient (config_obj &owner=sys, const char *name=NULL, const char *desc="Mqtt client connection configuration", RequestProperty *addProps=NULL, bool ConnectOnStartup=true)
 ConfiguredClient constructor.
 
- Public Member Functions inherited from MQTT::Client
 Client (const char *brokerURI, const char *pClientId, uint16_t maxKeepAlive=MQTT_DEFAULT_KEEP_ALIVE, bool bCleanStart=true, PublishRequest *lwtMsg=NULL, const char *pConnMsg=NULL, const char *pDisconnMsg=NULL, const char *pUsername=NULL, const char *pPassword=NULL, RequestProperty *addProps=NULL, bool ConnectOnStartup=true)
 Constructor. This version takes a raw string for the broker URI.
 
 Client (const ParsedURI *brokerURI, const char *pClientId, uint16_t maxKeepAlive=MQTT_DEFAULT_KEEP_ALIVE, bool bCleanStart=true, PublishRequest *lwtMsg=NULL, const char *pConnMsg=NULL, const char *pDisconnMsg=NULL, const char *pUsername=NULL, const char *pPassword=NULL, RequestProperty *addProps=NULL, bool ConnectOnStartup=true)
 Constructor. This version takes a ParsedURI object for the broker URI.
 
int Connect (bool bWaitForConnection, const char *pNewBrokerURI, ConnAckCb_t notifyCb=NULL, void *notifyCtx=NULL)
 Begin the process of Connecting the client to the Broker.
 
int Connect (bool bWaitForConnection=true, const ParsedURI *pNewBrokerURI=NULL, ConnAckCb_t notifyCb=NULL, void *notifyCtx=NULL)
 Begin the process of Connecting the client to the Broker.
 
int Disconnect ()
 Disconnect the Client from the Broker.
 
void SetConnectNotify (ConnAckCb_t notifyCb, void *notifyCtx)
 Set the connection notification callback and it's context information.
 
int SetRateLimit (eRateLimitType type, uint8_t bucketMax, uint8_t fillCount, uint8_t fillTicks, eRateLimitAdjustMethod adjMethod, uint8_t adjCount)
 Set the value for a given rate limit.
 
int SetRateLimit_Publish (int reqPerSecond)
 Set the Publish rate limit. This method automatically determines the fillCount and fillTicks to use for refilling the credit bucket.
 
int SetRateLimit_Subscribe (int reqPerSecond)
 Set the Subscribe rate limit. This method automatically determines the fillCount and fillTicks to use for refilling the credit bucket.
 
eConnectionStatus GetConnectionStatus ()
 Get the current state of the Client's connection to the Broker.
 
void SetClientCert (uint8_t *cert, uint32_t len, uint8_t *privkey, uint32_t privlen)
 Set the Client Certificate and Private Key to use when connecting to a Broker via TLS.
 
void GetClientCert (uint8_t **cert, uint32_t *len, uint8_t **privkey, uint32_t *privlen)
 Set the Client Certificate and Private Key to use when connecting to a Broker via TLS.
 
int QueuePublish (mqtt_leaf &leaf)
 Queue an MqttObj to be published.
 
int QueueSubscribe (mqtt_leaf &leaf)
 Queue an MqttObj to subscribe.
 
int QueueUnsubscribe (mqtt_leaf &leaf)
 Queue an MqttObj to unsubscribe.
 
int QueueAllSubscriptions ()
 Queue all Client's registered MqttObjs to be subscribed and published according to the object's operation flags.
 
int Publish (const char *topic, uint8_t *pData, uint32_t len, int prio, TickTimeout &t, uint8_t qos=0)
 Publish a binary payload message.
 
int Publish (const char *topic, const char *pStr, int prio, TickTimeout &t, uint8_t qos=0)
 Publish a message.
 
int Publish (PublishRequest *req, int prio, TickTimeout &t)
 Publish a fully defined request.
 
int QueuePublish (PublishRequest *req, int *prio)
 Queue a publish message from a fully defined request.
 
int Subscribe (TopicHandler &handler, int *handlerIdx, TickTimeout &t, uint8_t subOpts=Pkt::eSubOpt_NoLocal)
 Register a TopicHandler and subscribe its Topic on the Broker.
 
int Subscribe (SubscribeRequest *req, int *handlerIdx, TickTimeout &t)
 Register a TopicHandler (via fully specified SubscribeRequest) and subscribe its Topic on the Broker.
 
int QueueSubscribe (SubUnsubQueueMsg *qmsg)
 Register a TopicHandler and subscribe its Topic on the Broker.
 
int Unsubscribe (int handlerIdx, TickTimeout &t, const char *topicFilter=NULL)
 Unsubscribe and deregister a TopicHandler.
 
int Unsubscribe (const char *topicFilter, TickTimeout &t)
 Unsubscribe and deregister a TopicHandler.
 
int QueueUnsubscribe (SubUnsubQueueMsg *qmsg)
 Queue unsubscribing and deregistering a TopicHandler.
 
int RegisterTopicHandler (TopicHandler *newHandler, int *handlerIdx)
 Register a TopicHandler with the Client.
 
int RemoveTopicHandler (TopicHandler *handler)
 Remove/deregister a TopicHandler from the Client by reference.
 
int RemoveTopicHandler (int handlerIdx)
 Remove/deregister a TopicHandler from the Client by index.
 
void RegisterMqttObj (mqtt_leaf &leaf, uint32_t interval=0)
 Register an MqttObj with the Client.
 
void RemoveObj (mqtt_leaf &leaf)
 Deregister/remove an MqttObj from the Client.
 
int SendNextPubReq ()
 Send the next queued Publish Request.
 
int SendNextSubReq ()
 Send the next queued SubUnSub Request.
 

Additional Inherited Members

- Public Types inherited from MQTT::Client
enum  eSessionLimit {
  eLimit_Size_Tx , eLimit_Size_Rx , eLimit_InFlight_Tx , eLimit_InFlight_Rx ,
  eLimit_Subscriptions , eLimit_SubAliases , eLimit_PublishAliases , eLimit_QoS ,
  eLimit_SessionExpirary
}
 Limit types for the Client interactions with the Broker. More...
 
enum  eRateLimitType { eRateLimit_Publish , eRateLimit_Subscribe }
 Rate limit types for Client messaging. More...
 
enum  eRateLimitAdjustMethod { eRateLimitAdj_None , eRateLimitAdj_Set , eRateLimitAdj_Add , eRateLimitAdj_Subtract }
 How to adjust rate limit buckets when modifying the current rate limit. More...
 
enum  eConnectionStatus {
  eConnStat_Error , eConnStat_No_Broker_Configured , eConnStat_Resolving , eConnStat_InProgress ,
  eConnStat_Established , eConnStat_Refused , eConnStat_Disconnected
}
 Connection state values. More...
 
- Static Public Member Functions inherited from MQTT::Client
static void StartTask (uint8_t taskPrio=MQTT_TASK_PRIO)
 Start the Client Task.
 
static ClientGetFirstClient ()
 Start the Client Task.
 

Detailed Description

Easy MQTT Client wrapper for interacting with MQTT brokers. The client handles all network communications with the Broker and handles local message queueing and dispatching to topic handlers. Adds ConfigObj for automatically configuring all Client settings via the Config System.

Constructor & Destructor Documentation

◆ ConfiguredClient()

MQTT::ConfiguredClient::ConfiguredClient ( config_obj & owner = sys,
const char * name = NULL,
const char * desc = "Mqtt client connection configuration",
RequestProperty * addProps = NULL,
bool ConnectOnStartup = true )

ConfiguredClient constructor.

Parameters
&ownerReference to the ConfigObj this Client should be registered below
*nameName of this client in the Config System. If NULL, a default name will automatically be assigned.
*descDescription of this client to provide within the Config System
*addPropsAdditional message Properties to send with Connection Requests
ConnectOnStartupWhether the client should automatically connect after startup.

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