Fork of the excellent esp8266-react - https://github.com/rjwats/esp8266-react
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
696 B
19 lines
696 B
#include <APStatus.h>
|
|
|
|
APStatus::APStatus(AsyncWebServer *server) : _server(server) {
|
|
_server->on(AP_STATUS_SERVICE_PATH, HTTP_GET, std::bind(&APStatus::apStatus, this, std::placeholders::_1));
|
|
}
|
|
|
|
void APStatus::apStatus(AsyncWebServerRequest *request) {
|
|
AsyncJsonResponse * response = new AsyncJsonResponse();
|
|
JsonObject& root = response->getRoot();
|
|
|
|
WiFiMode_t currentWiFiMode = WiFi.getMode();
|
|
root["active"] = (currentWiFiMode == WIFI_AP || currentWiFiMode == WIFI_AP_STA);
|
|
root["ip_address"] = WiFi.softAPIP().toString();
|
|
root["mac_address"] = WiFi.softAPmacAddress();
|
|
root["station_num"] = WiFi.softAPgetStationNum();
|
|
|
|
response->setLength();
|
|
request->send(response);
|
|
}
|