Go to the documentation of this file.
10 #ifndef INC_MESHCONFIG_H_
11 #define INC_MESHCONFIG_H_
19 #include "Simulation.h"
22 #include <HardwareCRC.h>
23 #include <ThreadLock.h>
28 #define MESHNET_VERSION (MeshVersion(1,0,0))
33 #define MESHNET_VERSION_txt "1.0.0"
37 #define ISTREAM Stream //Input debug stream
41 #define OSTREAM Print //Output debug stream
50 #define BROADCAST_MESH_ADDRESS (255)
56 #define INVALID_MESH_ADDRESS (254)
62 #define UNKNOWN_MESH_ADDRESS (253)
69 #define MESH_GATEWAY_MAX_ADDRESS (2)
75 #define MAX_MESH_ADDRESS (250)
76 #define MAX_MESH_ADDRESS_txt "250" //Text form of MAX_MNODE_ADDRESS
82 #define IS_VALID_MESH_ADDRESS(address) ((address) <= MAX_MESH_ADDRESS && (address) >= 0)
88 #define IS_VALID_MESH_SRC_ADDRESS(address) (IS_VALID_MESH_ADDRESS(address) || (address) == UNKNOWN_MESH_ADDRESS)
94 #define IS_VALID_MESH_DEST_ADDRESS(address) (IS_VALID_MESH_SRC_ADDRESS(address) || (address) == BROADCAST_MESH_ADDRESS)
100 #define IS_VALID_MESH_FROM_ADDRESS(address) (IS_VALID_MESH_SRC_ADDRESS(address))
106 #define IS_VALID_MESH_TO_ADDRESS(address) (IS_VALID_MESH_SRC_ADDRESS(address))
116 #define MESH_PACKET_PAYLOAD_SIZE_LIMIT (512)
117 #define MESH_PACKET_PAYLOAD_SIZE_LIMIT_txt "512"
123 #define MESH_PING_PAYLOAD_SIZE_LIMIT (MESH_PACKET_PAYLOAD_SIZE_LIMIT-12)
124 #define MESH_PING_PAYLOAD_SIZE_LIMIT_txt "500"
131 #define MESH_FRAME_SIZE_LIMIT (128)
139 #define MESH_FRAME_SIZE_MIN_LIMIT (24)
144 #define DHCPTABLE_SIZE (MAX_MESH_ADDRESS+1) //Size of DHCP table has to be same as maximum address value + 1, because index of this table is node address
145 #define DHCPTABLE_SIZE_txt "251" //Size of DHCP table in text form. TODO this has to be evaluated each time DHCPTABLE_SIZE or MAX_MESH_ADDRESS is changed
146 #define DHCPTABLE_VALID_ROW_LIFETIME (86400000UL) //Time, until DHCPTable row is valid. After this time, it is invalid, but still reserved.
147 #define DHCPTABLE_ROW_RAW_LIFETIME_RESERVED (127) //If DHCP tables's row raw life time is under this value (raw lifetime can be from 0 to 255), record will be no longer valid.
150 #define DHCPTABLE_ROW_LIFETIME (DHCPTABLE_VALID_ROW_LIFETIME + (DHCPTABLE_VALID_ROW_LIFETIME*(255ULL - DHCPTABLE_ROW_RAW_LIFETIME_RESERVED))/DHCPTABLE_ROW_RAW_LIFETIME_RESERVED) //MAX Lifetime of each row in RouteTable in milliseconds.
152 #define ROUTETABLE_SIZE (64) //Maximum number of routes (including routes to neighbors and gateways)
153 #define ROUTETABLE_SIZE_txt "64" //Size of route table in text form.
154 #define ROUTETABLE_MAX_IND_txt "63" //Maximum index in route table
155 #define ROUTETABLE_ROW_LIFETIME (30UL * 60UL * 1000UL) //MAX Lifetime of each row in RouteTable in milliseconds.
157 #define IDTABLE_SIZE (64) //Size of ID table.
158 #define IDTABLE_SIZE_txt "64" //Size of ID table in text form.
159 #define IDTABLE_MAX_IND_txt "63" //Maximum index in ID table
160 #define IDTABLE_ROW_LIFETIME (5UL * 60UL * 1000UL) //MAX Lifetime of each row in ID table in milliseconds.
162 #define FIDTABLE_SIZE (8) //Size of FID table.
163 #define FIDTABLE_SIZE_txt "8" //Size of FID table in text form.
164 #define FIDTABLE_MAX_IND_txt "7" //Maximum index in FID table
165 #define FIDTABLE_ROW_LIFETIME (5UL * 60UL * 1000UL) //MAX Lifetime of each row in FID table in milliseconds.
167 #define OIDTABLE_SIZE (64) //Size of output ID table.
168 #define OIDTABLE_SIZE_txt "64" //Size of output ID table in text form.
169 #define OIDTABLE_MAX_IND_txt "63" //Maximum index in OID table
170 #define OIDTABLE_ROW_LIFETIME (127500UL) //MAX Lifetime of each row in output ID table in milliseconds.
172 #define MESH_OFIFO_HIGH_SIZE (3) //Size of output packet FIFO buffer with high priority.
173 #define MESH_OFIFO_LOW_SIZE (4) //Size of output packet FIFO buffer with low priority.
174 #define MESH_WFIFO_SIZE (8) //Size of waiting packet FIFO buffer.
177 #define MESH_INST_ARRAY_SIZE instArrSize
179 #define MESH_INST_ARRAY_SIZE (2) //Size of instance array. This array stores all created instances of current class. Number of created instances of MeshNet in this program cannot exceed this number.
192 #define MESH_NEXT_FRAME_TIMEOUT (40)
199 #define MESH_ROUTE_RETR_TIME (50)
205 #define MESH_FRAME_SEND_DELAY (15)
211 #define MESH_ACK_CTS_TIME (15000)
217 #define MESH_FRAME_CTS_TIME (20000)
225 #define MESH_RANDOM_ROUTED_CTS_TIME (5000)
234 #define MESH_RANDOM_UNROUTED_CTS_TIME (10000)
240 #define MESH_PATH_DISC_TIMEOUT (5000)
250 #define MESH_HOP_RELAY_LIMIT (25)
256 #define MESH_ROUTE_RETR_CNT (4)
262 #define MESH_FLOOD_RETR_CNT (1)
268 #define MESH_RSSI_THRESHOLD (-70)
274 #define MESH_PROCESS_RECV_FRAMES_AT_ONCE_MAX_LIMIT (3)
276 #if !defined(SIMULATION)
281 #define MESH_IMPL_CONSOLE_ITEM (1)
283 #define MESH_IMPL_CONSOLE_ITEM (0) //Disabled in simulation
284 #endif // !SIMULATION
301 #define MESH_SYS_NET_SCAN_TIMEOUT (1500)
307 #define MESH_CONNECT_TIMEOUT (7500)
313 #define MESH_DISCONNECT_TIMEOUT (5000)
319 #define MESH_REQ_DISCONNECT_TIMEOUT (7500)
325 #define MESH_CONNECT_REQ_TIMEOUT (MESH_CONNECT_TIMEOUT - MESH_SYS_NET_SCAN_TIMEOUT)