ESPHome  2024.10.2
ota_esphome.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "esphome/core/defines.h"
4 #ifdef USE_OTA
5 #include "esphome/core/helpers.h"
9 
10 namespace esphome {
11 
14  public:
15 #ifdef USE_OTA_PASSWORD
16  void set_auth_password(const std::string &password) { password_ = password; }
17 #endif // USE_OTA_PASSWORD
18 
20  void set_port(uint16_t port);
21 
22  void setup() override;
23  void dump_config() override;
24  float get_setup_priority() const override;
25  void loop() override;
26 
27  uint16_t get_port() const;
28 
29  protected:
30  void handle_();
31  bool readall_(uint8_t *buf, size_t len);
32  bool writeall_(const uint8_t *buf, size_t len);
33 
34 #ifdef USE_OTA_PASSWORD
35  std::string password_;
36 #endif // USE_OTA_PASSWORD
37 
38  uint16_t port_;
39 
40  std::unique_ptr<socket::Socket> server_;
41  std::unique_ptr<socket::Socket> client_;
42 };
43 
44 } // namespace esphome
45 #endif
std::unique_ptr< socket::Socket > client_
Definition: ota_esphome.h:41
void set_auth_password(const std::string &password)
Definition: ota_esphome.h:16
ESPHomeOTAComponent provides a simple way to integrate Over-the-Air updates into your app using Ardui...
Definition: ota_esphome.h:13
bool writeall_(const uint8_t *buf, size_t len)
std::string size_t len
Definition: helpers.h:292
float get_setup_priority() const override
std::unique_ptr< socket::Socket > server_
Definition: ota_esphome.h:40
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_port(uint16_t port)
Manually set the port OTA should listen on.
bool readall_(uint8_t *buf, size_t len)