 |
EnigmaIOT
0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
|
Go to the documentation of this file.
9 #ifndef _ENIGMAIOTJSONCONTROLLER_h
10 #define _ENIGMAIOTJSONCONTROLLER_h
12 #if defined(ARDUINO) && ARDUINO >= 100
19 #include <ArduinoJson.h>
21 #if defined ESP8266 || defined ESP32
25 #error This code only supports ESP8266 or ESP32 platforms
38 virtual void begin (
void* config = NULL) = 0;
110 int len = measureMsgPack (json) + 1;
111 uint8_t* buffer = (uint8_t*)malloc (len);
112 len = serializeMsgPack (json, (
char*)buffer, len);
114 size_t strLen = measureJson (json) + 1;
115 char* strBuffer = (
char*)calloc (
sizeof (uint8_t), strLen);
119 serializeJson (json, strBuffer, strLen);
120 DEBUG_INFO (
"Trying to send: %s", strBuffer);
125 DEBUG_WARN (
"---- Error sending data");
127 DEBUG_INFO (
"---- Data sent");
135 #endif // _ENIGMAIOTJSONCONTROLLER_h
virtual void loop()=0
This should be called periodically for module handling.
virtual void configManagerExit(bool status)=0
Called when wifi manager exits config portal.
nodeMessageType
Message code definition.
virtual bool sendStartAnouncement()=0
Send a message to notify node has started running.
void sendDataCallback(sendData_cb cb)
Register send data callback to run when module needs to send a message.
bool sendJson(DynamicJsonDocument &json)
Sends a JSON encoded message to lower layer.
virtual bool loadConfig()=0
Loads output module configuration.
EnigmaIOTNodeClass * enigmaIotNode
virtual void configManagerStart(EnigmaIOTNodeClass *node)=0
Called when wifi manager starts config portal.
virtual bool saveConfig()=0
Saves output module configuration.
virtual bool sendCommandResp(const char *command, bool result)=0
Sends command processing response acknowledge.
virtual bool processRxCommand(const uint8_t *mac, const uint8_t *buffer, uint8_t length, nodeMessageType_t command, nodePayloadEncoding_t payloadEncoding)=0
Called to process a downlink command.
Library to build a node for EnigmaIoT system.
virtual void begin(void *config=NULL)=0
Initialize data structures.
Main node class. Manages communication with gateway and allows sending and receiving user data.