mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-24 14:48:29 +02:00
a62b6548d2
Apparently play()/stop() etc. are not meant to be called directly by users of the class and if they're called directly that would not give the expected result for the classes that have an empty play(). Make all methods except play_complex, stop_comples and is_running protected. While there also make RemoteTransmitterActionBase::encode protected.
37 lines
829 B
C++
37 lines
829 B
C++
#pragma once
|
|
|
|
#include "remote_base.h"
|
|
|
|
namespace esphome {
|
|
namespace remote_base {
|
|
|
|
struct JVCData {
|
|
uint32_t data;
|
|
|
|
bool operator==(const JVCData &rhs) const { return data == rhs.data; }
|
|
};
|
|
|
|
class JVCProtocol : public RemoteProtocol<JVCData> {
|
|
public:
|
|
void encode(RemoteTransmitData *dst, const JVCData &data) override;
|
|
optional<JVCData> decode(RemoteReceiveData src) override;
|
|
void dump(const JVCData &data) override;
|
|
};
|
|
|
|
DECLARE_REMOTE_PROTOCOL(JVC)
|
|
|
|
template<typename... Ts> class JVCAction : public RemoteTransmitterActionBase<Ts...> {
|
|
public:
|
|
TEMPLATABLE_VALUE(uint32_t, data)
|
|
|
|
protected:
|
|
void encode_(RemoteTransmitData *dst, Ts... x) override {
|
|
JVCData data{};
|
|
data.data = this->data_.value(x...);
|
|
JVCProtocol().encode(dst, data);
|
|
}
|
|
};
|
|
|
|
} // namespace remote_base
|
|
} // namespace esphome
|