mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-04 14:47:37 +03:00
format
This commit is contained in:
parent
cb7f3313f0
commit
ead5c5ced4
@ -1,10 +1,11 @@
|
||||
#include "WifiCredentialStore.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <HardwareSerial.h>
|
||||
#include <SDCardManager.h>
|
||||
#include <Serialization.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
// Initialize the static instance
|
||||
WifiCredentialStore WifiCredentialStore::instance;
|
||||
|
||||
@ -104,7 +105,7 @@ bool WifiCredentialStore::loadFromFile() {
|
||||
bool WifiCredentialStore::addCredential(const std::string& ssid, const std::string& password) {
|
||||
// Check if this SSID already exists and update it
|
||||
auto cred = std::find_if(credentials.begin(), credentials.end(),
|
||||
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||
if (cred != credentials.end()) {
|
||||
cred->password = password;
|
||||
Serial.printf("[%lu] [WCS] Updated credentials for: %s\n", millis(), ssid.c_str());
|
||||
@ -125,7 +126,7 @@ bool WifiCredentialStore::addCredential(const std::string& ssid, const std::stri
|
||||
|
||||
bool WifiCredentialStore::removeCredential(const std::string& ssid) {
|
||||
auto cred = std::find_if(credentials.begin(), credentials.end(),
|
||||
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||
if (cred != credentials.end()) {
|
||||
credentials.erase(cred);
|
||||
Serial.printf("[%lu] [WCS] Removed credentials for: %s\n", millis(), ssid.c_str());
|
||||
@ -136,7 +137,7 @@ bool WifiCredentialStore::removeCredential(const std::string& ssid) {
|
||||
|
||||
const WifiCredential* WifiCredentialStore::findCredential(const std::string& ssid) const {
|
||||
auto cred = std::find_if(credentials.begin(), credentials.end(),
|
||||
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||
[&ssid](const WifiCredential& cred) { return cred.ssid == ssid; });
|
||||
|
||||
if (cred != credentials.end()) {
|
||||
return &*cred;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user