ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
byronsx_protocol.h
Go to the documentation of this file.
1#pragma once
2
4#include "remote_base.h"
5
6namespace esphome::remote_base {
7
8struct ByronSXData {
9 uint8_t address;
10 uint8_t command;
11
12 bool operator==(const ByronSXData &rhs) const {
13 // Treat 0x10 as a special, wildcard command/chime
14 // This allows us to match on just the address if wanted.
15 if (address != rhs.address) {
16 return false;
17 }
18 return (rhs.command == 0x10 || command == rhs.command);
19 }
20};
21
22class ByronSXProtocol : public RemoteProtocol<ByronSXData> {
23 public:
24 void encode(RemoteTransmitData *dst, const ByronSXData &data) override;
25 optional<ByronSXData> decode(RemoteReceiveData src) override;
26 void dump(const ByronSXData &data) override;
27};
28
29DECLARE_REMOTE_PROTOCOL(ByronSX)
30
31template<typename... Ts> class ByronSXAction : public RemoteTransmitterActionBase<Ts...> {
32 public:
33 TEMPLATABLE_VALUE(uint8_t, address)
34 TEMPLATABLE_VALUE(uint8_t, command)
35
36 void encode(RemoteTransmitData *dst, Ts... x) override {
37 ByronSXData data{};
38 data.address = this->address_.value(x...);
39 data.command = this->command_.value(x...);
40 ByronSXProtocol().encode(dst, data);
41 }
42};
43
44} // namespace esphome::remote_base
uint8_t address
Definition bl0906.h:4
void dump(const ByronSXData &data) override
optional< ByronSXData > decode(RemoteReceiveData src) override
void encode(RemoteTransmitData *dst, const ByronSXData &data) override
const void * src
Definition hal.h:64
bool operator==(const ByronSXData &rhs) const
uint16_t x
Definition tt21100.cpp:5