RF24Gateway - TCP/IP over RF24Network  0.1b
TMRh20 - Pushing the practical limits of RF24 modules
Classes | List of all members
RF24Gateway Class Reference

#include <RF24Gateway.h>

RF24Gateway (RPi/Linux)

RF24Gateway library for devices with an IP stack

uint16_t thisNodeAddress
 
uint8_t thisNodeID
 
bool config_TUN
 
 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 meshEnabled ()
 
uint32_t ifDropped ()
 

Detailed Description

Examples:
RF24Gateway_ncurses.cpp, and RF24GatewayNode.cpp.

Definition at line 39 of file RF24Gateway.h.

Constructor & Destructor Documentation

RF24Gateway::RF24Gateway ( RF24 &  _radio,
RF24Network &  _network,
RF24Mesh &  _mesh 
)

RF24Gateway constructor.

Definition at line 9 of file RF24Gateway.cpp.

Member Function Documentation

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)

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 16 of file RF24Gateway.cpp.

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.

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 24 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.

Parameters
ipA 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 181 of file RF24Gateway.cpp.

void RF24Gateway::update ( )

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
}

Definition at line 246 of file RF24Gateway.cpp.

bool RF24Gateway::meshEnabled ( )

Is RF24Mesh enabled?

Definition at line 89 of file RF24Gateway.cpp.

uint32_t RF24Gateway::ifDropped ( )
inline

Definition at line 111 of file RF24Gateway.h.

Member Data Documentation

uint16_t RF24Gateway::thisNodeAddress

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

Definition at line 104 of file RF24Gateway.h.

uint8_t RF24Gateway::thisNodeID

NodeID (0-255)

Definition at line 105 of file RF24Gateway.h.

bool RF24Gateway::config_TUN

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

Definition at line 109 of file RF24Gateway.h.