8000 Changes for #138 · kebot-embedded/esp32-snippets@b76b89f · GitHub
[go: up one dir, main page]

Skip to content

Commit b76b89f

Browse files
committed
Changes for nkolban#138
1 parent e930d26 commit b76b89f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cpp_utils/WiFi.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <string>
1010
#include <sstream>
1111
#include <iomanip>
12+
#include <algorithm>
1213
#include "sdkconfig.h"
1314

1415

@@ -379,11 +380,15 @@ std::vector<WiFiAPRecord> WiFi::scan() {
379380
for (auto i=0; i<apCount; i++) {
380381
WiFiAPRecord wifiAPRecord;
381382
memcpy(wifiAPRecord.m_bssid, list[i].bssid, 6);
382-
wifiAPRecord.m_ssid = std::string((char *)list[i].ssid);
383+
wifiAPRecord.m_ssid = std::string((char *)list[i].ssid);
383384
wifiAPRecord.m_authMode = list[i].authmode;
385+
wifiAPRecord.m_rssi = list[i].rssi;
384386
apRecords.push_back(wifiAPRecord);
385387
}
386388
free(list); // Release the storage allocated to hold the records.
389+
std::sort(apRecords.begin(),
390+
apRecords.end(),
391+
[](const WiFiAPRecord& lhs,const WiFiAPRecord& rhs){ return lhs.m_rssi> rhs.m_rssi;});
387392
return apRecords;
388393
} // scan
389394

0 commit comments

Comments
 (0)
0