mirror of https://github.com/arendst/Tasmota.git
unconditional RgxClients, ip dict with mac as key
This commit is contained in:
parent
4c376350a7
commit
912574f8d7
|
@ -11,7 +11,6 @@ build_flags = ${env:tasmota32_base.build_flags}
|
|||
-D FIRMWARE_TASMOTA32
|
||||
-D USE_WIFI_RANGE_EXTENDER
|
||||
-D USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
-D USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
|
||||
[env:tasmota32s3-file]
|
||||
extends = env:tasmota32_base
|
||||
|
|
|
@ -96,10 +96,8 @@ const char kDrvRgxCommands[] PROGMEM = "Rgx|" // Prefix
|
|||
"|"
|
||||
"NAPT"
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
#ifdef USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
"|"
|
||||
"Clients"
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
"|"
|
||||
"Address"
|
||||
"|"
|
||||
|
@ -112,9 +110,7 @@ void (*const DrvRgxCommand[])(void) PROGMEM = {
|
|||
#ifdef USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
&CmndRgxNAPT,
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_NAPT
|
||||
#ifdef USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
&CmndRgxClients,
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
&CmndRgxAddresses,
|
||||
&CmndRgxAddresses,
|
||||
};
|
||||
|
@ -133,6 +129,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
|
||||
|
@ -172,29 +169,25 @@ void RgxCheckConfig(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
#include "esp_wifi.h"
|
||||
|
||||
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("["));
|
||||
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{\"" D_JSON_MAC "\":\"%02x:%02x:%02x:%02x:%02x:%02x\",\"" D_CMND_IPADDRESS "\":\"%_I\"}"),
|
||||
ResponseAppend_P(PSTR("%s\"%02x:%02x:%02x:%02x:%02x:%02x\":{\"" D_CMND_IPADDRESS "\":\"%_I\"}"),
|
||||
sep, m[0], m[1], m[2], m[3], m[4], m[5], adapter_sta_list.sta[i].ip);
|
||||
sep = ",";
|
||||
}
|
||||
ResponseAppend_P(PSTR("]"));
|
||||
ResponseAppend_P(PSTR("}}"));
|
||||
}
|
||||
#endif // USE_WIFI_RANGE_EXTENDER_CLIENTS
|
||||
|
||||
void CmndRgxState(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue