RF24Gateway - TCP/IP over RF24Network v2.1.1
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
ESBGateway< mesh_t, network_t, radio_t > Class Template Reference

#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
 
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]
 
uint8_t routingTableSize
 

Detailed Description

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
class ESBGateway< mesh_t, network_t, radio_t >
Template Parameters
mesh_tThe 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_tThe 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_tThe 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.
Examples
RF24GatewayNode.cpp, RF24GatewayNodeInt.cpp, RF24Gateway_ncurses.cpp, and RF24Gateway_ncursesInt.cpp.

Definition at line 65 of file RF24Gateway.h.

Constructor & Destructor Documentation

◆ ESBGateway()

template<class mesh_t , class network_t , class radio_t >
ESBGateway< mesh_t, network_t, radio_t >::ESBGateway ( radio_t & _radio,
network_t & _network,
mesh_t & _mesh )

ESBGateway constructor.

RF24 radio(7,8);
RF24Network network(radio);
RF24Mesh mesh(radio,network);
RF24Gateway gateway(radio,network,mesh);

Definition at line 13 of file RF24Gateway.cpp.

Member Function Documentation

◆ begin() [1/2]

template<class mesh_t , class network_t , class radio_t >
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)

Parameters
nodeIDThe RF24Mesh nodeID to use
channelThe radio channel to use (1-127)
data_rateThe RF24 datarate to use (RF24_250KBPS, RF24_1MBPS, RF24_2MBPS)
gw.begin(); //Start the gateway using RF24Mesh, with nodeID 0 (Master)
uint8_t nodeID; gw.begin(nodeID); //Start the gateway using RF24Mesh, with nodeID 1 (Child node)

Definition at line 21 of file RF24Gateway.cpp.

◆ begin() [2/2]

template<class mesh_t , class network_t , class radio_t >
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.

Parameters
addressThe RF24Network address to use
channelThe radio channel (0-127) to use
data_rateThe RF24 datarate to use (RF24_250KBPS, RF24_1MBPS, RF24_2MBPS)
meshEnableWhether to use RF24Mesh for address assignment
nodeIDThe RF24Mesh nodeID to use if meshEnable has been set to true
uint16_t address=00; gw.begin(address); //Start the gateway without using RF24Mesh, with RF24Network address 00 (Master)
uint16_t address=01; gw.begin(address); //Start the gateway without using RF24Mesh, with RF24Network address 01 (Child)

Definition at line 30 of file RF24Gateway.cpp.

◆ setIP()

template<class mesh_t , class network_t , class radio_t >
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.

Parameters
ip_addrA character array containing the numeric IP address ie: 192.168.1.1
maskA character array containing the subnet mask ie: 255.255.255.0
Returns
-1 if failed, 0 on success

Definition at line 257 of file RF24Gateway.cpp.

◆ update()

template<class mesh_t , class network_t , class radio_t >
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.

gw.update();
if(network.available()){
...do something
}
Parameters
interruptsSet true if called from an interrupt handler & call poll() from the main loop or a thread.

Definition at line 327 of file RF24Gateway.cpp.

◆ poll()

template<class mesh_t , class network_t , class radio_t >
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.

Parameters
waitDelayHow long in milliseconds this function will wait for incoming data.

Definition at line 344 of file RF24Gateway.cpp.

◆ interrupts()

template<class mesh_t , class network_t , class radio_t >
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

Parameters
enable0 to disable interrupts and access the radio, 1 to re-enable

Definition at line 319 of file RF24Gateway.cpp.

◆ meshEnabled()

template<class mesh_t , class network_t , class radio_t >
bool ESBGateway< mesh_t, network_t, radio_t >::meshEnabled ( )

Is RF24Mesh enabled?

Definition at line 153 of file RF24Gateway.cpp.

◆ ifDropped()

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
uint32_t ESBGateway< mesh_t, network_t, radio_t >::ifDropped ( )
inline

Definition at line 166 of file RF24Gateway.h.

◆ sendUDP()

template<class mesh_t , class network_t , class radio_t >
void ESBGateway< mesh_t, network_t, radio_t >::sendUDP ( uint8_t nodeID,
RF24NetworkFrame frame )

Definition at line 725 of file RF24Gateway.cpp.

Member Data Documentation

◆ thisNodeAddress

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
uint16_t ESBGateway< mesh_t, network_t, radio_t >::thisNodeAddress

Address of our node in Octal format (01,021, etc)

Definition at line 159 of file RF24Gateway.h.

◆ thisNodeID

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
uint8_t ESBGateway< mesh_t, network_t, radio_t >::thisNodeID

NodeID (0-255)

Definition at line 160 of file RF24Gateway.h.

◆ config_TUN

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
bool ESBGateway< mesh_t, network_t, radio_t >::config_TUN

Using a TAP(false) or TUN(true) interface

Definition at line 163 of file RF24Gateway.h.

◆ fifoCleared

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
bool ESBGateway< mesh_t, network_t, radio_t >::fifoCleared

Definition at line 164 of file RF24Gateway.h.

◆ routingStruct

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
routeStruct ESBGateway< mesh_t, network_t, radio_t >::routingStruct[256]

The array that holds the routing structure data. See routeStruct

Definition at line 219 of file RF24Gateway.h.

◆ routingTableSize

template<class mesh_t = ESBMesh<ESBNetwork<RF24>, RF24>, class network_t = ESBNetwork<RF24>, class radio_t = RF24>
uint8_t ESBGateway< mesh_t, network_t, radio_t >::routingTableSize

The size of the existing routing table loaded into memory. See routeStruct

Definition at line 224 of file RF24Gateway.h.