ESPHome  2024.6.1
samsung_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 SamsungData {
10  uint64_t data;
11  uint8_t nbits;
12 
13  bool operator==(const SamsungData &rhs) const { return data == rhs.data && nbits == rhs.nbits; }
14 };
15 
16 class SamsungProtocol : public RemoteProtocol<SamsungData> {
17  public:
18  void encode(RemoteTransmitData *dst, const SamsungData &data) override;
19  optional<SamsungData> decode(RemoteReceiveData src) override;
20  void dump(const SamsungData &data) override;
21 };
22 
24 
25 template<typename... Ts> class SamsungAction : public RemoteTransmitterActionBase<Ts...> {
26  public:
27  TEMPLATABLE_VALUE(uint64_t, data)
28  TEMPLATABLE_VALUE(uint8_t, nbits)
29 
30  void encode(RemoteTransmitData *dst, Ts... x) override {
31  SamsungData data{};
32  data.data = this->data_.value(x...);
33  data.nbits = this->nbits_.value(x...);
34  SamsungProtocol().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
bool operator==(const SamsungData &rhs) const
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
void encode(RemoteTransmitData *dst, const SamsungData &data) override