Skip to content

Commit ca9f570

Browse files
committed
Merge pull request #847 from pgollor/esp8266
use String return for both SSID functions
2 parents 247fd33 + d4c17b0 commit ca9f570

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

hardware/esp8266com/esp8266/libraries/DNSServer/examples/CaptivePortalAdvanced/handleHttp.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void handleWifi() {
7373
Serial.println("scan done");
7474
if (n > 0) {
7575
for (int i = 0; i < n; i++) {
76-
server.sendContent(String() + "\r\n<tr><td>SSID " + String(WiFi.SSID(i)) + String((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":" *") + " (" + WiFi.RSSI(i) + ")</td></tr>");
76+
server.sendContent(String() + "\r\n<tr><td>SSID " + WiFi.SSID(i) + String((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":" *") + " (" + WiFi.RSSI(i) + ")</td></tr>");
7777
}
7878
} else {
7979
server.sendContent(String() + "<tr><td>No WLAN found</td></tr>");

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,13 +536,13 @@ void * ESP8266WiFiClass::_getScanInfoByIndex(int i)
536536
return reinterpret_cast<bss_info*>(ESP8266WiFiClass::_scanResult) + i;
537537
}
538538

539-
const char* ESP8266WiFiClass::SSID(uint8_t i)
539+
String ESP8266WiFiClass::SSID(uint8_t i)
540540
{
541541
struct bss_info* it = reinterpret_cast<struct bss_info*>(_getScanInfoByIndex(i));
542542
if (!it)
543-
return 0;
543+
return "";
544544

545-
return reinterpret_cast<const char*>(it->ssid);
545+
return String(reinterpret_cast<const char*>(it->ssid));
546546
}
547547

548548
uint8_t * ESP8266WiFiClass::BSSID(uint8_t i)

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/ESP8266WiFi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class ESP8266WiFiClass
239239
*
240240
* return: ssid string of the specified item on the networks scanned list
241241
*/
242-
const char* SSID(uint8_t networkItem);
242+
String SSID(uint8_t networkItem);
243243

244244
/*
245245
* Return the encryption type of the networks discovered during the scanNetworks

0 commit comments

Comments
 (0)