mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-06 04:48:27 +02:00
Add Captive Portal (#624)
* WIP: Captive Portal * Updates * Updates * Lint * Fixes
This commit is contained in:
@@ -122,6 +122,7 @@ class WiFiComponent : public Component {
|
||||
/// Construct a WiFiComponent.
|
||||
WiFiComponent();
|
||||
|
||||
void set_sta(const WiFiAP &ap);
|
||||
void add_sta(const WiFiAP &ap);
|
||||
|
||||
/** Setup an Access Point that should be created if no connection to a station can be made.
|
||||
@@ -137,6 +138,7 @@ class WiFiComponent : public Component {
|
||||
void check_scanning_finished();
|
||||
void start_connecting(const WiFiAP &ap, bool two);
|
||||
void set_fast_connect(bool fast_connect);
|
||||
void set_ap_timeout(uint32_t ap_timeout) { ap_timeout_ = ap_timeout; }
|
||||
|
||||
void check_connecting_finished();
|
||||
|
||||
@@ -144,8 +146,6 @@ class WiFiComponent : public Component {
|
||||
|
||||
bool can_proceed() override;
|
||||
|
||||
bool ready_for_ota();
|
||||
|
||||
void set_reboot_timeout(uint32_t reboot_timeout);
|
||||
|
||||
bool is_connected();
|
||||
@@ -171,6 +171,10 @@ class WiFiComponent : public Component {
|
||||
std::string get_use_address() const;
|
||||
void set_use_address(const std::string &use_address);
|
||||
|
||||
const std::vector<WiFiScanResult> &get_scan_result() const { return scan_result_; }
|
||||
|
||||
IPAddress wifi_soft_ap_ip();
|
||||
|
||||
protected:
|
||||
static std::string format_mac_addr(const uint8_t mac[6]);
|
||||
void setup_ap_config_();
|
||||
@@ -188,7 +192,8 @@ class WiFiComponent : public Component {
|
||||
bool wifi_scan_start_();
|
||||
bool wifi_ap_ip_config_(optional<ManualIP> manual_ip);
|
||||
bool wifi_start_ap_(const WiFiAP &ap);
|
||||
IPAddress wifi_soft_ap_ip_();
|
||||
|
||||
bool is_captive_portal_active_();
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
static void wifi_event_callback(System_Event_t *event);
|
||||
@@ -211,7 +216,8 @@ class WiFiComponent : public Component {
|
||||
uint32_t action_started_;
|
||||
uint8_t num_retried_{0};
|
||||
uint32_t last_connected_{0};
|
||||
uint32_t reboot_timeout_{300000};
|
||||
uint32_t reboot_timeout_{};
|
||||
uint32_t ap_timeout_{};
|
||||
WiFiPowerSaveMode power_save_{WIFI_POWER_SAVE_NONE};
|
||||
bool error_from_callback_{false};
|
||||
std::vector<WiFiScanResult> scan_result_;
|
||||
|
||||
Reference in New Issue
Block a user