Added a new api call to get the nearby access points
This commit is contained in:
parent
cd6af9f99f
commit
723132a082
@ -38,7 +38,10 @@ boolean nextViewApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc,
|
|||||||
{
|
{
|
||||||
SAB *p = (SAB *)pData;
|
SAB *p = (SAB *)pData;
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
if(p->getScreenManager().displayNextView())
|
|
||||||
|
p->getScreenManager().displayNextView();
|
||||||
|
|
||||||
|
if(p->getScreenManager().getError() == OK)
|
||||||
sprintf(buffer, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{ \"status\" : \"ok\", \"ViewUID\" : \"%d\" }", p->getScreenManager().getCurrentViewUID());
|
sprintf(buffer, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{ \"status\" : \"ok\", \"ViewUID\" : \"%d\" }", p->getScreenManager().getCurrentViewUID());
|
||||||
else
|
else
|
||||||
sprintf(buffer, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{ \"status\" : \"failed\", \"message\" : \"%s\" }", p->getScreenManager().getErrorMessage());
|
sprintf(buffer, "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{ \"status\" : \"failed\", \"message\" : \"%s\" }", p->getScreenManager().getErrorMessage());
|
||||||
@ -215,6 +218,20 @@ boolean staWifiInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *w
|
|||||||
return true;
|
return true;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
boolean apScannerApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
|
||||||
|
{
|
||||||
|
uint8_t number = WiFi.scanNetworks();
|
||||||
|
wc->print("HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n[");
|
||||||
|
|
||||||
|
for(uint8_t i(0); i < number; i++)
|
||||||
|
{
|
||||||
|
wc->printf("%s{\"SSID\":\"%s\",\"RSSI\":%d,\"Protected\":\"%s\"}", i == 0 ? "":",", WiFi.SSID(i).c_str(), WiFi.RSSI(i), WiFi.encryptionType(i) == ENC_TYPE_NONE ? "No":"Yes");
|
||||||
|
}
|
||||||
|
|
||||||
|
wc->print("]");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
boolean systemInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
|
boolean systemInfoApi(WEBServer<WEBClient>::HttpRequestData &HRD, WiFiClient *wc, void *pData)
|
||||||
{
|
{
|
||||||
SAB *p = (SAB *)pData;
|
SAB *p = (SAB *)pData;
|
||||||
|
@ -19,6 +19,7 @@ typedef struct sdCardApiPacket
|
|||||||
boolean sdCardUnmountApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
boolean sdCardUnmountApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||||
boolean sdCardMountApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
boolean sdCardMountApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||||
|
|
||||||
|
boolean apScannerApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||||
boolean staWifiInfoApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
boolean staWifiInfoApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||||
boolean apWifiInfoApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
boolean apWifiInfoApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||||
boolean espRestartApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
boolean espRestartApi(WEBServer<WEBClient>::HttpRequestData&, WiFiClient*, void*);
|
||||||
|
Loading…
Reference in New Issue
Block a user