ESPHome 2025.5.0
Loading...
Searching...
No Matches
toto_protocol.h
Go to the documentation of this file.
1#pragma once
2
3#include "remote_base.h"
4
5namespace esphome {
6namespace remote_base {
7
8struct TotoData {
9 uint8_t rc_code_1 : 4;
10 uint8_t rc_code_2 : 4;
11 uint8_t command;
12
13 bool operator==(const TotoData &rhs) const {
14 return (rc_code_1 == rhs.rc_code_1) && (rc_code_2 == rhs.rc_code_2) && (command == rhs.command);
15 }
16};
17
18class TotoProtocol : public RemoteProtocol<TotoData> {
19 public:
20 void encode(RemoteTransmitData *dst, const TotoData &data) override;
22 void dump(const TotoData &data) override;
23};
24
25DECLARE_REMOTE_PROTOCOL(Toto)
26
27template<typename... Ts> class TotoAction : public RemoteTransmitterActionBase<Ts...> {
28 public:
29 TEMPLATABLE_VALUE(uint8_t, rc_code_1)
30 TEMPLATABLE_VALUE(uint8_t, rc_code_2)
31 TEMPLATABLE_VALUE(uint8_t, command)
32
33 void encode(RemoteTransmitData *dst, Ts... x) override {
34 TotoData data{};
35 data.rc_code_1 = this->rc_code_1_.value(x...);
36 data.rc_code_2 = this->rc_code_2_.value(x...);
37 data.command = this->command_.value(x...);
38 this->set_send_times(this->send_times_.value_or(x..., 3));
39 this->set_send_wait(this->send_wait_.value_or(x..., 36000));
40 TotoProtocol().encode(dst, data);
41 }
42};
43
44} // namespace remote_base
45} // namespace esphome
optional< TotoData > decode(RemoteReceiveData src) override
void dump(const TotoData &data) override
void encode(RemoteTransmitData *dst, const TotoData &data) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const TotoData &rhs) const
uint16_t x
Definition tt21100.cpp:5