ESPHome  2024.12.2
samsung36_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 Samsung36Data {
12  uint16_t address;
13  uint32_t command;
14 
15  bool operator==(const Samsung36Data &rhs) const { return address == rhs.address && command == rhs.command; }
16 };
17 
18 class Samsung36Protocol : public RemoteProtocol<Samsung36Data> {
19  public:
20  void encode(RemoteTransmitData *dst, const Samsung36Data &data) override;
21  optional<Samsung36Data> decode(RemoteReceiveData src) override;
22  void dump(const Samsung36Data &data) override;
23 };
24 
26 
27 template<typename... Ts> class Samsung36Action : 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  Samsung36Data data{};
34  data.address = this->address_.value(x...);
35  data.command = this->command_.value(x...);
36  Samsung36Protocol().encode(dst, data);
37  }
38 };
39 
40 } // namespace remote_base
41 } // namespace esphome
void encode(RemoteTransmitData *dst, const Samsung36Data &data) override
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:27
uint16_t x
Definition: tt21100.cpp:17
bool operator==(const Samsung36Data &rhs) const
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7