ESPHome 2025.5.0
Loading...
Searching...
No Matches
byronsx_protocol.h
Go to the documentation of this file.
1#pragma once
2
4#include "remote_base.h"
5
6namespace esphome {
7namespace remote_base {
8
9struct ByronSXData {
10 uint8_t address;
11 uint8_t command;
12
13 bool operator==(const ByronSXData &rhs) const {
14 // Treat 0x10 as a special, wildcard command/chime
15 // This allows us to match on just the address if wanted.
16 if (address != rhs.address) {
17 return false;
18 }
19 return (rhs.command == 0x10 || command == rhs.command);
20 }
21};
22
23class ByronSXProtocol : public RemoteProtocol<ByronSXData> {
24 public:
25 void encode(RemoteTransmitData *dst, const ByronSXData &data) override;
27 void dump(const ByronSXData &data) override;
28};
29
30DECLARE_REMOTE_PROTOCOL(ByronSX)
31
32template<typename... Ts> class ByronSXAction : public RemoteTransmitterActionBase<Ts...> {
33 public:
34 TEMPLATABLE_VALUE(uint8_t, address)
35 TEMPLATABLE_VALUE(uint8_t, command)
36
37 void encode(RemoteTransmitData *dst, Ts... x) override {
38 ByronSXData data{};
39 data.address = this->address_.value(x...);
40 data.command = this->command_.value(x...);
41 ByronSXProtocol().encode(dst, data);
42 }
43};
44
45} // namespace remote_base
46} // namespace esphome
uint8_t address
Definition bl0906.h:4
void dump(const ByronSXData &data) override
optional< ByronSXData > decode(RemoteReceiveData src) override
void encode(RemoteTransmitData *dst, const ByronSXData &data) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const ByronSXData &rhs) const
uint16_t x
Definition tt21100.cpp:5