|
RF24Network v1
|
Network Layer for RF24 Radios. More...
#include <RF24Network.h>
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) |
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.
| RF24Network::RF24Network | ( | RF24 & | _radio | ) |
Construct the network.
| _radio | The underlying radio driver instance |
| bool RF24Network::available | ( | void | ) |
Test whether there is a message available for this node.
| void RF24Network::begin | ( | uint8_t | _channel, |
| uint16_t | _node_address | ||
| ) |
Bring up the network.
| _channel | The RF channel to operate on |
| _node_address | The 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] | header | The header (envelope) of the next message |
| size_t RF24Network::read | ( | RF24NetworkHeader & | header, |
| void * | message, | ||
| size_t | maxlen | ||
| ) |
Read a message.
| [out] | header | The header (envelope) of this message |
| [out] | message | Pointer to memory where the message should be placed |
| maxlen | The largest message size which can be held in message |
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] | header | The 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. |
| message | Pointer to memory where the message is located | |
| len | The size of the message |
1.7.3