int type = 0;
char proxy[100] = { 0, };
int hidden = 0;
+ int address_type = 0;
+ char ip_addr[40] = { 0, };
wifi_manager_config_h config;
+ int ip_update = 0;
printf("Input AP configuration\n");
printf("Name : ");
if (rv != WIFI_MANAGER_ERROR_NONE)
return -1;
+ rv = test_get_user_int("Update IP details (0:No, 1:Yes):", &ip_update);
+ if (rv == false || (ip_update != 0 && ip_update != 1)) {
+ printf("Invalid input!!\n");
+ return -1;
+ }
+
+ if (ip_update == 1) {
+ rv = test_get_user_int("Input Address type "
+ "(0:IPV4, 1:IPV6):", &address_type);
+
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return -1;
+ }
+ rv = wifi_manager_config_set_ip_config_type(config, address_type,
+ WIFI_MANAGER_IP_CONFIG_TYPE_STATIC);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to set ip method type[%s]\n",
+ __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ printf("Input new ip address (x:skip, 0:clear) :\n");
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_config_set_ip_address(config, address_type,
+ NULL);
+ break;
+ default:
+ rv = wifi_manager_config_set_ip_address(config, address_type,
+ ip_addr);
+ }
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to set ip address[%s]\n",
+ __test_convert_error_to_string(rv));
+ return -1;
+ }
+ }
+
+ printf("Input new subnet mask (x:skip, 0:clear) :\n");
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_config_set_subnet_mask(config, address_type,
+ NULL);
+ break;
+ default:
+ rv = wifi_manager_config_set_subnet_mask(config, address_type,
+ ip_addr);
+ }
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to set subnet mask[%s]\n",
+ __test_convert_error_to_string(rv));
+ return -1;
+ }
+ }
+
+ printf("Input new gateway address (x:skip, 0:clear) :\n");
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_config_set_gateway_address(config,
+ address_type, NULL);
+ break;
+ default:
+ rv = wifi_manager_config_set_gateway_address(config,
+ address_type, ip_addr);
+ }
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to set gateway address[%s]\n",
+ __test_convert_error_to_string(rv));
+ return -1;
+ }
+ }
+
+ rv = wifi_manager_config_set_dns_config_type(config,
+ address_type, WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC);
+ if (rv == WIFI_MANAGER_ERROR_NONE) {
+ printf("Input DNS1 address (x: skip, 0: clear) : \n");
+ if (address_type == WIFI_MANAGER_ADDRESS_FAMILY_IPV4)
+ rv = scanf("%15s", ip_addr);
+ else
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_config_set_dns_address(config,
+ 1, address_type, NULL);
+ break;
+ default:
+ rv = wifi_manager_config_set_dns_address(config,
+ 1, address_type,
+ ip_addr);
+ }
+ }
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to set DNS1 address[%s]\n",
+ __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ printf("Input DNS2 address (x: skip, 0: clear) : \n");
+ if (address_type == WIFI_MANAGER_ADDRESS_FAMILY_IPV4)
+ rv = scanf("%15s", ip_addr);
+ else
+ rv = scanf("%39s", ip_addr);
+ if (rv > 0) {
+ switch (ip_addr[0]) {
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_config_set_dns_address(config,
+ 2, address_type, NULL);
+ break;
+ default:
+ rv = wifi_manager_config_set_dns_address(config,
+ 2, address_type,
+ ip_addr);
+ }
+ }
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to set DNS2 address[%s]\n",
+ __test_convert_error_to_string(rv));
+ return -1;
+ }
+ }
+ }
+
if (test_get_user_string("Proxy(server:port) - (Enter for skip): ", proxy, 99)) {
- rv = wifi_manager_config_set_proxy_address(config, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, proxy);
+ rv = wifi_manager_config_set_proxy_address(config,
+ WIFI_MANAGER_ADDRESS_FAMILY_IPV4, proxy);
if (rv != WIFI_MANAGER_ERROR_NONE)
return -1;
}