ESPHome 2026.6.0-dev
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::remote_base {
6
8 uint8_t device : 7;
9 uint8_t address : 6;
10 uint8_t repeat : 1;
11 uint8_t command : 7;
12
13 bool operator==(const CanalSatData &rhs) const {
14 return device == rhs.device && address == rhs.address && command == rhs.command;
15 }
16};
17
18struct CanalSatLDData : public CanalSatData {};
19
20class CanalSatBaseProtocol : public RemoteProtocol<CanalSatData> {
21 public:
22 void encode(RemoteTransmitData *dst, const CanalSatData &data) override;
23 optional<CanalSatData> decode(RemoteReceiveData src) override;
24 void dump(const CanalSatData &data) override;
25
26 protected:
27 uint16_t frequency_;
28 uint16_t unit_;
29 const char *tag_;
30};
31
33 public:
35};
36
38 public:
40};
41
42DECLARE_REMOTE_PROTOCOL(CanalSat)
43
44template<typename... Ts> class CanalSatAction : public RemoteTransmitterActionBase<Ts...> {
45 public:
46 TEMPLATABLE_VALUE(uint8_t, device)
47 TEMPLATABLE_VALUE(uint8_t, address)
48 TEMPLATABLE_VALUE(uint8_t, command)
49
50 void encode(RemoteTransmitData *dst, Ts... x) {
51 CanalSatData data{};
52 data.device = this->device_.value(x...);
53 data.address = this->address_.value(x...);
54 data.command = this->command_.value(x...);
55 CanalSatProtocol().encode(dst, data);
56 }
57};
58
59DECLARE_REMOTE_PROTOCOL(CanalSatLD)
60
61template<typename... Ts> class CanalSatLDAction : public RemoteTransmitterActionBase<Ts...> {
62 public:
63 TEMPLATABLE_VALUE(uint8_t, device)
64 TEMPLATABLE_VALUE(uint8_t, address)
65 TEMPLATABLE_VALUE(uint8_t, command)
66
67 void encode(RemoteTransmitData *dst, Ts... x) {
68 CanalSatData data{};
69 data.device = this->device_.value(x...);
70 data.address = this->address_.value(x...);
71 data.command = this->command_.value(x...);
72 CanalSatLDProtocol().encode(dst, data);
73 }
74};
75
76} // namespace esphome::remote_base
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
const std::vector< uint8_t > & data
const void * src
Definition hal.h:64
bool operator==(const CanalSatData &rhs) const
uint16_t x
Definition tt21100.cpp:5