RF24Network v1
Public Member Functions | Protected Member Functions

RF24Network Class Reference

Network Layer for RF24 Radios. More...

#include <RF24Network.h>

List of all members.

Public Member Functions

 RF24Network (RF24 &_radio)
 Construct the network.
void begin (uint8_t _channel, uint16_t _node_address)
 Bring up the network.
void update (void)
 Main layer loop.
bool available (void)
 Test whether there is a message available for this node.
void peek (RF24NetworkHeader &header)
 Read the next available header.
size_t read (RF24NetworkHeader &header, void *message, size_t maxlen)
 Read a message.
bool write (RF24NetworkHeader &header, const void *message, size_t len)
 Send a message.

Protected Member Functions

void open_pipes (void)
uint16_t find_node (uint16_t current_node, uint16_t target_node)
bool write (uint16_t)
bool write_to_pipe (uint16_t node, uint8_t pipe)
bool enqueue (void)
bool is_direct_child (uint16_t node)
bool is_descendant (uint16_t node)
uint16_t direct_child_route_to (uint16_t node)
uint8_t pipe_to_descendant (uint16_t node)
void setup_address (void)

Detailed Description

Network Layer for RF24 Radios.

This class implements an OSI Network Layer using nRF24L01(+) radios driven by RF24 library.


helloworld_rx.pde, helloworld_tx.pde, meshping.pde, and sensornet.pde.

Constructor & Destructor Documentation

RF24Network::RF24Network ( RF24 &  _radio)

Construct the network.

_radioThe underlying radio driver instance

Member Function Documentation

bool RF24Network::available ( void  )

Test whether there is a message available for this node.

Whether there is a message available for this node
void RF24Network::begin ( uint8_t  _channel,
uint16_t  _node_address 

Bring up the network.

Be sure to 'begin' the radio first.
_channelThe RF channel to operate on
_node_addressThe logical address of this node
void RF24Network::peek ( RF24NetworkHeader header)

Read the next available header.

Reads the next available header without advancing to the next incoming message. Useful for doing a switch on the message type

If there is no message available, the header is not touched

[out]headerThe header (envelope) of the next message
size_t RF24Network::read ( RF24NetworkHeader header,
void *  message,
size_t  maxlen 

Read a message.

[out]headerThe header (envelope) of this message
[out]messagePointer to memory where the message should be placed
maxlenThe largest message size which can be held in message
The total number of bytes copied into message
void RF24Network::update ( void  )

Main layer loop.

This function must be called regularly to keep the layer going. This is where all the action happens!

bool RF24Network::write ( RF24NetworkHeader header,
const void *  message,
size_t  len 

Send a message.

[in,out]headerThe header (envelope) of this message. The critical thing to fill in is the to_node field so we know where to send the message. It is then updated with the details of the actual header sent.
messagePointer to memory where the message is located
lenThe size of the message
Whether the message was successfully received

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables