Open RTS
Full implementation of the Somfy RTS protocol
Loading...
Searching...
No Matches
RTSFrame Class Reference

Represents the message "payload" sent by RTS remote controls. More...

#include <RTSFrame.hpp>

Inherits rts_frame.

Public Member Functions

 RTSFrame (rts_command command, uint16_t rollingCode, uint32_t remoteAddress)
 Construct an RTSFrame with typical payload, and auto-generated encryption_key.
 
 RTSFrame (uint8_t *bytes)
 Construct an RTSFrame from the raw (deobfuscated) bytes received.
 
 RTSFrame (rts_frame *frame)
 Construct an RTSFrame by copying the contents of an rts_frame.
 
void toBytes (uint8_t *bytes, bool obfuscate=false)
 Convert an RTSFrame to byte representation.
 

Static Public Member Functions

static void obfuscateBytes (uint8_t *bytes)
 Apply in-place XOR obfuscation to a raw byte representation of a frame.
 
static void deobfuscateBytes (uint8_t *dest, uint8_t *src)
 Apply XOR deobfuscation to a raw byte representation of a frame.
 
static uint8_t generateChecksum (uint8_t *bytes)
 Generate a checksum for the raw (deobfuscated) bytes of a frame.
 

Additional Inherited Members

- Data Fields inherited from rts_frame
uint8_t encryption_key: 8
 8-bit encryption key, typically generated automatically.
 
enum rts_command command: 4
 The command we are sending, eg "Up", "Down", "My", or combinations of buttons found on remote controls.
 
uint16_t rolling_code: 16
 The rolling code of this frame.
 
uint32_t remote_address: 24
 The three-byte remote address sending this frame.
 

Detailed Description

Represents the message "payload" sent by RTS remote controls.

It contains the command (eg. UP, DOWN, etc), the identity of the sender remote_address), and information to verify the authenticity of the payload (checksum, rolling_code, encryption_key).

Constructor & Destructor Documentation

◆ RTSFrame() [1/3]

RTSFrame::RTSFrame ( rts_command  command,
uint16_t  rollingCode,
uint32_t  remoteAddress 
)

Construct an RTSFrame with typical payload, and auto-generated encryption_key.

Parameters
commandthe rts_command
rollingCodethe rolling code
remoteAddressthe remote address

◆ RTSFrame() [2/3]

RTSFrame::RTSFrame ( uint8_t *  bytes)

Construct an RTSFrame from the raw (deobfuscated) bytes received.

Parameters
bytesthe raw frame bytes to construct from

◆ RTSFrame() [3/3]

RTSFrame::RTSFrame ( rts_frame frame)

Construct an RTSFrame by copying the contents of an rts_frame.

Parameters
frame

Member Function Documentation

◆ toBytes()

void RTSFrame::toBytes ( uint8_t *  bytes,
bool  obfuscate = false 
)

Convert an RTSFrame to byte representation.

Parameters
bytesthe byte array to store the result in
obfuscateshould we also apply obfuscation to the bytes

◆ obfuscateBytes()

void RTSFrame::obfuscateBytes ( uint8_t *  bytes)
static

Apply in-place XOR obfuscation to a raw byte representation of a frame.

Parameters
bytesthe raw frame bytes to obfuscate

◆ deobfuscateBytes()

void RTSFrame::deobfuscateBytes ( uint8_t *  dest,
uint8_t *  src 
)
static

Apply XOR deobfuscation to a raw byte representation of a frame.

Parameters
destthe destination byte array for the deobfuscated frame bytes
srcthe raw frame bytes to deobfuscate

◆ generateChecksum()

uint8_t RTSFrame::generateChecksum ( uint8_t *  bytes)
static

Generate a checksum for the raw (deobfuscated) bytes of a frame.

Parameters
bytesthe raw deobfuscated frame bytes to check

The checksum for a valid frame should be 0.


The documentation for this class was generated from the following files: