ESPHome  2024.12.2
roomba_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 RoombaData {
9  uint8_t data;
10 
11  bool operator==(const RoombaData &rhs) const { return data == rhs.data; }
12 };
13 
14 class RoombaProtocol : public RemoteProtocol<RoombaData> {
15  public:
16  void encode(RemoteTransmitData *dst, const RoombaData &data) override;
17  optional<RoombaData> decode(RemoteReceiveData src) override;
18  void dump(const RoombaData &data) override;
19 };
20 
22 
23 template<typename... Ts> class RoombaAction : public RemoteTransmitterActionBase<Ts...> {
24  public:
25  TEMPLATABLE_VALUE(uint8_t, data)
26 
27  void encode(RemoteTransmitData *dst, Ts... x) override {
28  RoombaData data{};
29  data.data = this->data_.value(x...);
30  RoombaProtocol().encode(dst, data);
31  }
32 };
33 
34 } // namespace remote_base
35 } // 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 RoombaData &data) override
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool operator==(const RoombaData &rhs) const