RF24Gateway - TCP/IP over RF24Network v1.0.4
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 | |
RF24Gateway (RF24 &_radio, RF24Network &_network, RF24Mesh &_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 |
Definition at line 46 of file RF24Gateway.h.
RF24Gateway::RF24Gateway | ( | RF24 & | _radio, |
RF24Network & | _network, | ||
RF24Mesh & | _mesh | ||
) |
RF24Gateway constructor.
Definition at line 12 of file RF24Gateway.cpp.
void RF24Gateway::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 20 of file RF24Gateway.cpp.
References begin().
Referenced by begin().
void RF24Gateway::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 28 of file RF24Gateway.cpp.
References begin().
int RF24Gateway::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 244 of file RF24Gateway.cpp.
void RF24Gateway::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 322 of file RF24Gateway.cpp.
References interrupts().
void RF24Gateway::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 349 of file RF24Gateway.cpp.
References fifoCleared.
void RF24Gateway::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 304 of file RF24Gateway.cpp.
Referenced by update().
bool RF24Gateway::meshEnabled | ( | ) |
Is RF24Mesh enabled?
Definition at line 148 of file RF24Gateway.cpp.
|
inline |
Definition at line 141 of file RF24Gateway.h.
void RF24Gateway::sendUDP | ( | uint8_t | nodeID, |
RF24NetworkFrame | frame | ||
) |
Definition at line 723 of file RF24Gateway.cpp.
uint16_t RF24Gateway::thisNodeAddress |
Address of our node in Octal format (01,021, etc)
Definition at line 134 of file RF24Gateway.h.
uint8_t RF24Gateway::thisNodeID |
NodeID (0-255)
Definition at line 135 of file RF24Gateway.h.
bool RF24Gateway::config_TUN |
Using a TAP(false) or TUN(true) interface
Definition at line 138 of file RF24Gateway.h.
bool RF24Gateway::fifoCleared |
Definition at line 139 of file RF24Gateway.h.
Referenced by poll().
routeStruct RF24Gateway::routingStruct[256] |
The array that holds the routing structure data. See routeStruct
Definition at line 194 of file RF24Gateway.h.
uint8_t RF24Gateway::routingTableSize |
The size of the existing routing table loaded into memory. See routeStruct
Definition at line 199 of file RF24Gateway.h.