|
RF24Gateway - TCP/IP over RF24Network v2.2.0
TMRh20 - Pushing the practical limits of RF24 modules
|
#include <RF24Gateway.h>
Classes | |
| struct | routeStruct |
Public Member Functions | |
RF24Gateway (RPi/Linux) | |
RF24Gateway library for devices with an IP stack | |
| ESBGateway (radio_t &_radio, network_t &_network, mesh_t &_mesh) | |
| void | begin (uint8_t nodeID=0, uint8_t channel=97, rf24_datarate_e data_rate=RF24_1MBPS) |
| void | begin (uint16_t address, uint8_t channel=97, rf24_datarate_e data_rate=RF24_1MBPS, bool meshEnable=0, uint8_t nodeID=0) |
| int | setIP (char *ip_addr, char *mask) |
| void | update (bool interrupts=0) |
| void | poll (uint32_t waitDelay=3) |
| void | interrupts (bool enable=1) |
Advanced Operation | |
More advanced methods and options | |
| uint16_t | thisNodeAddress |
| uint8_t | thisNodeID |
| bool | config_TUN |
| bool | fifoCleared |
| uint32_t | droppedSpoofed |
| bool | meshEnabled () |
| uint32_t | ifDropped () |
| void | sendUDP (uint8_t nodeID, RF24NetworkFrame frame) |
Routing Table | |
Utilizing a routing table to provide complete connectivity | |
| routeStruct | routingStruct [256] |
| uint16_t | routingTableSize |
| uint32_t | networkOverruns |
| uint32_t | networkCorruption |
| mesh_t | The mesh object's type. Defaults to RF24Mesh for legacy behavior. This new abstraction is really meant for using the nRF52840 SoC as a drop-in replacement for the nRF24L01 radio. For more detail, see the nrf_to_nrf Arduino library. |
| network_t | The network object's type. Defaults to RF24Network for legacy behavior. This new abstraction is really meant for using the nRF52840 SoC as a drop-in replacement for the nRF24L01 radio. For more detail, see the nrf_to_nrf Arduino library. |
| radio_t | The radio object's type. Defaults to RF24 for legacy behavior. This new abstraction is really meant for using the nRF52840 SoC as a drop-in replacement for the nRF24L01 radio. For more detail, see the nrf_to_nrf Arduino library. |
Definition at line 66 of file RF24Gateway.h.
| ESBGateway< mesh_t, network_t, radio_t >::ESBGateway | ( | radio_t & | _radio, |
| network_t & | _network, | ||
| mesh_t & | _mesh ) |
ESBGateway constructor.
Definition at line 16 of file RF24Gateway.cpp.
References droppedSpoofed, and routingTableSize.
| void ESBGateway< mesh_t, network_t, radio_t >::begin | ( | uint8_t | nodeID = 0, |
| uint8_t | channel = 97, | ||
| rf24_datarate_e | data_rate = RF24_1MBPS ) |
Begin function for use with RF24Mesh (TUN interface)
| nodeID | The RF24Mesh nodeID to use |
| channel | The radio channel to use (1-127) |
| data_rate | The RF24 datarate to use (RF24_250KBPS, RF24_1MBPS, RF24_2MBPS) |
Definition at line 26 of file RF24Gateway.cpp.
References begin().
| void ESBGateway< mesh_t, network_t, radio_t >::begin | ( | uint16_t | address, |
| uint8_t | channel = 97, | ||
| rf24_datarate_e | data_rate = RF24_1MBPS, | ||
| bool | meshEnable = 0, | ||
| uint8_t | nodeID = 0 ) |
Begin function for use with a TAP (Ethernet) interface. RF24Mesh can be used for address assignment, but ARP will be used to perform the lookups.
| address | The RF24Network address to use |
| channel | The radio channel (0-127) to use |
| data_rate | The RF24 datarate to use (RF24_250KBPS, RF24_1MBPS, RF24_2MBPS) |
| meshEnable | Whether to use RF24Mesh for address assignment |
| nodeID | The RF24Mesh nodeID to use if meshEnable has been set to true |
Definition at line 35 of file RF24Gateway.cpp.
References begin().
| int ESBGateway< mesh_t, network_t, radio_t >::setIP | ( | char * | ip_addr, |
| char * | mask ) |
Once the Gateway has been started via begin() , call setIP to configure the IP and subnet mask.
| ip_addr | A character array containing the numeric IP address ie: 192.168.1.1 |
| mask | A character array containing the subnet mask ie: 255.255.255.0 |
Definition at line 260 of file RF24Gateway.cpp.
| void ESBGateway< mesh_t, network_t, radio_t >::update | ( | bool | interrupts = 0 | ) |
Calling update() keeps the network and mesh layers active and processing data. This needs to be called regularly.
| interrupts | Set true if called from an interrupt handler & call poll() from the main loop or a thread. |
Definition at line 330 of file RF24Gateway.cpp.
References interrupts().
| void ESBGateway< mesh_t, network_t, radio_t >::poll | ( | uint32_t | waitDelay = 3 | ) |
gw.poll(); needs to be called to handle incoming data from the network interface. The function will perform a delayed wait of max 3ms unless otherwise specified.
| waitDelay | How long in milliseconds this function will wait for incoming data. |
Definition at line 347 of file RF24Gateway.cpp.
References fifoCleared.
| void ESBGateway< mesh_t, network_t, radio_t >::interrupts | ( | bool | enable = 1 | ) |
When using interrupts (gwNodeInt, ncursesInt examples) users need to call this function to disable interrupts before accessing the radio and again to re-enable interrupts when complete
| enable | 0 to disable interrupts and access the radio, 1 to re-enable |
Definition at line 322 of file RF24Gateway.cpp.
Referenced by update().
| bool ESBGateway< mesh_t, network_t, radio_t >::meshEnabled | ( | ) |
Is RF24Mesh enabled?
Definition at line 160 of file RF24Gateway.cpp.
|
inline |
Definition at line 167 of file RF24Gateway.h.
| void ESBGateway< mesh_t, network_t, radio_t >::sendUDP | ( | uint8_t | nodeID, |
| RF24NetworkFrame | frame ) |
Definition at line 829 of file RF24Gateway.cpp.
| uint16_t ESBGateway< mesh_t, network_t, radio_t >::thisNodeAddress |
Address of our node in Octal format (01,021, etc)
Definition at line 160 of file RF24Gateway.h.
| uint8_t ESBGateway< mesh_t, network_t, radio_t >::thisNodeID |
NodeID (0-255)
Definition at line 161 of file RF24Gateway.h.
| bool ESBGateway< mesh_t, network_t, radio_t >::config_TUN |
Using a TAP(false) or TUN(true) interface
Definition at line 164 of file RF24Gateway.h.
| bool ESBGateway< mesh_t, network_t, radio_t >::fifoCleared |
Definition at line 165 of file RF24Gateway.h.
Referenced by poll().
| uint32_t ESBGateway< mesh_t, network_t, radio_t >::droppedSpoofed |
How many packets received from the radio were dropped because their source IP did not match the mesh node that sent them (TUN mode, master node only)
Definition at line 176 of file RF24Gateway.h.
Referenced by ESBGateway().
| routeStruct ESBGateway< mesh_t, network_t, radio_t >::routingStruct[256] |
The array that holds the routing structure data. See routeStruct
Definition at line 226 of file RF24Gateway.h.
| uint16_t ESBGateway< mesh_t, network_t, radio_t >::routingTableSize |
The size of the existing routing table loaded into memory. See routeStruct
Definition at line 231 of file RF24Gateway.h.
Referenced by ESBGateway().
| uint32_t ESBGateway< mesh_t, network_t, radio_t >::networkOverruns |
How many times the network has returned error 160 NETWORK_OVERRUN
Definition at line 236 of file RF24Gateway.h.
| uint32_t ESBGateway< mesh_t, network_t, radio_t >::networkCorruption |
How many times the network has returned error 161 NETWORK_CORRUPTION
Definition at line 241 of file RF24Gateway.h.