EnigmaIOT  0.9.8
Secure sensor and gateway platform based on ESP8266 and ESP32
EnigmaIoTconfigAdvanced.h
Go to the documentation of this file.
1 
9  /****************************************************************************
10  DO NOT MODIFY THESE SETTINGS UNLESS YOU KNOW WHAT YOU ARE DOING
11  ---------------------------------------------------------------
12  NO MODIFIQUES ESTOS AJUSTES SI NO SABES LO QUE ESTÁS HACIENDO
13  ****************************************************************************/
14 
15 #ifndef _CONFIG_ADVANCED_h
16 #define _CONFIG_ADVANCED_h
17 
18 #include "Arduino.h"
19 
20 // Global configuration. Physical layer settings
21 static const uint8_t MAX_MESSAGE_LENGTH = 250;
22 static const uint8_t MAX_DATA_PAYLOAD_LENGTH = 214;
23 static const size_t ENIGMAIOT_ADDR_LEN = 6;
24 static const uint8_t NETWORK_NAME_LENGTH = 21;
25 static const uint8_t NODE_NAME_LENGTH = 33;
26 static const uint8_t BROADCAST_ADDRESS[] = { 0xff,0xff,0xff,0xff,0xff,0xff };
27 static const char BROADCAST_NONE_NAME[] = "broadcast";
28 static const uint8_t COMMS_QUEUE_SIZE = 5;
29 
30 // Gateway configuration
31 static const int OTA_GW_TIMEOUT = 11000;
32 #ifndef DISCONNECT_ON_DATA_ERROR
33 static const bool DISCONNECT_ON_DATA_ERROR = true;
34 #endif //DISCONNECT_ON_DATA_ERROR
35 #ifndef ENABLE_REST_API
36 #define ENABLE_REST_API 1
37 #endif // ENABLE_REST_API
38 #ifndef SUPPORT_HA_DISCOVERY
39 #define SUPPORT_HA_DISCOVERY 1
40 #if SUPPORT_HA_DISCOVERY
41 static const char HA_DISCOVERY_PREFIX[] = "homeassistant";
42 #endif // SUPPORT_HA_DISCOVERY
43 #endif // SUPPORT_HA_DISCOVERY
44 
45 // Node configuration
46 static const uint32_t OTA_TIMEOUT_TIME = 10000;
47 static const int MIN_SYNC_ACCURACY = 5000;
48 static const int MAX_DATA_PAYLOAD_SIZE = 214;
49 #ifndef CHECK_COMM_ERRORS
50 static const bool CHECK_COMM_ERRORS = true;
51 #endif // CHECK_COMM_ERRORS
52 static const uint32_t RTC_ADDRESS = 8;
53 #ifndef USE_FLASH_INSTEAD_RTC
54 #define USE_FLASH_INSTEAD_RTC 0
55 #endif // USE_FLASH_INSTEAD_RTC
56 #ifndef HA_FIRST_DISCOVERY_DELAY
57 #define HA_FIRST_DISCOVERY_DELAY 5000
58 #endif // HA_FIRST_DISCOVERY_DELAY
59 #ifndef HA_NEXT_DISCOVERY_DELAY
60 #define HA_NEXT_DISCOVERY_DELAY 500
61 #endif // HA_NEXT_DISCOVERY_DELAY
62 #ifndef HA_FIRST_DISCOVERY_DELAY_SLEEPY
63 #define HA_FIRST_DISCOVERY_DELAY_SLEEPY 10
64 #endif // HA_FIRST_DISCOVERY_DELAY
65 #ifndef HA_NEXT_DISCOVERY_DELAY_SLEEPY
66 #define HA_NEXT_DISCOVERY_DELAY_SLEEPY 10
67 #endif // HA_NEXT_DISCOVERY_DELAY
68 
69 //Crypto configuration
70 const uint8_t KEY_LENGTH = 32;
71 const uint8_t IV_LENGTH = 12;
72 const uint8_t TAG_LENGTH = 16;
73 const uint8_t AAD_LENGTH = 8;
74 #define CYPHER_TYPE ChaChaPoly
75 
76 //Web API
77 const int WEB_API_PORT = 80;
78 
79 //File system
80 #if defined ESP32
81 #define FILESYSTEM SPIFFS
82 #include <SPIFFS.h>
83 #elif defined ESP8266
84  #ifndef USE_LITTLE_FS
85  #define USE_LITTLE_FS 1
86  #endif // USE_LITTLE_FS
87 #if USE_LITTLE_FS
88 #include <FS.h>
89 #include <LittleFS.h>
90 #define FILESYSTEM LittleFS
91 #else
92 #define FILESYSTEM SPIFFS
93 #endif // USE_LITTLE_FS
94 #endif
95 
96 #endif
DISCONNECT_ON_DATA_ERROR
static const bool DISCONNECT_ON_DATA_ERROR
Activates node invalidation in case of data error.
Definition: EnigmaIoTconfigAdvanced.h:33
OTA_TIMEOUT_TIME
static const uint32_t OTA_TIMEOUT_TIME
Timeout between OTA messages. In milliseconds.
Definition: EnigmaIoTconfigAdvanced.h:46
TAG_LENGTH
const uint8_t TAG_LENGTH
Authentication tag length. For Poly1305 it is always 16.
Definition: EnigmaIoTconfigAdvanced.h:72
ENIGMAIOT_ADDR_LEN
static const size_t ENIGMAIOT_ADDR_LEN
Address size. Mac address = 6 bytes.
Definition: EnigmaIoTconfigAdvanced.h:23
MAX_MESSAGE_LENGTH
static const uint8_t MAX_MESSAGE_LENGTH
Maximum payload size on ESP-NOW.
Definition: EnigmaIoTconfigAdvanced.h:21
NODE_NAME_LENGTH
static const uint8_t NODE_NAME_LENGTH
Maximum number of characters of node name.
Definition: EnigmaIoTconfigAdvanced.h:25
MAX_DATA_PAYLOAD_SIZE
static const int MAX_DATA_PAYLOAD_SIZE
Maximun payload size for data packets.
Definition: EnigmaIoTconfigAdvanced.h:48
NETWORK_NAME_LENGTH
static const uint8_t NETWORK_NAME_LENGTH
Maximum number of characters of network name.
Definition: EnigmaIoTconfigAdvanced.h:24
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: EnigmaIoTconfigAdvanced.h:47
MAX_DATA_PAYLOAD_LENGTH
static const uint8_t MAX_DATA_PAYLOAD_LENGTH
Maximum EnigmaIOT user data payload size.
Definition: EnigmaIoTconfigAdvanced.h:22
OTA_GW_TIMEOUT
static const int OTA_GW_TIMEOUT
OTA mode timeout. In OTA mode all data messages are ignored.
Definition: EnigmaIoTconfigAdvanced.h:31
AAD_LENGTH
const uint8_t AAD_LENGTH
Number of bytes from last part of key that will be used for additional authenticated data.
Definition: EnigmaIoTconfigAdvanced.h:73
CHECK_COMM_ERRORS
static const bool CHECK_COMM_ERRORS
Try to reconnect in case of communication errors.
Definition: EnigmaIoTconfigAdvanced.h:50
COMMS_QUEUE_SIZE
static const uint8_t COMMS_QUEUE_SIZE
Definition: EnigmaIoTconfigAdvanced.h:28
BROADCAST_NONE_NAME
static const char BROADCAST_NONE_NAME[]
Name to reference broadcast node.
Definition: EnigmaIoTconfigAdvanced.h:27
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: EnigmaIoTconfigAdvanced.h:70
BROADCAST_ADDRESS
static const uint8_t BROADCAST_ADDRESS[]
Broadcast address.
Definition: EnigmaIoTconfigAdvanced.h:26
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: EnigmaIoTconfigAdvanced.h:52
WEB_API_PORT
const int WEB_API_PORT
TCP port where Web API will listen through.
Definition: EnigmaIoTconfigAdvanced.h:77
IV_LENGTH
const uint8_t IV_LENGTH
Initalization vector length used by selected crypto algorythm.
Definition: EnigmaIoTconfigAdvanced.h:71
HA_DISCOVERY_PREFIX
static const char HA_DISCOVERY_PREFIX[]
Used to build HomeAssistant discovery message topic.
Definition: EnigmaIoTconfigAdvanced.h:41