There is a cgic code that saves data to the ini file.
How to add a console command after / or during data writing in ini:
/opt/ip/params_ctrl -s set_wifi "ssid" "password"
where are the ssid
arguments for the transmitted data wireless:ssid
and password
is wireless:password
?
Code:
static void doWirelessAddSave(struct setting_info *setting) { char string[LEN32]; int choice; cgiFormResultType ret; ret = cgiFormString("ssid", string, sizeof(string)); iniparser_set(setting->ini, "wireless:ssid", string); ret = cgiFormSelectSingle("wifiMode", wifi_mode, sizeof(wifi_mode), &choice, 0); iniparser_set(setting->ini, "wireless:mode", wifi_mode[choice]); ret = cgiFormSelectSingle("safe", safe, sizeof(safe), &choice, 0); iniparser_set(setting->ini, "wireless:security", safe[choice]); ret = cgiFormString("password", string, sizeof(string)); iniparser_set(setting->ini, "wireless:password", string); storeSettingInfo(setting); }
from the "answer":
Build error
setting.c: In function 'doWirelessSave': setting.c: 1932: error: 'ssid' undeclared (first use in this function) setting.c: 1932: error: (Each undeclared : error: for each function it appears in.) setting.c: 1932: error: 'password' undeclared (first use in this function) make [1]: *** [setting.o] Error 1
system(("/opt/ip/params_ctrl -s set_wifi " + ssid + " " + password).c_str());
- user26699 4:26 pm