ESPHome  2024.10.2
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:79
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
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:50
float get_setup_priority() const override
Definition: am43_cover.h:25
void set_invert_position(bool invert_position)
Definition: am43_cover.h:28
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
cover::CoverTraits get_traits() override
Definition: am43_cover.cpp:41