ESPHome  2022.9.1
nextion_base.h
Go to the documentation of this file.
1 #pragma once
2 #include "esphome/core/defines.h"
3 #include "esphome/core/color.h"
5 namespace esphome {
6 namespace nextion {
7 
8 #ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
9 #define NEXTION_PROTOCOL_LOG
10 #endif
11 
12 #ifdef NEXTION_PROTOCOL_LOG
13 #ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
14 #define ESP_LOGN(tag, ...) ESP_LOGVV(tag, __VA_ARGS__)
15 #else
16 #define ESP_LOGN(tag, ...) ESP_LOGD(tag, __VA_ARGS__)
17 #endif
18 #else
19 #define ESP_LOGN(tag, ...) \
20  {}
21 #endif
22 
23 class NextionBase;
24 
25 class NextionBase {
26  public:
27  virtual void add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value) = 0;
28  virtual void add_no_result_to_queue_with_set(const std::string &variable_name,
29  const std::string &variable_name_to_send, int state_value) = 0;
30 
31  virtual void add_no_result_to_queue_with_set(NextionComponentBase *component, const std::string &state_value) = 0;
32  virtual void add_no_result_to_queue_with_set(const std::string &variable_name,
33  const std::string &variable_name_to_send,
34  const std::string &state_value) = 0;
35 
36  virtual void add_addt_command_to_queue(NextionComponentBase *component) = 0;
37 
38  virtual void add_to_get_queue(NextionComponentBase *component) = 0;
39 
40  virtual void set_component_background_color(const char *component, Color color) = 0;
41  virtual void set_component_pressed_background_color(const char *component, Color color) = 0;
42  virtual void set_component_font_color(const char *component, Color color) = 0;
43  virtual void set_component_pressed_font_color(const char *component, Color color) = 0;
44  virtual void set_component_font(const char *component, uint8_t font_id) = 0;
45 
46  virtual void show_component(const char *component) = 0;
47  virtual void hide_component(const char *component) = 0;
48 
49  bool is_sleeping() { return this->is_sleeping_; }
50  bool is_setup() { return this->is_setup_; }
51 
52  protected:
53  bool is_setup_ = false;
54  bool is_sleeping_ = false;
55 };
56 
57 } // namespace nextion
58 } // namespace esphome
virtual void set_component_font(const char *component, uint8_t font_id)=0
virtual void set_component_pressed_font_color(const char *component, Color color)=0
virtual void set_component_pressed_background_color(const char *component, Color color)=0
virtual void add_to_get_queue(NextionComponentBase *component)=0
virtual void add_addt_command_to_queue(NextionComponentBase *component)=0
virtual void hide_component(const char *component)=0
virtual void show_component(const char *component)=0
virtual void add_no_result_to_queue_with_set(NextionComponentBase *component, int state_value)=0
virtual void set_component_background_color(const char *component, Color color)=0
Definition: a4988.cpp:4
virtual void set_component_font_color(const char *component, Color color)=0