13 static const uint8_t RF_MESSAGE_SIZE = 9;
14 static const uint8_t RF_CODE_START = 0xAA;
15 static const uint8_t RF_CODE_ACK = 0xA0;
16 static const uint8_t RF_CODE_LEARN = 0xA1;
17 static const uint8_t RF_CODE_LEARN_KO = 0xA2;
18 static const uint8_t RF_CODE_LEARN_OK = 0xA3;
19 static const uint8_t RF_CODE_RFIN = 0xA4;
20 static const uint8_t RF_CODE_RFOUT = 0xA5;
21 static const uint8_t RF_CODE_ADVANCED_RFIN = 0xA6;
22 static const uint8_t RF_CODE_SNIFFING_ON = 0xA6;
23 static const uint8_t RF_CODE_SNIFFING_OFF = 0xA7;
24 static const uint8_t RF_CODE_RFOUT_NEW = 0xA8;
25 static const uint8_t RF_CODE_LEARN_NEW = 0xA9;
26 static const uint8_t RF_CODE_LEARN_KO_NEW = 0xAA;
27 static const uint8_t RF_CODE_LEARN_OK_NEW = 0xAB;
28 static const uint8_t RF_CODE_RFOUT_BUCKET = 0xB0;
29 static const uint8_t RF_CODE_RFIN_BUCKET = 0xB1;
30 static const uint8_t RF_CODE_BEEP = 0xC0;
31 static const uint8_t RF_CODE_STOP = 0x55;
32 static const uint8_t RF_DEBOUNCE = 200;
50 void dump_config()
override;
52 this->data_callback_.add(std::move(callback));
55 this->advanced_data_callback_.add(std::move(callback));
60 void start_advanced_sniffing();
61 void stop_advanced_sniffing();
62 void start_bucket_sniffing();
63 void send_raw(
const std::string &
code);
64 void beep(uint16_t ms);
69 bool parse_bridge_byte_(uint8_t byte);
70 void write_byte_str_(
const std::string &codes);
73 uint32_t last_bridge_byte_{0};
96 TEMPLATABLE_VALUE(uint16_t,
sync)
97 TEMPLATABLE_VALUE(uint16_t,
low)
98 TEMPLATABLE_VALUE(uint16_t,
high)
99 TEMPLATABLE_VALUE(uint32_t,
code)
103 data.
sync = this->sync_.value(x...);
104 data.low = this->low_.value(x...);
105 data.high = this->high_.value(x...);
106 data.code = this->code_.value(x...);
107 this->parent_->send_code(data);
117 TEMPLATABLE_VALUE(uint8_t,
length)
118 TEMPLATABLE_VALUE(uint8_t, protocol)
123 data.
length = this->length_.value(x...);
124 data.protocol = this->protocol_.value(x...);
125 data.code = this->code_.value(x...);
126 this->parent_->send_advanced_code(data);
137 void play(Ts...
x) { this->parent_->learn(); }
147 void play(Ts...
x) { this->parent_->start_advanced_sniffing(); }
157 void play(Ts...
x) { this->parent_->stop_advanced_sniffing(); }
167 void play(Ts...
x) { this->parent_->start_bucket_sniffing(); }
178 void play(Ts...
x) { this->parent_->send_raw(this->raw_.value(
x...)); }
189 void play(Ts...
x) { this->parent_->beep(this->duration_.value(
x...)); }
CallbackManager< void(RFBridgeData)> data_callback_
CallbackManager< void(RFBridgeAdvancedData)> advanced_data_callback_
RFBridgeSendAdvancedCodeAction(RFBridgeComponent *parent)
RFBridgeComponent * parent_
void add_on_advanced_code_received_callback(std::function< void(RFBridgeAdvancedData)> callback)
TEMPLATABLE_VALUE(std::string, raw) void play(Ts... x)
RFBridgeComponent * parent_
RFBridgeComponent * parent_
std::vector< uint8_t > rx_buffer_
RFBridgeBeepAction(RFBridgeComponent *parent)
RFBridgeComponent * parent_
RFBridgeComponent * parent_
RFBridgeStartAdvancedSniffingAction(RFBridgeComponent *parent)
RFBridgeReceivedCodeTrigger(RFBridgeComponent *parent)
TEMPLATABLE_VALUE(uint16_t, duration) void play(Ts... x)
RFBridgeStartBucketSniffingAction(RFBridgeComponent *parent)
RFBridgeComponent * parent_
RFBridgeReceivedAdvancedCodeTrigger(RFBridgeComponent *parent)
RFBridgeComponent * parent_
RFBridgeSendCodeAction(RFBridgeComponent *parent)
RFBridgeStopAdvancedSniffingAction(RFBridgeComponent *parent)
void add_on_code_received_callback(std::function< void(RFBridgeData)> callback)
Implementation of SPI Controller mode.
RFBridgeLearnAction(RFBridgeComponent *parent)
RFBridgeSendRawAction(RFBridgeComponent *parent)
RFBridgeComponent * parent_