ESPHome  2024.10.2
toshiba_ac_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 ToshibaAcData {
10  uint64_t rc_code_1;
11  uint64_t rc_code_2;
12 
13  bool operator==(const ToshibaAcData &rhs) const { return rc_code_1 == rhs.rc_code_1 && rc_code_2 == rhs.rc_code_2; }
14 };
15 
16 class ToshibaAcProtocol : public RemoteProtocol<ToshibaAcData> {
17  public:
18  void encode(RemoteTransmitData *dst, const ToshibaAcData &data) override;
19  optional<ToshibaAcData> decode(RemoteReceiveData src) override;
20  void dump(const ToshibaAcData &data) override;
21 };
22 
24 
25 template<typename... Ts> class ToshibaAcAction : public RemoteTransmitterActionBase<Ts...> {
26  public:
27  TEMPLATABLE_VALUE(uint64_t, rc_code_1)
28  TEMPLATABLE_VALUE(uint64_t, rc_code_2)
29 
30  void encode(RemoteTransmitData *dst, Ts... x) override {
31  ToshibaAcData data{};
32  data.rc_code_1 = this->rc_code_1_.value(x...);
33  data.rc_code_2 = this->rc_code_2_.value(x...);
34  ToshibaAcProtocol().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 ToshibaAcData &data) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool operator==(const ToshibaAcData &rhs) const