mirror of
https://github.com/esphome/esphome.git
synced 2025-11-17 15:26:01 +00:00
Improv - BLE WiFi provisioning (#1807)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
@@ -27,6 +27,11 @@ extern "C" {
|
||||
namespace esphome {
|
||||
namespace wifi {
|
||||
|
||||
struct SavedWifiSettings {
|
||||
char ssid[33];
|
||||
char password[65];
|
||||
} PACKED; // NOLINT
|
||||
|
||||
enum WiFiComponentState {
|
||||
/** Nothing has been initialized yet. Internal AP, if configured, is disabled at this point. */
|
||||
WIFI_COMPONENT_STATE_OFF = 0,
|
||||
@@ -156,6 +161,7 @@ class WiFiComponent : public Component {
|
||||
|
||||
void set_sta(const WiFiAP &ap);
|
||||
void add_sta(const WiFiAP &ap);
|
||||
void clear_sta();
|
||||
|
||||
/** Setup an Access Point that should be created if no connection to a station can be made.
|
||||
*
|
||||
@@ -185,6 +191,7 @@ class WiFiComponent : public Component {
|
||||
void set_power_save_mode(WiFiPowerSaveMode power_save);
|
||||
void set_output_power(float output_power) { output_power_ = output_power; }
|
||||
|
||||
void save_wifi_sta(const std::string &ssid, const std::string &password);
|
||||
// ========== INTERNAL METHODS ==========
|
||||
// (In most use cases you won't need these)
|
||||
/// Setup WiFi interface.
|
||||
@@ -253,6 +260,7 @@ class WiFiComponent : public Component {
|
||||
bool wifi_disconnect_();
|
||||
|
||||
bool is_captive_portal_active_();
|
||||
bool is_esp32_improv_active_();
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
static void wifi_event_callback(System_Event_t *event);
|
||||
@@ -288,6 +296,8 @@ class WiFiComponent : public Component {
|
||||
bool scan_done_{false};
|
||||
bool ap_setup_{false};
|
||||
optional<float> output_power_;
|
||||
ESPPreferenceObject pref_;
|
||||
bool has_saved_wifi_settings_{false};
|
||||
};
|
||||
|
||||
extern WiFiComponent *global_wifi_component;
|
||||
|
||||
Reference in New Issue
Block a user