ESPHome  2024.10.2
mirage_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 MirageData {
10  std::vector<uint8_t> data;
11 
12  bool operator==(const MirageData &rhs) const { return data == rhs.data; }
13 };
14 
15 class MirageProtocol : public RemoteProtocol<MirageData> {
16  public:
17  void encode(RemoteTransmitData *dst, const MirageData &data) override;
18  optional<MirageData> decode(RemoteReceiveData src) override;
19  void dump(const MirageData &data) override;
20 
21  protected:
22  void encode_byte_(RemoteTransmitData *dst, uint8_t item);
23 };
24 
26 
27 template<typename... Ts> class MirageAction : public RemoteTransmitterActionBase<Ts...> {
28  public:
29  TEMPLATABLE_VALUE(std::vector<uint8_t>, code)
30 
31  void encode(RemoteTransmitData *dst, Ts... x) override {
32  MirageData data{};
33  data.data = this->code_.value(x...);
34  MirageProtocol().encode(dst, data);
35  }
36 };
37 
38 } // namespace remote_base
39 } // namespace esphome
void encode(RemoteTransmitData *dst, const MirageData &data) override
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:27
uint16_t x
Definition: tt21100.cpp:17
std::vector< uint8_t > data
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool operator==(const MirageData &rhs) const