slightly cleaner XTABLE_WIFI

work
Ondřej Hruška 7 years ago
parent cabd42f2b4
commit 9146c9880a
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 41
      user/wifimgr.h

@ -23,35 +23,36 @@
#define wifimgr_notify_sta() { wifi_change_flags.ap = true; }
//....Type................Name..Suffix...............Deref..XGET.........Cast..XSET.........................NOTIFY
// 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, xnoop) \
X(u8, opmode, /**/, /**/, xget_dec, /**/, xset_wifi_opmode, NULL, xnoop) \
\
X(u8, tpw, , , xget_dec, , xset_wifi_tpw, NULL, wifimgr_notify_ap) \
X(u8, ap_channel, , , xget_dec, , xset_wifi_ap_channel, NULL, wifimgr_notify_ap) \
X(u8, ap_ssid, [SSID_LEN], , xget_ustring, (u8**), xset_wifi_ssid, 1, wifimgr_notify_ap) \
X(u8, ap_password, [PASSWORD_LEN], , xget_ustring, (u8**), xset_wifi_pwd, NULL, wifimgr_notify_ap) \
X(bool, ap_hidden, , , xget_bool, , xset_bool, NULL, wifimgr_notify_ap) \
X(u8, tpw, /**/, /**/, xget_dec, /**/, xset_wifi_tpw, NULL, wifimgr_notify_ap) \
X(u8, ap_channel, /**/, /**/, xget_dec, /**/, xset_wifi_ap_channel, NULL, wifimgr_notify_ap) \
X(u8, ap_ssid, [SSID_LEN], /**/, xget_ustring, (u8**), xset_wifi_ssid, 1, wifimgr_notify_ap) \
X(u8, ap_password, [PASSWORD_LEN], /**/, xget_ustring, (u8**), xset_wifi_pwd, NULL, wifimgr_notify_ap) \
X(bool, ap_hidden, /**/, /**/, xget_bool, /**/, xset_bool, NULL, wifimgr_notify_ap) \
\
X(u16, ap_dhcp_time, , , xget_dec, , xset_wifi_lease_time, NULL, wifimgr_notify_ap) \
X(u32, unused1, , , xget_dummy, , xset_dummy, NULL, xnoop) \
X(struct ip_addr, ap_dhcp_start, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_ap) \
X(struct ip_addr, ap_dhcp_end, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_ap) \
X(u16, ap_dhcp_time, /**/, /**/, xget_dec, /**/, xset_wifi_lease_time, NULL, wifimgr_notify_ap) \
X(u32, unused1, /**/, /**/, xget_dummy, /**/, xset_dummy, NULL, xnoop) \
X(struct ip_addr, ap_dhcp_start, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap) \
X(struct ip_addr, ap_dhcp_end, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap) \
\
X(struct ip_addr, ap_addr_ip, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_ap) \
X(struct ip_addr, ap_addr_mask, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_ap) \
X(struct ip_addr, ap_addr_ip, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap) \
X(struct ip_addr, ap_addr_mask, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_ap) \
\
\
X(u32, unused2, , , xget_dummy, , xset_dummy, NULL, xnoop) \
X(u8, sta_ssid, [SSID_LEN], , xget_ustring, (u8**), xset_wifi_ssid, 0, wifimgr_notify_sta) \
X(u8, sta_password, [PASSWORD_LEN], , xget_ustring, (u8**), xset_wifi_pwd, NULL, wifimgr_notify_sta) \
X(bool, sta_dhcp_enable, , , xget_bool, , xset_bool, NULL, wifimgr_notify_sta) \
X(u32, unused2, /**/, /**/, xget_dummy, /**/, xset_dummy, NULL, xnoop) \
X(u8, sta_ssid, [SSID_LEN], /**/, xget_ustring, (u8**), xset_wifi_ssid, 0, wifimgr_notify_sta) \
X(u8, sta_password, [PASSWORD_LEN], /**/, xget_ustring, (u8**), xset_wifi_pwd, NULL, wifimgr_notify_sta) \
X(bool, sta_dhcp_enable, /**/, /**/, xget_bool, /**/, xset_bool, NULL, wifimgr_notify_sta) \
\
X(struct ip_addr, sta_addr_ip, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_sta) \
X(struct ip_addr, sta_addr_mask, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_sta) \
X(struct ip_addr, sta_addr_gw, , &, xget_ip, , xset_ip, NULL, wifimgr_notify_sta) \
X(struct ip_addr, sta_addr_ip, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_sta) \
X(struct ip_addr, sta_addr_mask, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_sta) \
X(struct ip_addr, sta_addr_gw, /**/, &, xget_ip, /**/, xset_ip, NULL, wifimgr_notify_sta) \
\
\
X(u8, config_version, , , xget_dec, , xset_u8, NULL, xnoop)
X(u8, config_version, /**/, /**/, xget_dec, /**/, xset_u8, NULL, xnoop)
// unused1 - replaces 'enabled' bit from old dhcps_lease struct
// unused2 - gap after 'ap_gw' which isn't used and doesn't make sense

Loading…
Cancel
Save