NetBurner 3.5.6
PDF Version |
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. | |
![]() | |
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. | |
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.
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.
&owner | Reference to the ConfigObj this Client should be registered below |
*name | Name of this client in the Config System. If NULL, a default name will automatically be assigned. |
*desc | Description of this client to provide within the Config System |
*addProps | Additional message Properties to send with Connection Requests |
ConnectOnStartup | Whether the client should automatically connect after startup. |