EnigmaIOT  0.9.3
Secure sensor and gateway platform based on ESP8266 and ESP32
EnigmaIoTconfig.h
Go to the documentation of this file.
1 
9 #ifndef _CONFIG_h
10 #define _CONFIG_h
11 
12 // Global configuration. Physical layer settings
13 static const uint8_t MAX_MESSAGE_LENGTH = 250;
14 static const size_t ENIGMAIOT_ADDR_LEN = 6;
15 static const char ENIGMAIOT_PROT_VERS[] = "0.9.3";
16 static const uint8_t DEFAULT_CHANNEL = 3;
17 static const uint32_t FLASH_LED_TIME = 50;
18 static const uint8_t NETWORK_NAME_LENGTH = 21;
19 static const uint8_t NODE_NAME_LENGTH = 33;
20 static const int RESET_PIN_DURATION = 5000;
21 
22 // Gateway configuration
23 static const unsigned int MAX_KEY_VALIDITY = 86400000U;
24 static const unsigned int MAX_NODE_INACTIVITY = 86400000U;
25 static const int OTA_GW_TIMEOUT = 11000;
26 static const size_t MAX_MQTT_QUEUE_SIZE = 5;
27 static const int RATE_AVE_ORDER = 5;
28 static const int MAX_INPUT_QUEUE_SIZE = 3;
29 #ifndef NUM_NODES
30 static const int NUM_NODES = 20;
31 #endif //NUM_NODES
32 #ifndef DISCONNECT_ON_DATA_ERROR
33 static const bool DISCONNECT_ON_DATA_ERROR = true;
34 #endif //DISCONNECT_ON_DATA_ERROR
35 #ifndef CONNECT_TO_WIFI_AP
36 #define CONNECT_TO_WIFI_AP 1
37 #endif //CONNECT_TO_WIFI_AP
38 
39 // Node configuration
40 static const int16_t RECONNECTION_PERIOD = 1500;
41 static const uint16_t DOWNLINK_WAIT_TIME = 800;
42 static const uint32_t DEFAULT_SLEEP_TIME = 10;
43 static const uint32_t OTA_TIMEOUT_TIME = 10000;
44 static const time_t IDENTIFY_TIMEOUT = 10000;
45 static const uint32_t TIME_SYNC_PERIOD = 30000;
46 static const unsigned int QUICK_SYNC_TIME = 5000;
47 static const int MIN_SYNC_ACCURACY = 5;
48 static const int MAX_DATA_PAYLOAD_SIZE = 214;
49 static const uint32_t PRE_REG_DELAY = 5000;
50 static const uint32_t POST_REG_DELAY = 1500;
51 #ifndef CHECK_COMM_ERRORS
52 static const bool CHECK_COMM_ERRORS = true;
53 #endif // !1
54 static const uint8_t COMM_ERRORS_BEFORE_SCAN = 2;
55 static const uint32_t RTC_ADDRESS = 0;
56 
57 //Crypto configuration
58 const uint8_t KEY_LENGTH = 32;
59 const uint8_t IV_LENGTH = 12;
60 const uint8_t TAG_LENGTH = 16;
61 const uint8_t AAD_LENGTH = 8;
62 #define CYPHER_TYPE ChaChaPoly
63 
64 //Debug
65 #define DEBUG_ESP_PORT Serial
66 #ifndef DEBUG_LEVEL
67 #define DEBUG_LEVEL WARN
68 #endif //DEBUG_LEVEL
69 
70 #endif
ENIGMAIOT_PROT_VERS
static const char ENIGMAIOT_PROT_VERS[]
EnitmaIoT Version.
Definition: EnigmaIoTconfig.h:15
MAX_NODE_INACTIVITY
static const unsigned int MAX_NODE_INACTIVITY
After this time (in ms) a node is marked as gone.
Definition: EnigmaIoTconfig.h:24
IDENTIFY_TIMEOUT
static const time_t IDENTIFY_TIMEOUT
How long LED will be flashing during identification.
Definition: EnigmaIoTconfig.h:44
MAX_DATA_PAYLOAD_SIZE
static const int MAX_DATA_PAYLOAD_SIZE
Maximun payload size for data packets.
Definition: EnigmaIoTconfig.h:48
OTA_GW_TIMEOUT
static const int OTA_GW_TIMEOUT
OTA mode timeout. In OTA mode all data messages are ignored.
Definition: EnigmaIoTconfig.h:25
COMM_ERRORS_BEFORE_SCAN
static const uint8_t COMM_ERRORS_BEFORE_SCAN
Node will search for a gateway if this number of communication errors have happened.
Definition: EnigmaIoTconfig.h:54
ENIGMAIOT_ADDR_LEN
static const size_t ENIGMAIOT_ADDR_LEN
Address size. Mac address = 6 bytes.
Definition: EnigmaIoTconfig.h:14
OTA_TIMEOUT_TIME
static const uint32_t OTA_TIMEOUT_TIME
Timeout between OTA messages. In milliseconds.
Definition: EnigmaIoTconfig.h:43
NODE_NAME_LENGTH
static const uint8_t NODE_NAME_LENGTH
Maximum number of characters of node name.
Definition: EnigmaIoTconfig.h:19
RATE_AVE_ORDER
static const int RATE_AVE_ORDER
Message rate filter order.
Definition: EnigmaIoTconfig.h:27
IV_LENGTH
const uint8_t IV_LENGTH
Initalization vector length used by selected crypto algorythm.
Definition: EnigmaIoTconfig.h:59
TIME_SYNC_PERIOD
static const uint32_t TIME_SYNC_PERIOD
Period of clock synchronization request.
Definition: EnigmaIoTconfig.h:45
MIN_SYNC_ACCURACY
static const int MIN_SYNC_ACCURACY
If calculated offset absolute value is higher than this value resync is done more often.
Definition: EnigmaIoTconfig.h:47
DISCONNECT_ON_DATA_ERROR
static const bool DISCONNECT_ON_DATA_ERROR
Activates node invalidation in case of data error.
Definition: EnigmaIoTconfig.h:33
QUICK_SYNC_TIME
static const unsigned int QUICK_SYNC_TIME
Period of clock synchronization request in case of resync is needed.
Definition: EnigmaIoTconfig.h:46
AAD_LENGTH
const uint8_t AAD_LENGTH
Number of bytes from last part of key that will be used for additional authenticated data.
Definition: EnigmaIoTconfig.h:61
NUM_NODES
static const int NUM_NODES
Maximum number of nodes that this gateway can handle.
Definition: EnigmaIoTconfig.h:30
PRE_REG_DELAY
static const uint32_t PRE_REG_DELAY
Time to wait before registration so that other nodes have time to communicate. Real delay is a random...
Definition: EnigmaIoTconfig.h:49
POST_REG_DELAY
static const uint32_t POST_REG_DELAY
Time to waif before sending data after registration so that other nodes have time to finish their reg...
Definition: EnigmaIoTconfig.h:50
MAX_MESSAGE_LENGTH
static const uint8_t MAX_MESSAGE_LENGTH
Maximum payload size on ESP-NOW.
Definition: EnigmaIoTconfig.h:13
MAX_KEY_VALIDITY
static const unsigned int MAX_KEY_VALIDITY
After this time (in ms) a nude is unregistered.
Definition: EnigmaIoTconfig.h:23
RTC_ADDRESS
static const uint32_t RTC_ADDRESS
RTC memory address where to store context. Modify it if you need place to store your own data during ...
Definition: EnigmaIoTconfig.h:55
RECONNECTION_PERIOD
static const int16_t RECONNECTION_PERIOD
Time to retry Gateway connection.
Definition: EnigmaIoTconfig.h:40
DOWNLINK_WAIT_TIME
static const uint16_t DOWNLINK_WAIT_TIME
Time to wait for downlink message before sleep. Setting less than 180 ms causes ESP-NOW errors due to...
Definition: EnigmaIoTconfig.h:41
MAX_INPUT_QUEUE_SIZE
static const int MAX_INPUT_QUEUE_SIZE
Input queue size for EnigmaIOT messages. Acts as a buffer to be able to handle messages during high l...
Definition: EnigmaIoTconfig.h:28
DEFAULT_CHANNEL
static const uint8_t DEFAULT_CHANNEL
WiFi channel to be used on ESP-NOW.
Definition: EnigmaIoTconfig.h:16
NETWORK_NAME_LENGTH
static const uint8_t NETWORK_NAME_LENGTH
Maximum number of characters of network name.
Definition: EnigmaIoTconfig.h:18
CHECK_COMM_ERRORS
static const bool CHECK_COMM_ERRORS
Try to reconnect in case of communication errors.
Definition: EnigmaIoTconfig.h:52
RESET_PIN_DURATION
static const int RESET_PIN_DURATION
Number of milliseconds that reset pin has to be grounded to produce a configuration reset.
Definition: EnigmaIoTconfig.h:20
FLASH_LED_TIME
static const uint32_t FLASH_LED_TIME
Time that led keeps on during flash in ms.
Definition: EnigmaIoTconfig.h:17
MAX_MQTT_QUEUE_SIZE
static const size_t MAX_MQTT_QUEUE_SIZE
Maximum number of MQTT messages to be sent.
Definition: EnigmaIoTconfig.h:26
DEFAULT_SLEEP_TIME
static const uint32_t DEFAULT_SLEEP_TIME
Default sleep time if it was not set.
Definition: EnigmaIoTconfig.h:42
KEY_LENGTH
const uint8_t KEY_LENGTH
Key length used by selected crypto algorythm. The only tested value is 32. Change it only if you know...
Definition: EnigmaIoTconfig.h:58
TAG_LENGTH
const uint8_t TAG_LENGTH
Authentication tag length. For Poly1305 it is always 16.
Definition: EnigmaIoTconfig.h:60