MQTT Communication
Smart Factory
|
The Connection-class provides the interface. More...
#include <MQTTCommunication.h>
Public Member Functions | |
Communication (String Hostname) | |
Construct a new Communication object. More... | |
void | init () |
Initializes the Hard- and Software for WLAN and MQTT-Connection. More... | |
bool | loop () |
This should be called regularly to allow the client to process incoming messages and maintain its connection to the server. More... | |
void | printNetworkInfo () |
bool | subscribe (const String topic) |
subsribes to MQTT topic on Server More... | |
bool | unsubscribe (const String topic) |
unsubsribes from MQTT topic on Server More... | |
bool | publishMessage (const String topic, const String msg) |
handles outgoing MQTT messages to Server More... | |
myJSONStr | last () |
Retriev data from the Tail (oldest Element) of the Buffer. More... | |
myJSONStr | getElement (int x) |
Get the Element object. More... | |
myJSONStr | pop () |
Retriev data from the Tail (oldest Element) of the Buffer. More... | |
bool | isEmpty () |
Check if the Buffer is empty. More... | |
myJSONStr | first () |
Retriev data from the Head (newest Element) of the Buffer. More... | |
myJSONStr | shift () |
Retriev data from the Head (newest Element) of the Buffer. More... | |
int | size () |
returns the number of elements currently stored in the buffer More... | |
void | clear () |
resets the whole buffer to its initial state More... | |
Private Attributes | |
String | pHostname |
WiFiClient | pClient = WiFiClient() |
instance of WiFiClient More... | |
Network | pNetwork |
instance of Network More... | |
myMQTT | pMymqtt |
instance of myMQTT More... | |
void(* | funcPointer )(char *, unsigned char *, unsigned int) = callback |
functionpointer to callback-function More... | |
The Connection-class provides the interface.
Definition at line 71 of file MQTTCommunication.h.
Communication::Communication | ( | String | Hostname | ) |
Construct a new Communication object.
Definition at line 80 of file MQTTCommunication.cpp.
|
inline |
resets the whole buffer to its initial state
Definition at line 240 of file MQTTCommunication.h.
|
inline |
Retriev data from the Head (newest Element) of the Buffer.
This operation is non destructiv and the element will NOT be removed from the buffer Reading from an empty buffer is forbidden!!
Definition at line 213 of file MQTTCommunication.h.
|
inline |
Get the Element object.
x | - |
Definition at line 181 of file MQTTCommunication.h.
|
inline |
Initializes the Hard- and Software for WLAN and MQTT-Connection.
Definition at line 84 of file MQTTCommunication.h.
|
inline |
Check if the Buffer is empty.
Definition at line 202 of file MQTTCommunication.h.
|
inline |
Retriev data from the Tail (oldest Element) of the Buffer.
This operation is non destructiv and the element will NOT be removed from the buffer Reading from an empty buffer is forbidden!!
Definition at line 171 of file MQTTCommunication.h.
|
inline |
This should be called regularly to allow the client to process incoming messages and maintain its connection to the server.
Definition at line 97 of file MQTTCommunication.h.
|
inline |
Retriev data from the Tail (oldest Element) of the Buffer.
Cause the element being read to be removed from the buffer Reading from an empty buffer is forbidden!!
Definition at line 192 of file MQTTCommunication.h.
|
inline |
Definition at line 106 of file MQTTCommunication.h.
|
inline |
handles outgoing MQTT messages to Server
Checks if the Board is connected to a newtork and reconects if not
Beware though that the default packet size supported by the PubSub client is 128 bytes. You can increase this limit by editing the value lof MQTT_MAX_PACKET_SIZE in PubSubClient.h
topic | - the topic to publish to (const char[]) |
msg | - the message to publish (const char[]) |
Definition at line 157 of file MQTTCommunication.h.
|
inline |
Retriev data from the Head (newest Element) of the Buffer.
Cause the element being read to be removed from the buffer Reading from an empty buffer is forbidden!!
Definition at line 223 of file MQTTCommunication.h.
|
inline |
returns the number of elements currently stored in the buffer
Definition at line 232 of file MQTTCommunication.h.
|
inline |
subsribes to MQTT topic on Server
Checks if the Board is connected to a newtork and reconects if not Check if the client is connected to the server if not call connectToMQTT()
topic | - the topic to subscribe to (const char[]) |
Definition at line 122 of file MQTTCommunication.h.
|
inline |
unsubsribes from MQTT topic on Server
Checks if the Board is connected to a newtork and reconects if not Check if the client is connected to the server
topic | - the topic to unsubscribe from (const char[]) |
Definition at line 137 of file MQTTCommunication.h.
|
private |
functionpointer to callback-function
Definition at line 260 of file MQTTCommunication.h.
|
private |
instance of WiFiClient
Definition at line 246 of file MQTTCommunication.h.
|
private |
Definition at line 245 of file MQTTCommunication.h.
|
private |
|
private |