wifi related rest api implemented

This commit is contained in:
Bogdan Pilyugin 2023-08-01 15:59:16 +02:00
parent 155c2469cb
commit 7f59cd0904
2 changed files with 30 additions and 59 deletions

View File

@ -89,14 +89,7 @@ typedef struct
char SntpServer3Adr[33]; char SntpServer3Adr[33];
struct struct
{ {
char b1 :1; bool bIsGlobalEnabled;
char b2 :1;
char b3 :1;
char b4 :1;
char b5 :1;
char b6 :1;
char b7 :1;
char bIsGlobalEnabled :1;
} Flags1; } Flags1;
} sntpClient; } sntpClient;
@ -112,14 +105,7 @@ typedef struct
char UserPass[32]; char UserPass[32];
struct struct
{ {
char b0 :1; bool bIsGlobalEnabled;
char b1 :1;
char b2 :1;
char b3 :1;
char b4 :1;
char b5 :1;
char b6 :1;
char bIsGlobalEnabled :1;
} Flags1; } Flags1;
} mqttStation[CONFIG_WEBGUIAPP_MQTT_CLIENTS_NUM]; } mqttStation[CONFIG_WEBGUIAPP_MQTT_CLIENTS_NUM];
#endif #endif
@ -137,14 +123,8 @@ typedef struct
struct struct
{ {
char bIsDHCPEnabled :1; bool bIsDHCPEnabled;
char b1 :1; bool bIsETHEnabled;
char b2 :1;
char b3 :1;
char b4 :1;
char b5 :1;
char b6 :1;
char bIsETHEnabled :1;
} Flags1; // Flag structure } Flags1; // Flag structure
} ethSettings; } ethSettings;
@ -172,14 +152,8 @@ typedef struct
struct struct
{ {
char bIsDHCPEnabled :1; bool bIsDHCPEnabled :1;
char b1 :1; bool bIsWiFiEnabled :1;
char b2 :1;
char b3 :1;
char b4 :1;
char b5 :1;
char b6 :1;
char bIsWiFiEnabled :1;
} Flags1; // Flag structure } Flags1; // Flag structure
uint8_t MaxPower; uint8_t MaxPower;
} wifiSettings; } wifiSettings;
@ -197,14 +171,7 @@ typedef struct
uint8_t MACAddr[6]; // MAC address uint8_t MACAddr[6]; // MAC address
struct struct
{ {
char b0 :1; bool bIsGSMEnabled;
char b1 :1;
char b2 :1;
char b3 :1;
char b4 :1;
char b5 :1;
char b6 :1;
char bIsGSMEnabled :1;
} Flags1; // Flag structure } Flags1; // Flag structure
} gsmSettings; } gsmSettings;
@ -218,14 +185,7 @@ typedef struct
struct struct
{ {
char b0 :1; bool bIsLoRaWANEnabled;
char b1 :1;
char b2 :1;
char b3 :1;
char b4 :1;
char b5 :1;
char b6 :1;
char bIsLoRaWANEnabled :1;
} Flags1; // Flag structure } Flags1; // Flag structure
} lorawanSettings; } lorawanSettings;

View File

@ -62,17 +62,28 @@ static void funct_wifiscanres(char *argres)
const rest_var_t ConfigVariables[] = const rest_var_t ConfigVariables[] =
{ {
{ 0, "netname", &SysConfig.NetBIOSName, VAR_STRING, 3, 31 }, { 0, "netname", &SysConfig.NetBIOSName, VAR_STRING, 3, 31 },
{ 1, "otaurl", &SysConfig.OTAURL, VAR_STRING, 3, 128 }, { 0, "otaurl", &SysConfig.OTAURL, VAR_STRING, 3, 128 },
{ 2, "ledenab", &SysConfig.Flags1.bIsLedsEnabled, VAR_BOOL, 0, 1 }, { 0, "ledenab", &SysConfig.Flags1.bIsLedsEnabled, VAR_BOOL, 0, 1 },
{ 3, "otaint", &SysConfig.OTAAutoInt, VAR_INT, 0, 65535 }, { 0, "otaint", &SysConfig.OTAAutoInt, VAR_INT, 0, 65535 },
{ 4, "time", &funct_time, VAR_FUNCT, 0, 0 }, { 0, "time", &funct_time, VAR_FUNCT, 0, 0 },
{ 5, "addone", &funct_addone, VAR_FUNCT, 0, 0 }, { 0, "addone", &funct_addone, VAR_FUNCT, 0, 0 },
{ 6, "wifiscan", &funct_wifiscan, VAR_FUNCT, 0, 0 },
{ 7, "wifiscanres", &funct_wifiscanres, VAR_FUNCT, 0, 0 }, { 0, "wifiscan", &funct_wifiscan, VAR_FUNCT, 0, 0 },
{ 8, "wifi-sta-ip", &SysConfig.wifiSettings.InfIPAddr, VAR_IPADDR, 0, 0 }, { 0, "wifiscanres", &funct_wifiscanres, VAR_FUNCT, 0, 0 },
{ 9, "wifi-ap-ip", &SysConfig.wifiSettings.ApIPAddr, VAR_IPADDR, 0, 0 },
{ 9, "wifi-sta-mask", &SysConfig.wifiSettings.InfMask, VAR_IPADDR, 0, 0 }, { 0, "wifi-mode", &SysConfig.wifiSettings.WiFiMode, VAR_INT, 0, 0 },
{ 9, "wifi-sta-gw", &SysConfig.wifiSettings.InfGateway, VAR_IPADDR, 0, 0 } { 0, "wifi-sta-ip", &SysConfig.wifiSettings.InfIPAddr, VAR_IPADDR, 0, 0 },
{ 0, "wifi-sta-mask", &SysConfig.wifiSettings.InfMask, VAR_IPADDR, 0, 0 },
{ 0, "wifi-sta-gw", &SysConfig.wifiSettings.InfGateway, VAR_IPADDR, 0, 0 },
{ 0, "wifi-ap-ip", &SysConfig.wifiSettings.ApIPAddr, VAR_IPADDR, 0, 0 },
{ 0, "wifi-dns1", &SysConfig.wifiSettings.DNSAddr1, VAR_IPADDR, 0, 0 },
{ 0, "wifi-dns2", &SysConfig.wifiSettings.DNSAddr2, VAR_IPADDR, 0, 0 },
{ 0, "wifi-dns3", &SysConfig.wifiSettings.DNSAddr3, VAR_IPADDR, 0, 0 },
{ 0, "wifi-sta-ssid", &SysConfig.wifiSettings.InfSSID, VAR_STRING, 3, 31 },
{ 0, "wifi-sta-key", &SysConfig.wifiSettings.InfSSID, VAR_STRING, 8, 31 },
{ 0, "wifi-ap-ssid", &SysConfig.wifiSettings.InfSSID, VAR_STRING, 3, 31 },
{ 0, "wifi-ap-key", &SysConfig.wifiSettings.InfSSID, VAR_STRING, 8, 31 },
}; };