ESPHome  2024.10.2
dish_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 DishData {
9  uint8_t address;
10  uint8_t command;
11 
12  bool operator==(const DishData &rhs) const { return address == rhs.address && command == rhs.command; }
13 };
14 
15 class DishProtocol : public RemoteProtocol<DishData> {
16  public:
17  void encode(RemoteTransmitData *dst, const DishData &data) override;
18  optional<DishData> decode(RemoteReceiveData src) override;
19  void dump(const DishData &data) override;
20 };
21 
23 
24 template<typename... Ts> class DishAction : public RemoteTransmitterActionBase<Ts...> {
25  public:
26  TEMPLATABLE_VALUE(uint8_t, address)
27  TEMPLATABLE_VALUE(uint8_t, command)
28 
29  void encode(RemoteTransmitData *dst, Ts... x) override {
30  DishData data{};
31  data.address = this->address_.value(x...);
32  data.command = this->command_.value(x...);
33  DishProtocol().encode(dst, data);
34  }
35 };
36 
37 } // namespace remote_base
38 } // namespace esphome
bool operator==(const DishData &rhs) const
Definition: dish_protocol.h:12
DECLARE_REMOTE_PROTOCOL(AEHA) template< typename... Ts > class AEHAAction
Definition: aeha_protocol.h:27
uint16_t x
Definition: tt21100.cpp:17
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void encode(RemoteTransmitData *dst, const DishData &data) override