ESPHome 2025.5.0
Loading...
Searching...
No Matches
coolix_protocol.h
Go to the documentation of this file.
1#pragma once
2
5#include "remote_base.h"
6
7#include <cinttypes>
8
9namespace esphome {
10namespace remote_base {
11
12struct CoolixData {
14 CoolixData(uint32_t a) : first(a), second(a) {}
15 CoolixData(uint32_t a, uint32_t b) : first(a), second(b) {}
16 bool operator==(const CoolixData &other) const;
17 bool is_strict() const { return this->first == this->second; }
18 bool has_second() const { return this->second != 0; }
19 uint32_t first;
20 uint32_t second;
21};
22
23class CoolixProtocol : public RemoteProtocol<CoolixData> {
24 public:
25 void encode(RemoteTransmitData *dst, const CoolixData &data) override;
27 void dump(const CoolixData &data) override;
28};
29
30DECLARE_REMOTE_PROTOCOL(Coolix)
31
32template<typename... Ts> class CoolixAction : public RemoteTransmitterActionBase<Ts...> {
33 TEMPLATABLE_VALUE(uint32_t, first)
34 TEMPLATABLE_VALUE(uint32_t, second)
35 void encode(RemoteTransmitData *dst, Ts... x) override {
36 CoolixProtocol().encode(dst, {this->first_.value(x...), this->second_.value(x...)});
37 }
38};
39
40} // namespace remote_base
41} // namespace esphome
void dump(const CoolixData &data) override
optional< CoolixData > decode(RemoteReceiveData data) override
void encode(RemoteTransmitData *dst, const CoolixData &data) override
uint8_t second
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const CoolixData &other) const
CoolixData(uint32_t a, uint32_t b)
uint16_t x
Definition tt21100.cpp:5