|
NetBurner 3.5.6
PDF Version |
Easy MqttObj class for automatically publishing and subscribing string values to/from an MQTT topic. Use like a normal NBString. More...
#include <mqtt.h>
Inherits MQTT::mqtt_leaf.
Public Member Functions | |
| mqtt_string (const char *val, const char *topic, Client *mClient=NULL, uint16_t flags=0) | |
| Constructor for a standalone mqtt_string object. | |
| mqtt_string (const NBString &val, const char *topic, Client *mClient=NULL, uint16_t flags=0) | |
| Constructor for a standalone mqtt_string object. | |
| mqtt_string (const char *topic, Client *mClient=NULL, uint16_t flags=0) | |
| Constructor for a standalone mqtt_string object. | |
| mqtt_string (mqtt_leaf &parent, const char *val, const char *topic, Client *mClient=NULL, uint16_t flags=0) | |
| Constructor for a mqtt_string object that has a parent. | |
| mqtt_string (mqtt_leaf &parent, const NBString &val, const char *topic, Client *mClient=NULL, uint16_t flags=0) | |
| Constructor for a mqtt_string object that has a parent. | |
| mqtt_string (mqtt_leaf &parent, const char *topic, Client *mClient=NULL, uint16_t flags=0) | |
| Constructor for a mqtt_string object that has a parent. | |
| mqtt_string & | operator= (const NBString &s) |
| Assignment operator for mqtt_string. Assigns the value to the object, then performs any post assignment operations. | |
| mqtt_string & | operator= (const char *s) |
| Assignment operator for mqtt_string. Assigns the value to the object, then performs any post assignment operations. | |
| operator NBString () const | |
| NBString conversion operator for mqtt_string. Returns the value of the object as an NBString. | |
| const char | operator[] (size_t pos) const |
| operator that returns the const char value of the character an the index. Operates on const objects. | |
| char & | operator[] (size_t pos) |
| operator that returns a reference to the character at the given position. | |
| virtual ValueTestResult | TestOrSetValue (ParsedJsonDataSet &pjs, bool setVal) override |
| Test whether the current index of a JSON dataset is valid for this object, or assign the value at the current index of the dataset to this object. | |
| virtual int | SubscribeEvent (int mqttFd, PacketInfo::Msg *msg) override |
| Handle a message sent by the Broker triggered by this object's Subscription. | |
| virtual int | RenderToBuffer (eObj_Serialize_t form, uint8_t *buf, int buflen) override |
| Render this object to an output buffer. | |
| virtual int | RenderToFd (eObj_Serialize_t form, int fd) override |
| Render this object to an output socket. | |
Public Member Functions inherited from MQTT::mqtt_leaf | |
| ~mqtt_leaf () | |
| ~mqtt_leaf Destructor for base mqtt_leaf | |
| void | RemoveFromTree () |
| Remove this object from it's parent tree. | |
| bool | NameMatch (const char *cp) |
| Determine whether a given name matches this object. | |
| virtual int | GetPubTopicName (NBString &s) |
| Get the Topic Name this object Publishes to. | |
| virtual int | GetSubTopicFilter (NBString &s) |
| Get the Subscription Topic Filter this object Subscribes to. | |
| virtual int | GetRenderLength (eObj_Serialize_t form=eObj_Serialize_CURRENT_FORM) |
| Get the number of bytes used to serialize this object in a particular format. | |
| int | Publish (int waitForCompletion=-1) |
| Publishes the current MQTT object, optionally waiting for completion. | |
| void | SetPublishInterval (uint32_t intervalPeriodTicks) |
| Sets or clears an automatic publishing interval for this MQTT object. | |
| virtual void | SetSerializationForm (eObj_Serialize_t form) |
| Set the default serialization format for this object. | |
| eObj_Serialize_t | GetSerializationForm () |
| Get the default serialization format for this object. | |
| virtual void | SetFlags (uint16_t newFlags) |
| Set additional behavioral flags for this object. | |
| virtual void | ClearFlags (uint16_t delFlags) |
| Clear behavioral flags from this object. | |
| uint16_t | GetFlags () |
| Get the behavioral flags set for this object. | |
| int | getPriority () |
| Get the message priority for this object. | |
Protected Member Functions | |
| virtual int | ParseFd (int mqttFd) override |
| the data from a file descriptor according to this object's current default serialization method and assign the value. | |
Protected Member Functions inherited from MQTT::mqtt_leaf | |
| mqtt_leaf (const char *topic, Client *mClient, uint16_t flags=(eObj_Flag_PubOnWrite|eObj_Flag_Subscribe|eObj_Flag_Sub_NoLocal)) | |
| Constructor for mqtt_leaf objects. | |
| mqtt_leaf (mqtt_leaf &parent, const char *topic, Client *mClient, uint16_t flags=(eObj_Flag_PubOnWrite|eObj_Flag_Subscribe|eObj_Flag_Sub_NoLocal)) | |
| Constructor for mqtt_leaf objects. | |
| virtual mqtt_leaf * | GetChildren () |
| Get the first child of this object. | |
| virtual mqtt_leaf * | AddChild (mqtt_leaf *child) |
| Add an MqttObj as a child to this object. | |
| virtual mqtt_leaf * | RemoveFirstChild () |
| Remove the first child from this object. | |
| void | ForEachLeaf (LeafCallBack *p, void *pd) |
| Call a function on each element of the MqttObj tree with this object as the root. | |
| void | RootParse (ParsedJsonDataSet &pjs) |
| Assign to this object tree from a JSON dataset. | |
| bool | MatchId (ParsedJsonDataSet &pjs) |
| Determine whether the JSON dataset's current index matches this object's name. | |
| int | QueuePublish () |
| Queue this object to be Published via the registered Client. | |
| int | QueueSubscribe () |
| Queue this object to be Subscribed via the registered Client. | |
| int | QueueUnsubscribe () |
| Queue this object to be Unsubscribed via the registered Client. | |
| int | Assign () |
| Perform post assignemnt operations. | |
| uint8_t | PubState () |
| Get the Publish state. | |
| uint8_t | SubState () |
| Get the Subscribe state of this object. | |
| virtual void | SetPubState (uint8_t newState) |
| Set the Publish state. | |
| virtual void | SetSubState (uint8_t newState) |
| Set the Subscribe state. | |
| int | HandleSubAck (int mqttFd, PacketInfo::Msg *msg) |
| Handle a Subscribe Acknowledge message from the broker for our Subscribe request. | |
| int | HandleUnsubAck (int mqttFd, PacketInfo::Msg *msg) |
| Handle an Unsubscribe Acknowledge message from the broker for our Unsubscribe request. | |
| int | HandlePubAck (int mqttFd, PacketInfo::Msg *msg) |
| Handle an Publish Acknowledge message from the broker for our Publish request. | |
Additional Inherited Members | |
Public Types inherited from MQTT::mqtt_leaf | |
| enum | eObj_State_t |
| Mqtt Object Publication/Subscription States. | |
Static Public Member Functions inherited from MQTT::mqtt_leaf | |
| static int | MqttRxPublish (Client *mClient, int mqttFd, PacketInfo::Msg *msg, void *ctx) |
| Static message handler for Publish messages received by the registered Client. | |
Protected Attributes inherited from MQTT::mqtt_leaf | |
| NBInterpolatedString | topicName |
| Topic name or additional branch. | |
| eObj_Serialize_t | publishForm |
| Default serialization form. | |
| uint16_t | mFlags |
| Behavioral flags. | |
Easy MqttObj class for automatically publishing and subscribing string values to/from an MQTT topic. Use like a normal NBString.
| MQTT::mqtt_string::mqtt_string | ( | const char * | val, |
| const char * | topic, | ||
| Client * | mClient = NULL, | ||
| uint16_t | flags = 0 ) |
Constructor for a standalone mqtt_string object.
| MQTT::mqtt_string::mqtt_string | ( | const NBString & | val, |
| const char * | topic, | ||
| Client * | mClient = NULL, | ||
| uint16_t | flags = 0 ) |
Constructor for a standalone mqtt_string object.
| MQTT::mqtt_string::mqtt_string | ( | const char * | topic, |
| Client * | mClient = NULL, | ||
| uint16_t | flags = 0 ) |
Constructor for a standalone mqtt_string object.
| MQTT::mqtt_string::mqtt_string | ( | mqtt_leaf & | parent, |
| const char * | val, | ||
| const char * | topic, | ||
| Client * | mClient = NULL, | ||
| uint16_t | flags = 0 ) |
Constructor for a mqtt_string object that has a parent.
| MQTT::mqtt_string::mqtt_string | ( | mqtt_leaf & | parent, |
| const NBString & | val, | ||
| const char * | topic, | ||
| Client * | mClient = NULL, | ||
| uint16_t | flags = 0 ) |
Constructor for a mqtt_string object that has a parent.
| MQTT::mqtt_string::mqtt_string | ( | mqtt_leaf & | parent, |
| const char * | topic, | ||
| Client * | mClient = NULL, | ||
| uint16_t | flags = 0 ) |
Constructor for a mqtt_string object that has a parent.
|
inline |
NBString conversion operator for mqtt_string. Returns the value of the object as an NBString.
| mqtt_string & MQTT::mqtt_string::operator= | ( | const char * | s | ) |
Assignment operator for mqtt_string. Assigns the value to the object, then performs any post assignment operations.
| s | The value to assign to the object. |
| mqtt_string & MQTT::mqtt_string::operator= | ( | const NBString & | s | ) |
Assignment operator for mqtt_string. Assigns the value to the object, then performs any post assignment operations.
| s | The value to assign to the object. |
|
inline |
operator that returns a reference to the character at the given position.
|
inline |
operator that returns the const char value of the character an the index. Operates on const objects.
|
overrideprotectedvirtual |
the data from a file descriptor according to this object's current default serialization method and assign the value.
| mqttFd | File descriptor to read from. |
Implements MQTT::mqtt_leaf.
|
overridevirtual |
Render this object to an output buffer.
| form | Serialization format to render as |
| *buf | Pointer to output buffer |
| buflen | Size of the output buffer |
Implements MQTT::mqtt_leaf.
|
overridevirtual |
Render this object to an output socket.
| form | Serialization format to render as |
| fd | File descriptor to render to |
Implements MQTT::mqtt_leaf.
|
overridevirtual |
Handle a message sent by the Broker triggered by this object's Subscription.
| mqttFd | File Descriptor to read any additional message data from |
| *msg | Pointer to message received from the Broker |
Reimplemented from MQTT::mqtt_leaf.
|
overridevirtual |
Test whether the current index of a JSON dataset is valid for this object, or assign the value at the current index of the dataset to this object.
| &pjs | The JSON dataset to use |
| setVal | true: Assign from the value at the current index, false: test if current index is valid for this object |
Implements MQTT::mqtt_leaf.