ESPHome  2024.10.2
haier_protocol.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "remote_base.h"
4 #include <vector>
5 
6 namespace esphome {
7 namespace remote_base {
8 
9 struct HaierData {
10  std::vector<uint8_t> data;
11 
12  bool operator==(const HaierData &rhs) const { return data == rhs.data; }
13 };
14 
15 class HaierProtocol : public RemoteProtocol<HaierData> {
16  public:
17  void encode(RemoteTransmitData *dst, const HaierData &data) override;
18  optional<HaierData> decode(RemoteReceiveData src) override;
19  void dump(const HaierData &data) override;
20 
21  protected:
22  void encode_byte_(RemoteTransmitData *dst, uint8_t item);
23 };
24 
26 
27 template<typename... Ts> class HaierAction : public RemoteTransmitterActionBase<Ts...> {
28  public:
29  TEMPLATABLE_VALUE(std::vector<uint8_t>, code)
30 
31  void encode(RemoteTransmitData *dst, Ts... x) override {
32  HaierData data{};
33  data.data = this->code_.value(x...);
34  HaierProtocol().encode(dst, data);
35  }
36 };
37 
38 } // namespace remote_base
39 } // namespace esphome
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:27
uint16_t x
Definition: tt21100.cpp:17
void encode(RemoteTransmitData *dst, const HaierData &data) override
std::vector< uint8_t > data
bool operator==(const HaierData &rhs) const
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7