Open RTS
Full implementation of the Somfy RTS protocol
|
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. | |
Related Symbols inherited from rts_frame | |
void | rts_frame_init (struct rts_frame *frame, enum rts_command command, uint16_t rolling_code, uint32_t remote_address) |
Initialize an rts_frame with typical payload. | |
void | rts_frame_from_bytes (struct rts_frame *frame, const uint8_t *bytes) |
Initialize an rts_frame from the raw (deobfuscated) bytes received. | |
void | rts_frame_to_bytes (struct rts_frame *frame, uint8_t *bytes, bool obfuscate) |
Convert an rts_frame to byte representation, and optionally apply XOR obfuscation to make it ready to send. | |
void | rts_frame_obfuscate_bytes (uint8_t *bytes) |
Apply in-place XOR obfuscation to a raw byte array representation of a frame. | |
void | rts_frame_deobfuscate_bytes (uint8_t *dest, const uint8_t *src) |
Apply XOR deobfuscation to a raw byte array representation of a frame. | |
uint8_t | rts_frame_generate_checksum (const uint8_t *bytes) |
Generate a checksum for the raw (deobfuscated) bytes of a frame. | |
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).
RTSFrame::RTSFrame | ( | rts_command | command, |
uint16_t | rollingCode, | ||
uint32_t | remoteAddress | ||
) |
Construct an RTSFrame with typical payload, and auto-generated encryption_key.
command | the rts_command |
rollingCode | the rolling code |
remoteAddress | the remote address |
RTSFrame::RTSFrame | ( | uint8_t * | bytes | ) |
Construct an RTSFrame from the raw (deobfuscated) bytes received.
bytes | the raw frame bytes to construct from |
RTSFrame::RTSFrame | ( | rts_frame * | frame | ) |
void RTSFrame::toBytes | ( | uint8_t * | bytes, |
bool | obfuscate = false |
||
) |
Convert an RTSFrame to byte representation.
bytes | the byte array to store the result in |
obfuscate | should we also apply obfuscation to the bytes |
|
static |
Apply in-place XOR obfuscation to a raw byte representation of a frame.
bytes | the raw frame bytes to obfuscate |
|
static |
Apply XOR deobfuscation to a raw byte representation of a frame.
dest | the destination byte array for the deobfuscated frame bytes |
src | the raw frame bytes to deobfuscate |
|
static |
Generate a checksum for the raw (deobfuscated) bytes of a frame.
bytes | the raw deobfuscated frame bytes to check |
The checksum for a valid frame should be 0.