EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
Classes | Macros | Typedefs | Enumerations | Variables
EnigmaIOTGateway.h File Reference

Library to build a gateway for EnigmaIoT system. More...

#include "WProgram.h"
#include "EnigmaIoTconfig.h"
#include "NodeList.h"
#include "Filter.h"
#include "Comms_hal.h"
#include <ESPAsyncWebServer.h>
#include <ESPAsyncWiFiManager.h>
#include <DNSServer.h>
#include <queue>
#include "EnigmaIOTRingBuffer.h"
#include "GatewayAPI.h"
#include "helperFunctions.h"

Go to the source code of this file.

Classes

struct  gateway_config_t
 
struct  msg_queue_item_t
 
class  EnigmaIOTGatewayClass
 Main gateway class. Manages communication with nodes and sends data to upper layer. More...
 

Macros

#define LED_ON   LOW
 
#define LED_OFF   !LED_ON
 

Typedefs

typedef void(* onGwDataRx_t) (uint8_t *mac, uint8_t *data, uint8_t len, uint16_t lostMessages, bool control, gatewayPayloadEncoding_t payload_type, char *nodeName)
 
typedef void(* onNewNode_t) (uint8_t *mac, uint16_t node_id, char *nodeName)
 
typedef void(* onNodeDisconnected_t) (uint8_t *mac, gwInvalidateReason_t reason)
 
typedef void(* onWiFiManagerExit_t) (boolean status)
 
typedef void(* simpleEventHandler_t) (void)
 

Enumerations

enum  gatewayMessageType_t {
  SENSOR_DATA = 0x01, SENSOR_BRCAST_DATA = 0x81, UNENCRYPTED_NODE_DATA = 0x11, DOWNSTREAM_DATA_SET = 0x02,
  DOWNSTREAM_BRCAST_DATA_SET = 0x82, DOWNSTREAM_DATA_GET = 0x12, DOWNSTREAM_BRCAST_DATA_GET = 0x92, CONTROL_DATA = 0x03,
  DOWNSTREAM_CTRL_DATA = 0x04, DOWNSTREAM_BRCAST_CTRL_DATA = 0x84, HA_DISCOVERY_MESSAGE = 0x08, CLOCK_REQUEST = 0x05,
  CLOCK_RESPONSE = 0x06, NODE_NAME_SET = 0x07, NODE_NAME_RESULT = 0x17, BROADCAST_KEY_REQUEST = 0x08,
  BROADCAST_KEY_RESPONSE = 0x18, CLIENT_HELLO = 0xFF, SERVER_HELLO = 0xFE, INVALIDATE_KEY = 0xFB
}
 Message code definition. More...
 
enum  gatewayPayloadEncoding_t {
  RAW = 0x00, CAYENNELPP = 0x81, PROT_BUF = 0x82, MSG_PACK = 0x83,
  BSON = 0x84, CBOR = 0x85, SMILE = 0x86, ENIGMAIOT = 0xFF
}
 
enum  gwInvalidateReason_t {
  UNKNOWN_ERROR = 0x00, WRONG_CLIENT_HELLO = 0x01, WRONG_DATA = 0x03, UNREGISTERED_NODE = 0x04,
  KEY_EXPIRED = 0x05, KICKED = 0x06
}
 Key invalidation reason definition. More...
 

Variables

EnigmaIOTGatewayClass EnigmaIOTGateway
 

Detailed Description

Library to build a gateway for EnigmaIoT system.

Version
0.9.8
Date
15/07/2021
Author
German Martin

Definition in file EnigmaIOTGateway.h.

Macro Definition Documentation

◆ LED_OFF

#define LED_OFF   !LED_ON

Definition at line 33 of file EnigmaIOTGateway.h.

◆ LED_ON

#define LED_ON   LOW

Definition at line 32 of file EnigmaIOTGateway.h.

Typedef Documentation

◆ onGwDataRx_t

typedef void(* onGwDataRx_t) (uint8_t *mac, uint8_t *data, uint8_t len, uint16_t lostMessages, bool control, gatewayPayloadEncoding_t payload_type, char *nodeName)

Definition at line 97 of file EnigmaIOTGateway.h.

◆ onNewNode_t

typedef void(* onNewNode_t) (uint8_t *mac, uint16_t node_id, char *nodeName)

Definition at line 98 of file EnigmaIOTGateway.h.

◆ onNodeDisconnected_t

typedef void(* onNodeDisconnected_t) (uint8_t *mac, gwInvalidateReason_t reason)

Definition at line 99 of file EnigmaIOTGateway.h.

◆ onWiFiManagerExit_t

typedef void(* onWiFiManagerExit_t) (boolean status)

Definition at line 100 of file EnigmaIOTGateway.h.

◆ simpleEventHandler_t

typedef void(* simpleEventHandler_t) (void)

Definition at line 101 of file EnigmaIOTGateway.h.

Enumeration Type Documentation

◆ gatewayMessageType_t

Message code definition.

Enumerator
SENSOR_DATA 

Data message from sensor node

SENSOR_BRCAST_DATA 

Data broadcast message from sensor node

UNENCRYPTED_NODE_DATA 

Data message from sensor node. Unencrypted

DOWNSTREAM_DATA_SET 

Data message from gateway. Downstream data for user commands

DOWNSTREAM_BRCAST_DATA_SET 

Data broadcast message from gateway. Downstream data for user commands

DOWNSTREAM_DATA_GET 

Data message from gateway. Downstream data for user commands

DOWNSTREAM_BRCAST_DATA_GET 

Data broadcast message from gateway. Downstream data for user commands

CONTROL_DATA 

Internal control message from sensor to gateway. Used for OTA, settings configuration, etc

DOWNSTREAM_CTRL_DATA 

Internal control message from gateway to sensor. Used for OTA, settings configuration, etc

DOWNSTREAM_BRCAST_CTRL_DATA 

Internal control broadcast message from gateway to sensor. Used for OTA, settings configuration, etc

HA_DISCOVERY_MESSAGE 

This sends gateway needed information to build a Home Assistant discovery MQTT message to allow automatic entities provision

CLOCK_REQUEST 

Clock request message from node

CLOCK_RESPONSE 

Clock response message from gateway

NODE_NAME_SET 

Message from node to signal its own custom node name

NODE_NAME_RESULT 

Message from gateway to get result after set node name

BROADCAST_KEY_REQUEST 

Message from node to request broadcast key

BROADCAST_KEY_RESPONSE 

Message from gateway with broadcast key

CLIENT_HELLO 

ClientHello message from sensor node

SERVER_HELLO 

ServerHello message from gateway

INVALIDATE_KEY 

InvalidateKey message from gateway

Definition at line 38 of file EnigmaIOTGateway.h.

◆ gatewayPayloadEncoding_t

Enumerator
RAW 

Raw data without specific format

CAYENNELPP 

CayenneLPP packed data

PROT_BUF 

Data packed using Protocol Buffers. NOT IMPLEMENTED

MSG_PACK 

Data packed using MessagePack

BSON 

Data packed using BSON. NOT IMPLEMENTED

CBOR 

Data packed using CBOR. NOT IMPLEMENTED

SMILE 

Data packed using SMILE. NOT IMPLEMENTED

ENIGMAIOT 

Definition at line 61 of file EnigmaIOTGateway.h.

◆ gwInvalidateReason_t

Key invalidation reason definition.

Enumerator
UNKNOWN_ERROR 

Unknown error. Not used by the moment

WRONG_CLIENT_HELLO 

ClientHello message received was invalid

WRONG_DATA 

Data message received could not be decrypted successfuly

UNREGISTERED_NODE 

Data received from an unregistered node

KEY_EXPIRED 

Node key has reached maximum validity time

KICKED 

Node key has been forcibly unregistered

Definition at line 75 of file EnigmaIOTGateway.h.

Variable Documentation

◆ EnigmaIOTGateway

EnigmaIOTGatewayClass EnigmaIOTGateway
extern

Definition at line 2050 of file EnigmaIOTGateway.cpp.