ESPHome 2025.5.0
Loading...
Searching...
No Matches
canalsat_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
9 uint8_t device : 7;
10 uint8_t address : 6;
11 uint8_t repeat : 1;
12 uint8_t command : 7;
13
14 bool operator==(const CanalSatData &rhs) const {
15 return device == rhs.device && address == rhs.address && command == rhs.command;
16 }
17};
18
19struct CanalSatLDData : public CanalSatData {};
20
21class CanalSatBaseProtocol : public RemoteProtocol<CanalSatData> {
22 public:
23 void encode(RemoteTransmitData *dst, const CanalSatData &data) override;
25 void dump(const CanalSatData &data) override;
26
27 protected:
28 uint16_t frequency_;
29 uint16_t unit_;
30 const char *tag_;
31};
32
34 public:
36};
37
39 public:
41};
42
43DECLARE_REMOTE_PROTOCOL(CanalSat)
44
45template<typename... Ts> class CanalSatAction : public RemoteTransmitterActionBase<Ts...> {
46 public:
47 TEMPLATABLE_VALUE(uint8_t, device)
48 TEMPLATABLE_VALUE(uint8_t, address)
49 TEMPLATABLE_VALUE(uint8_t, command)
50
51 void encode(RemoteTransmitData *dst, Ts... x) {
52 CanalSatData data{};
53 data.device = this->device_.value(x...);
54 data.address = this->address_.value(x...);
55 data.command = this->command_.value(x...);
56 CanalSatProtocol().encode(dst, data);
57 }
58};
59
60DECLARE_REMOTE_PROTOCOL(CanalSatLD)
61
62template<typename... Ts> class CanalSatLDAction : public RemoteTransmitterActionBase<Ts...> {
63 public:
64 TEMPLATABLE_VALUE(uint8_t, device)
65 TEMPLATABLE_VALUE(uint8_t, address)
66 TEMPLATABLE_VALUE(uint8_t, command)
67
68 void encode(RemoteTransmitData *dst, Ts... x) {
69 CanalSatData data{};
70 data.device = this->device_.value(x...);
71 data.address = this->address_.value(x...);
72 data.command = this->command_.value(x...);
73 CanalSatLDProtocol().encode(dst, data);
74 }
75};
76
77} // namespace remote_base
78} // namespace esphome
uint8_t address
Definition bl0906.h:4
void dump(const CanalSatData &data) override
void encode(RemoteTransmitData *dst, const CanalSatData &data) override
optional< CanalSatData > decode(RemoteReceiveData src) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const CanalSatData &rhs) const
uint16_t x
Definition tt21100.cpp:5