EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
GwOutput_generic.h
Go to the documentation of this file.
1 
11 #ifndef _GWOUT_GEN_h
12 #define _GWOUT_GEN_h
13 
14 #include <EnigmaIOTGateway.h>
15 
16 #if defined(ARDUINO) && ARDUINO >= 100
17 #include "Arduino.h"
18 #else
19 #include "WProgram.h"
20 #endif
21 
22 typedef enum GwOutput_data_type {
25  status
27 
28 #include <functional>
29 typedef std::function<void (uint8_t* address, char* nodeName, control_message_type_t msgType, char* data, unsigned int len)> onDlData_t;
30 
32 protected:
35 
40  virtual bool saveConfig () = 0;
41 
42 public:
43  String netName;
44  String clientId;
45  String gwTopic;
46 
47  //virtual int send () = 0;
48  //virtual void onReveive () = 0;
49 
54  virtual void configManagerStart (EnigmaIOTGatewayClass* enigmaIotGw) = 0;
55 
60  virtual void configManagerExit (bool status) = 0;
61 
66  virtual bool begin () = 0;
67 
72  virtual bool loadConfig () = 0;
73 
81  virtual bool outputControlSend (char* address, uint8_t* data, size_t length) = 0;
82 
89  virtual bool newNodeSend (char* address, uint16_t node_id) = 0;
90 
97  virtual bool nodeDisconnectedSend (char* address, gwInvalidateReason_t reason) = 0;
98 
107  virtual bool outputDataSend (char* address, char* data, size_t length, GwOutput_data_type_t type = data) = 0;
108 
112  virtual void loop () = 0;
113 
119  downlinkCb = cb;
120  }
121 };
122 
123 #endif // _GWOUT_GEN_h
GatewayOutput_generic
Definition: GwOutput_generic.h:31
EnigmaIOTGatewayClass
Main gateway class. Manages communication with nodes and sends data to upper layer.
Definition: EnigmaIOTGateway.h:120
GatewayOutput_generic::outputControlSend
virtual bool outputControlSend(char *address, uint8_t *data, size_t length)=0
Send control data from nodes.
GatewayOutput_generic::nodeDisconnectedSend
virtual bool nodeDisconnectedSend(char *address, gwInvalidateReason_t reason)=0
Send node disconnection notification.
GatewayOutput_generic::newNodeSend
virtual bool newNodeSend(char *address, uint16_t node_id)=0
Send new node notification.
GwOutput_data_type
GwOutput_data_type
Definition: GwOutput_generic.h:22
GatewayOutput_generic::downlinkCb
onDlData_t downlinkCb
downlink processing function handle
Definition: GwOutput_generic.h:34
GatewayOutput_generic::configManagerStart
virtual void configManagerStart(EnigmaIOTGatewayClass *enigmaIotGw)=0
Called when wifi manager starts config portal.
onDlData_t
std::function< void(uint8_t *address, char *nodeName, control_message_type_t msgType, char *data, unsigned int len)> onDlData_t
Definition: GwOutput_generic.h:29
GatewayOutput_generic::configManagerExit
virtual void configManagerExit(bool status)=0
Called when wifi manager exits config portal.
GatewayOutput_generic::begin
virtual bool begin()=0
Starts output module.
GwOutput_data_type_t
enum GwOutput_data_type GwOutput_data_type_t
GatewayOutput_generic::clientId
String clientId
MQTT clientId.
Definition: GwOutput_generic.h:44
GatewayOutput_generic::loadConfig
virtual bool loadConfig()=0
Loads output module configuration.
GatewayOutput_generic::loop
virtual void loop()=0
Should be called often for module management.
GatewayOutput_generic::gwTopic
String gwTopic
MQTT topic for gateway.
Definition: GwOutput_generic.h:45
GatewayOutput_generic::enigmaIotGateway
EnigmaIOTGatewayClass * enigmaIotGateway
Pointer to EnigmaIOT gateway instance.
Definition: GwOutput_generic.h:33
GatewayOutput_generic::setDlCallback
void setDlCallback(onDlData_t cb)
Set data processing function.
Definition: GwOutput_generic.h:118
GatewayOutput_generic::saveConfig
virtual bool saveConfig()=0
Saves output module configuration.
data
@ data
Definition: GwOutput_generic.h:23
GatewayOutput_generic::netName
String netName
EnigmaIOT network name.
Definition: GwOutput_generic.h:43
lostmessages
@ lostmessages
Definition: GwOutput_generic.h:24
GatewayOutput_generic::outputDataSend
virtual bool outputDataSend(char *address, char *data, size_t length, GwOutput_data_type_t type=data)=0
Send data from nodes.
EnigmaIOTGateway.h
Library to build a gateway for EnigmaIoT system.
gwInvalidateReason_t
gwInvalidateReason_t
Key invalidation reason definition.
Definition: EnigmaIOTGateway.h:75
control_message_type_t
enum control_message_type control_message_type_t
status
@ status
Definition: GwOutput_generic.h:25