Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
UartProtocol Namespace Reference

Enumerations

enum  Encrypt { ENCRYPT_NEVER = 0 , ENCRYPT_IF_ENABLED = 1 , ENCRYPT_OR_FAIL = 2 , ENCRYPT_ACCORDING_TO_TYPE = 3 }
 Option whether a UART message should be encrypted. More...
 

Functions

constexpr bool mustBeEncryptedRx (UartOpcodeRx opCode)
 Whether a received UART message must be encrypted when "encryption required" is true (when a UART key is set). More...
 
constexpr bool mustBeEncryptedTx (UartOpcodeTx opCode)
 Whether a written UART message must be encrypted when "encryption required" is true (when a UART key is set). More...
 
void escape (uint8_t &val)
 Escape a value: converts a value to the an escaped version. More...
 
void unEscape (uint8_t &val)
 Unescape a value: converts an escaped value back to the original value. More...
 
uint16_t crc16 (const uint8_t *data, uint16_t size)
 Calculate the CRC of given data. More...
 
void crc16 (const uint8_t *data, const uint16_t size, uint16_t &crc)
 Calculate the CRC of given data, with given CRC as start. More...
 

Enumeration Type Documentation

◆ Encrypt

Option whether a UART message should be encrypted.

Enumerator
ENCRYPT_NEVER 
ENCRYPT_IF_ENABLED 
ENCRYPT_OR_FAIL 
ENCRYPT_ACCORDING_TO_TYPE 

Function Documentation

◆ crc16() [1/2]

void UartProtocol::crc16 ( const uint8_t *  data,
const uint16_t  size,
uint16_t &  crc 
)

Calculate the CRC of given data, with given CRC as start.

◆ crc16() [2/2]

uint16_t UartProtocol::crc16 ( const uint8_t *  data,
uint16_t  size 
)

Calculate the CRC of given data.

◆ escape()

void UartProtocol::escape ( uint8_t &  val)

Escape a value: converts a value to the an escaped version.

◆ mustBeEncryptedRx()

constexpr bool UartProtocol::mustBeEncryptedRx ( UartOpcodeRx  opCode)
constexpr

Whether a received UART message must be encrypted when "encryption required" is true (when a UART key is set).

Optionals should return false.

◆ mustBeEncryptedTx()

constexpr bool UartProtocol::mustBeEncryptedTx ( UartOpcodeTx  opCode)
constexpr

Whether a written UART message must be encrypted when "encryption required" is true (when a UART key is set).

Optionals should return true.

◆ unEscape()

void UartProtocol::unEscape ( uint8_t &  val)

Unescape a value: converts an escaped value back to the original value.