1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 15:26:01 +00:00

remote_base changes (#5124)

This commit is contained in:
Sergey Dudanov
2023-07-31 00:07:33 +04:00
committed by GitHub
parent a120a455bf
commit 794a4bd9a1
6 changed files with 147 additions and 164 deletions

View File

@@ -31,17 +31,17 @@ class RawBinarySensor : public RemoteReceiverBinarySensorBase {
size_t len_;
};
class RawTrigger : public Trigger<std::vector<int32_t>>, public Component, public RemoteReceiverListener {
class RawTrigger : public Trigger<RawTimings>, public Component, public RemoteReceiverListener {
protected:
bool on_receive(RemoteReceiveData src) override {
this->trigger(*src.get_raw_data());
this->trigger(src.get_raw_data());
return false;
}
};
template<typename... Ts> class RawAction : public RemoteTransmitterActionBase<Ts...> {
public:
void set_code_template(std::function<std::vector<int32_t>(Ts...)> func) { this->code_func_ = func; }
void set_code_template(std::function<RawTimings(Ts...)> func) { this->code_func_ = func; }
void set_code_static(const int32_t *code, size_t len) {
this->code_static_ = code;
this->code_static_len_ = len;
@@ -65,7 +65,7 @@ template<typename... Ts> class RawAction : public RemoteTransmitterActionBase<Ts
}
protected:
std::function<std::vector<int32_t>(Ts...)> code_func_{};
std::function<RawTimings(Ts...)> code_func_{nullptr};
const int32_t *code_static_{nullptr};
int32_t code_static_len_{0};
};