ESPHome  2022.9.2
samsung36_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 Samsung36Data {
10  uint16_t address;
11  uint32_t command;
12 
13  bool operator==(const Samsung36Data &rhs) const { return address == rhs.address && command == rhs.command; }
14 };
15 
16 class Samsung36Protocol : public RemoteProtocol<Samsung36Data> {
17  public:
18  void encode(RemoteTransmitData *dst, const Samsung36Data &data) override;
19  optional<Samsung36Data> decode(RemoteReceiveData src) override;
20  void dump(const Samsung36Data &data) override;
21 };
22 
24 
25 template<typename... Ts> class Samsung36Action : public RemoteTransmitterActionBase<Ts...> {
26  public:
27  TEMPLATABLE_VALUE(uint16_t, address)
28  TEMPLATABLE_VALUE(uint32_t, command)
29 
30  void encode(RemoteTransmitData *dst, Ts... x) override {
31  Samsung36Data data{};
32  data.address = this->address_.value(x...);
33  data.command = this->command_.value(x...);
34  Samsung36Protocol().encode(dst, data);
35  }
36 };
37 
38 } // namespace remote_base
39 } // namespace esphome
void encode(RemoteTransmitData *dst, const Samsung36Data &data) override
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:25
bool operator==(const Samsung36Data &rhs) const
Definition: a4988.cpp:4