Network Payload Structures

struct RF24NetworkFrame

Frame structure for internal message handling, and for use by external applications

The actual frame put over the air consists of a header (8-bytes) and a message payload (Up to 24-bytes). When data is received, it is stored using the RF24NetworkFrame structure, which includes:

  1. The header containing information about routing the message and the message type

  2. The size of the included message

  3. The ‘message’ or data being received

Public Functions

inline RF24NetworkFrame()

Default constructor

Simply constructs a blank frame. Frames are generally used internally. See RF24NetworkHeader.

inline RF24NetworkFrame(RF24NetworkHeader &_header, const void *_message = NULL, uint16_t _len = 0)

Constructor for Linux platforms - create a network frame with data Frames are constructed and handled differently on Arduino/AVR and Linux devices (#if defined RF24_LINUX)

Frames are used internally and by external systems. See RF24NetworkHeader.

Parameters:
RF24NetworkHeader &_header

The RF24Network header to be stored in the frame

const void *_message = NULL

The ‘message’ or data.

uint16_t _len = 0

The size of the ‘message’ or data.

inline RF24NetworkFrame(RF24NetworkHeader &_header, uint16_t _message_size)

Constructor for Arduino/AVR/etc. platforms - create a network frame with data Frames are constructed and handled differently on Arduino/AVR and Linux devices (#if defined RF24_LINUX)

Frames are used internally and by external systems. See RF24NetworkHeader.

Parameters:
RF24NetworkHeader &_header

The RF24Network header to be stored in the frame

uint16_t _message_size

The size of the ‘message’ or data

Public Members

RF24NetworkHeader header

Header which is sent with each message

uint16_t message_size

The size in bytes of the payload length

uint8_t *message_buffer

On Arduino, the message buffer is just a pointer, and can be pointed to any memory location. On Linux the message buffer is a standard byte array, equal in size to the defined MAX_PAYLOAD_SIZE

struct RF24NetworkHeader

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.

Public Functions

inline RF24NetworkHeader()

Default constructor

Simply constructs a blank header

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

Send constructor

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));

Note

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

Parameters:
uint16_t _to

The Octal format, logical node address where the message is going

unsigned char _type = 0

The type of message which follows. Only 0 - 127 are allowed for user messages. Types 1 - 64 will not receive a network acknowledgement.

const char *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.

Public Members

uint16_t from_node

Logical address where the message was generated

uint16_t to_node

Logical address where the message is going

uint16_t id

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

unsigned char 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

unsigned char reserved

Reserved for system use

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

Public Static Attributes

static uint16_t next_id = 1

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