MeshNet
1.0.0
|
This class implements MeshNet protocol for microcontrollers. More...
#include <mesh.h>
Public Member Functions | |
MeshNet () | |
Constructor without arguments. More... | |
virtual | ~MeshNet () |
Virtual destructor. More... | |
virtual bool | begin (MeshMAC mac, RFInterface &RFI) |
Starts MeshNet instance for current node. More... | |
virtual bool | begin () |
Starts MeshNet instance for current node with last settings. More... | |
virtual bool | end () |
Disables mesh node. It is recommended to disconnect from network before calling this method, because some packets for another nodes can be lost. If node won't be disconnected before calling this method, it will be disconnected forcibly. More... | |
bool | setChannel (uint8_t channel_) |
Sets network channel. More... | |
bool | connect (MeshMAC netBSSID, bool autoConnect=false, uint32_t autoConnectInterval=30000) |
Connects to specified network. More... | |
bool | directConnect (MeshMAC netBSSID, uint8_t interpreterAddr) |
Connects to specified network, but without scan. In this case, you have to know address of node, you want to connect to. More... | |
bool | disconnect () |
Disconnects current node from mesh network. It is recommended to check isDisconnecting() and isConnected() methods after calling this method. But do not forget, that this method may not immediately disconnect node, because it has to send some remaining packets. That's why it is not recommended to create while loop, where isDisconnecting() and isConnected() will be checked without calling hande() method. More... | |
void | setAutoConnect (MeshMAC netBSSID, uint32_t retryInterval=60000) |
Enables auto connect to specified network. If auto connect is enabled and node is not connected to any network, it tries to connect to network, which BSSID is specified in parameter. If network is not found, connection is retried after time specified in retryInterval parameter. More... | |
void | disableAutoConnect () |
Disables auto connection. More... | |
bool | startNetScan (void(*responseCallback)(MeshNet *, const MeshNetScanResult &), uint32_t timeout, MeshNetScanFlags flags, MeshMAC ResponderBSSID=0) |
Starts asynchronous network scanning. This function cannot be called when scan is actually running. More... | |
bool | startNetScan (void(*responseCallback)(MeshNet *, const MeshNetScanResult &), uint32_t timeout=2000) |
Starts asynchronous network scanning. This function cannot be called when scan is actually running. More... | |
int16_t | send (uint8_t addr, const uint8_t *data, uint16_t dataSize) |
Sends data packet to specified node. More... | |
int16_t | send (uint8_t addr, const MeshVariableArray< uint8_t > &data) |
Sends data packet to specified node. More... | |
int16_t | send (uint8_t addr, MeshVariableArray< uint8_t > &&data) |
Sends data packet to specified node. More... | |
int16_t | ping (uint8_t addr, uint32_t timeout, int16_t testDataLength=0) |
Sends ping packet to node with specified address. When ping response is received, callback function set using setOnPingResponseCallback() is called. This is also called, when ping timed out. More... | |
void | resetStatistics () |
Resets statistics data. More... | |
virtual void | handle () |
This method has to be called in main program loop as often as possible. More... | |
uint8_t | getMinChannel () |
Get minimum channel number, that can be set using setChannel() method. More... | |
uint8_t | getMaxChannel () |
Get maximum channel number, that can be set using setChannel() method. More... | |
bool | isConnected () const |
Checks if node is connected to any network. More... | |
bool | isDisconnecting () const |
Checks if node is disconnecting right now. Node is finally disconnected after disconnect timeout or when no packet for that network is stored in some FIFO on current node. More... | |
MeshConnectionState | getConnectionState () const |
Gets connection state of current node. More... | |
bool | netScanRunning () const |
Checks if network scan is running. More... | |
bool | pathExists (uint8_t address) const |
Checks if path to specified node exists. More... | |
bool | pathCreating (uint8_t address) const |
Checks if path to specified node is creating right now. More... | |
uint8_t | getNeighborNode (uint8_t address) const |
Gets address of neighbor node, which is next node in path. More... | |
uint8_t | availablePacketsToSend (uint8_t destAddress, bool ACK_R=false) const |
Checks how many packet can be sent right now. More... | |
MeshPacketStatus | getPacketStatus (uint8_t ID) const |
Tries to check, where is packet, that was sent by it's ID. More... | |
bool | canBeGateway () const |
Checks if current node can be used as gateway or is used as gateway. More... | |
bool | isMainGateway () const |
Checks if node is main gateway of network. Only main gateway can manage network. Other nodes, which are marked as gateway, but are connected to network are backup gateways. More... | |
bool | isBackupGateway () const |
Checks if node is backup gateway of network. Only main gateway can manage network. Other nodes, which are marked as gateway, but are connected to network are backup gateways. Those nodes acts as normal node, but when main gateway is lost, one of backup nodes will act as gateway. More... | |
MeshMAC | getNetworkBSSID () const |
Gets BSSID of network, the node is connected to. More... | |
MeshMAC | getNodeMAC () const |
Gets current node unique MAC address. More... | |
uint8_t | getNodeAddress () const |
Gets address of current node. If node is not connected to any network, 253 is returned. More... | |
RFInterface * | getRadioInterfacePtr () const |
Gets pointer to radio interface. More... | |
uint32_t | getLostFramesTotalCnt () const |
Gets total count of lost frames. Frame is marked as lost, when attempt to send false, because of radio error or carriage sense detected interference. Frame is also marked as lost, when it need to be acknowledged, but ACK was not received. This value also includes frames for current network (see getLostFramesInNetworkCnt()). This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getLostFramesInNetworkCnt () const |
Gets count of lost frames for current network. Frame is marked as lost, when attempt to send false, because of radio error or carriage sense detected interference. Frame is also marked as lost, when it need to be acknowledged, but ACK was not received. This value does not include count of lost frames, that are not for current network. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected. More... | |
uint32_t | getLostPacketsTotalCnt () const |
Gets total count of lost packets created by current node. This count does not include packet, that was lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout (see getLostRemotePacketsCnt()). This value also includes lost data packets, not only system packets. This value also includes packets for current network (see getLostPacketsTotalCnt()). This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getLostPacketsInNetworkCnt () const |
Gets count of lost packets created by current node for current network. This count does not include packets, that were lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout (see getLostRemotePacketsCnt()). This value also includes lost data packets, not only system packets. This value does not include count of lost packets, that are not for current network. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected. More... | |
uint32_t | getLostDataPacketsCnt () const |
Gets count of lost data packets created by current node for current network. This count does not include packets, that were lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout (see getLostRemoteDataPacketsCnt()). This value includes only data packets. This value does not include count of lost packets, that are not for current network. This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getLostRemotePacketsCnt () const |
Gets total count of lost packets outside of current node created by current node. This value includes only packet, that was lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout. To get total lost packets use this formula: getLostPacketsTotalCnt() + getLostRemotePacketsCnt(). This value also includes lost data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getLostRemoteDataPacketsCnt () const |
Gets total count of lost data packets outside of current node created by current node. This value includes only packet, that was lost outside of node and were marked as data packets, for example when response to packet marked with ACK-R was not received until specified timeout. To get total lost packets use this formula: getLostPacketsTotalCnt() + getLostRemotePacketsCnt(). This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getLostRelayiedPacketsCnt () const |
Gets count of lost relayed packets in current node (packets, that were not created by current node). This value also includes data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getSentFramesTotalCnt () const |
Gets total count of successfully sent frames. Frame is successfully sent, when send was successful and frame was acknowledged when ACK was needed. This value also includes frames for current network (see getSentFramesInNetworkCnt()). This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getSentFramesInNetworkCnt () const |
Gets total count of successfully sent frames. Frame is successfully sent, when send was successful and frame was acknowledged when ACK was needed. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected. More... | |
uint32_t | getSentPacketsTotalCnt () const |
Gets total count of successfully sent packets created by current node. This value also includes packets, that was lost outside of this node (see getLostRemotePacketsCnt()). This value also includes sent data packets, not only system packets. This value also includes packets for current network (see getSentPacketsInNetworkCnt()). This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getSentPacketsInNetworkCnt () const |
Gets count of successfully sent packets created by current node for current network. This value also includes packets, that was lost outside of this node (see getLostRemotePacketsCnt()). This value also includes sent data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected. More... | |
uint32_t | getSentDataPacketsCnt () const |
Gets count of successfully sent data packets created by current node for current network. This value also includes packets, that was lost outside of this node (see getLostRemoteDataPacketsCnt()). This value also includes only data packets. This value is reset when end(), clear() or resetStatistics() is called. More... | |
uint32_t | getRelayiedPacketsCnt () const |
Gets count of successfully relayed packets (packets, that were not created by current node). This value also includes data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called. More... | |
bool | printRTable (OSTREAM *stream) const |
Prints Route Table in pretty format to stream. More... | |
bool | printIDTable (OSTREAM *stream) const |
Prints ID Table in pretty format to stream. More... | |
bool | printFIDTable (OSTREAM *stream) const |
Prints FID Table in pretty format to stream. More... | |
bool | printOIDTable (OSTREAM *stream) const |
Prints OID Table in pretty format to stream. More... | |
bool | printWaitingFIFO (OSTREAM *stream) const |
Prints waiting FIFO buffer in pretty format to stream. More... | |
bool | printOutFIFO (OSTREAM *stream) const |
Prints output FIFO buffer in pretty format to stream. More... | |
size_t | printMeshNetworkInfo (OSTREAM &stream) const |
Prints informations about network, node is connected to. More... | |
size_t | printStatistics (OSTREAM &stream) const |
Prints statistics informations. More... | |
void | setOnConnectedCallback (void(*callback)(MeshNet *)) |
Sets callback function, which is called when current node is connected to network. More... | |
void | setOnDisconnectedCallback (void(*callback)(MeshNet *, MeshDisconnectReason, MeshMAC, uint8_t)) |
Sets callback function, which is called when current node is disconnected from network or when connection to network was aborted. More... | |
void | setOnRemoteNodeDisconnectedCallback (void(*callback)(MeshNet *, uint8_t)) |
This method is called when some node (not current node) is disconnected from network. More... | |
void | setOnPingResponseCallback (void(*callback)(MeshNet *, uint8_t, uint8_t, MeshPacketError, uint8_t, uint32_t, const uint8_t *, int16_t)) |
Sets callback function, which is called when ping response is received, or when ping timed out. More... | |
void | setOnPacketErrorCallback (void(*callback)(MeshNet *, MeshPacketError, uint8_t, uint8_t, const MeshPacket *)) |
Sets callback function, which is called when packet timeout happened and packet is removed. More... | |
void | setOnReceive (void(*callback)(MeshNet *, MeshPacket &)) |
Sets callback function, which is called when data packet is received. More... | |
Static Public Member Functions | |
static size_t | printMeshConnectionState (OSTREAM &stream, MeshConnectionState value) |
Prints MeshConnectionState to stream. More... | |
static size_t | printMeshDisconnectReason (OSTREAM &stream, MeshDisconnectReason value) |
Prints MeshDisconnectReason to stream. More... | |
static size_t | printMeshPacketError (OSTREAM &stream, MeshPacketError value) |
Prints MeshPacketError to stream. More... | |
static MeshNet ** | getInstances () |
Gets array of all created MeshNet instances. More... | |
Static Public Attributes | |
const static MeshVersion | Version = MESHNET_VERSION |
Version of MeshNet protocol. More... | |
Protected Member Functions | |
MeshNet (bool canBeGateway) | |
Universal protected constructor. More... | |
uint8_t | getNewID () |
Generates new ID for packet. More... | |
uint8_t | getLastID () |
Gets last generated ID. More... | |
void | handleReceivedInterrupt () |
void | onFrameReceive (MeshPacketBuilder *builder, MeshPacketBuilderStatus status, const MeshFrameHeader &frameHeader, const uint8_t *frameData, uint8_t frameDataSize, int8_t rssi) |
Method, which is called, when new valid frame is received. This method is used to calculate CTS time. More... | |
bool | checkPacket (MeshPacketBuilder *builder, const MeshPacketHeader &packetHeader, MeshMAC BSSID, SystemPacketType systemPacketType, const uint8_t *frameData, uint8_t frameDataSize, int8_t rssi) |
This method is called when first frame of packet has been received. It has to decide, if packet has to be processed or ignored. More... | |
void | processReceived () |
Processes received frames. More... | |
virtual void | processPacket (MeshPacket &packet, MeshMAC BSSID) |
Processes received packet. Called in processReceived() method. More... | |
void | processTransmit () |
Processes transmission of one frame from output FIFO. More... | |
void | abortCurrentPacketTransmission (bool packetLost) |
Aborts splitting and transmission of packet currently loaded in packetSplitter. More... | |
void | restartCurrentPacketTransmission () |
Restarts transmission of current packet. Splitting is restarted. More... | |
void | restartCurrentPacketTransmission (uint8_t maxFrameSize) |
Restarts transmission of current packet. Splitting is restarted. More... | |
bool | packetTransmitting () |
Checks if some frame of currently splitting packet has been already transmitted. More... | |
bool | packetSplitting () |
Checks if some packet is loaded in packet splitter. More... | |
bool | systemNetworkScan (MeshMAC responderBSSID, MeshNetScanFlags flags) |
Perform network scan invoked by system before connecting to any network. This can be done only when no other scan is running right now and only if node is disconnected. More... | |
bool | sendACK (const MeshACKSetup &setup, bool asDisconnected=false, bool asConnectedToOld=false) |
Sends ACK to last received frame. This has to be done when builder returns status MPB_FullPacketOK or MPB_PartPacketOK. More... | |
bool | sendERR_ACK (const MeshACKSetup &setup, ERR_ACK_ErrorCode ErrorCode, uint8_t RepairValue, bool asDisconnected=false, bool asConnectedToOld=false) |
Sends ERROR ACK to last received frame. This has to be done when some error happened to last received frame. More... | |
bool | PacketToFrame (const MeshPacket &packet, MeshMAC bssid, uint8_t *outBuffer, uint8_t &bufferSize) const |
Converts packet to frame. This can be called only if you are sure, that this packet won't be splitted to multiple frames, but will be converted to only one frame. Routed packets (ROE == 1 && RE == 1) cannot be converted. More... | |
bool | SendPacketAsFrame (MeshPacket &packet, MeshMAC bssid) |
Sends packet, which is converted using method PacketToFrame() to frame, which is then sends. Packet is cleared after sending. Only packets, that won't be splitted to multiple frames will be sent, else false is returned. Packet ID is automatically generated here, same as using pushOutPacket() method, also From field is filled by current node address if needed. More... | |
virtual void | onNodeLost (uint8_t address, bool nodeLostForever) |
This method is called, when some node is disconnected from network or does not responds to sent packet. More... | |
bool | disconnectPriv (MeshDisconnectReason reason, bool doNotDisconnectImmediatelly, bool forceDisconnect=false) |
Disconnects current node from mesh network. It is recommended to check isDisconnecting() and isConnected() methods after calling this method. But do not forget, that this method may not immediately disconnect node, because it has to send some remaining packets. That's why it is not recommended to create while loop, where isDisconnecting() and isConnected() will be checked without calling handle() method. More... | |
bool | sendDisconnectPacket (MeshNetDisconnectPacketType type) |
Immediately sends disconnect packet (without pushing to outFIFO), that says current node is disconnecting. OnSystemDisconnect() method is not called here. More... | |
void | onSystemDisconnect (MeshDisconnectReason reason) |
Do necessary work after node was disconnected or connection was aborted. onDisconnected method is called here. More... | |
virtual void | onOIDTRemove (int16_t index, const MeshOIDTableRow &oldRow, uint8_t oldRawLifeTime, MeshOIDTableRemoveReason reason) |
This method is called when any row from OID table is removed. More... | |
void | onNewPath (int16_t index, const MeshRouteTableRow &row) |
This method is called when new path was found (created). It is not called if path is prolonged. More... | |
void | onBufferPacketLost (const MeshPacket &packet, MeshPacketError error) |
This method is called when some packet created by this node was lost, because some FIFO, where it has to be stored is full or it was removed from FIFO. This method does some clearing process (clears OIDT row of current packet if exists) and reports error if packet was created by current node. More... | |
void | onBufferPacketRemove (const MeshPacket &packet, bool ignoreCurrentNetworkPacket, bool packetLost) |
This method is called when any packet is removed from waitingFIFO or outFIFO. More... | |
virtual void | onPacketError (MeshPacketError error, uint8_t packetID, uint8_t packetDest, SystemPacketType packetType, const MeshPacket *packet_ptr) |
This method is called when some error happened to any packet created by current node. More... | |
bool | systemPing (uint8_t addr, uint32_t timeout) |
Sends ping packet to node with specified address. When ping response is received, onSystemPingReceived() is called. This is also called, when ping timed out. This can be called only once. More... | |
void | onSystemPingReceived (bool valid, uint32_t duration) |
This method is called when system ping packet response was received. More... | |
virtual void | routeTableUpdate (const MeshPacketHeader &header, MeshMAC BSSID, int8_t rssi) |
Updates route table when valid packet from node with same network is received.ň More... | |
MeshPacketError | pushOutPacket (MeshPacket &packet, uint32_t timeout=0) |
Pushes packet to output FIFO buffer. More... | |
bool | createPath (uint8_t address) |
Creates path to specified node. More... | |
void | checkWaitingBuffer () |
Checks if there are some packets in waiting buffer, which can be sent. Those packets will be sent in this method. More... | |
Static Protected Member Functions | |
static void | onFrameReceiveStatic (MeshPacketBuilder *builder, MeshPacketBuilderStatus status, const MeshFrameHeader &frameHeader, const uint8_t *frameData, uint8_t frameDataSize, int8_t rssi) |
Processed received messages. More... | |
static bool | checkPacketStatic (MeshPacketBuilder *builder, const MeshPacketHeader &packetHeader, MeshMAC BSSID, SystemPacketType systemPacketType, const uint8_t *frameData, uint8_t frameDataSize, int8_t rssi) |
Static function, which can be used as callback. In this function correct checkPacket() method is called. More... | |
static bool | isForeignNetworkPacket (const MeshPacket &packet, MeshMAC bssid) |
Checks if packet is for current network (with specified BSSID in BSSID parameter) or not. More... | |
static void | onOIDTRemoveStatic (MeshOIDTable< OIDTABLE_SIZE > *table, int16_t index, const MeshOIDTableRow &oldRow, uint8_t oldRawLifeTime, MeshOIDTableRemoveReason reason) |
Static function, which can be used as callback. In this function correct onOIDTRemove() method is called. More... | |
static void | onNewPathStatic (MeshRouteTable< ROUTETABLE_SIZE > *table, int16_t index, const MeshRouteTableRow &row, uint8_t rawLifeTime) |
Static function, which can be used as callback. In this function correct onNewPath() method is called. More... | |
Protected Attributes | |
const bool | canBeGateway_:1 |
True if current node can be used as gateway. More... | |
bool | sentFrameWasACK:1 |
True when sent frame was acknowledged. More... | |
bool | packetSplittingStarted:1 |
True if packet splitting has started. More... | |
bool | sendingPacketIsForeign:1 |
True if packet, that is loaded in packetSplitter is for foreign network. More... | |
bool | ignoreRSSIThreshold:1 |
True to ignore RSSI threshold on received network scan responses during scan. More... | |
bool | waitingBufferCheck:1 |
True if waitBuffer has to be checked and some packets has to be sent. More... | |
bool | beginCalled:1 |
True if begin was called. More... | |
bool | receiveInterruptEnabled:1 |
True if interrupt will be fired when new frame is received. More... | |
uint8_t | channel |
Channel number, that will be set or is set. More... | |
uint8_t | AddrPriv = UNKNOWN_MESH_ADDRESS |
Address of current node. Can be between 0 - 250 or 254 when disconnected. More... | |
MeshMAC | NodeMAC |
Unique node physical MeshMAC address. More... | |
MeshMAC | NetworkBSSID |
If node is disconnected, this is same as NodeMAC, else NetworkBSSID equals BSSID address of connected network. More... | |
char | SSID [65] |
SSID of network, node is connected to. More... | |
uint32_t | AddrReservedUntil = 0 |
Time in milliseconds until which address of current node is for sure reserved in main gateway node's DHCP table. Address reservation in DHCP table is prolonged, when gateway receives any packet from current node. More... | |
uint16_t | AddrReservationTime = 0 |
Time in minutes the address can be reserved for in DHCP table in main gateway. This value is obtained during connection and it cannot change when connected to network. More... | |
uint8_t | oldNodeAddress = UNKNOWN_MESH_ADDRESS |
Old node address, that was assigned to node when it has been connected to some network. More... | |
MeshMAC | oldBSSID |
Old BSSID of network the node was connected to last time. More... | |
RFInterface * | rf |
Pointer to radio interface, that is used by current class. More... | |
uint64_t | CTS_until = 0 |
Clear to send until this time in microseconds, so node cannot send frames until this time. ACK packets have exception from this rule. More... | |
uint64_t | lastReceiveTime = 0 |
Time when last frame was received in microseconds. More... | |
uint32_t | lastSentTime = 0 |
Time, when was last frame sent in milliseconds. More... | |
uint8_t | frameTranCnt = 0 |
(Re)Transmission count of last sent frame. More... | |
MeshConnectionState | connectionState = MeshConnectionState::MeshDisconnected |
Connection state of current node. More... | |
MeshDisconnectReason | lastDisconnectReason = MeshDisconnectReason::MDR_None |
Last disconnect or connection fail reason. More... | |
uint8_t | currentNetworkPackets = 0 |
Count of packets in buffers, that belongs to the current connected network. More... | |
uint32_t | scanEndTime = 0 |
Time in milliseconds, when network scan ends. More... | |
uint32_t | lastScanTime = 0 |
Time in milliseconds, when network scan was last time executed. More... | |
uint8_t | lowestHopsToGateway = 255 |
The smallest count of hops to gateway established during last system network scan. More... | |
uint8_t | lowestHopsToGateway_Addr = INVALID_MESH_ADDRESS |
Address of node with the smallest count of hops to gateway established during last system network scan. More... | |
MeshMAC | lastScanResponderBSSID |
BSSID of network, the system network scan was assigned to. More... | |
uint32_t | connectionStepTime = 0 |
Time in milliseconds, when connection state was last changed. More... | |
MeshMAC | autoConnectBSSID |
BSSID of network, this node has to automatically connect to. More... | |
uint32_t | nextAutoConnectTime = 0 |
Time in milliseconds, when auto connection attempt will be invoked. More... | |
uint32_t | autoConnectInterval = 0 |
Auto connect interval in milliseconds. More... | |
uint32_t | disconnectUntil = 0 |
Until this time in milliseconds node has to be disconnected. More... | |
int16_t | systemPingID = -1 |
ID of last system ping packet. More... | |
void(* | netScanResponseCallback )(MeshNet *, const MeshNetScanResult &) |
Pointer to callback function called when network scan response was received. More... | |
void(* | onConnected )(MeshNet *) |
This method is called when node is connected to network. More... | |
void(* | onDisconnected )(MeshNet *, MeshDisconnectReason, MeshMAC, uint8_t) |
This method is called when node is disconnected from network. More... | |
void(* | onRemDisconnected )(MeshNet *, uint8_t) |
This method is called when some node from network is disconnected. More... | |
void(* | onReceive )(MeshNet *, MeshPacket &) |
Function called when data packet is received. More... | |
void(* | onPingResponse )(MeshNet *, uint8_t, uint8_t, MeshPacketError, uint8_t, uint32_t, const uint8_t *, int16_t) |
Function called when ping response is received or when ping timed out. More... | |
void(* | onPacketErrorCallback )(MeshNet *, MeshPacketError, uint8_t, uint8_t, const MeshPacket *) |
uint32_t | lostFramesTotal = 0 |
uint32_t | lostFramesInNetwork = 0 |
uint32_t | lostPacketsTotal = 0 |
uint32_t | lostPacketsInNetwork = 0 |
uint32_t | lostRemotePackets = 0 |
uint32_t | lostRemoteDataPackets = 0 |
uint32_t | lostDataPackets = 0 |
uint32_t | lostRelayiedPackets = 0 |
uint32_t | sentFramesTotal = 0 |
uint32_t | sentFramesInNetwork = 0 |
uint32_t | sentPacketsTotal = 0 |
uint32_t | sentPacketsInNetwork = 0 |
uint32_t | sentDataPackets = 0 |
uint32_t | relayiedPackets = 0 |
MeshPacketBuilder | packetBuilder |
Combines received MeshFrames to MeshPacket. More... | |
MeshPacketSplitter | packetSplitter |
Splits MeshPacket to multiple MeshFrames for transmission. More... | |
MeshRouteTable< ROUTETABLE_SIZE > | RTable |
Routing table. More... | |
MeshIDTable< IDTABLE_SIZE > | IDTable |
Table of received packets ID (ID+Source). This check, if some packet has been received multiple times. More... | |
MeshFIDTable< FIDTABLE_SIZE > | FIDTable |
MeshOIDTable< OIDTABLE_SIZE > | OIDTable |
Table of sent (output) packets ID and destination (source is current node address). Only packet, that was created by current node can be stored here, relayed packet cannot be stored here. This table is for checking, what action was done and what packet is expected (response or ACK-R response). More... | |
MeshPacketPriorityFIFO< MESH_OFIFO_HIGH_SIZE, MESH_OFIFO_LOW_SIZE > | outFIFO |
Packets that waits in buffer to be sent. More... | |
MeshPacketFIFO< MESH_WFIFO_SIZE > | waitingFIFO |
Packets, that has to be sent as routed packet, but path is not known yet. More... | |
Private Member Functions | |
void | addThisToInstArr () |
Writes new class instance to the array of all created MeshNet instances. We need to know all created instances to call correct callback method. This method has to be called in constructor. More... | |
void | removeThisFromInstArr () |
Removes this instance from instances array. This method has to be called in destructor. More... | |
void | clear (bool disconnecting) |
Clears current class data. More... | |
Private Attributes | |
uint8_t | msgIDPriv = 0xFF |
Last value of packet ID. More... | |
Static Private Attributes | |
static MeshNet * | instances [] = { 0 } |
Array of all created MeshNet instances. Thanks to this array callback functions of MicroTable, PacketSplitter and PacketBuilder classes can be set. If this array is full. New created instances will not work correctly. More... | |
static uint8_t | instCount = 0 |
Count of created instances of this class. More... | |
This class implements MeshNet protocol for microcontrollers.
|
inline |
Constructor without arguments.
|
virtual |
Virtual destructor.
|
protected |
Universal protected constructor.
|
inlineprotected |
Aborts splitting and transmission of packet currently loaded in packetSplitter.
packetLost | True when packet was lost. |
|
private |
Writes new class instance to the array of all created MeshNet instances. We need to know all created instances to call correct callback method. This method has to be called in constructor.
uint8_t MeshNet::availablePacketsToSend | ( | uint8_t | destAddress, |
bool | ACK_R = false |
||
) | const |
Checks how many packet can be sent right now.
destAddress | Destination address of receiver node. |
ACK_R | True if ACK response is requested. |
|
virtual |
Starts MeshNet instance for current node with last settings.
Reimplemented in MeshNetGateway.
|
virtual |
Starts MeshNet instance for current node.
mac | Node MAC address. |
RFI | Radio interface, which is used for radio control. |
Reimplemented in MeshNetGateway.
|
inline |
Checks if current node can be used as gateway or is used as gateway.
|
protected |
This method is called when first frame of packet has been received. It has to decide, if packet has to be processed or ignored.
builder | PacketBuilder, which called this method. |
packetHeader | Received packet header. |
BSSID | of packet transmitter. |
systemPacketType | Type of system packet. |
frameData | Part of received data from packet payload. |
frameDataSize | Size of part of received data from packet payload. |
rssi | RSSI value of received frame. |
|
staticprotected |
Static function, which can be used as callback. In this function correct checkPacket() method is called.
|
protected |
Checks if there are some packets in waiting buffer, which can be sent. Those packets will be sent in this method.
|
private |
Clears current class data.
disconnecting | True if clear is called, because node was disconnected |
bool MeshNet::connect | ( | MeshMAC | netBSSID, |
bool | autoConnect = false , |
||
uint32_t | autoConnectInterval = 30000 |
||
) |
Connects to specified network.
netBSSID | BSSID of network to connect to. |
autoConnect | Enables auto connection to that network. For more see setAutoConnect() method. |
autoConnectInterval | After this interval when connection failed, connect() method is called again. |
|
protected |
Creates path to specified node.
address | Address of node, to which path has to be created. |
bool MeshNet::directConnect | ( | MeshMAC | netBSSID, |
uint8_t | interpreterAddr | ||
) |
Connects to specified network, but without scan. In this case, you have to know address of node, you want to connect to.
netBSSID | BSSID of network to connect to. |
interpreterAddr | Address of interpreter node. |
void MeshNet::disableAutoConnect | ( | ) |
Disables auto connection.
bool MeshNet::disconnect | ( | ) |
Disconnects current node from mesh network. It is recommended to check isDisconnecting() and isConnected() methods after calling this method. But do not forget, that this method may not immediately disconnect node, because it has to send some remaining packets. That's why it is not recommended to create while loop, where isDisconnecting() and isConnected() will be checked without calling hande() method.
|
protected |
Disconnects current node from mesh network. It is recommended to check isDisconnecting() and isConnected() methods after calling this method. But do not forget, that this method may not immediately disconnect node, because it has to send some remaining packets. That's why it is not recommended to create while loop, where isDisconnecting() and isConnected() will be checked without calling handle() method.
reason | Disconnect reason; |
doNotDisconnectImmediatelly | If there is possibility to disconnect node immediately, don't do it. |
forceDisconnect | True to force immediately disconnect from network. |
|
virtual |
Disables mesh node. It is recommended to disconnect from network before calling this method, because some packets for another nodes can be lost. If node won't be disconnected before calling this method, it will be disconnected forcibly.
Reimplemented in MeshNetGateway.
|
inline |
Gets connection state of current node.
|
inlinestatic |
|
inlineprotected |
Gets last generated ID.
|
inline |
Gets count of lost data packets created by current node for current network. This count does not include packets, that were lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout (see getLostRemoteDataPacketsCnt()). This value includes only data packets. This value does not include count of lost packets, that are not for current network. This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets count of lost frames for current network. Frame is marked as lost, when attempt to send false, because of radio error or carriage sense detected interference. Frame is also marked as lost, when it need to be acknowledged, but ACK was not received. This value does not include count of lost frames, that are not for current network. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected.
|
inline |
Gets total count of lost frames. Frame is marked as lost, when attempt to send false, because of radio error or carriage sense detected interference. Frame is also marked as lost, when it need to be acknowledged, but ACK was not received. This value also includes frames for current network (see getLostFramesInNetworkCnt()). This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets count of lost packets created by current node for current network. This count does not include packets, that were lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout (see getLostRemotePacketsCnt()). This value also includes lost data packets, not only system packets. This value does not include count of lost packets, that are not for current network. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected.
|
inline |
Gets total count of lost packets created by current node. This count does not include packet, that was lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout (see getLostRemotePacketsCnt()). This value also includes lost data packets, not only system packets. This value also includes packets for current network (see getLostPacketsTotalCnt()). This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets count of lost relayed packets in current node (packets, that were not created by current node). This value also includes data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets total count of lost data packets outside of current node created by current node. This value includes only packet, that was lost outside of node and were marked as data packets, for example when response to packet marked with ACK-R was not received until specified timeout. To get total lost packets use this formula: getLostPacketsTotalCnt() + getLostRemotePacketsCnt(). This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets total count of lost packets outside of current node created by current node. This value includes only packet, that was lost outside of node, for example when response to packet (marked with ACK-R or system packet which need response) was not received until specified timeout. To get total lost packets use this formula: getLostPacketsTotalCnt() + getLostRemotePacketsCnt(). This value also includes lost data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Get maximum channel number, that can be set using setChannel() method.
|
inline |
Get minimum channel number, that can be set using setChannel() method.
|
inline |
Gets address of neighbor node, which is next node in path.
address | Destination address - address of node at the end of path. |
|
inline |
Gets BSSID of network, the node is connected to.
|
inlineprotected |
Generates new ID for packet.
|
inline |
Gets address of current node. If node is not connected to any network, 253 is returned.
Returns | address of current node. |
|
inline |
Gets current node unique MAC address.
MeshPacketStatus MeshNet::getPacketStatus | ( | uint8_t | ID | ) | const |
Tries to check, where is packet, that was sent by it's ID.
ID | ID of packet created by current node to check. |
|
inline |
Gets pointer to radio interface.
|
inline |
Gets count of successfully relayed packets (packets, that were not created by current node). This value also includes data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets count of successfully sent data packets created by current node for current network. This value also includes packets, that was lost outside of this node (see getLostRemoteDataPacketsCnt()). This value also includes only data packets. This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets total count of successfully sent frames. Frame is successfully sent, when send was successful and frame was acknowledged when ACK was needed. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected.
|
inline |
Gets total count of successfully sent frames. Frame is successfully sent, when send was successful and frame was acknowledged when ACK was needed. This value also includes frames for current network (see getSentFramesInNetworkCnt()). This value is reset when end(), clear() or resetStatistics() is called.
|
inline |
Gets count of successfully sent packets created by current node for current network. This value also includes packets, that was lost outside of this node (see getLostRemotePacketsCnt()). This value also includes sent data packets, not only system packets. This value is reset when end(), clear() or resetStatistics() is called or node is disconnected.
|
inline |
Gets total count of successfully sent packets created by current node. This value also includes packets, that was lost outside of this node (see getLostRemotePacketsCnt()). This value also includes sent data packets, not only system packets. This value also includes packets for current network (see getSentPacketsInNetworkCnt()). This value is reset when end(), clear() or resetStatistics() is called.
|
virtual |
This method has to be called in main program loop as often as possible.
Reimplemented in MeshNetGateway.
|
protected |
|
inline |
Checks if node is backup gateway of network. Only main gateway can manage network. Other nodes, which are marked as gateway, but are connected to network are backup gateways. Those nodes acts as normal node, but when main gateway is lost, one of backup nodes will act as gateway.
|
inline |
Checks if node is connected to any network.
|
inline |
Checks if node is disconnecting right now. Node is finally disconnected after disconnect timeout or when no packet for that network is stored in some FIFO on current node.
|
staticprotected |
Checks if packet is for current network (with specified BSSID in BSSID parameter) or not.
[in] | packet | Packet to check. |
bssid | Network BSSID to check. |
|
inline |
Checks if node is main gateway of network. Only main gateway can manage network. Other nodes, which are marked as gateway, but are connected to network are backup gateways.
|
inline |
Checks if network scan is running.
|
protected |
This method is called when some packet created by this node was lost, because some FIFO, where it has to be stored is full or it was removed from FIFO. This method does some clearing process (clears OIDT row of current packet if exists) and reports error if packet was created by current node.
index | Index of row, where new path is located. |
packet | Reference to packet, which will be lost. |
error | Error code indicating, why packet was lost. |
|
protected |
This method is called when any packet is removed from waitingFIFO or outFIFO.
packet | Packet to be removed. |
ignoreCurrentNetworkPacket | When true, currentNetworkPacket cannot be changed. This can be set |
packetLost | True if packet was lost. to true only in special cases. |
|
protected |
Method, which is called, when new valid frame is received. This method is used to calculate CTS time.
|
staticprotected |
Processed received messages.
Static function, which can be used as callback. In this function correct onFrameReceive() method is called.
|
protected |
This method is called when new path was found (created). It is not called if path is prolonged.
index | Index of row, where new path is located. |
row | Row, which contains path informations from route table. |
|
staticprotected |
Static function, which can be used as callback. In this function correct onNewPath() method is called.
|
protectedvirtual |
This method is called, when some node is disconnected from network or does not responds to sent packet.
address | Address of lost node. |
nodeLostForever | True when node was lost forever. This has to be set to true if node was disconnected from network. |
Reimplemented in MeshNetGateway.
|
protectedvirtual |
This method is called when any row from OID table is removed.
index | Index of removed row. |
oldRow | Old row. |
oldRawLifeTime | Old raw life time of row. |
reason | Remove reason. |
|
staticprotected |
Static function, which can be used as callback. In this function correct onOIDTRemove() method is called.
|
protectedvirtual |
This method is called when some error happened to any packet created by current node.
error | Type of error that happened. |
packetID | ID of packet. |
packetDest | Destination address of packet. |
packetType | Type of packet. |
packet_ptr | Pointer to packet, this may be NULL. |
Reimplemented in MeshNetGateway.
|
protected |
Do necessary work after node was disconnected or connection was aborted. onDisconnected method is called here.
reason | Disconnect reason. |
|
protected |
This method is called when system ping packet response was received.
valid | True if ping response was valid. |
duration | Ping duration in milliseconds. |
|
inlineprotected |
Checks if some packet is loaded in packet splitter.
|
protected |
Converts packet to frame. This can be called only if you are sure, that this packet won't be splitted to multiple frames, but will be converted to only one frame. Routed packets (ROE == 1 && RE == 1) cannot be converted.
[in] | packet | ACK packet, that has to be splitted. This condition has to be valid: ackPackets.Length() <= 11. |
bssid | BSSID of packet sender. | |
[out] | data | Buffer reserved for frame data. Size of this buffer has to be at least 24 bytes. |
[out] | dataSize | The size of data copied to data buffer. |
|
inlineprotected |
Checks if some frame of currently splitting packet has been already transmitted.
|
inline |
Checks if path to specified node is creating right now.
address | Address of node, to which path has to be checked. |
|
inline |
Checks if path to specified node exists.
address | Address of node, to which path has to be checked. |
int16_t MeshNet::ping | ( | uint8_t | addr, |
uint32_t | timeout, | ||
int16_t | testDataLength = 0 |
||
) |
Sends ping packet to node with specified address. When ping response is received, callback function set using setOnPingResponseCallback() is called. This is also called, when ping timed out.
addr | Address of node, the ping packet is for. |
timeout | Ping timeout value in milliseconds. Minimum value, that can be set is 1 second (1000ms). Error of timeout is +0ms, -500ms. |
testDataLength | Length of test data sent with ping packet. Those data are randomly generated. Allowed values: 0-500. |
bool MeshNet::printFIDTable | ( | OSTREAM * | stream | ) | const |
Prints FID Table in pretty format to stream.
stream | Output stream where to print. |
bool MeshNet::printIDTable | ( | OSTREAM * | stream | ) | const |
Prints ID Table in pretty format to stream.
stream | Output stream where to print. |
|
static |
Prints MeshConnectionState to stream.
stream | Where to print. |
value | Value to print. |
|
static |
Prints MeshDisconnectReason to stream.
stream | Where to print. |
value | Value to print. |
size_t MeshNet::printMeshNetworkInfo | ( | OSTREAM & | stream | ) | const |
Prints informations about network, node is connected to.
stream | Stream where to print. |
|
static |
Prints MeshPacketError to stream.
stream | Where to print. |
value | Value to print. |
bool MeshNet::printOIDTable | ( | OSTREAM * | stream | ) | const |
Prints OID Table in pretty format to stream.
stream | Output stream where to print. |
bool MeshNet::printOutFIFO | ( | OSTREAM * | stream | ) | const |
Prints output FIFO buffer in pretty format to stream.
stream | Output stream where to print. |
bool MeshNet::printRTable | ( | OSTREAM * | stream | ) | const |
Prints Route Table in pretty format to stream.
stream | Output stream where to print. |
size_t MeshNet::printStatistics | ( | OSTREAM & | stream | ) | const |
Prints statistics informations.
stream | Stream where to print. |
bool MeshNet::printWaitingFIFO | ( | OSTREAM * | stream | ) | const |
Prints waiting FIFO buffer in pretty format to stream.
stream | Output stream where to print. |
|
protectedvirtual |
Processes received packet. Called in processReceived() method.
packet | Reference to received packet. |
BSSID | BSSID of network, which sent packet. |
Reimplemented in MeshNetGateway.
|
protected |
Processes received frames.
|
protected |
Processes transmission of one frame from output FIFO.
|
protected |
Pushes packet to output FIFO buffer.
Those fields should not be set before calling this method, because they are set in this method.
This methods makes decision, where packet will be pushed. If path to packet destination can be found or is not needed, packet is pushed to the outFIFO, where it waits until it will be sent. If path to packet destination cannot be found, packet is pushed to the waitingFIFO, where packet will wait until path is created. If path is successfully created, all related packets from waitingFIFO will be moved to the outFIFO.
packet | Packet to push. |
timeout | Packet timeout in milliseconds. Value resolution is 500ms, that's why timeout error is (+0ms, -500ms) and that's why it is recommended to set at least 1 second. Maximum value is 127500 milliseconds, which is more than 2 minutes. If 0 is set, packet is not set to OIDTable. After this timeout packet is removed from OIDTable and from waiting or output FIFO buffer. Timeout is ignored (timeout = 0) if packet was not created, but only relayed. |
|
private |
Removes this instance from instances array. This method has to be called in destructor.
void MeshNet::resetStatistics | ( | ) |
Resets statistics data.
|
inlineprotected |
Restarts transmission of current packet. Splitting is restarted.
|
inlineprotected |
Restarts transmission of current packet. Splitting is restarted.
maxFrameSize | New max frame size for packet splitter. |
|
protectedvirtual |
Updates route table when valid packet from node with same network is received.ň
header | Header of received packet. |
BSSID | BSSID of received packet. |
rssi | RSSI of first packet frame. |
Reimplemented in MeshNetGateway.
int16_t MeshNet::send | ( | uint8_t | addr, |
const MeshVariableArray< uint8_t > & | data | ||
) |
Sends data packet to specified node.
addr | Address of node, where to send message. | |
[in] | data | Data, that will be sent. To achieve better performance, use std::move. |
int16_t MeshNet::send | ( | uint8_t | addr, |
const uint8_t * | data, | ||
uint16_t | dataSize | ||
) |
Sends data packet to specified node.
addr | Address of node, where to send message. |
data | Data, that will be sent. |
dataSize | Size of data to be sent in bytes. |
int16_t MeshNet::send | ( | uint8_t | addr, |
MeshVariableArray< uint8_t > && | data | ||
) |
Sends data packet to specified node.
addr | Address of node, where to send message. | |
[in] | data | Data, that will be sent. Those data will be cleared when send was successful, because std::move is used, which has incredible performance compared to copying data. |
|
protected |
Sends ACK to last received frame. This has to be done when builder returns status MPB_FullPacketOK or MPB_PartPacketOK.
setup | Structure, which has data needed for ACK packet creation. |
asDisconnected | Send packet as disconnected node (BSSID = NodeMAC and Source == 253) |
asConnectedToOld | Send packet as connected to old network (BSSID = oldBSSID and Source == oldNodeAddress) |
|
protected |
Immediately sends disconnect packet (without pushing to outFIFO), that says current node is disconnecting. OnSystemDisconnect() method is not called here.
type | Disconnect type. |
|
protected |
Sends ERROR ACK to last received frame. This has to be done when some error happened to last received frame.
setup | Structure, which has data needed for ACK packet creation. |
ErrorCode | Error code. |
RepairValue | Value, which can be used for repairing this error. |
asDisconnected | Send packet as disconnected node (BSSID = NodeMAC and Source == 253) |
asConnectedToOld | Send packet as connected to old network (BSSID = oldBSSID and Source == oldNodeAddress) |
|
protected |
Sends packet, which is converted using method PacketToFrame() to frame, which is then sends. Packet is cleared after sending. Only packets, that won't be splitted to multiple frames will be sent, else false is returned. Packet ID is automatically generated here, same as using pushOutPacket() method, also From field is filled by current node address if needed.
packet[in] | Packet to send. Packet is never cleared. |
bssid | BSSID of current network. |
void MeshNet::setAutoConnect | ( | MeshMAC | netBSSID, |
uint32_t | retryInterval = 60000 |
||
) |
Enables auto connect to specified network. If auto connect is enabled and node is not connected to any network, it tries to connect to network, which BSSID is specified in parameter. If network is not found, connection is retried after time specified in retryInterval parameter.
Auto connection is disabled when:
netBSSID | BSSID of network, the node has to connect to. |
retryInterval | Auto connect retry interval in milliseconds. Minimum value is 10000ms. |
bool MeshNet::setChannel | ( | uint8_t | channel_ | ) |
Sets network channel.
channel_ | Channel to set. This value has to be between or same as getMinChannel() and getMaxChannel() values. |
return | Return true if channel was set. |
|
inline |
Sets callback function, which is called when current node is connected to network.
callback | Callback function. |
|
inline |
|
inline |
Sets callback function, which is called when packet timeout happened and packet is removed.
callback | Callback function. |
|
inline |
Sets callback function, which is called when ping response is received, or when ping timed out.
callback | Callback function. |
|
inline |
Sets callback function, which is called when data packet is received.
callback | Callback function. |
|
inline |
bool MeshNet::startNetScan | ( | void(*)(MeshNet *, const MeshNetScanResult &) | responseCallback, |
uint32_t | timeout, | ||
MeshNetScanFlags | flags, | ||
MeshMAC | ResponderBSSID = 0 |
||
) |
Starts asynchronous network scanning. This function cannot be called when scan is actually running.
responseCallback | Function, that is called when some node responded to scan request. |
timeout | Timeout in milliseconds. After this time, all scan responses are ignored. Min: 500ms, max: 10000ms, recommended: 2000ms. |
flags | Scan request flags. |
ResponderBSSID | This parameter is optional and when is specified, only nodes connected to network same as ResponserBSSID can respond. |
bool MeshNet::startNetScan | ( | void(*)(MeshNet *, const MeshNetScanResult &) | responseCallback, |
uint32_t | timeout = 2000 |
||
) |
Starts asynchronous network scanning. This function cannot be called when scan is actually running.
responseCallback | Function, that is called when some node responded to scan request. |
timeout | Timeout in milliseconds. After this time, all scan responses are ignored. Min: 500ms, max: 10000ms, recommended: 2000ms. |
|
protected |
Perform network scan invoked by system before connecting to any network. This can be done only when no other scan is running right now and only if node is disconnected.
responderBSSID | BSSID of network, which nodes has to respond to scan request. |
flags | Scan flags. |
|
protected |
Sends ping packet to node with specified address. When ping response is received, onSystemPingReceived() is called. This is also called, when ping timed out. This can be called only once.
addr | Address of node, the ping packet is for. |
timeout | Ping timeout value in milliseconds. Minimum value, that can be set is 1 second (1000ms). Error of timeout is +0ms, -500ms. |
testDataLength | Length of test data sent with ping packet. Those data are randomly generated. Allowed values: 0-500. |
|
protected |
Address of current node. Can be between 0 - 250 or 254 when disconnected.
|
protected |
Time in minutes the address can be reserved for in DHCP table in main gateway. This value is obtained during connection and it cannot change when connected to network.
|
protected |
Time in milliseconds until which address of current node is for sure reserved in main gateway node's DHCP table. Address reservation in DHCP table is prolonged, when gateway receives any packet from current node.
|
protected |
BSSID of network, this node has to automatically connect to.
|
protected |
Auto connect interval in milliseconds.
|
protected |
True if begin was called.
|
protected |
True if current node can be used as gateway.
|
protected |
Channel number, that will be set or is set.
|
protected |
Connection state of current node.
|
protected |
Time in milliseconds, when connection state was last changed.
|
protected |
Clear to send until this time in microseconds, so node cannot send frames until this time. ACK packets have exception from this rule.
|
protected |
Count of packets in buffers, that belongs to the current connected network.
|
protected |
Until this time in milliseconds node has to be disconnected.
|
protected |
@breif Table of received packets ID (ID+Source+BSSID) from foreign networks. This check, if some packet has been received multiple times.
|
protected |
(Re)Transmission count of last sent frame.
|
protected |
Table of received packets ID (ID+Source). This check, if some packet has been received multiple times.
|
protected |
True to ignore RSSI threshold on received network scan responses during scan.
|
staticprivate |
Array of all created MeshNet instances. Thanks to this array callback functions of MicroTable, PacketSplitter and PacketBuilder classes can be set. If this array is full. New created instances will not work correctly.
|
staticprivate |
Count of created instances of this class.
|
protected |
Last disconnect or connection fail reason.
|
protected |
Time when last frame was received in microseconds.
|
protected |
BSSID of network, the system network scan was assigned to.
|
protected |
Time in milliseconds, when network scan was last time executed.
|
protected |
Time, when was last frame sent in milliseconds.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
The smallest count of hops to gateway established during last system network scan.
|
protected |
Address of node with the smallest count of hops to gateway established during last system network scan.
|
private |
Last value of packet ID.
|
protected |
Pointer to callback function called when network scan response was received.
|
protected |
If node is disconnected, this is same as NodeMAC, else NetworkBSSID equals BSSID address of connected network.
|
protected |
Time in milliseconds, when auto connection attempt will be invoked.
|
protected |
Table of sent (output) packets ID and destination (source is current node address). Only packet, that was created by current node can be stored here, relayed packet cannot be stored here. This table is for checking, what action was done and what packet is expected (response or ACK-R response).
|
protected |
Old BSSID of network the node was connected to last time.
|
protected |
Old node address, that was assigned to node when it has been connected to some network.
|
protected |
This method is called when node is connected to network.
|
protected |
|
protected |
|
protected |
Function called when ping response is received or when ping timed out.
|
protected |
Function called when data packet is received.
|
protected |
|
protected |
Packets that waits in buffer to be sent.
|
protected |
Combines received MeshFrames to MeshPacket.
|
protected |
Splits MeshPacket to multiple MeshFrames for transmission.
|
protected |
True if packet splitting has started.
|
protected |
True if interrupt will be fired when new frame is received.
|
protected |
|
protected |
Pointer to radio interface, that is used by current class.
|
protected |
Routing table.
|
protected |
Time in milliseconds, when network scan ends.
|
protected |
True if packet, that is loaded in packetSplitter is for foreign network.
|
protected |
|
protected |
|
protected |
|
protected |
True when sent frame was acknowledged.
|
protected |
|
protected |
|
protected |
SSID of network, node is connected to.
|
protected |
ID of last system ping packet.
|
static |
Version of MeshNet protocol.
|
protected |
True if waitBuffer has to be checked and some packets has to be sent.
|
protected |
Packets, that has to be sent as routed packet, but path is not known yet.