mirror of https://github.com/arendst/Tasmota.git
Merge pull request #17048 from joba-1/range-extender-clients-list
Range extender clients list
This commit is contained in:
commit
c63aad49c1
|
@ -35,10 +35,13 @@ CONFIG_LWIP_IP_FORWARD option set, and optionally CONFIG_LWIP_IPV4_NAPT.
|
|||
If you want to support NAPT (removing the need for routes on a core router):
|
||||
#define USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
|
||||
List AP clients (MAC, IP and RSSI) with command RgxClients on ESP32
|
||||
|
||||
|
||||
An example full static configuration:
|
||||
#define USE_WIFI_RANGE_EXTENDER
|
||||
#define USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
#define USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
#define WIFI_RGX_STATE 1
|
||||
#define WIFI_RGX_NAPT 1
|
||||
#define WIFI_RGX_SSID "rangeextender"
|
||||
|
@ -92,6 +95,10 @@ const char kDrvRgxCommands[] PROGMEM = "Rgx|" // Prefix
|
|||
"|"
|
||||
"NAPT"
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
#ifdef ESP32
|
||||
"|"
|
||||
"Clients"
|
||||
#endif // ESP32
|
||||
"|"
|
||||
"Address"
|
||||
"|"
|
||||
|
@ -104,6 +111,9 @@ void (*const DrvRgxCommand[])(void) PROGMEM = {
|
|||
#ifdef USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
&CmndRgxNAPT,
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
#ifdef ESP32
|
||||
&CmndRgxClients,
|
||||
#endif // ESP32
|
||||
&CmndRgxAddresses,
|
||||
&CmndRgxAddresses,
|
||||
};
|
||||
|
@ -122,6 +132,7 @@ void (*const DrvRgxCommand[])(void) PROGMEM = {
|
|||
#ifdef ESP32
|
||||
#include "lwip/lwip_napt.h"
|
||||
#include <dhcpserver/dhcpserver.h>
|
||||
#include "esp_wifi.h"
|
||||
#endif // ESP32
|
||||
|
||||
#define RGX_NOT_CONFIGURED 0
|
||||
|
@ -161,6 +172,28 @@ void RgxCheckConfig(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ESP32
|
||||
void CmndRgxClients(void)
|
||||
{
|
||||
wifi_sta_list_t wifi_sta_list = {0};
|
||||
tcpip_adapter_sta_list_t adapter_sta_list = {0};
|
||||
|
||||
esp_wifi_ap_get_sta_list(&wifi_sta_list);
|
||||
tcpip_adapter_get_sta_list(&wifi_sta_list, &adapter_sta_list);
|
||||
|
||||
Response_P(PSTR("{\"RgxClients\":{"));
|
||||
const char *sep = "";
|
||||
for (int i=0; i<adapter_sta_list.num; i++)
|
||||
{
|
||||
const uint8_t *m = adapter_sta_list.sta[i].mac;
|
||||
ResponseAppend_P(PSTR("%s\"%02X%02X%02X%02X%02X%02X\":{\"" D_CMND_IPADDRESS "\":\"%_I\",\"" D_JSON_RSSI "\":%d}"),
|
||||
sep, m[0], m[1], m[2], m[3], m[4], m[5], adapter_sta_list.sta[i].ip, wifi_sta_list.sta[i].rssi);
|
||||
sep = ",";
|
||||
}
|
||||
ResponseAppend_P(PSTR("}}"));
|
||||
}
|
||||
#endif // ESP32
|
||||
|
||||
void CmndRgxState(void)
|
||||
{
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1))
|
||||
|
|
Loading…
Reference in New Issue