ini export!
This commit is contained in:
+2
-2
@@ -51,7 +51,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR cgiNetworkSetParams(HttpdConnData *connData)
|
||||
|
||||
#define XSTRUCT wificonf
|
||||
#define X XSET_CGI_FUNC
|
||||
XTABLE_WIFI
|
||||
XTABLE_WIFICONF
|
||||
#undef X
|
||||
|
||||
(void) redir_url;
|
||||
@@ -101,7 +101,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplNetwork(HttpdConnData *connData, char *toke
|
||||
|
||||
#define XSTRUCT wificonf
|
||||
#define X XGET_CGI_FUNC
|
||||
XTABLE_WIFI
|
||||
XTABLE_WIFICONF
|
||||
#undef X
|
||||
|
||||
// non-config
|
||||
|
||||
@@ -7,6 +7,9 @@ Cgi/template routines for configuring non-wifi settings
|
||||
#include "persist.h"
|
||||
#include "helpers.h"
|
||||
#include "cgi_logging.h"
|
||||
#include "version.h"
|
||||
#include "screen.h"
|
||||
#include "config_xmacros.h"
|
||||
|
||||
#define SET_REDIR_SUC "/cfg/system"
|
||||
|
||||
@@ -74,3 +77,133 @@ cgiPersistRestoreHard(HttpdConnData *connData)
|
||||
httpdRedirect(connData, SET_REDIR_SUC "?msg=All%20settings%20restored%20to%20factory%20defaults.");
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define httpdSend_orDie(conn, data, len) do { if (!httpdSend((conn), (data), (len))) return false; } while (0)
|
||||
|
||||
/* encode for double-quoted string */
|
||||
int ICACHE_FLASH_ATTR httpdSend_dblquot(HttpdConnData *conn, const char *data, int len)
|
||||
{
|
||||
int start = 0, end = 0;
|
||||
char c;
|
||||
if (conn->conn==NULL) return 0;
|
||||
if (len < 0) len = (int) strlen(data);
|
||||
if (len==0) return 0;
|
||||
|
||||
for (end = 0; end < len; end++) {
|
||||
c = data[end];
|
||||
if (c == 0) {
|
||||
// we found EOS
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '"' || c == '\'' || c == '\\' || c == '\n' || c == '\r' || c == '\x1b') {
|
||||
if (start < end) httpdSend_orDie(conn, data + start, end - start);
|
||||
start = end + 1;
|
||||
}
|
||||
|
||||
if (c == '"') httpdSend_orDie(conn, "\\\"", 2);
|
||||
else if (c == '\'') httpdSend_orDie(conn, "\\'", 2);
|
||||
else if (c == '\\') httpdSend_orDie(conn, "\\\\", 2);
|
||||
else if (c == '\n') httpdSend_orDie(conn, "\\n", 2);
|
||||
else if (c == '\r') httpdSend_orDie(conn, "\\r", 2);
|
||||
else if (c == '\x1b') httpdSend_orDie(conn, "\\e", 2);
|
||||
}
|
||||
|
||||
if (start < end) httpdSend_orDie(conn, data + start, end - start);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export settings to INI
|
||||
*
|
||||
* @param connData
|
||||
* @return status
|
||||
*/
|
||||
httpd_cgi_state ICACHE_FLASH_ATTR
|
||||
cgiPersistExport(HttpdConnData *connData)
|
||||
{
|
||||
char buff[256];
|
||||
u8 mac[6];
|
||||
|
||||
int step = (int) connData->cgiData;
|
||||
|
||||
if (connData->conn == NULL) {
|
||||
//Connection aborted. Clean up.
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
if (step == 0) {
|
||||
wifi_get_macaddr(SOFTAP_IF, mac);
|
||||
sprintf(buff, "attachment; filename=ESPTerm_%02X%02X%02X_%s.ini",
|
||||
mac[3], mac[4], mac[5], FW_VERSION);
|
||||
|
||||
httpdStartResponse(connData, 200);
|
||||
httpdHeader(connData, "Content-Disposition", buff);
|
||||
httpdHeader(connData, "Content-Type", "text/plain");
|
||||
httpdEndHeaders(connData);
|
||||
|
||||
sprintf(buff, "# == ESPTerm config export ==\r\n"
|
||||
"# Device: %02X%02X%02X - %s\r\n"
|
||||
"# Version: %s\r\n",
|
||||
mac[3], mac[4], mac[5],
|
||||
termconf->title,
|
||||
FW_VERSION);
|
||||
|
||||
httpdSend(connData, buff, -1);
|
||||
}
|
||||
|
||||
bool quoted;
|
||||
#define X(type, name, suffix, deref, xget, xset, xsarg, xnotify, allow) \
|
||||
if (allow) { \
|
||||
xget(buff, deref XSTRUCT->name); \
|
||||
\
|
||||
quoted = false; \
|
||||
quoted |= streq(#type, "char"); \
|
||||
quoted |= streq(#type, "uchar"); \
|
||||
if (strstarts(#name, "bm")) quoted=false; \
|
||||
\
|
||||
httpdSend(connData, "\r\n"#name " = ", -1); \
|
||||
if (quoted) { \
|
||||
httpdSend(connData, "\"", 1); \
|
||||
httpdSend_dblquot(connData, buff, -1); \
|
||||
httpdSend(connData, "\"", 1); \
|
||||
} else { \
|
||||
httpdSend(connData, buff, -1); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define admin 1
|
||||
#define tpl 1
|
||||
if (step == 1) {
|
||||
httpdSend(connData, "\r\n[system]", -1);
|
||||
#define XSTRUCT sysconf
|
||||
XTABLE_SYSCONF
|
||||
#undef XSTRUCT
|
||||
httpdSend(connData, "\r\n", -1);
|
||||
}
|
||||
|
||||
if (step == 2) {
|
||||
httpdSend(connData, "\r\n[wifi]", -1);
|
||||
#define XSTRUCT wificonf
|
||||
XTABLE_WIFICONF
|
||||
#undef XSTRUCT
|
||||
httpdSend(connData, "\r\n", -1);
|
||||
}
|
||||
|
||||
if (step == 3) {
|
||||
httpdSend(connData, "\r\n[terminal]", -1);
|
||||
#define XSTRUCT termconf
|
||||
XTABLE_TERMCONF
|
||||
#undef XSTRUCT
|
||||
httpdSend(connData, "\r\n", -1);
|
||||
|
||||
return HTTPD_CGI_DONE;
|
||||
}
|
||||
|
||||
#undef X
|
||||
connData->cgiData = (void *) (step + 1);
|
||||
return HTTPD_CGI_MORE;
|
||||
}
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
httpd_cgi_state cgiPersistWriteDefaults(HttpdConnData *connData);
|
||||
httpd_cgi_state cgiPersistRestoreDefaults(HttpdConnData *connData);
|
||||
httpd_cgi_state cgiPersistRestoreHard(HttpdConnData *connData);
|
||||
httpd_cgi_state cgiPersistExport(HttpdConnData *connData);
|
||||
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -326,7 +326,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR cgiWiFiSetParams(HttpdConnData *connData)
|
||||
|
||||
#define XSTRUCT wificonf
|
||||
#define X XSET_CGI_FUNC
|
||||
XTABLE_WIFI
|
||||
XTABLE_WIFICONF
|
||||
#undef X
|
||||
|
||||
// ---- WiFi opmode ----
|
||||
@@ -417,7 +417,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR tplWlan(HttpdConnData *connData, char *token,
|
||||
|
||||
#define XSTRUCT wificonf
|
||||
#define X XGET_CGI_FUNC
|
||||
XTABLE_WIFI
|
||||
XTABLE_WIFICONF
|
||||
#undef X
|
||||
|
||||
// non-config
|
||||
|
||||
@@ -76,21 +76,21 @@ enum xset_result xset_ustring(const char *name, u8 *field, const char *buff, con
|
||||
* If 'name' is found in connData->getArgs, xset() is called.
|
||||
* If the result is SET, xnotify() is fired. Else, 'name,' is appended to the redir_url buffer.
|
||||
*/
|
||||
#define XSET_CGI_FUNC(type, name, suffix, deref, xget, cast, xset, xsarg, xnotify, allow) \
|
||||
#define XSET_CGI_FUNC(type, name, suffix, deref, xget, xset, xsarg, xnotify, allow) \
|
||||
if ((allow) && GET_ARG(#name)) { \
|
||||
type *_p = (type *) &XSTRUCT->name; \
|
||||
enum xset_result res = xset(#name, cast _p, buff, (const void*) (xsarg)); \
|
||||
enum xset_result res = xset(#name, _p, buff, (const void*) (xsarg)); \
|
||||
if (res == XSET_SET) { xnotify; } \
|
||||
else if (res == XSET_FAIL) { redir_url += sprintf(redir_url, #name","); } \
|
||||
}
|
||||
|
||||
#define XGET_CGI_FUNC(type, name, suffix, deref, xget, cast, xset, xsarg, xnotify, allow) \
|
||||
#define XGET_CGI_FUNC(type, name, suffix, deref, xget, xset, xsarg, xnotify, allow) \
|
||||
if ((allow) && streq(token, #name)) xget(buff, deref XSTRUCT->name);
|
||||
|
||||
#define XSTRUCT_FIELD(type, name, suffix, deref, xget, cast, xset, xsarg, xnotify, allow) \
|
||||
#define XSTRUCT_FIELD(type, name, suffix, deref, xget, xset, xsarg, xnotify, allow) \
|
||||
type name suffix;
|
||||
|
||||
#define XDUMP_FIELD(type, name, suffix, deref, xget, allow, cast, xset, xsarg, xnotify) \
|
||||
#define XDUMP_FIELD(type, name, suffix, deref, xget, allow, xset, xsarg, xnotify) \
|
||||
{ xget(buff, deref XSTRUCT->name); dbg(#name " = %s", buff); }
|
||||
|
||||
#endif //ESPTERM_CONFIG_XMACROS_H
|
||||
|
||||
@@ -131,6 +131,7 @@ const HttpdBuiltInUrl routes[] ESP_CONST_DATA = {
|
||||
|
||||
ROUTE_TPL_FILE("/cfg/system/?", tplSystemCfg, "/cfg_system.tpl"),
|
||||
ROUTE_CGI("/cfg/system/set", cgiSystemCfgSetParams),
|
||||
ROUTE_CGI("/cfg/system/export", cgiPersistExport),
|
||||
ROUTE_CGI("/cfg/system/write_defaults", cgiPersistWriteDefaults),
|
||||
ROUTE_CGI("/cfg/system/restore_defaults", cgiPersistRestoreDefaults),
|
||||
ROUTE_CGI("/cfg/system/restore_hard", cgiPersistRestoreHard),
|
||||
|
||||
+31
-31
@@ -82,37 +82,37 @@ enum CursorShape {
|
||||
//....Type................Name..Suffix...............Deref..XGET.........Cast..XSET.........................NOTIFY................Allow
|
||||
// Deref is used to pass the field to xget. Cast is used to convert the &'d field to what xset wants (needed for static arrays)
|
||||
#define XTABLE_TERMCONF \
|
||||
X(u32, width, /**/, /**/, xget_dec, /**/, xset_u32, NULL, /**/, 1) \
|
||||
X(u32, height, /**/, /**/, xget_dec, /**/, xset_u32, NULL, /**/, 1) \
|
||||
X(u32, default_bg, /**/, /**/, xget_term_color, /**/, xset_term_color, NULL, /**/, 1) \
|
||||
X(u32, default_fg, /**/, /**/, xget_term_color, /**/, xset_term_color, NULL, /**/, 1) \
|
||||
X(char, title, [TERM_TITLE_LEN], /**/, xget_string, /**/, xset_string, TERM_TITLE_LEN, /**/, 1) \
|
||||
X(char, btn1, [TERM_BTN_LEN], /**/, xget_string, /**/, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn2, [TERM_BTN_LEN], /**/, xget_string, /**/, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn3, [TERM_BTN_LEN], /**/, xget_string, /**/, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn4, [TERM_BTN_LEN], /**/, xget_string, /**/, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn5, [TERM_BTN_LEN], /**/, xget_string, /**/, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(u8, theme, /**/, /**/, xget_dec, /**/, xset_u8, NULL, /**/, 1) \
|
||||
X(u32, parser_tout_ms, /**/, /**/, xget_dec, /**/, xset_u32, NULL, /**/, 1) \
|
||||
X(u32, display_tout_ms, /**/, /**/, xget_dec, /**/, xset_u32, NULL, /**/, 1) \
|
||||
X(bool, fn_alt_mode, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(u8, config_version, /**/, /**/, xget_dec, /**/, xset_u8, NULL, /**/, 1) \
|
||||
X(u32, display_cooldown_ms, /**/, /**/, xget_dec, /**/, xset_u32, NULL, /**/, 1) \
|
||||
X(bool, loopback, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, show_buttons, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, show_config_links, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(char, bm1, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, /**/, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm2, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, /**/, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm3, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, /**/, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm4, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, /**/, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm5, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, /**/, xset_term_bm, NULL, /**/, 1) \
|
||||
X(u32, cursor_shape, /**/, /**/, xget_dec, /**/, xset_term_cursorshape, NULL, /**/, 1) \
|
||||
X(bool, crlf_mode, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, want_all_fn, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, debugbar, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, allow_decopt_12, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, ascii_debug, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(char, backdrop, [TERM_BACKDROP_LEN], /**/, xget_string, /**/, xset_string, TERM_BACKDROP_LEN, /**/, 1)
|
||||
X(u32, width, /**/, /**/, xget_dec, xset_u32, NULL, /**/, 1) \
|
||||
X(u32, height, /**/, /**/, xget_dec, xset_u32, NULL, /**/, 1) \
|
||||
X(u32, default_bg, /**/, /**/, xget_term_color, xset_term_color, NULL, /**/, 1) \
|
||||
X(u32, default_fg, /**/, /**/, xget_term_color, xset_term_color, NULL, /**/, 1) \
|
||||
X(char, title, [TERM_TITLE_LEN], /**/, xget_string, xset_string, TERM_TITLE_LEN, /**/, 1) \
|
||||
X(char, btn1, [TERM_BTN_LEN], /**/, xget_string, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn2, [TERM_BTN_LEN], /**/, xget_string, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn3, [TERM_BTN_LEN], /**/, xget_string, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn4, [TERM_BTN_LEN], /**/, xget_string, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(char, btn5, [TERM_BTN_LEN], /**/, xget_string, xset_string, TERM_BTN_LEN, /**/, 1) \
|
||||
X(u8, theme, /**/, /**/, xget_dec, xset_u8, NULL, /**/, 1) \
|
||||
X(u32, parser_tout_ms, /**/, /**/, xget_dec, xset_u32, NULL, /**/, 1) \
|
||||
X(u32, display_tout_ms, /**/, /**/, xget_dec, xset_u32, NULL, /**/, 1) \
|
||||
X(bool, fn_alt_mode, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(u8, config_version, /**/, /**/, xget_dec, xset_u8, NULL, /**/, 1) \
|
||||
X(u32, display_cooldown_ms, /**/, /**/, xget_dec, xset_u32, NULL, /**/, 1) \
|
||||
X(bool, loopback, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, show_buttons, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, show_config_links, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(char, bm1, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm2, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm3, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm4, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, xset_term_bm, NULL, /**/, 1) \
|
||||
X(char, bm5, [TERM_BTN_MSG_LEN], /**/, xget_term_bm, xset_term_bm, NULL, /**/, 1) \
|
||||
X(u32, cursor_shape, /**/, /**/, xget_dec, xset_term_cursorshape, NULL, /**/, 1) \
|
||||
X(bool, crlf_mode, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, want_all_fn, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, debugbar, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, allow_decopt_12, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, ascii_debug, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
X(char, backdrop, [TERM_BACKDROP_LEN], /**/, xget_string, xset_string, TERM_BACKDROP_LEN, /**/, 1)
|
||||
|
||||
#define TERM_BM_N(tc, n) ((tc)->bm1+(TERM_BTN_MSG_LEN*n))
|
||||
#define TERM_BTN_N(tc, n) ((tc)->btn1+(TERM_BTN_LEN*n))
|
||||
|
||||
+8
-8
@@ -28,17 +28,17 @@ enum pwlock {
|
||||
//....Type................Name..Suffix...............Deref..XGET..........Cast..XSET.........................NOTIFY....Allow
|
||||
// Deref is used to pass the field to xget. Cast is used to convert the &'d field to what xset wants (needed for static arrays)
|
||||
#define XTABLE_SYSCONF \
|
||||
X(u32, uart_baudrate, /**/, /**/, xget_dec, /**/, xset_sys_baudrate, NULL, uart_changed=true, 1) \
|
||||
X(u8, uart_parity, /**/, /**/, xget_dec, /**/, xset_sys_parity, NULL, uart_changed=true, 1) \
|
||||
X(u8, uart_stopbits, /**/, /**/, xget_dec, /**/, xset_sys_stopbits, NULL, uart_changed=true, 1) \
|
||||
X(u32, uart_baudrate, /**/, /**/, xget_dec, xset_sys_baudrate, NULL, uart_changed=true, 1) \
|
||||
X(u8, uart_parity, /**/, /**/, xget_dec, xset_sys_parity, NULL, uart_changed=true, 1) \
|
||||
X(u8, uart_stopbits, /**/, /**/, xget_dec, xset_sys_stopbits, NULL, uart_changed=true, 1) \
|
||||
\
|
||||
X(u8, config_version, /**/, /**/, xget_dec, /**/, xset_u8, NULL, /**/, 1) \
|
||||
X(u8, config_version, /**/, /**/, xget_dec, xset_u8, NULL, /**/, 1) \
|
||||
\
|
||||
X(u8, pwlock, /**/, /**/, xget_dec, /**/, xset_sys_pwlock, NULL, /**/, admin|tpl) \
|
||||
X(uchar, access_pw, [64], /**/, xget_ustring, /**/, xset_sys_accesspw, NULL, /**/, admin) \
|
||||
X(uchar, access_name, [32], /**/, xget_ustring, /**/, xset_ustring, NULL, /**/, admin|tpl) \
|
||||
X(u8, pwlock, /**/, /**/, xget_dec, xset_sys_pwlock, NULL, /**/, admin|tpl) \
|
||||
X(uchar, access_pw, [64], /**/, xget_ustring, xset_sys_accesspw, NULL, /**/, admin) \
|
||||
X(uchar, access_name, [32], /**/, xget_ustring, xset_ustring, NULL, /**/, admin|tpl) \
|
||||
\
|
||||
X(bool, overclock, /**/, /**/, xget_bool, /**/, xset_bool, NULL, /**/, 1) \
|
||||
X(bool, overclock, /**/, /**/, xget_bool, xset_bool, NULL, /**/, 1) \
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
+23
-23
@@ -23,37 +23,37 @@
|
||||
#define wifimgr_notify_ap() { wifi_change_flags.ap = true; }
|
||||
#define wifimgr_notify_sta() { wifi_change_flags.ap = true; }
|
||||
|
||||
//....Type................Name..Suffix...............Deref..XGET.........Cast..XSET.........................NOTIFY................Allow
|
||||
//....Type................Name..Suffix...............Deref..XGET...........XSET.........................NOTIFY................Allow
|
||||
// Deref is used to pass the field to xget. Cast is used to convert the &'d field to what xset wants (needed for static arrays)
|
||||
#define XTABLE_WIFI \
|
||||
X(u8, opmode, /**/, /**/, xget_dec, /**/, xset_wifi_opmode, NULL, /**/, 1) \
|
||||
#define XTABLE_WIFICONF \
|
||||
X(u8, opmode, /**/, /**/, xget_dec, xset_wifi_opmode, NULL, /**/, 1) \
|
||||
\
|
||||
X(u8, tpw, /**/, /**/, xget_dec, /**/, xset_wifi_tpw, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u8, ap_channel, /**/, /**/, xget_dec, /**/, xset_wifi_ap_channel, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u8, ap_ssid, [SSID_LEN], /**/, xget_ustring, /**/, xset_wifi_ssid, 1, wifimgr_notify_ap(), 1) \
|
||||
X(u8, ap_password, [PASSWORD_LEN], /**/, xget_ustring, /**/, xset_wifi_pwd, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(bool, ap_hidden, /**/, /**/, xget_bool, /**/, xset_bool, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u8, tpw, /**/, /**/, xget_dec, xset_wifi_tpw, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u8, ap_channel, /**/, /**/, xget_dec, xset_wifi_ap_channel, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(uchar, ap_ssid, [SSID_LEN], /**/, xget_ustring, xset_wifi_ssid, 1, wifimgr_notify_ap(), 1) \
|
||||
X(uchar, ap_password, [PASSWORD_LEN], /**/, xget_ustring, xset_wifi_pwd, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(bool, ap_hidden, /**/, /**/, xget_bool, xset_bool, NULL, wifimgr_notify_ap(), 1) \
|
||||
\
|
||||
X(u16, ap_dhcp_time, /**/, /**/, xget_dec, /**/, xset_wifi_lease_time, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u32, unused1, /**/, /**/, xget_dummy, /**/, xset_dummy, NULL, /**/, 0) \
|
||||
X(struct ip_addr, ap_dhcp_start, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(struct ip_addr, ap_dhcp_end, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u16, ap_dhcp_time, /**/, /**/, xget_dec, xset_wifi_lease_time, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(u32, unused1, /**/, /**/, xget_dummy, xset_dummy, NULL, /**/, 0) \
|
||||
X(struct ip_addr, ap_dhcp_start, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(struct ip_addr, ap_dhcp_end, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
\
|
||||
X(struct ip_addr, ap_addr_ip, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(struct ip_addr, ap_addr_mask, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(struct ip_addr, ap_addr_ip, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
X(struct ip_addr, ap_addr_mask, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_ap(), 1) \
|
||||
\
|
||||
\
|
||||
X(u32, unused2, /**/, /**/, xget_dummy, /**/, xset_dummy, NULL, /**/, 0) \
|
||||
X(u8, sta_ssid, [SSID_LEN], /**/, xget_ustring, /**/, xset_wifi_ssid, 0, wifimgr_notify_sta(), 1) \
|
||||
X(u8, sta_password, [PASSWORD_LEN], /**/, xget_ustring, /**/, xset_wifi_pwd, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(bool, sta_dhcp_enable, /**/, /**/, xget_bool, /**/, xset_bool, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(u32, unused2, /**/, /**/, xget_dummy, xset_dummy, NULL, /**/, 0) \
|
||||
X(uchar, sta_ssid, [SSID_LEN], /**/, xget_ustring, xset_wifi_ssid, 0, wifimgr_notify_sta(), 1) \
|
||||
X(uchar, sta_password, [PASSWORD_LEN], /**/, xget_ustring, xset_wifi_pwd, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(bool, sta_dhcp_enable, /**/, /**/, xget_bool, xset_bool, NULL, wifimgr_notify_sta(), 1) \
|
||||
\
|
||||
X(struct ip_addr, sta_addr_ip, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(struct ip_addr, sta_addr_mask, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(struct ip_addr, sta_addr_gw, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(struct ip_addr, sta_addr_ip, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(struct ip_addr, sta_addr_mask, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_sta(), 1) \
|
||||
X(struct ip_addr, sta_addr_gw, /**/, &, xget_ip, xset_ip, NULL, wifimgr_notify_sta(), 1) \
|
||||
\
|
||||
\
|
||||
X(u8, config_version, /**/, /**/, xget_dec, /**/, xset_u8, NULL, /**/, 1)
|
||||
X(u8, config_version, /**/, /**/, xget_dec, xset_u8, NULL, /**/, 1)
|
||||
|
||||
// unused1 - replaces 'enabled' bit from old dhcps_lease struct
|
||||
// unused2 - gap after 'ap_gw' which isn't used and doesn't make sense
|
||||
@@ -66,7 +66,7 @@
|
||||
*/
|
||||
typedef struct {
|
||||
#define X XSTRUCT_FIELD
|
||||
XTABLE_WIFI
|
||||
XTABLE_WIFICONF
|
||||
#undef X
|
||||
} WiFiConfigBundle;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user