mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 12:46:34 +00:00
Cleanup JSON message
This commit is contained in:
parent
4037184ee0
commit
e327c6194f
@ -129,8 +129,8 @@ void CmndWifiScan(void)
|
|||||||
char stemp1[20];
|
char stemp1[20];
|
||||||
ResponseAppend_P(PSTR("{"));
|
ResponseAppend_P(PSTR("{"));
|
||||||
for (uint32_t i = 0; i < WiFi.scanComplete(); i++) {
|
for (uint32_t i = 0; i < WiFi.scanComplete(); i++) {
|
||||||
ResponseAppend_P(PSTR("\"" D_STATUS5_NETWORK "%d\":{\"" D_SSID "\":\"%s\", \"" D_BSSID "\":\"%s\", \"" D_CHANNEL
|
ResponseAppend_P(PSTR("\"" D_STATUS5_NETWORK "%d\":{\"" D_SSID "\":\"%s\",\"" D_BSSID "\":\"%s\",\"" D_CHANNEL
|
||||||
"\":\"%d\", \"" D_JSON_SIGNAL "\":\"%d\", \"" D_RSSI "\":\"%d\", \"" D_JSON_ENCRYPTION "\":\"%s\"}"),
|
"\":\"%d\",\"" D_JSON_SIGNAL "\":\"%d\",\"" D_RSSI "\":\"%d\",\"" D_JSON_ENCRYPTION "\":\"%s\"}"),
|
||||||
i+1,
|
i+1,
|
||||||
WiFi.SSID(indexes[i]).c_str(),
|
WiFi.SSID(indexes[i]).c_str(),
|
||||||
WiFi.BSSIDstr(indexes[i]).c_str(),
|
WiFi.BSSIDstr(indexes[i]).c_str(),
|
||||||
@ -139,7 +139,7 @@ void CmndWifiScan(void)
|
|||||||
WifiGetRssiAsQuality(WiFi.RSSI(indexes[i])),
|
WifiGetRssiAsQuality(WiFi.RSSI(indexes[i])),
|
||||||
GetTextIndexed(stemp1, sizeof(stemp1), WiFi.encryptionType(indexes[i]), kWifiEncryptionTypes));
|
GetTextIndexed(stemp1, sizeof(stemp1), WiFi.encryptionType(indexes[i]), kWifiEncryptionTypes));
|
||||||
if ( ResponseSize() < ResponseLength() + 300 ) { break; }
|
if ( ResponseSize() < ResponseLength() + 300 ) { break; }
|
||||||
if ( i < WiFi.scanComplete() -1 ) { ResponseAppend_P(PSTR(", ")); }
|
if ( i < WiFi.scanComplete() -1 ) { ResponseAppend_P(PSTR(",")); }
|
||||||
//AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "MAX SIZE: %d, SIZE: %d"),ResponseSize(),ResponseLength());
|
//AddLog(LOG_LEVEL_DEBUG, PSTR(D_LOG_WIFI "MAX SIZE: %d, SIZE: %d"),ResponseSize(),ResponseLength());
|
||||||
}
|
}
|
||||||
ResponseJsonEnd();
|
ResponseJsonEnd();
|
||||||
|
@ -380,8 +380,8 @@ void WifiBeginAfterScan(void)
|
|||||||
char stemp1[20];
|
char stemp1[20];
|
||||||
uint32_t end_item = ( wifi_scan_result > initial_item + 10 ) ? initial_item + 10 : wifi_scan_result;
|
uint32_t end_item = ( wifi_scan_result > initial_item + 10 ) ? initial_item + 10 : wifi_scan_result;
|
||||||
for (uint32_t i = initial_item; i < end_item; i++) {
|
for (uint32_t i = initial_item; i < end_item; i++) {
|
||||||
Response_P(PSTR("{\"" D_CMND_WIFISCAN "\":{\"" D_STATUS5_NETWORK "%d\":{\"" D_SSID "\":\"%s\", \"" D_BSSID "\":\"%s\", \"" D_CHANNEL
|
Response_P(PSTR("{\"" D_CMND_WIFISCAN "\":{\"" D_STATUS5_NETWORK "%d\":{\"" D_SSID "\":\"%s\",\"" D_BSSID "\":\"%s\",\"" D_CHANNEL
|
||||||
"\":\"%d\", \"" D_JSON_SIGNAL "\":\"%d\", \"" D_RSSI "\":\"%d\", \"" D_JSON_ENCRYPTION "\":\"%s\"}}}"),
|
"\":\"%d\",\"" D_JSON_SIGNAL "\":\"%d\",\"" D_RSSI "\":\"%d\",\"" D_JSON_ENCRYPTION "\":\"%s\"}}}"),
|
||||||
i+1,
|
i+1,
|
||||||
WiFi.SSID(indexes[i]).c_str(),
|
WiFi.SSID(indexes[i]).c_str(),
|
||||||
WiFi.BSSIDstr(indexes[i]).c_str(),
|
WiFi.BSSIDstr(indexes[i]).c_str(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user