Skip to content

Instantly share code, notes, and snippets.

@misternay
Last active November 5, 2017 12:52
Show Gist options
  • Save misternay/ec3d73546aace7a3af279840808c5d03 to your computer and use it in GitHub Desktop.
Save misternay/ec3d73546aace7a3af279840808c5d03 to your computer and use it in GitHub Desktop.
String setJsonString(int counts) {
String jsonS = "{\n";
jsonS += "\"homeMobileCountryCode\": 234,\n"; // this is a real UK MCC
jsonS += "\"homeMobileNetworkCode\": 27,\n"; // and a real UK MNC
jsonS += "\"radioType\": \"gsm\",\n"; // for gsm
jsonS += "\"carrier\": \"Vodafone\",\n"; // associated with Vodafone
jsonS += "\"wifiAccessPoints\": [\n";
for (int j = 0; j < counts; ++j)
{
jsonS += "{\n";
jsonS += "\"macAddress\" : \"";
jsonS += (WiFi.BSSIDstr(j));
jsonS += "\",\n";
jsonS += "\"signalStrength\": ";
jsonS += WiFi.RSSI(j);
jsonS += "\n";
if (j < counts - 1)
{
jsonS += "},\n";
}
else
{
jsonS += "}\n";
}
}
jsonS += ("]\n");
jsonS += ("}\n");
return jsonS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment