ESPHome  2024.10.2
pioneer_protocol.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "remote_base.h"
4 
5 namespace esphome {
6 namespace remote_base {
7 
8 struct PioneerData {
9  uint16_t rc_code_1;
10  uint16_t rc_code_2;
11 
12  bool operator==(const PioneerData &rhs) const { return rc_code_1 == rhs.rc_code_1 && rc_code_2 == rhs.rc_code_2; }
13 };
14 
15 class PioneerProtocol : public RemoteProtocol<PioneerData> {
16  public:
17  void encode(RemoteTransmitData *dst, const PioneerData &data) override;
18  optional<PioneerData> decode(RemoteReceiveData src) override;
19  void dump(const PioneerData &data) override;
20 };
21 
23 
24 template<typename... Ts> class PioneerAction : public RemoteTransmitterActionBase<Ts...> {
25  public:
26  TEMPLATABLE_VALUE(uint16_t, rc_code_1)
27  TEMPLATABLE_VALUE(uint16_t, rc_code_2)
28 
29  void encode(RemoteTransmitData *dst, Ts... x) override {
30  PioneerData data{};
31  data.rc_code_1 = this->rc_code_1_.value(x...);
32  data.rc_code_2 = this->rc_code_2_.value(x...);
33  PioneerProtocol().encode(dst, data);
34  }
35 };
36 
37 } // namespace remote_base
38 } // 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 PioneerData &data) override
bool operator==(const PioneerData &rhs) const
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7