Open RTS
Full implementation of the Somfy RTS protocol
Loading...
Searching...
No Matches
rts_frame.h
Go to the documentation of this file.
1#ifndef RTS_FRAME_H
2#define RTS_FRAME_H
3
4#include <stdbool.h>
5#include <stdint.h>
6
7#include "rts_command.h"
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
22// Number of bytes in a raw RTS frame payload
23#define RTS_FRAME_BYTES 7
24
32struct rts_frame {
39 uint8_t encryption_key : 8;
40
46
54 uint16_t rolling_code : 16;
55
61 uint32_t remote_address : 24;
62};
63
75void rts_frame_init(struct rts_frame *frame, enum rts_command command,
76 uint16_t rolling_code, uint32_t remote_address);
77
86void rts_frame_from_bytes(struct rts_frame *frame, const uint8_t *bytes);
87
98void rts_frame_to_bytes(struct rts_frame *frame, uint8_t *bytes,
99 bool obfuscate);
100
108void rts_frame_obfuscate_bytes(uint8_t *bytes);
109
118void rts_frame_deobfuscate_bytes(uint8_t *dest, const uint8_t *src);
119
128uint8_t rts_frame_generate_checksum(const uint8_t *bytes);
129
134#ifdef __cplusplus
135} // extern "C"
136#endif
137
138#endif // RTS_FRAME_H
rts_command
Command sent by a remote, or received by a receiver as part of an rts_frame event.
Definition rts_command.h:24
Represents the message "payload" sent by RTS remote controls.
Definition rts_frame.h:32
uint32_t remote_address
The three-byte remote address sending this frame.
Definition rts_frame.h:61
enum rts_command command
The command we are sending, eg "Up", "Down", "My", or combinations of buttons found on remote control...
Definition rts_frame.h:45
uint8_t encryption_key
8-bit encryption key, typically generated automatically.
Definition rts_frame.h:39
uint16_t rolling_code
The rolling code of this frame.
Definition rts_frame.h:54