firmware update moving to new rest api

This commit is contained in:
Bogdan Pilyugin 2023-08-21 09:12:47 +02:00
parent 30a9a6ef93
commit c1713e4e2e

View File

@ -33,7 +33,6 @@
extern SYS_CONFIG SysConfig;
rest_var_t *AppVars = NULL;
int AppVarsSize = 0;
void SetAppVars(rest_var_t *appvars, int size)
@ -152,7 +151,6 @@ static void PrintMACFromInterface(char *argres, int rw, esp_netif_t *netif)
mac_addr[5]);
}
static void funct_wifi_ap_mac(char *argres, int rw)
{
PrintMACFromInterface(argres, rw, GetAPNetifAdapter());
@ -167,7 +165,6 @@ static void funct_eth_mac(char *argres, int rw)
PrintMACFromInterface(argres, rw, GetETHNetifAdapter());
}
static void funct_wifiscan(char *argres, int rw)
{
if (atoi(argres))
@ -201,38 +198,51 @@ static void funct_wifiscanres(char *argres, int rw)
strcpy(argres, "\"SYS_ERROR_UNKNOWN\"");
}
const int hw_rev = CONFIG_BOARD_HARDWARE_REVISION;
static void funct_ota_state(char *argres, int rw)
{
snprintf(argres, VAR_MAX_VALUE_LENGTH, "\"%s\"", GetUpdateStatus());
}
static void funct_ota_start(char *argres, int rw)
{
StartOTA();
}
static void funct_ota_newver(char *argres, int rw)
{
snprintf(argres, MAX_DYNVAR_LENGTH, "\"%s\"", GetAvailVersion());
}
const int hw_rev = CONFIG_BOARD_HARDWARE_REVISION;
const bool VAR_TRUE = true;
const bool VAR_FALSE = false;
const rest_var_t SystemVariables[] =
{
/*FUNCTIONS*/
{ 0, "time", &funct_time, VAR_FUNCT, R, 0, 0 },
{ 0, "uptime", &funct_uptime, VAR_FUNCT, R, 0, 0 },
{ 0, "free_ram", &funct_fram, VAR_FUNCT, R, 0, 0 },
{ 0, "free_ram_min", &funct_fram_min, VAR_FUNCT, R, 0, 0 },
{ 0, "def_interface", &funct_def_interface, VAR_FUNCT, R, 0, 0 },
{ 0, "fw_rev", &funct_fw_ver, VAR_FUNCT, R, 0, 0 },
{ 0, "idf_rev", &funct_idf_ver, VAR_FUNCT, R, 0, 0 },
{ 0, "build_date", &funct_build_date, VAR_FUNCT, R, 0, 0 },
/*CONSTANTS*/
{ 0, "model_name", CONFIG_DEVICE_MODEL_NAME, VAR_STRING, R, 1, 64 },
{ 0, "hw_rev", ((int*) &hw_rev), VAR_INT, R, 1, 1024 },
{ 0, "build_date", CONFIG_DEVICE_MODEL_NAME, VAR_STRING, R, 1, 64 },
{ 0, "model_name", CONFIG_DEVICE_MODEL_NAME, VAR_STRING, R, 1, 64 },
/*VARIABLES*/
{ 0, "net_bios_name", &SysConfig.NetBIOSName, VAR_STRING, RW, 3, 31 },
{ 0, "sys_name", &SysConfig.SysName, VAR_STRING, RW, 3, 31 },
{ 0, "sys_pass", &SysConfig.SysPass, VAR_PASS, RW, 3, 31 },
{ 0, "ota_url", &SysConfig.OTAURL, VAR_STRING, RW, 3, 128 },
{ 0, "ota_auto_int", &SysConfig.OTAAutoInt, VAR_INT, RW, 0, 65535 },
{ 0, "ota_state", &funct_ota_state, VAR_FUNCT, R, 0, 0 },
{ 0, "ota_start", &funct_ota_start, VAR_FUNCT, R, 0, 0 },
{ 0, "ota_newver", &funct_ota_newver, VAR_FUNCT, R, 0, 0 },
{ 0, "ser_num", &SysConfig.SN, VAR_STRING, RW, 10, 10 },
{ 0, "dev_id", &SysConfig.ID, VAR_STRING, RW, 8, 8 },
{ 0, "color_scheme", &SysConfig.ColorSheme, VAR_INT, RW, 1, 2 },