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