added test routines for config export
This commit is contained in:
parent
82a2328571
commit
5778bee9b2
|
|
@ -111,5 +111,6 @@ uint32_t GetUpTime(void);
|
||||||
void RegEthReset(void (*eth_rst)(uint8_t level));
|
void RegEthReset(void (*eth_rst)(uint8_t level));
|
||||||
void RegGSMReset(void (*gsm_rst)(uint8_t level));
|
void RegGSMReset(void (*gsm_rst)(uint8_t level));
|
||||||
|
|
||||||
|
void GenerateSystemSettingsJSONFile(void);
|
||||||
|
|
||||||
#endif /* MAIN_INCLUDE_NETTRANSPORT_H_ */
|
#endif /* MAIN_INCLUDE_NETTRANSPORT_H_ */
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,16 @@ static HTTP_IO_RESULT HTTPPostAdaptersSettings(httpd_req_t *req, char *PostData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (httpd_query_key_value(PostData, "wifisave", tmp, 4) == ESP_OK)
|
||||||
|
{
|
||||||
|
if (!strcmp(tmp, (const char*) "prs"))
|
||||||
|
{
|
||||||
|
WriteNVSSysConfig(GetSysConf());
|
||||||
|
memcpy(PostData, "/reboot.html", sizeof "/reboot.html");
|
||||||
|
return HTTP_IO_REDIRECT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (httpd_query_key_value(PostData, "save", tmp, 5) == ESP_OK ||
|
if (httpd_query_key_value(PostData, "save", tmp, 5) == ESP_OK ||
|
||||||
httpd_query_key_value(PostData, "apply", tmp, 5) == ESP_OK)
|
httpd_query_key_value(PostData, "apply", tmp, 5) == ESP_OK)
|
||||||
{
|
{
|
||||||
|
|
@ -512,6 +522,7 @@ static HTTP_IO_RESULT HTTPPostSystemSettings(httpd_req_t *req, char *PostData)
|
||||||
}
|
}
|
||||||
else if (!strcmp(tmp, (const char*) "10"))
|
else if (!strcmp(tmp, (const char*) "10"))
|
||||||
{
|
{
|
||||||
|
GenerateSystemSettingsJSONFile();
|
||||||
return HTTP_IO_DONE_NOREFRESH;
|
return HTTP_IO_DONE_NOREFRESH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "esp_ota_ops.h"
|
#include "esp_ota_ops.h"
|
||||||
#include "ROMFS.h"
|
#include "ROMFS.h"
|
||||||
#include "esp_idf_version.h"
|
#include "esp_idf_version.h"
|
||||||
|
#include "jWrite.h"
|
||||||
|
|
||||||
static const char *TAG = "HTTPServerPrint";
|
static const char *TAG = "HTTPServerPrint";
|
||||||
|
|
||||||
|
|
@ -886,3 +887,26 @@ int HTTPPrint(httpd_req_t *req, char *buf, char *var)
|
||||||
return dLen;
|
return dLen;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GenerateSystemSettingsJSONFile(void)
|
||||||
|
{
|
||||||
|
char *buf = malloc(2048);
|
||||||
|
if(!buf) return;
|
||||||
|
|
||||||
|
jwOpen(buf, 2048, JW_OBJECT, JW_PRETTY);
|
||||||
|
for (int i = 0; i < (sizeof(HANDLERS_ARRAY) / sizeof(HANDLERS_ARRAY[0])); ++i)
|
||||||
|
{
|
||||||
|
char val[18];
|
||||||
|
val[0] = 0x00;
|
||||||
|
strcat(val, "~");
|
||||||
|
strcat(val, HANDLERS_ARRAY[i].tag);
|
||||||
|
strcat(val, "~");
|
||||||
|
jwObj_string(HANDLERS_ARRAY[i].tag, val);
|
||||||
|
}
|
||||||
|
jwEnd();
|
||||||
|
jwClose();
|
||||||
|
ESP_LOGI(TAG, "%s", buf);
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user