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