EnigmaIOT  0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
Macros | Variables
EnigmaIoTconfig.h File Reference

Parameter configuration. More...

Go to the source code of this file.

Macros

#define CONNECT_TO_WIFI_AP   1
 In projects where gateway should not be connected to WiFi (for instance a data logger to SD) it may be useful to disable WiFi setting this to 0. Set it to 1 otherwise. More...
 
#define CYPHER_TYPE   ChaChaPoly
 
#define DEBUG_ESP_PORT   Serial
 Stream to output debug info. It will normally be Serial More...
 
#define DEBUG_LEVEL   WARN
 Possible values VERBOSE, DBG, INFO, WARN, ERROR, NONE. More...
 

Variables

static const uint8_t MAX_MESSAGE_LENGTH = 250
 Maximum payload size on ESP-NOW. More...
 
static const size_t ENIGMAIOT_ADDR_LEN = 6
 Address size. Mac address = 6 bytes. More...
 
static const char ENIGMAIOT_PROT_VERS [] = "0.9.3"
 EnitmaIoT Version. More...
 
static const uint8_t DEFAULT_CHANNEL = 3
 WiFi channel to be used on ESP-NOW. More...
 
static const uint32_t FLASH_LED_TIME = 50
 Time that led keeps on during flash in ms. More...
 
static const uint8_t NETWORK_NAME_LENGTH = 21
 Maximum number of characters of network name. More...
 
static const uint8_t NODE_NAME_LENGTH = 33
 Maximum number of characters of node name. More...
 
static const int RESET_PIN_DURATION = 5000
 Number of milliseconds that reset pin has to be grounded to produce a configuration reset. More...
 
static const unsigned int MAX_KEY_VALIDITY = 86400000U
 After this time (in ms) a nude is unregistered. More...
 
static const unsigned int MAX_NODE_INACTIVITY = 86400000U
 After this time (in ms) a node is marked as gone. More...
 
static const int OTA_GW_TIMEOUT = 11000
 OTA mode timeout. In OTA mode all data messages are ignored. More...
 
static const size_t MAX_MQTT_QUEUE_SIZE = 5
 Maximum number of MQTT messages to be sent. More...
 
static const int RATE_AVE_ORDER = 5
 Message rate filter order. More...
 
static const int MAX_INPUT_QUEUE_SIZE = 3
 Input queue size for EnigmaIOT messages. Acts as a buffer to be able to handle messages during high load. More...
 
static const int NUM_NODES = 20
 Maximum number of nodes that this gateway can handle. More...
 
static const bool DISCONNECT_ON_DATA_ERROR = true
 Activates node invalidation in case of data error. More...
 
static const int16_t RECONNECTION_PERIOD = 1500
 Time to retry Gateway connection. More...
 
static const uint16_t DOWNLINK_WAIT_TIME = 800
 Time to wait for downlink message before sleep. Setting less than 180 ms causes ESP-NOW errors due to lack of ACK processing. More...
 
static const uint32_t DEFAULT_SLEEP_TIME = 10
 Default sleep time if it was not set. More...
 
static const uint32_t OTA_TIMEOUT_TIME = 10000
 Timeout between OTA messages. In milliseconds. More...
 
static const time_t IDENTIFY_TIMEOUT = 10000
 How long LED will be flashing during identification. More...
 
static const uint32_t TIME_SYNC_PERIOD = 30000
 Period of clock synchronization request. More...
 
static const unsigned int QUICK_SYNC_TIME = 5000
 Period of clock synchronization request in case of resync is needed. More...
 
static const int MIN_SYNC_ACCURACY = 5
 If calculated offset absolute value is higher than this value resync is done more often. More...
 
static const int MAX_DATA_PAYLOAD_SIZE = 214
 Maximun payload size for data packets. More...
 
static const uint32_t PRE_REG_DELAY = 5000
 Time to wait before registration so that other nodes have time to communicate. Real delay is a random lower than this value. More...
 
static const uint32_t POST_REG_DELAY = 1500
 Time to waif before sending data after registration so that other nodes have time to finish their registration. Real delay is a random lower than this value. More...
 
static const bool CHECK_COMM_ERRORS = true
 Try to reconnect in case of communication errors. More...
 
static const uint8_t COMM_ERRORS_BEFORE_SCAN = 2
 Node will search for a gateway if this number of communication errors have happened. More...
 
static const uint32_t RTC_ADDRESS = 0
 RTC memory address where to store context. Modify it if you need place to store your own data during deep sleep. Take care not to overwrite above that address. More...
 
const uint8_t KEY_LENGTH = 32
 Key length used by selected crypto algorythm. The only tested value is 32. Change it only if you know what you are doing. More...
 
const uint8_t IV_LENGTH = 12
 Initalization vector length used by selected crypto algorythm. More...
 
const uint8_t TAG_LENGTH = 16
 Authentication tag length. For Poly1305 it is always 16. More...
 
const uint8_t AAD_LENGTH = 8
 Number of bytes from last part of key that will be used for additional authenticated data. More...
 

Detailed Description

Parameter configuration.

Version
0.9.3
Date
14/07/2020
Author
German Martin

Definition in file EnigmaIoTconfig.h.

Macro Definition Documentation

◆ CONNECT_TO_WIFI_AP

#define CONNECT_TO_WIFI_AP   1

In projects where gateway should not be connected to WiFi (for instance a data logger to SD) it may be useful to disable WiFi setting this to 0. Set it to 1 otherwise.

Definition at line 37 of file EnigmaIoTconfig.h.

◆ CYPHER_TYPE

#define CYPHER_TYPE   ChaChaPoly

Definition at line 63 of file EnigmaIoTconfig.h.

◆ DEBUG_ESP_PORT

#define DEBUG_ESP_PORT   Serial

Stream to output debug info. It will normally be Serial

Definition at line 66 of file EnigmaIoTconfig.h.

◆ DEBUG_LEVEL

#define DEBUG_LEVEL   WARN

Possible values VERBOSE, DBG, INFO, WARN, ERROR, NONE.

Definition at line 68 of file EnigmaIoTconfig.h.

Variable Documentation

◆ AAD_LENGTH

const uint8_t AAD_LENGTH = 8

Number of bytes from last part of key that will be used for additional authenticated data.

Definition at line 61 of file EnigmaIoTconfig.h.

◆ CHECK_COMM_ERRORS

const bool CHECK_COMM_ERRORS = true
static

Try to reconnect in case of communication errors.

Definition at line 52 of file EnigmaIoTconfig.h.

◆ COMM_ERRORS_BEFORE_SCAN

const uint8_t COMM_ERRORS_BEFORE_SCAN = 2
static

Node will search for a gateway if this number of communication errors have happened.

Definition at line 54 of file EnigmaIoTconfig.h.

◆ DEFAULT_CHANNEL

const uint8_t DEFAULT_CHANNEL = 3
static

WiFi channel to be used on ESP-NOW.

Definition at line 16 of file EnigmaIoTconfig.h.

◆ DEFAULT_SLEEP_TIME

const uint32_t DEFAULT_SLEEP_TIME = 10
static

Default sleep time if it was not set.

Definition at line 42 of file EnigmaIoTconfig.h.

◆ DISCONNECT_ON_DATA_ERROR

const bool DISCONNECT_ON_DATA_ERROR = true
static

Activates node invalidation in case of data error.

Definition at line 33 of file EnigmaIoTconfig.h.

◆ DOWNLINK_WAIT_TIME

const uint16_t DOWNLINK_WAIT_TIME = 800
static

Time to wait for downlink message before sleep. Setting less than 180 ms causes ESP-NOW errors due to lack of ACK processing.

Definition at line 41 of file EnigmaIoTconfig.h.

◆ ENIGMAIOT_ADDR_LEN

const size_t ENIGMAIOT_ADDR_LEN = 6
static

Address size. Mac address = 6 bytes.

Definition at line 14 of file EnigmaIoTconfig.h.

◆ ENIGMAIOT_PROT_VERS

const char ENIGMAIOT_PROT_VERS[] = "0.9.3"
static

EnitmaIoT Version.

Definition at line 15 of file EnigmaIoTconfig.h.

◆ FLASH_LED_TIME

const uint32_t FLASH_LED_TIME = 50
static

Time that led keeps on during flash in ms.

Definition at line 17 of file EnigmaIoTconfig.h.

◆ IDENTIFY_TIMEOUT

const time_t IDENTIFY_TIMEOUT = 10000
static

How long LED will be flashing during identification.

Definition at line 44 of file EnigmaIoTconfig.h.

◆ IV_LENGTH

const uint8_t IV_LENGTH = 12

Initalization vector length used by selected crypto algorythm.

Definition at line 59 of file EnigmaIoTconfig.h.

◆ KEY_LENGTH

const uint8_t KEY_LENGTH = 32

Key length used by selected crypto algorythm. The only tested value is 32. Change it only if you know what you are doing.

Definition at line 58 of file EnigmaIoTconfig.h.

◆ MAX_DATA_PAYLOAD_SIZE

const int MAX_DATA_PAYLOAD_SIZE = 214
static

Maximun payload size for data packets.

Definition at line 48 of file EnigmaIoTconfig.h.

◆ MAX_INPUT_QUEUE_SIZE

const int MAX_INPUT_QUEUE_SIZE = 3
static

Input queue size for EnigmaIOT messages. Acts as a buffer to be able to handle messages during high load.

Definition at line 28 of file EnigmaIoTconfig.h.

◆ MAX_KEY_VALIDITY

const unsigned int MAX_KEY_VALIDITY = 86400000U
static

After this time (in ms) a nude is unregistered.

Definition at line 23 of file EnigmaIoTconfig.h.

◆ MAX_MESSAGE_LENGTH

const uint8_t MAX_MESSAGE_LENGTH = 250
static

Maximum payload size on ESP-NOW.

Definition at line 13 of file EnigmaIoTconfig.h.

◆ MAX_MQTT_QUEUE_SIZE

const size_t MAX_MQTT_QUEUE_SIZE = 5
static

Maximum number of MQTT messages to be sent.

Definition at line 26 of file EnigmaIoTconfig.h.

◆ MAX_NODE_INACTIVITY

const unsigned int MAX_NODE_INACTIVITY = 86400000U
static

After this time (in ms) a node is marked as gone.

Definition at line 24 of file EnigmaIoTconfig.h.

◆ MIN_SYNC_ACCURACY

const int MIN_SYNC_ACCURACY = 5
static

If calculated offset absolute value is higher than this value resync is done more often.

Definition at line 47 of file EnigmaIoTconfig.h.

◆ NETWORK_NAME_LENGTH

const uint8_t NETWORK_NAME_LENGTH = 21
static

Maximum number of characters of network name.

Definition at line 18 of file EnigmaIoTconfig.h.

◆ NODE_NAME_LENGTH

const uint8_t NODE_NAME_LENGTH = 33
static

Maximum number of characters of node name.

Definition at line 19 of file EnigmaIoTconfig.h.

◆ NUM_NODES

const int NUM_NODES = 20
static

Maximum number of nodes that this gateway can handle.

Definition at line 30 of file EnigmaIoTconfig.h.

◆ OTA_GW_TIMEOUT

const int OTA_GW_TIMEOUT = 11000
static

OTA mode timeout. In OTA mode all data messages are ignored.

Definition at line 25 of file EnigmaIoTconfig.h.

◆ OTA_TIMEOUT_TIME

const uint32_t OTA_TIMEOUT_TIME = 10000
static

Timeout between OTA messages. In milliseconds.

Definition at line 43 of file EnigmaIoTconfig.h.

◆ POST_REG_DELAY

const uint32_t POST_REG_DELAY = 1500
static

Time to waif before sending data after registration so that other nodes have time to finish their registration. Real delay is a random lower than this value.

Definition at line 50 of file EnigmaIoTconfig.h.

◆ PRE_REG_DELAY

const uint32_t PRE_REG_DELAY = 5000
static

Time to wait before registration so that other nodes have time to communicate. Real delay is a random lower than this value.

Definition at line 49 of file EnigmaIoTconfig.h.

◆ QUICK_SYNC_TIME

const unsigned int QUICK_SYNC_TIME = 5000
static

Period of clock synchronization request in case of resync is needed.

Definition at line 46 of file EnigmaIoTconfig.h.

◆ RATE_AVE_ORDER

const int RATE_AVE_ORDER = 5
static

Message rate filter order.

Definition at line 27 of file EnigmaIoTconfig.h.

◆ RECONNECTION_PERIOD

const int16_t RECONNECTION_PERIOD = 1500
static

Time to retry Gateway connection.

Definition at line 40 of file EnigmaIoTconfig.h.

◆ RESET_PIN_DURATION

const int RESET_PIN_DURATION = 5000
static

Number of milliseconds that reset pin has to be grounded to produce a configuration reset.

Definition at line 20 of file EnigmaIoTconfig.h.

◆ RTC_ADDRESS

const uint32_t RTC_ADDRESS = 0
static

RTC memory address where to store context. Modify it if you need place to store your own data during deep sleep. Take care not to overwrite above that address.

Definition at line 55 of file EnigmaIoTconfig.h.

◆ TAG_LENGTH

const uint8_t TAG_LENGTH = 16

Authentication tag length. For Poly1305 it is always 16.

Definition at line 60 of file EnigmaIoTconfig.h.

◆ TIME_SYNC_PERIOD

const uint32_t TIME_SYNC_PERIOD = 30000
static

Period of clock synchronization request.

Definition at line 45 of file EnigmaIoTconfig.h.