ESPHome 2025.5.0
Loading...
Searching...
No Matches
drayton_protocol.h
Go to the documentation of this file.
1#pragma once
2
4#include "remote_base.h"
5
6#include <cinttypes>
7
8namespace esphome {
9namespace remote_base {
10
12 uint16_t address;
13 uint8_t channel;
14 uint8_t command;
15
16 bool operator==(const DraytonData &rhs) const {
17 return address == rhs.address && channel == rhs.channel && command == rhs.command;
18 }
19};
20
21class DraytonProtocol : public RemoteProtocol<DraytonData> {
22 public:
23 void encode(RemoteTransmitData *dst, const DraytonData &data) override;
25 void dump(const DraytonData &data) override;
26};
27
28DECLARE_REMOTE_PROTOCOL(Drayton)
29
30template<typename... Ts> class DraytonAction : public RemoteTransmitterActionBase<Ts...> {
31 public:
32 TEMPLATABLE_VALUE(uint16_t, address)
33 TEMPLATABLE_VALUE(uint8_t, channel)
34 TEMPLATABLE_VALUE(uint8_t, command)
35
36 void encode(RemoteTransmitData *dst, Ts... x) override {
37 DraytonData data{};
38 data.address = this->address_.value(x...);
39 data.channel = this->channel_.value(x...);
40 data.command = this->command_.value(x...);
41 DraytonProtocol().encode(dst, data);
42 }
43};
44
45} // namespace remote_base
46} // namespace esphome
uint8_t address
Definition bl0906.h:4
optional< DraytonData > decode(RemoteReceiveData src) override
void encode(RemoteTransmitData *dst, const DraytonData &data) override
void dump(const DraytonData &data) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const DraytonData &rhs) const
uint16_t x
Definition tt21100.cpp:5