ESPHome  2024.10.2
automation.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace pn7150 {
9 
11  public:
13  parent->add_on_emulated_tag_scan_callback([this]() { this->trigger(); });
14  }
15 };
16 
18  public:
20  parent->add_on_finished_write_callback([this]() { this->trigger(); });
21  }
22 };
23 
24 template<typename... Ts> class PN7150IsWritingCondition : public Condition<Ts...>, public Parented<PN7150> {
25  public:
26  bool check(Ts... x) override { return this->parent_->is_writing(); }
27 };
28 
29 template<typename... Ts> class EmulationOffAction : public Action<Ts...>, public Parented<PN7150> {
30  void play(Ts... x) override { this->parent_->set_tag_emulation_off(); }
31 };
32 
33 template<typename... Ts> class EmulationOnAction : public Action<Ts...>, public Parented<PN7150> {
34  void play(Ts... x) override { this->parent_->set_tag_emulation_on(); }
35 };
36 
37 template<typename... Ts> class PollingOffAction : public Action<Ts...>, public Parented<PN7150> {
38  void play(Ts... x) override { this->parent_->set_polling_off(); }
39 };
40 
41 template<typename... Ts> class PollingOnAction : public Action<Ts...>, public Parented<PN7150> {
42  void play(Ts... x) override { this->parent_->set_polling_on(); }
43 };
44 
45 template<typename... Ts> class SetCleanModeAction : public Action<Ts...>, public Parented<PN7150> {
46  void play(Ts... x) override { this->parent_->clean_mode(); }
47 };
48 
49 template<typename... Ts> class SetFormatModeAction : public Action<Ts...>, public Parented<PN7150> {
50  void play(Ts... x) override { this->parent_->format_mode(); }
51 };
52 
53 template<typename... Ts> class SetReadModeAction : public Action<Ts...>, public Parented<PN7150> {
54  void play(Ts... x) override { this->parent_->read_mode(); }
55 };
56 
57 template<typename... Ts> class SetEmulationMessageAction : public Action<Ts...>, public Parented<PN7150> {
58  TEMPLATABLE_VALUE(std::string, message)
59  TEMPLATABLE_VALUE(bool, include_android_app_record)
60 
61  void play(Ts... x) override {
62  this->parent_->set_tag_emulation_message(this->message_.optional_value(x...),
63  this->include_android_app_record_.optional_value(x...));
64  }
65 };
66 
67 template<typename... Ts> class SetWriteMessageAction : public Action<Ts...>, public Parented<PN7150> {
68  TEMPLATABLE_VALUE(std::string, message)
69  TEMPLATABLE_VALUE(bool, include_android_app_record)
70 
71  void play(Ts... x) override {
72  this->parent_->set_tag_write_message(this->message_.optional_value(x...),
73  this->include_android_app_record_.optional_value(x...));
74  }
75 };
76 
77 template<typename... Ts> class SetWriteModeAction : public Action<Ts...>, public Parented<PN7150> {
78  void play(Ts... x) override { this->parent_->write_mode(); }
79 };
80 
81 } // namespace pn7150
82 } // namespace esphome
uint16_t x
Definition: tt21100.cpp:17
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
Definition: automation.h:95
Base class for all automation conditions.
Definition: automation.h:74
void add_on_finished_write_callback(std::function< void()> callback)
Definition: pn7150.h:174
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void add_on_emulated_tag_scan_callback(std::function< void()> callback)
Definition: pn7150.h:170
Helper class to easily give an object a parent of type T.
Definition: helpers.h:521