MeshNet  1.0.0
Macros
meshConfig.h File Reference

This file contains macros, which can MeshNet behavior can be configured. More...

#include <wirish.h>
#include <Stream.h>
#include <HardwareCRC.h>
#include <ThreadLock.h>
Include dependency graph for meshConfig.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NO_ITOA_S
 
#define ITOA   _itoa_s
 
#define MESHNET_VERSION   (MeshVersion(1,0,0))
 MeshNet version represented as MeshVersion structure. More...
 
#define MESHNET_VERSION_txt   "1.0.0"
 MeshNet version represented as text. More...
 
#define ISTREAM   Stream
 
#define OSTREAM   Print
 
#define BROADCAST_MESH_ADDRESS   (255)
 Address, that is used for broadcast. Not implemented yet. More...
 
#define INVALID_MESH_ADDRESS   (254)
 Address, that is invalid and cannot be used. More...
 
#define UNKNOWN_MESH_ADDRESS   (253)
 Address, of node, when node is not connected to any network. More...
 
#define MESH_GATEWAY_MAX_ADDRESS   (2)
 Maximum address, which is reserved for gateway. Defaultly addressed 0,1,2 are reserved for gateway and 0 is reserved for main gateway. More...
 
#define MAX_MESH_ADDRESS   (250)
 Maximum valid address number (included). Can be set up to 250 MNodes. Default value: 250. More...
 
#define MAX_MESH_ADDRESS_txt   "250"
 
#define IS_VALID_MESH_ADDRESS(address)   ((address) <= MAX_MESH_ADDRESS && (address) >= 0)
 Checks if mesh address is valid. Accepted values from 0 to MAX_MESH_ADDRESS. More...
 
#define IS_VALID_MESH_SRC_ADDRESS(address)   (IS_VALID_MESH_ADDRESS(address) || (address) == UNKNOWN_MESH_ADDRESS)
 Checks if mesh "source" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS. More...
 
#define IS_VALID_MESH_DEST_ADDRESS(address)   (IS_VALID_MESH_SRC_ADDRESS(address) || (address) == BROADCAST_MESH_ADDRESS)
 Checks if mesh "destination" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS and BROADCAST_MESH_ADDRESS. More...
 
#define IS_VALID_MESH_FROM_ADDRESS(address)   (IS_VALID_MESH_SRC_ADDRESS(address))
 Checks if mesh "from" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS. More...
 
#define IS_VALID_MESH_TO_ADDRESS(address)   (IS_VALID_MESH_SRC_ADDRESS(address))
 Checks if mesh "to" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS. More...
 
#define MESH_PACKET_PAYLOAD_SIZE_LIMIT   (512)
 Mesh packet payload size limit in bytes. Protects memory from large space allocation. More...
 
#define MESH_PACKET_PAYLOAD_SIZE_LIMIT_txt   "512"
 
#define MESH_PING_PAYLOAD_SIZE_LIMIT   (MESH_PACKET_PAYLOAD_SIZE_LIMIT-12)
 Maximum size of payload, that can be sent with ping packet. More...
 
#define MESH_PING_PAYLOAD_SIZE_LIMIT_txt   "500"
 
#define MESH_FRAME_SIZE_LIMIT   (128)
 Maximum size of frame including it's header. Protects from long sending times and from interference. More...
 
#define MESH_FRAME_SIZE_MIN_LIMIT   (24)
 Minimum settable maximum frame size limit in bytes. Radio, which cannot send frame with this size cannot be used, because packet headers cannot be splitted to multiple frames. Also ACK should be never splitted. More...
 
#define DHCPTABLE_SIZE   (MAX_MESH_ADDRESS+1)
 
#define DHCPTABLE_SIZE_txt   "251"
 
#define DHCPTABLE_VALID_ROW_LIFETIME   (86400000UL)
 
#define DHCPTABLE_ROW_RAW_LIFETIME_RESERVED   (127)
 
#define DHCPTABLE_ROW_LIFETIME   (DHCPTABLE_VALID_ROW_LIFETIME + (DHCPTABLE_VALID_ROW_LIFETIME*(255ULL - DHCPTABLE_ROW_RAW_LIFETIME_RESERVED))/DHCPTABLE_ROW_RAW_LIFETIME_RESERVED)
 
#define ROUTETABLE_SIZE   (64)
 
#define ROUTETABLE_SIZE_txt   "64"
 
#define ROUTETABLE_MAX_IND_txt   "63"
 
#define ROUTETABLE_ROW_LIFETIME   (30UL * 60UL * 1000UL)
 
#define IDTABLE_SIZE   (64)
 
#define IDTABLE_SIZE_txt   "64"
 
#define IDTABLE_MAX_IND_txt   "63"
 
#define IDTABLE_ROW_LIFETIME   (5UL * 60UL * 1000UL)
 
#define FIDTABLE_SIZE   (8)
 
#define FIDTABLE_SIZE_txt   "8"
 
#define FIDTABLE_MAX_IND_txt   "7"
 
#define FIDTABLE_ROW_LIFETIME   (5UL * 60UL * 1000UL)
 
#define OIDTABLE_SIZE   (64)
 
#define OIDTABLE_SIZE_txt   "64"
 
#define OIDTABLE_MAX_IND_txt   "63"
 
#define OIDTABLE_ROW_LIFETIME   (127500UL)
 
#define MESH_OFIFO_HIGH_SIZE   (3)
 
#define MESH_OFIFO_LOW_SIZE   (4)
 
#define MESH_WFIFO_SIZE   (8)
 
#define MESH_INST_ARRAY_SIZE   (2)
 
#define MESH_NEXT_FRAME_TIMEOUT   (40)
 If header frame was received and next frame is expected, until this timeout all others frames are ignored. If expected frame is received timer is restarted. This loop ends when all frames of one packet were received. This value is in milliseconds. More...
 
#define MESH_ROUTE_RETR_TIME   (50)
 After this time in ms routed frame (Type: Route or Unicast) can be retransmitted. Frame is retransmitted only when ACK is needed. More...
 
#define MESH_FRAME_SEND_DELAY   (15)
 Minimum delay between sent frames in ms. If frame has to be acknowledged, this setting is ignored. More...
 
#define MESH_ACK_CTS_TIME   (15000)
 During this time in µs, transmitter cannot transmit data, because ACK is expected. More...
 
#define MESH_FRAME_CTS_TIME   (20000)
 During this time in µs, transmitter cannot transmit data, because FRAME is expected. More...
 
#define MESH_RANDOM_ROUTED_CTS_TIME   (5000)
 Max possible random value in µs added to new CTS time value after it's prediction. This value has to be higher than maximum transmission time of frame. More...
 
#define MESH_RANDOM_UNROUTED_CTS_TIME   (10000)
 Max possible random CTS time in µs added to CTS_until value if broadcasted or flooded frame is received. This time protects from sending packets at same time. This value has to be higher than maximum transmission time of frame. More...
 
#define MESH_PATH_DISC_TIMEOUT   (5000)
 Mesh path discovery timeout in milliseconds. More...
 
#define MESH_HOP_RELAY_LIMIT   (25)
 Number of hops, that message can achieve. If this limit is reached, message won't be relayed. More...
 
#define MESH_ROUTE_RETR_CNT   (4)
 Number of possible retransmissions. More...
 
#define MESH_FLOOD_RETR_CNT   (1)
 Number of needed retransmissions for each packet, that don't has to be acknowledged. More...
 
#define MESH_RSSI_THRESHOLD   (-70)
 Thanks to RSSI threshold, packet from not reliable links are ignored and path to them is not created. More...
 
#define MESH_PROCESS_RECV_FRAMES_AT_ONCE_MAX_LIMIT   (3)
 This settings limits how many frames can be processed in one call of processReceived() method. More...
 
#define MESH_IMPL_CONSOLE_ITEM   (1)
 Set to 1 to implement SerialConsole ConsoleItem to MeshNet. More...
 
#define MESH_SYS_NET_SCAN_TIMEOUT   (1500)
 Uncomment to disable statistics. This can decrease class size. More...
 
#define MESH_CONNECT_TIMEOUT   (7500)
 Mesh connection timeout in ms. More...
 
#define MESH_DISCONNECT_TIMEOUT   (5000)
 After this time in ms node is definitely disconnected from network and all packets in FIFO for that network are cleared. More...
 
#define MESH_REQ_DISCONNECT_TIMEOUT   (7500)
 Until this time, node, the gateway requested disconnection, has to respond with disconnect packet, which says, it is disconnecting. More...
 
#define MESH_CONNECT_REQ_TIMEOUT   (MESH_CONNECT_TIMEOUT - MESH_SYS_NET_SCAN_TIMEOUT)
 Mesh connection timeout from time, the connection request was sent, in ms. More...
 

Detailed Description

This file contains macros, which can MeshNet behavior can be configured.

Credits

Author
Matej Fitoš
Date
Sept 18, 2021

Macro Definition Documentation

◆ BROADCAST_MESH_ADDRESS

#define BROADCAST_MESH_ADDRESS   (255)

Address, that is used for broadcast. Not implemented yet.

@macro BROADCAST_MESH_ADDRESS

◆ DHCPTABLE_ROW_LIFETIME

◆ DHCPTABLE_ROW_RAW_LIFETIME_RESERVED

#define DHCPTABLE_ROW_RAW_LIFETIME_RESERVED   (127)

◆ DHCPTABLE_SIZE

#define DHCPTABLE_SIZE   (MAX_MESH_ADDRESS+1)

◆ DHCPTABLE_SIZE_txt

#define DHCPTABLE_SIZE_txt   "251"

◆ DHCPTABLE_VALID_ROW_LIFETIME

#define DHCPTABLE_VALID_ROW_LIFETIME   (86400000UL)

◆ FIDTABLE_MAX_IND_txt

#define FIDTABLE_MAX_IND_txt   "7"

◆ FIDTABLE_ROW_LIFETIME

#define FIDTABLE_ROW_LIFETIME   (5UL * 60UL * 1000UL)

◆ FIDTABLE_SIZE

#define FIDTABLE_SIZE   (8)

◆ FIDTABLE_SIZE_txt

#define FIDTABLE_SIZE_txt   "8"

◆ IDTABLE_MAX_IND_txt

#define IDTABLE_MAX_IND_txt   "63"

◆ IDTABLE_ROW_LIFETIME

#define IDTABLE_ROW_LIFETIME   (5UL * 60UL * 1000UL)

◆ IDTABLE_SIZE

#define IDTABLE_SIZE   (64)

◆ IDTABLE_SIZE_txt

#define IDTABLE_SIZE_txt   "64"

◆ INVALID_MESH_ADDRESS

#define INVALID_MESH_ADDRESS   (254)

Address, that is invalid and cannot be used.

@macro INVALID_MESH_ADDRESS

◆ IS_VALID_MESH_ADDRESS

#define IS_VALID_MESH_ADDRESS (   address)    ((address) <= MAX_MESH_ADDRESS && (address) >= 0)

Checks if mesh address is valid. Accepted values from 0 to MAX_MESH_ADDRESS.

@macro IS_VALID_MESH_ADDRESS

◆ IS_VALID_MESH_DEST_ADDRESS

#define IS_VALID_MESH_DEST_ADDRESS (   address)    (IS_VALID_MESH_SRC_ADDRESS(address) || (address) == BROADCAST_MESH_ADDRESS)

Checks if mesh "destination" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS and BROADCAST_MESH_ADDRESS.

@macro IS_VALID_MESH_DEST_ADDRESS

◆ IS_VALID_MESH_FROM_ADDRESS

#define IS_VALID_MESH_FROM_ADDRESS (   address)    (IS_VALID_MESH_SRC_ADDRESS(address))

Checks if mesh "from" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS.

@macro IS_VALID_MESH_FROM_ADDRESS

◆ IS_VALID_MESH_SRC_ADDRESS

#define IS_VALID_MESH_SRC_ADDRESS (   address)    (IS_VALID_MESH_ADDRESS(address) || (address) == UNKNOWN_MESH_ADDRESS)

Checks if mesh "source" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS.

@macro IS_VALID_MESH_SRC_ADDRESS

◆ IS_VALID_MESH_TO_ADDRESS

#define IS_VALID_MESH_TO_ADDRESS (   address)    (IS_VALID_MESH_SRC_ADDRESS(address))

Checks if mesh "to" address from packet or frame header is valid. Accepted values from 0 to MAX_MESH_ADDRESS and UNKNOWN_MESH_ADDRESS.

@macro IS_VALID_MESH_TO_ADDRESS

◆ ISTREAM

#define ISTREAM   Stream

◆ ITOA

#define ITOA   _itoa_s

◆ MAX_MESH_ADDRESS

#define MAX_MESH_ADDRESS   (250)

Maximum valid address number (included). Can be set up to 250 MNodes. Default value: 250.

@macro MAX_MNODE_ADDRESS

◆ MAX_MESH_ADDRESS_txt

#define MAX_MESH_ADDRESS_txt   "250"

◆ MESH_ACK_CTS_TIME

#define MESH_ACK_CTS_TIME   (15000)

During this time in µs, transmitter cannot transmit data, because ACK is expected.

@macro MESH_ACK_CTS_TIME

◆ MESH_CONNECT_REQ_TIMEOUT

#define MESH_CONNECT_REQ_TIMEOUT   (MESH_CONNECT_TIMEOUT - MESH_SYS_NET_SCAN_TIMEOUT)

Mesh connection timeout from time, the connection request was sent, in ms.

@macro MESH_CONNECT_REQ_TIMEOUT

◆ MESH_CONNECT_TIMEOUT

#define MESH_CONNECT_TIMEOUT   (7500)

Mesh connection timeout in ms.

@macro MESH_CONNECT_TIMEOUT

◆ MESH_DISCONNECT_TIMEOUT

#define MESH_DISCONNECT_TIMEOUT   (5000)

After this time in ms node is definitely disconnected from network and all packets in FIFO for that network are cleared.

@macro MESH_DISCONNECT_TIMEOUT

◆ MESH_FLOOD_RETR_CNT

#define MESH_FLOOD_RETR_CNT   (1)

Number of needed retransmissions for each packet, that don't has to be acknowledged.

@macro MESH_FLOOD_RETR_CNT

◆ MESH_FRAME_CTS_TIME

#define MESH_FRAME_CTS_TIME   (20000)

During this time in µs, transmitter cannot transmit data, because FRAME is expected.

@macro MESH_FRAME_CTS_TIME

◆ MESH_FRAME_SEND_DELAY

#define MESH_FRAME_SEND_DELAY   (15)

Minimum delay between sent frames in ms. If frame has to be acknowledged, this setting is ignored.

@macro MESH_FRAME_SEND_DELAY

◆ MESH_FRAME_SIZE_LIMIT

#define MESH_FRAME_SIZE_LIMIT   (128)

Maximum size of frame including it's header. Protects from long sending times and from interference.

@macro MESH_FRAME_SIZE_LIMIT

Warning
Do not change.

◆ MESH_FRAME_SIZE_MIN_LIMIT

#define MESH_FRAME_SIZE_MIN_LIMIT   (24)

Minimum settable maximum frame size limit in bytes. Radio, which cannot send frame with this size cannot be used, because packet headers cannot be splitted to multiple frames. Also ACK should be never splitted.

@macro MESH_FRAME_SIZE_MIN_LIMIT

Warning
Do not change.

◆ MESH_GATEWAY_MAX_ADDRESS

#define MESH_GATEWAY_MAX_ADDRESS   (2)

Maximum address, which is reserved for gateway. Defaultly addressed 0,1,2 are reserved for gateway and 0 is reserved for main gateway.

@macro MESH_GATEWAY_MAX_ADDRESS

◆ MESH_HOP_RELAY_LIMIT

#define MESH_HOP_RELAY_LIMIT   (25)

Number of hops, that message can achieve. If this limit is reached, message won't be relayed.

@macro MESH_HOP_RELAY_LIMIT

◆ MESH_IMPL_CONSOLE_ITEM

#define MESH_IMPL_CONSOLE_ITEM   (1)

Set to 1 to implement SerialConsole ConsoleItem to MeshNet.

@macro MESH_IMPL_CONSOLE_ITEM

◆ MESH_INST_ARRAY_SIZE

#define MESH_INST_ARRAY_SIZE   (2)

◆ MESH_NEXT_FRAME_TIMEOUT

#define MESH_NEXT_FRAME_TIMEOUT   (40)

If header frame was received and next frame is expected, until this timeout all others frames are ignored. If expected frame is received timer is restarted. This loop ends when all frames of one packet were received. This value is in milliseconds.

@macro MESH_NEXT_FRAME_TIMEOUT

◆ MESH_OFIFO_HIGH_SIZE

#define MESH_OFIFO_HIGH_SIZE   (3)

◆ MESH_OFIFO_LOW_SIZE

#define MESH_OFIFO_LOW_SIZE   (4)

◆ MESH_PACKET_PAYLOAD_SIZE_LIMIT

#define MESH_PACKET_PAYLOAD_SIZE_LIMIT   (512)

Mesh packet payload size limit in bytes. Protects memory from large space allocation.

@macro MESH_PACKET_PAYLOAD_SIZE_LIMIT

Note
This value can be set from 128 bytes to 1024 bytes.

◆ MESH_PACKET_PAYLOAD_SIZE_LIMIT_txt

#define MESH_PACKET_PAYLOAD_SIZE_LIMIT_txt   "512"

◆ MESH_PATH_DISC_TIMEOUT

#define MESH_PATH_DISC_TIMEOUT   (5000)

Mesh path discovery timeout in milliseconds.

@macro MESH_PATH_DISC_TIMEOUT

◆ MESH_PING_PAYLOAD_SIZE_LIMIT

#define MESH_PING_PAYLOAD_SIZE_LIMIT   (MESH_PACKET_PAYLOAD_SIZE_LIMIT-12)

Maximum size of payload, that can be sent with ping packet.

@macro MESH_PING_PAYLOAD_SIZE_LIMIT

◆ MESH_PING_PAYLOAD_SIZE_LIMIT_txt

#define MESH_PING_PAYLOAD_SIZE_LIMIT_txt   "500"

◆ MESH_PROCESS_RECV_FRAMES_AT_ONCE_MAX_LIMIT

#define MESH_PROCESS_RECV_FRAMES_AT_ONCE_MAX_LIMIT   (3)

This settings limits how many frames can be processed in one call of processReceived() method.

@macro MESH_PROCESS_RECV_FRAMES_AT_ONCE_MAX_LIMIT

◆ MESH_RANDOM_ROUTED_CTS_TIME

#define MESH_RANDOM_ROUTED_CTS_TIME   (5000)

Max possible random value in µs added to new CTS time value after it's prediction. This value has to be higher than maximum transmission time of frame.

@macro MESH_RANDOM_ROUTED_CTS_TIME

Note
This is just upper limit of random value. Lower limit is set to 0.

◆ MESH_RANDOM_UNROUTED_CTS_TIME

#define MESH_RANDOM_UNROUTED_CTS_TIME   (10000)

Max possible random CTS time in µs added to CTS_until value if broadcasted or flooded frame is received. This time protects from sending packets at same time. This value has to be higher than maximum transmission time of frame.

@macro MESH_RANDOM_UNROUTED_CTS_TIME

Note
This is just upper limit of random value. Lower limit is set to 0.

◆ MESH_REQ_DISCONNECT_TIMEOUT

#define MESH_REQ_DISCONNECT_TIMEOUT   (7500)

Until this time, node, the gateway requested disconnection, has to respond with disconnect packet, which says, it is disconnecting.

@macro MESH_REQ_DISCONNECT_TIMEOUT

◆ MESH_ROUTE_RETR_CNT

#define MESH_ROUTE_RETR_CNT   (4)

Number of possible retransmissions.

@macro MESH_ROUTE_RETR_CNT

◆ MESH_ROUTE_RETR_TIME

#define MESH_ROUTE_RETR_TIME   (50)

After this time in ms routed frame (Type: Route or Unicast) can be retransmitted. Frame is retransmitted only when ACK is needed.

@macro MESH_ROUTE_RETR_TIME

◆ MESH_RSSI_THRESHOLD

#define MESH_RSSI_THRESHOLD   (-70)

Thanks to RSSI threshold, packet from not reliable links are ignored and path to them is not created.

@macro MESH_RSSI_THRESHOLD

◆ MESH_SYS_NET_SCAN_TIMEOUT

#define MESH_SYS_NET_SCAN_TIMEOUT   (1500)

Uncomment to disable statistics. This can decrease class size.

@macro MESH_NO_STATISTICS @macro MESH_SYS_NET_SCAN_TIMEOUT

System network scan timeout in ms.

◆ MESH_WFIFO_SIZE

#define MESH_WFIFO_SIZE   (8)

◆ MESHNET_VERSION

#define MESHNET_VERSION   (MeshVersion(1,0,0))

MeshNet version represented as MeshVersion structure.

◆ MESHNET_VERSION_txt

#define MESHNET_VERSION_txt   "1.0.0"

MeshNet version represented as text.

◆ NO_ITOA_S

#define NO_ITOA_S

◆ OIDTABLE_MAX_IND_txt

#define OIDTABLE_MAX_IND_txt   "63"

◆ OIDTABLE_ROW_LIFETIME

#define OIDTABLE_ROW_LIFETIME   (127500UL)

◆ OIDTABLE_SIZE

#define OIDTABLE_SIZE   (64)

◆ OIDTABLE_SIZE_txt

#define OIDTABLE_SIZE_txt   "64"

◆ OSTREAM

#define OSTREAM   Print

◆ ROUTETABLE_MAX_IND_txt

#define ROUTETABLE_MAX_IND_txt   "63"

◆ ROUTETABLE_ROW_LIFETIME

#define ROUTETABLE_ROW_LIFETIME   (30UL * 60UL * 1000UL)

◆ ROUTETABLE_SIZE

#define ROUTETABLE_SIZE   (64)

◆ ROUTETABLE_SIZE_txt

#define ROUTETABLE_SIZE_txt   "64"

◆ UNKNOWN_MESH_ADDRESS

#define UNKNOWN_MESH_ADDRESS   (253)

Address, of node, when node is not connected to any network.

@macro UNKNOWN_MESH_ADDRESS