Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By tavalin
#15369 My code so far is a mashup of the AJAX Webserver example and the Basic Wifi example.

Here's the snippets where I think there could be a problem:

Code: Select allBssList accessPoints; // global variable for discovered access points

void listNetworks(bool succeeded, BssList list)
{
if (!succeeded)
{
debugf("Failed to scan networks");
return;
}
for (int i = 0; i < list.count(); i++)
{
Serial.print("\tWiFi: ");
Serial.print(list[i].ssid);
Serial.print(", ");
Serial.print(list[i].getAuthorizationMethodName());
if (list[i].hidden) Serial.print(" (hidden)");
Serial.println();
}
memcpy(&accessPoints, &list, sizeof(list));
}


void onAjaxAP(HttpRequest &request, HttpResponse &response)
{
JsonObjectStream* stream = new JsonObjectStream();
JsonObject& json = stream->getRoot();
JsonObject& ap= json.createNestedArray("ap");
for (int i = 0; i < accessPoint.count(); i++) {
 ap.add(accessPoint[i].ssid);
}
response.sendJsonObject(stream);
}


The actual line that causes the reboot is:
Code: Select all ap.add(accessPoint[i].ssid);