8000 Add eraseCredentials option to WiFi disconnect method. by cziter15 · Pull Request #8758 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

Add eraseCredentials option to WiFi disconnect method. #8758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix default behavior of basic disconnect method variant. Change erase…
…ap to

 meaningful name 'eraseCredentials'. Fix comments.
  • Loading branch information
cziter15 authored Dec 15, 2022
commit 4ecaf68a8879a38ce716e6a23d69decf605eb1cc
15 changes: 8 additions & 7 deletions libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,28 +353,29 @@ bool ESP8266WiFiSTAClass::reconnect() {
}

/**
* Disconnect from the network
* @param wifioff
* Disconnect from the network with clearing saved credentials
* @param wifioff Bool indicating whether STA should be disabled.
* @return one value of wl_status_t enum
*/
bool ESP8266WiFiSTAClass::disconnect(bool wifioff) {
return disconnect(wifioff, false);
// Disconnect with clearing saved credentials.
return disconnect(wifioff, true);
}

/**
* Disconnect from the network
* @param wifioff
* @param eraseap
* @param wifioff Bool indicating whether STA should be disabled.
* @param eraseCredentials Bool indicating whether saved credentials should be erased.
* @return one value of wl_status_t enum
*/
bool ESP8266WiFiSTAClass::disconnect(bool wifioff, bool eraseap) {
bool ESP8266WiFiSTAClass::disconnect(bool wifioff, bool eraseCredentials) {
bool ret = false;

// Read current config.
struct station_config conf;
wifi_station_get_config(&conf);

if (eraseap) {
if (eraseCredentials) {
memset(&conf.ssid, 0, sizeof(conf.ssid));
memset(&conf.password, 0, sizeof(conf.password));
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ESP8266WiFiSTAClass: public LwipIntf {
bool reconnect();

bool disconnect(bool wifioff = false);
bool disconnect(bool wifioff, bool eraseap);
bool disconnect(bool wifioff, bool eraseCredentials);

bool isConnected();

Expand Down
0