Optimized RF24Network Layer v2.3.0
2024 - Optimized RF24 Network Layer for NRF24L01 & NRF52x radios
Loading...
Searching...
No Matches
RF24CCM Class Reference

#include <RF24CCM.h>

Inheritance diagram for RF24CCM:

Public Member Functions

void setKey (const uint8_t key[RF24CCM_KEY_SIZE])
void setCounter (uint32_t counter)
void setRetries (uint8_t delay, uint8_t count)
uint8_t getDynamicPayloadSize (void)
void read (void *buf, uint8_t len)
bool write (const void *buf, uint8_t len)
bool write (const void *buf, uint8_t len, const bool multicast)
bool writeFast (const void *buf, uint8_t len)
bool writeFast (const void *buf, uint8_t len, const bool multicast)

Public Attributes

bool enableEncryption = false
uint32_t decryptFailures = 0

Detailed Description

Drop-in replacement for RF24 that encrypts outgoing frames and decrypts incoming ones.

Use it as the radio_t of ESBNetwork, ESBMesh and ESBGateway. The libraries must be built with the RF24NETWORK_CCM option so these template instantiations exist.

When encryption is enabled, frames that are too short or fail the MIC check are dropped, counted in decryptFailures, and reported to RF24Network as a zero length payload (which RF24Network::update() returns as NETWORK_CORRUPTION).

Member Function Documentation

◆ setKey()

void RF24CCM::setKey ( const uint8_t key[RF24CCM_KEY_SIZE])
inline

Set the 16 byte (128 bit) key. Use the same byte order as nrf_to_nrf::setKey()

◆ setCounter()

void RF24CCM::setCounter ( uint32_t counter)
inline

Set the packet counter for outgoing frames. It starts at a random value and wraps at 24 bits

◆ setRetries()

void RF24CCM::setRetries ( uint8_t delay,
uint8_t count )
inline

RF24::setRetries(), raised to at least minRetryDelay and minRetryCount while encryption is enabled

◆ getDynamicPayloadSize()

uint8_t RF24CCM::getDynamicPayloadSize ( void )
inline

◆ read()

void RF24CCM::read ( void * buf,
uint8_t len )
inline

◆ write() [1/2]

bool RF24CCM::write ( const void * buf,
uint8_t len )
inline

◆ write() [2/2]

bool RF24CCM::write ( const void * buf,
uint8_t len,
const bool multicast )
inline

◆ writeFast() [1/2]

bool RF24CCM::writeFast ( const void * buf,
uint8_t len )
inline

◆ writeFast() [2/2]

bool RF24CCM::writeFast ( const void * buf,
uint8_t len,
const bool multicast )
inline

Member Data Documentation

◆ enableEncryption

bool RF24CCM::enableEncryption = false

Encrypt and authenticate all traffic. Every node on the channel must use the same key

◆ decryptFailures

uint32_t RF24CCM::decryptFailures = 0

Received frames dropped because they were too short or failed authentication