diff --git a/src/app/WEBServer.h b/src/app/WEBServer.h index 5cd8e3d..e674461 100644 --- a/src/app/WEBServer.h +++ b/src/app/WEBServer.h @@ -374,7 +374,7 @@ class WEBServer : public TCPServer, public HttpConstants //Parsing done! #if 1//def DEBUG_WEBS Serial.println("Post params :"); - for(int i = 0; i < client->_httpRequestData.postParams.count(); i++) + for(unsigned int i = 0; i < client->_httpRequestData.postParams.count(); i++) { Serial.print(client->_httpRequestData.postParams.getParameter(i));Serial.print(" : ");Serial.println(client->_httpRequestData.postParams.getAt(i)->getString()); } diff --git a/src/app/app.ino b/src/app/app.ino index cf75444..7c34ea5 100644 --- a/src/app/app.ino +++ b/src/app/app.ino @@ -94,6 +94,7 @@ void setup() sab.getWebServer().addApiRoutine("/sab/io/set/level", &(ioSetLevelApi), &sab, WEBServer::GET); sab.getWebServer().addApiRoutine("/sab/io/get/mode", &(ioGetModeApi), &sab, WEBServer::GET); sab.getWebServer().addApiRoutine("/sab/io/set/mode", &(ioSetModeApi), &sab, WEBServer::GET); + sab.getWebServer().addApiRoutine("/sab/firmwareinfo", &(fwInfoApi), &sab, WEBServer::GET); sab.getWebServer().addApiRoutine("/sab/ota/update", &(otaUpdateApi), NULL, WEBServer::POST); sab.getIoManager().setISROnIOChange(&(ioISR), GPIO_3_RX); diff --git a/src/app/webApi.cpp b/src/app/webApi.cpp index 67a9493..946f259 100644 --- a/src/app/webApi.cpp +++ b/src/app/webApi.cpp @@ -560,6 +560,20 @@ boolean ioSetModeApi(WEBServer::HttpRequestData &HRD, WiFiClient *wc, return true; } +boolean fwInfoApi(WEBServer::HttpRequestData &HRD, WiFiClient *wc, void *pData) +{ + (void)HRD; + (void)pData; + + char buffer[100] = ""; + + sprintf(buffer ,"{\"status\":\"ok\",\"version\":\"%s\"}", SOFT_VERSION); + + WEBServer::sendHTTPHeader(wc, HttpConstants::httpMIMETypeToString(HttpConstants::APPLICATION_JSON), strlen(buffer)); + wc->print(buffer); + return true; +} + boolean otaUpdateApi(WEBServer::HttpRequestData &HRD, WiFiClient *wc, void *pData) { (void)HRD; diff --git a/src/app/webApi.h b/src/app/webApi.h index ce107fa..4fca7f3 100644 --- a/src/app/webApi.h +++ b/src/app/webApi.h @@ -30,6 +30,7 @@ boolean ioGetLevelApi(WEBServer::HttpRequestData&, WiFiClient*, void* boolean ioSetLevelApi(WEBServer::HttpRequestData&, WiFiClient*, void*); boolean ioGetModeApi(WEBServer::HttpRequestData&, WiFiClient*, void*); boolean ioSetModeApi(WEBServer::HttpRequestData&, WiFiClient*, void*); +boolean fwInfoApi(WEBServer::HttpRequestData&, WiFiClient*, void*); boolean otaUpdateApi(WEBServer::HttpRequestData&, WiFiClient*, void*); #endif