ESPHome 2025.5.0
Loading...
Searching...
No Matches
beo4_protocol.h
Go to the documentation of this file.
1#pragma once
2
3#include "remote_base.h"
4
5#include <cinttypes>
6
7namespace esphome {
8namespace remote_base {
9
10struct Beo4Data {
11 uint8_t source; // beoSource, e.g. video, audio, light...
12 uint8_t command; // beoCommend, e.g. volume+, mute,...
13 uint8_t repeats; // beoRepeat for repeat commands, e.g. up, down...
14
15 bool operator==(const Beo4Data &rhs) const { return source == rhs.source && command == rhs.command; }
16};
17
18class Beo4Protocol : public RemoteProtocol<Beo4Data> {
19 public:
20 void encode(RemoteTransmitData *dst, const Beo4Data &data) override;
22 void dump(const Beo4Data &data) override;
23};
24
25DECLARE_REMOTE_PROTOCOL(Beo4)
26
27template<typename... Ts> class Beo4Action : public RemoteTransmitterActionBase<Ts...> {
28 public:
29 TEMPLATABLE_VALUE(uint8_t, source)
30 TEMPLATABLE_VALUE(uint8_t, command)
31 TEMPLATABLE_VALUE(uint8_t, repeats)
32
33 void encode(RemoteTransmitData *dst, Ts... x) override {
34 Beo4Data data{};
35 data.source = this->source_.value(x...);
36 data.command = this->command_.value(x...);
37 data.repeats = this->repeats_.value(x...);
38 Beo4Protocol().encode(dst, data);
39 }
40};
41
42} // namespace remote_base
43} // namespace esphome
void * source_
void dump(const Beo4Data &data) override
optional< Beo4Data > decode(RemoteReceiveData src) override
void encode(RemoteTransmitData *dst, const Beo4Data &data) override
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
bool operator==(const Beo4Data &rhs) const
uint16_t x
Definition tt21100.cpp:5