Name: capi-network-wifi
Summary: Network Wi-Fi library in TIZEN C API
-Version: 1.0.60
+Version: 1.0.61
Release: 1
Group: System/Network
License: Apache-2.0
static void __libnet_update_specific_profile_iterator(GSList *ap_list)
{
- int count=0;
- GSList *list = ap_list;
+ int count = 0;
+ GSList *list = ap_list;
- for (count = 0; list; list = list->next) {
+ for (count = 0; list; list = list->next)
count++;
- }
if (count == 0) {
WIFI_LOG(WIFI_INFO, "No hidden AP found\n");
return;
case NET_ERR_ACTIVE_CONNECTION_EXISTS:
return;
- default :
+ default:
break;
}
case NET_EVENT_WIFI_POWER_IND:
__libnet_power_on_off_cb(event_cb, is_requested);
break;
- default :
+ default:
break;
}
}
}
int _wifi_libnet_scan_specific_ap(const char *essid,
- wifi_scan_finished_cb callback, void *user_data)
+ wifi_scan_finished_cb callback, void *user_data)
{
int rv;
- rv = net_specific_scan_wifi(essid);
+ rv = net_specific_scan_wifi(essid);
- if (rv == NET_ERR_NONE) {
+ if (rv == NET_ERR_NONE) {
g_strlcpy(specific_profile_essid, essid, NET_WLAN_ESSID_LEN+1);
__libnet_set_specific_scan_cb(callback, user_data);
return WIFI_ERROR_NONE;
int _wifi_check_feature_supported(const char *feature_name)
{
- if(is_feature_checked) {
- if(!feature_supported) {
+ if (is_feature_checked) {
+ if (!feature_supported) {
LOGE("%s feature is disabled", feature_name);
return WIFI_ERROR_NOT_SUPPORTED;
}
- }
- else {
+ } else {
if (!system_info_get_platform_bool(feature_name, &feature_supported)) {
is_feature_checked = true;
if (!feature_supported) {
LOGE("%s feature is disabled", feature_name);
return WIFI_ERROR_NOT_SUPPORTED;
}
- }
- else {
+ } else {
LOGE("Error - Feature getting from System Info");
return WIFI_ERROR_OPERATION_FAILED;
}
if (rv == NET_ERR_ACCESS_DENIED) {
WIFI_LOG(WIFI_ERROR, "Access denied");
return WIFI_ERROR_PERMISSION_DENIED;
- }
- else if (rv != NET_ERR_NONE) {
+ } else if (rv != NET_ERR_NONE) {
WIFI_LOG(WIFI_ERROR, "Init failed[%d]", rv);
return WIFI_ERROR_OPERATION_FAILED;
}
net_profile_info_t *profile_info = ap;
- if (address_family == WIFI_ADDRESS_FAMILY_IPV4){
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
profileType = profile_info->ProfileInfo.Wlan.net_info.IpConfigType ;
- } else {
+ else
profileType = profile_info->ProfileInfo.Wlan.net_info.IpConfigType6 ;
- }
if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
switch (profileType) {
net_profile_info_t *profile_info = ap;
- if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
profileType = &profile_info->ProfileInfo.Wlan.net_info.IpConfigType ;
- } else {
+ else
profileType = &profile_info->ProfileInfo.Wlan.net_info.IpConfigType6 ;
- }
if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
switch (type) {
* For IPv6 address subnet mask is prefix length, an integer, while for
* Ipv6 address subnet mask is a ipv6 address.
*/
- if (address_family == WIFI_ADDRESS_FAMILY_IPV6){
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
if (subnet_mask == NULL)
profile_info->ProfileInfo.Wlan.net_info.PrefixLen6 = 0;
else {
if (_wifi_libnet_check_profile_name_validity(profile_info->ProfileName) == false)
return WIFI_ERROR_NONE;
- rv =_wifi_update_ap_info(profile_info);
+ rv = _wifi_update_ap_info(profile_info);
if (rv != NET_ERR_NONE && proxy_type == WIFI_PROXY_TYPE_MANUAL) {
g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProxyAddr, "0.0.0.0:8080", 15);
rv = _wifi_update_ap_info(profile_info);
net_profile_info_t *profile_info = ap;
- if(address_family == WIFI_ADDRESS_FAMILY_IPV4)
+ if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
*dns_address = __ap_convert_ip_to_string(
&profile_info->ProfileInfo.Wlan.net_info.DnsAddr[order-1],
address_family);
{
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
- if (_wifi_libnet_check_ap_validity(ap) == false ||user_name == NULL || is_password_set == NULL) {
+ if (_wifi_libnet_check_ap_validity(ap) == false || user_name == NULL || is_password_set == NULL) {
WIFI_LOG(WIFI_ERROR, "Invalid parameter");
return WIFI_ERROR_INVALID_PARAMETER;
}
if (h->security_type == WIFI_SECURITY_TYPE_EAP) {
ret = wifi_save_eap_configurations(dbus_h, h->name, h->passphrase, h->security_type, h->proxy_address, h->eap_config, h->is_hidden);
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
WIFI_LOG(WIFI_ERROR, "Fail to wifi_save_eap_configurations");
- }
- }
- else {
+ } else {
ret = wifi_save_configurations(dbus_h, h->name, h->passphrase, h->security_type, h->proxy_address, h->is_hidden);
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
WIFI_LOG(WIFI_ERROR, "Fail to save configurations [%d]", ret);
- }
}
h->is_saved = TRUE;
}
ret = wifi_load_eap_configurations(dbus_h, id, &h->name,
&h->security_type, &h->proxy_address, &h->is_hidden, &h->eap_config, &h->last_error);
- }
- else {
+ } else {
ret = wifi_load_configurations(dbus_h, id, &h->name,
&h->security_type, &h->proxy_address, &h->is_hidden, &h->last_error);
}
config_id = wifi_config_get_config_id(h->name, h->security_type);
ret = wifi_configuration_set_field(dbus_h, config_id, WIFI_CONFIG_PROXYADDRESS, proxy_address);
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
WIFI_LOG(WIFI_ERROR, "Fail to set proxy address [%d]", ret);
- }
g_free(config_id);
}
config_id = wifi_config_get_config_id(h->name, h->security_type);
- if (h->is_hidden == TRUE) {
+ if (h->is_hidden == TRUE)
hidden = g_strdup("TRUE");
- } else {
+ else
hidden = g_strdup("FALSE");
- }
+
ret = wifi_configuration_set_field(dbus_h, config_id, WIFI_CONFIG_HIDDEN, hidden);
- if (ret != WIFI_ERROR_NONE) {
+ if (ret != WIFI_ERROR_NONE)
WIFI_LOG(WIFI_ERROR, "Fail to set hidden [%d]", ret);
- }
g_free(hidden);
g_free(config_id);
gint length = 0;
gchar *hex = NULL;
- if (name == NULL) {
+ if (name == NULL)
return NULL;
- }
length = strlen(name);
if (string == NULL)
return NULL;
- for (i = 0; i < length; i++) {
+ for (i = 0; i < length; i++)
g_string_append_printf(string, "%02x", name[i]);
- }
hex = g_strdup_printf("%s", string->str);
g_string_free(string, TRUE);
{
gchar *type = NULL;
- switch(eap_type) {
- case WIFI_EAP_TYPE_PEAP:
- type = g_strdup("PEAP");
- break;
- case WIFI_EAP_TYPE_TLS:
- type = g_strdup("TLS");
- break;
- case WIFI_EAP_TYPE_TTLS:
- type = g_strdup("TTLS");
- break;
- case WIFI_EAP_TYPE_SIM:
- type = g_strdup("SIM");
- break;
- case WIFI_EAP_TYPE_AKA:
- type = g_strdup("AKA");
- break;
+ switch (eap_type) {
+ case WIFI_EAP_TYPE_PEAP:
+ type = g_strdup("PEAP");
+ break;
+ case WIFI_EAP_TYPE_TLS:
+ type = g_strdup("TLS");
+ break;
+ case WIFI_EAP_TYPE_TTLS:
+ type = g_strdup("TTLS");
+ break;
+ case WIFI_EAP_TYPE_SIM:
+ type = g_strdup("SIM");
+ break;
+ case WIFI_EAP_TYPE_AKA:
+ type = g_strdup("AKA");
+ break;
}
return type;
}
{
gchar *type = NULL;
- switch(eap_auth_type) {
- case WIFI_EAP_AUTH_TYPE_PAP:
- type = g_strdup("PAP");
- break;
- case WIFI_EAP_AUTH_TYPE_MSCHAP:
- type = g_strdup("MSCHAP");
- break;
- case WIFI_EAP_AUTH_TYPE_MSCHAPV2:
- type = g_strdup("MSCHAPV2");
- break;
- case WIFI_EAP_AUTH_TYPE_GTC:
- type = g_strdup("GTC");
- break;
- case WIFI_EAP_AUTH_TYPE_MD5:
- type = g_strdup("MD5");
- break;
- default:
- case WIFI_EAP_AUTH_TYPE_NONE:
- type = NULL;
- break;
+ switch (eap_auth_type) {
+ case WIFI_EAP_AUTH_TYPE_PAP:
+ type = g_strdup("PAP");
+ break;
+ case WIFI_EAP_AUTH_TYPE_MSCHAP:
+ type = g_strdup("MSCHAP");
+ break;
+ case WIFI_EAP_AUTH_TYPE_MSCHAPV2:
+ type = g_strdup("MSCHAPV2");
+ break;
+ case WIFI_EAP_AUTH_TYPE_GTC:
+ type = g_strdup("GTC");
+ break;
+ case WIFI_EAP_AUTH_TYPE_MD5:
+ type = g_strdup("MD5");
+ break;
+ default:
+ case WIFI_EAP_AUTH_TYPE_NONE:
+ type = NULL;
+ break;
}
return type;
}
{
wifi_eap_type_e ret = -1;
- if (type == NULL) {
+ if (type == NULL)
return ret;
- }
- if (g_strcmp0(type, "PEAP") == 0) {
+ if (g_strcmp0(type, "PEAP") == 0)
ret = WIFI_EAP_TYPE_PEAP;
- } else if (g_strcmp0(type, "TLS") == 0) {
+ else if (g_strcmp0(type, "TLS") == 0)
ret = WIFI_EAP_TYPE_TLS;
- } else if (g_strcmp0(type, "TTLS") == 0) {
+ else if (g_strcmp0(type, "TTLS") == 0)
ret = WIFI_EAP_TYPE_TTLS;
- } else if (g_strcmp0(type, "SIM") == 0) {
+ else if (g_strcmp0(type, "SIM") == 0)
ret = WIFI_EAP_TYPE_SIM;
- } else if (g_strcmp0(type, "AKA") == 0) {
+ else if (g_strcmp0(type, "AKA") == 0)
ret = WIFI_EAP_TYPE_AKA;
- } else {
+ else
WIFI_LOG(WIFI_ERROR, "Not supported type (%s)", type);
- }
return ret;
}
{
wifi_eap_auth_type_e ret = WIFI_EAP_AUTH_TYPE_NONE;
- if (type == NULL) {
+ if (type == NULL)
return ret;
- }
- if (g_strcmp0(type, "PAP") == 0) {
+ if (g_strcmp0(type, "PAP") == 0)
ret = WIFI_EAP_AUTH_TYPE_PAP;
- } else if (g_strcmp0(type, "MSCHAP") == 0) {
+ else if (g_strcmp0(type, "MSCHAP") == 0)
ret = WIFI_EAP_AUTH_TYPE_MSCHAP;
- } else if (g_strcmp0(type, "MSCHAPV2") == 0) {
+ else if (g_strcmp0(type, "MSCHAPV2") == 0)
ret = WIFI_EAP_AUTH_TYPE_MSCHAPV2;
- } else if (g_strcmp0(type, "GTC") == 0) {
+ else if (g_strcmp0(type, "GTC") == 0)
ret = WIFI_EAP_AUTH_TYPE_GTC;
- } else if (g_strcmp0(type, "MD5") == 0) {
+ else if (g_strcmp0(type, "MD5") == 0)
ret = WIFI_EAP_AUTH_TYPE_MD5;
- } else {
+ else
WIFI_LOG(WIFI_ERROR, "Not supported type (%s)", type);
- }
return ret;
}
{
wifi_security_type_e ret = WIFI_SECURITY_TYPE_NONE;
- if (type == NULL) {
+ if (type == NULL)
return ret;
- }
- if (g_strcmp0(type, WIFI_SECURITY_NONE) == 0) {
+ if (g_strcmp0(type, WIFI_SECURITY_NONE) == 0)
ret = WIFI_SECURITY_TYPE_NONE;
- } else if (g_strcmp0(type, WIFI_SECURITY_WEP) == 0) {
+ else if (g_strcmp0(type, WIFI_SECURITY_WEP) == 0)
ret = WIFI_SECURITY_TYPE_WEP;
- } else if (g_strcmp0(type, WIFI_SECURITY_WPA_PSK) == 0) {
+ else if (g_strcmp0(type, WIFI_SECURITY_WPA_PSK) == 0)
ret = WIFI_SECURITY_TYPE_WPA_PSK;
- } else if (g_strcmp0(type, WIFI_SECURITY_EAP) == 0) {
+ else if (g_strcmp0(type, WIFI_SECURITY_EAP) == 0)
ret = WIFI_SECURITY_TYPE_EAP;
- } else {
+ else
WIFI_LOG(WIFI_ERROR, "Not supported type (%s)", type);
- }
return ret;
}
}
g_variant_get(result, "(as)", &iter);
- while (g_variant_iter_loop(iter, "s", &config_id)) {
+ while (g_variant_iter_loop(iter, "s", &config_id))
list = g_slist_append(list, g_strdup(config_id));
- }
g_variant_iter_free(iter);
g_variant_unref(result);
*security_type = _wifi_security_type_to_int(g_variant_get_string(value, NULL));
} else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
const gchar *r_hidden = g_variant_get_string(value, NULL);
- if (g_strcmp0(r_hidden, "TRUE") == 0) {
+ if (g_strcmp0(r_hidden, "TRUE") == 0)
*is_hidden = TRUE;
- } else {
+ else
*is_hidden = FALSE;
- }
} else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
const gchar *r_proxy_address = g_variant_get_string(value, NULL);
- if (g_strcmp0(r_proxy_address, "NONE") == 0) {
+ if (g_strcmp0(r_proxy_address, "NONE") == 0)
*proxy_address = NULL;
- } else {
+ else
*proxy_address = g_strdup(r_proxy_address);
- }
} else if (g_strcmp0(field, WIFI_CONFIG_FAILURE) == 0) {
*last_error = _wifi_last_error_to_enum(g_variant_get_string(value, NULL));
}
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_SUBJECT_MATCH, g_variant_new_string(eap_config->subject_match));
auth_type = wifi_eap_auth_type_to_string(eap_config->eap_auth_type);
- if (auth_type != NULL) {
+ if (auth_type != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_AUTH_TYPE, g_variant_new_string(auth_type));
- }
+
eap_type = wifi_eap_type_to_string(eap_config->eap_type);
- if (eap_type != NULL) {
+ if (eap_type != NULL)
g_variant_builder_add(b, "{sv}", WIFI_CONFIG_EAP_TYPE, g_variant_new_string(eap_type));
- }
g_free(auth_type);
g_free(eap_type);
*security_type = _wifi_security_type_to_int(g_variant_get_string(value, NULL));
} else if (g_strcmp0(field, WIFI_CONFIG_HIDDEN) == 0) {
const gchar *r_hidden = g_variant_get_string(value, NULL);
- if (g_strcmp0(r_hidden, "TRUE") == 0) {
+ if (g_strcmp0(r_hidden, "TRUE") == 0)
*is_hidden = TRUE;
- } else {
+ else
*is_hidden = FALSE;
- }
} else if (g_strcmp0(field, WIFI_CONFIG_PROXYADDRESS) == 0) {
const gchar *r_proxy_address = g_variant_get_string(value, NULL);
- if (g_strcmp0(r_proxy_address, "NONE") == 0) {
+ if (g_strcmp0(r_proxy_address, "NONE") == 0)
*proxy_address = NULL;
- } else {
+ else
*proxy_address = g_strdup(r_proxy_address);
- }
} else if (g_strcmp0(field, WIFI_CONFIG_EAP_ANONYMOUS_IDENTITY) == 0) {
const gchar *anonymous_identity = g_variant_get_string(value, NULL);
(*eap_config)->anonymous_identity = g_strdup(anonymous_identity);
static void __test_scan_request_callback(wifi_error_e error_code, void* user_data)
{
- if(user_data != NULL)
+ if (user_data != NULL)
printf("user_data : %s\n", (char *)user_data);
printf("Scan Completed from scan request, error code : %s\n",
return false;
}
- rv = test_get_user_int("Input Address type to get"
- "(0:IPV4, 1:IPV6):", &address_type);
+ rv = test_get_user_int("Input Address type to get"
+ "(0:IPV4, 1:IPV6):", &address_type);
- if (rv == false || (address_type != 0 && address_type != 1)) {
- printf("Invalid input!!\n");
- return false;
- }
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return false;
+ }
switch (method) {
case 1:
return false;
}
- rv = test_get_user_int("Input Address type to get"
- "(0:IPV4, 1:IPV6):", &address_type);
+ rv = test_get_user_int("Input Address type to get"
+ "(0:IPV4, 1:IPV6):", &address_type);
- if (rv == false || (address_type != 0 && address_type != 1)) {
- printf("Invalid input!!\n");
- return false;
- }
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return false;
+ }
switch (method) {
case 1:
printf("Fail to get Connection State\n");
rv = test_get_user_int("Input Address type to get"
- "(0:IPV4, 1:IPV6):", &address_type);
+ "(0:IPV4, 1:IPV6):", &address_type);
- if (rv == false || (address_type != 0 && address_type != 1)) {
- printf("Invalid input!!\n");
- return false;
- }
+ if (rv == false || (address_type != 0 && address_type != 1)) {
+ printf("Invalid input!!\n");
+ return false;
+ }
if (wifi_ap_get_ip_config_type(ap, address_type, &ip_type) == WIFI_ERROR_NONE)
printf("IP config type : %d\n", ip_type);
return false;
}
- switch(security_type) {
- case WIFI_SECURITY_TYPE_WEP :
- case WIFI_SECURITY_TYPE_WPA_PSK :
- case WIFI_SECURITY_TYPE_WPA2_PSK :
+ switch (security_type) {
+ case WIFI_SECURITY_TYPE_WEP:
+ case WIFI_SECURITY_TYPE_WPA_PSK:
+ case WIFI_SECURITY_TYPE_WPA2_PSK:
{
char passphrase[100];
printf("Input passphrase for %s : ", ap_name);
}
}
break;
- case WIFI_SECURITY_TYPE_EAP :
+ case WIFI_SECURITY_TYPE_EAP:
{
char input_str1[100];
printf("Input user name for %s : ", ap_name);
g_free(inputed_name);
}
break;
- case WIFI_SECURITY_TYPE_NONE :
- default :
+ case WIFI_SECURITY_TYPE_NONE:
+ default:
break;
}
rv = wifi_deinitialize();
- if (rv != WIFI_ERROR_NONE){
+ if (rv != WIFI_ERROR_NONE) {
printf("Wifi deinit failed [%s]\n", __test_convert_error_to_string(rv));
return -1;
}
{
GMainLoop *mainloop;
g_type_init();
- mainloop = g_main_loop_new (NULL, FALSE);
+ mainloop = g_main_loop_new(NULL, FALSE);
GIOChannel *channel = g_io_channel_unix_new(0);
g_io_add_watch(channel, (G_IO_IN|G_IO_ERR|G_IO_HUP|G_IO_NVAL), test_thread, NULL);
printf("Test Thread created...\n");
- g_main_loop_run (mainloop);
+ g_main_loop_run(mainloop);
return 0;
}
if (a[0] == '\n' || a[0] == '\r') {
printf("\n\n Network Connection API Test App\n\n");
printf("Options..\n");
- printf("1 - Wi-Fi init and set callbacks\n");
- printf("2 - Wi-Fi deinit(unset callbacks automatically)\n");
- printf("3 - Activate Wi-Fi device\n");
- printf("4 - Deactivate Wi-Fi device\n");
- printf("5 - Is Wi-Fi activated?\n");
- printf("6 - Get connection state\n");
- printf("7 - Get MAC address\n");
- printf("8 - Get Wi-Fi interface name\n");
- printf("9 - Scan request\n");
- printf("a - Get Connected AP\n");
- printf("b - Get AP list\n");
- printf("c - Connect\n");
- printf("d - Disconnect\n");
- printf("e - Connect by wps pbc\n");
- printf("f - Forget an AP\n");
- printf("g - Set & connect EAP\n");
- printf("h - Set IP method type\n");
- printf("i - Set Proxy method type\n");
- printf("j - Get Ap info\n");
- printf("k - Connect Specific AP\n");
- printf("l - Load configuration\n");
- printf("m - Save configuration\n");
- printf("n - Set configuration proxy and hidden\n");
- printf("o - Set EAP configuration\n");
- printf("0 - Exit \n");
+ printf("1 - Wi-Fi init and set callbacks\n");
+ printf("2 - Wi-Fi deinit(unset callbacks automatically)\n");
+ printf("3 - Activate Wi-Fi device\n");
+ printf("4 - Deactivate Wi-Fi device\n");
+ printf("5 - Is Wi-Fi activated?\n");
+ printf("6 - Get connection state\n");
+ printf("7 - Get MAC address\n");
+ printf("8 - Get Wi-Fi interface name\n");
+ printf("9 - Scan request\n");
+ printf("a - Get Connected AP\n");
+ printf("b - Get AP list\n");
+ printf("c - Connect\n");
+ printf("d - Disconnect\n");
+ printf("e - Connect by wps pbc\n");
+ printf("f - Forget an AP\n");
+ printf("g - Set & connect EAP\n");
+ printf("h - Set IP method type\n");
+ printf("i - Set Proxy method type\n");
+ printf("j - Get Ap info\n");
+ printf("k - Connect Specific AP\n");
+ printf("l - Load configuration\n");
+ printf("m - Save configuration\n");
+ printf("n - Set configuration proxy and hidden\n");
+ printf("o - Set EAP configuration\n");
+ printf("0 - Exit \n");
printf("ENTER - Show options menu.......\n");
}