Optimized RF24Network Layer v2.0.2
2024 - Optimized RF24 Network Layer for NRF24L01 & NRF52x radios
Loading...
Searching...
No Matches
RF24NetworkHeader Struct Reference

#include <RF24Network.h>

Public Member Functions

 RF24NetworkHeader ()
 
 RF24NetworkHeader (uint16_t _to, unsigned char _type=0)
 
const char * toString (void) const
 

Public Attributes

uint16_t from_node
 
uint16_t to_node
 
uint16_t id
 
unsigned char type
 
unsigned char reserved
 

Static Public Attributes

static uint16_t next_id = 1
 

Detailed Description

Header which is sent with each message

The frame put over the air consists of this header and a message

Headers are addressed to the appropriate node, and the network forwards them on to their final destination.

Examples
Network_Ping.ino, Network_Ping_Sleep.ino, Network_Priority_RX.ino, Network_Priority_TX.ino, helloworld_rx.ino, helloworld_rx_advanced.ino, helloworld_tx.ino, and helloworld_tx_advanced.ino.

Constructor & Destructor Documentation

◆ RF24NetworkHeader() [1/2]

RF24NetworkHeader::RF24NetworkHeader ( )
inline

Default constructor

Simply constructs a blank header

◆ RF24NetworkHeader() [2/2]

RF24NetworkHeader::RF24NetworkHeader ( uint16_t _to,
unsigned char _type = 0 )
inline

Send constructor

Note
Now supports automatic fragmentation for very long messages, which can be sent as usual if fragmentation is enabled.

Fragmentation is enabled by default for all devices except ATTiny. Configure fragmentation and max payload size in RF24Network_config.h

Use this constructor to create a header and then send a message

uint16_t recipient_address = 011;
RF24NetworkHeader header(recipient_address, 't');
network.write(header, &message, sizeof(message));
Definition RF24Network.h:229
Parameters
_toThe Octal format, logical node address where the message is going
_typeThe type of message which follows. Only 0 - 127 are allowed for user messages. Types 1 - 64 will not receive a network acknowledgement.

Member Function Documentation

◆ toString()

const char * RF24NetworkHeader::toString ( void ) const

Create debugging string

Useful for debugging. Dumps all members into a single string, using internal static memory. This memory will get overridden next time you call the method.

Returns
String representation of the object's significant members.

Member Data Documentation

◆ from_node

uint16_t RF24NetworkHeader::from_node

Logical address where the message was generated

Examples
Network_Ping.ino, and Network_Ping_Sleep.ino.

◆ to_node

uint16_t RF24NetworkHeader::to_node

Logical address where the message is going

◆ id

uint16_t RF24NetworkHeader::id

Sequential message ID, incremented every time a new frame is constructed

◆ type

unsigned char RF24NetworkHeader::type

Type of the packet. 0 - 127 are user-defined types, 128 - 255 are reserved for system.

User message types 1 through 64 will NOT be acknowledged by the network, while message types 65 through 127 will receive a network ACK. System message types 192 through 255 will NOT be acknowledged by the network. Message types 128 through 192 will receive a network ACK.

See also
Reserved System Message Types
Examples
Network_Ping.ino, Network_Ping_Sleep.ino, and Network_Priority_RX.ino.

◆ reserved

unsigned char RF24NetworkHeader::reserved

Reserved for system use

During fragmentation, it carries the fragment_id, and on the last fragment it carries the header_type.

◆ next_id

uint16_t RF24NetworkHeader::next_id = 1
static

The message ID of the next message to be sent. This attribute is not sent with the header.