|
EnigmaIOT
0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
|
#include <GwOutput_mqtt.h>
Public Member Functions | |
| GwOutput_MQTT () | |
| Constructor to initialize MQTT client. More... | |
| void | configManagerStart (EnigmaIOTGatewayClass *enigmaIotGw) |
| Called when wifi manager starts config portal. More... | |
| void | configManagerExit (bool status) |
| Called when wifi manager exits config portal. More... | |
| bool | begin () |
| Starts output module. More... | |
| bool | loadConfig () |
| Loads output module configuration. More... | |
| bool | outputControlSend (char *address, uint8_t *data, size_t length) |
| Send control data from nodes. More... | |
| bool | newNodeSend (char *address, uint16_t node_id) |
| Send new node notification. More... | |
| bool | nodeDisconnectedSend (char *address, gwInvalidateReason_t reason) |
| Send node disconnection notification. More... | |
| bool | outputDataSend (char *address, char *data, size_t length, GwOutput_data_type_t type=data) |
| Send data from nodes. More... | |
| void | loop () |
| Should be called regularly for module management. More... | |
Public Member Functions inherited from GatewayOutput_generic | |
| void | setDlCallback (onDlData_t cb) |
| Set data processing function. More... | |
Protected Member Functions | |
| bool | saveConfig () |
| Saves output module configuration. More... | |
| void | reconnect () |
| This is called anytime MQTT client is disconnected. More... | |
| bool | addMQTTqueue (const char *topic, char *payload, size_t len, bool retain=false) |
| Add MQTT message to queue. More... | |
| mqtt_queue_item_t * | getMQTTqueue () |
| Gets next item in the queue. More... | |
| void | popMQTTqueue () |
| Deletes next item in the queue. More... | |
| bool | publishMQTT (const char *topic, const char *payload, size_t len, bool retain=false) |
| Publishes data over MQTT. More... | |
Static Protected Member Functions | |
| static void | onDlData (char *topic, uint8_t *data, unsigned int len) |
| Function that processes downlink data from network to node. More... | |
Protected Attributes | |
| AsyncWiFiManagerParameter * | mqttServerParam |
| Configuration field for MQTT server address. More... | |
| AsyncWiFiManagerParameter * | mqttPortParam |
| Configuration field for MQTT server port. More... | |
| AsyncWiFiManagerParameter * | mqttUserParam |
| Configuration field for MQTT server user name. More... | |
| AsyncWiFiManagerParameter * | mqttPassParam |
| Configuration field for MQTT server password. More... | |
| std::queue< mqtt_queue_item_t * > | mqtt_queue |
| Output MQTT messages queue. It acts as a FIFO queue. More... | |
| mqttgw_config_t | mqttgw_config |
| MQTT server configuration data. More... | |
| bool | shouldSaveConfig = false |
| Flag to indicate if configuration should be saved. More... | |
| WiFiClient | espClient |
| TCP client. More... | |
| PubSubClient | mqtt_client |
| MQTT client. More... | |
Protected Attributes inherited from GatewayOutput_generic | |
| EnigmaIOTGatewayClass * | enigmaIotGateway |
| Pointer to EnigmaIOT gateway instance. More... | |
| onDlData_t | downlinkCb |
| downlink processing function handle More... | |
Additional Inherited Members | |
Public Attributes inherited from GatewayOutput_generic | |
| String | netName |
| EnigmaIOT network name. More... | |
| String | clientId |
| MQTT clientId. More... | |
| String | gwTopic |
| MQTT topic for gateway. More... | |
Definition at line 77 of file GwOutput_mqtt.h.
|
inline |
Constructor to initialize MQTT client.
Definition at line 160 of file GwOutput_mqtt.h.
|
protected |
Add MQTT message to queue.
| topic | MQTT message topic |
| payload | MQTT message payload |
| len | MQTT payload length |
| retain | Message retain flag |
Definition at line 460 of file GwOutput_mqtt.cpp.
|
virtual |
Starts output module.
true if successful. false otherwise Implements GatewayOutput_generic.
Definition at line 204 of file GwOutput_mqtt.cpp.
|
virtual |
Called when wifi manager exits config portal.
| status | true if configuration was successful |
Implements GatewayOutput_generic.
Definition at line 167 of file GwOutput_mqtt.cpp.
|
virtual |
Called when wifi manager starts config portal.
| enigmaIotGw | Pointer to EnigmaIOT gateway instance |
Implements GatewayOutput_generic.
Definition at line 44 of file GwOutput_mqtt.cpp.
|
protected |
Gets next item in the queue.
Definition at line 483 of file GwOutput_mqtt.cpp.
|
virtual |
Loads output module configuration.
true if load was successful. false otherwise Implements GatewayOutput_generic.
Definition at line 102 of file GwOutput_mqtt.cpp.
|
virtual |
Should be called regularly for module management.
Implements GatewayOutput_generic.
Definition at line 414 of file GwOutput_mqtt.cpp.
|
virtual |
Send new node notification.
true if sending was successful. false otherwise Implements GatewayOutput_generic.
Definition at line 624 of file GwOutput_mqtt.cpp.
|
virtual |
Send node disconnection notification.
| address | Node Address |
| reason | Disconnection reason code |
true if sending was successful. false otherwise Implements GatewayOutput_generic.
Definition at line 642 of file GwOutput_mqtt.cpp.
|
staticprotected |
Function that processes downlink data from network to node.
| topic | Topic that indicates message type |
| data | Message payload |
| len | Payload length |
Definition at line 364 of file GwOutput_mqtt.cpp.
|
virtual |
Send control data from nodes.
| address | Node Address |
| data | Message data buffer |
| length | Data buffer length |
true if sending was successful. false otherwise Implements GatewayOutput_generic.
Definition at line 533 of file GwOutput_mqtt.cpp.
|
virtual |
Send data from nodes.
| address | Node Address |
| data | Message data buffer |
| length | Data buffer length |
| type | Type of message |
true if sending was successful. false otherwise Implements GatewayOutput_generic.
Definition at line 510 of file GwOutput_mqtt.cpp.
|
protected |
Deletes next item in the queue.
Definition at line 491 of file GwOutput_mqtt.cpp.
|
protected |
Publishes data over MQTT.
| topic | Topic that indicates message type |
| payload | Message payload data |
| len | Payload length |
| retain | true if message should be retained |
Definition at line 431 of file GwOutput_mqtt.cpp.
|
protected |
This is called anytime MQTT client is disconnected.
It tries to connect to MQTT broker. After reconnection is done it resubscribes to network topics. It waits for connection and times out after 5 seconds
Definition at line 231 of file GwOutput_mqtt.cpp.
|
protectedvirtual |
Saves output module configuration.
true if save was successful. false otherwise Implements GatewayOutput_generic.
Definition at line 60 of file GwOutput_mqtt.cpp.
|
protected |
TCP client.
Definition at line 95 of file GwOutput_mqtt.h.
|
protected |
MQTT client.
Definition at line 97 of file GwOutput_mqtt.h.
|
protected |
Output MQTT messages queue. It acts as a FIFO queue.
Definition at line 84 of file GwOutput_mqtt.h.
|
protected |
MQTT server configuration data.
Definition at line 86 of file GwOutput_mqtt.h.
|
protected |
Configuration field for MQTT server password.
Definition at line 82 of file GwOutput_mqtt.h.
|
protected |
Configuration field for MQTT server port.
Definition at line 80 of file GwOutput_mqtt.h.
|
protected |
Configuration field for MQTT server address.
Definition at line 79 of file GwOutput_mqtt.h.
|
protected |
Configuration field for MQTT server user name.
Definition at line 81 of file GwOutput_mqtt.h.
|
protected |
Flag to indicate if configuration should be saved.
Definition at line 87 of file GwOutput_mqtt.h.
1.8.18