ESPHome  2022.5.1
am43_cover.h
Go to the documentation of this file.
1 #pragma once
2 
8 
9 #ifdef USE_ESP32
10 
11 #include <esp_gattc_api.h>
12 
13 namespace esphome {
14 namespace am43 {
15 
17 
19  public:
20  void setup() override;
21  void loop() override;
22  void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
23  esp_ble_gattc_cb_param_t *param) override;
24  void dump_config() override;
25  float get_setup_priority() const override { return setup_priority::DATA; }
26  cover::CoverTraits get_traits() override;
27  void set_pin(uint16_t pin) { this->pin_ = pin; }
28  void set_invert_position(bool invert_position) { this->invert_position_ = invert_position; }
29 
30  protected:
31  void control(const cover::CoverCall &call) override;
32  uint16_t char_handle_;
33  uint16_t pin_;
35  std::unique_ptr<Am43Encoder> encoder_;
36  std::unique_ptr<Am43Decoder> decoder_;
37  bool logged_in_;
38 
39  float position_;
40 };
41 
42 } // namespace am43
43 } // namespace esphome
44 
45 #endif
std::unique_ptr< Am43Decoder > decoder_
Definition: am43_cover.h:36
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
Definition: am43_cover.cpp:76
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
Base class for all cover devices.
Definition: cover.h:111
std::unique_ptr< Am43Encoder > encoder_
Definition: am43_cover.h:35
void set_pin(uint16_t pin)
Definition: am43_cover.h:27
void dump_config() override
Definition: am43_cover.cpp:13
void control(const cover::CoverCall &call) override
Definition: am43_cover.cpp:49
float get_setup_priority() const override
Definition: am43_cover.h:25
void set_invert_position(bool invert_position)
Definition: am43_cover.h:28
Definition: a4988.cpp:4
cover::CoverTraits get_traits() override
Definition: am43_cover.cpp:41