From: Chengyi Zhao Date: Thu, 4 Dec 2014 02:38:28 +0000 (+0800) Subject: Get the profile name X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b40a1348a7b49bf775dca760c21f3aabe357b75;p=platform%2Fcore%2Fapi%2Fconnection.git Get the profile name Different methods have been used to get the profile name based on different profile types. Change-Id: Id5de80658bbcd74e01818c599f2c275e39bebd6b Signed-off-by: Chengyi Zhao --- diff --git a/src/connection_profile.c b/src/connection_profile.c index 85bd113..fb455f3 100644 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -284,19 +284,23 @@ EXPORT_API int connection_profile_get_name(connection_profile_h profile, char** return CONNECTION_ERROR_INVALID_PARAMETER; } - /* + struct connman_service *service = + _connection_libnet_get_service_h(profile); + if (service == NULL) + return CONNECTION_ERROR_INVALID_PARAMETER; + net_profile_info_t *profile_info = profile; switch (profile_info->profile_type) { - case NET_DEVICE_CELLULAR: - *profile_name = g_strdup(profile_info->ProfileInfo.Pdp.Keyword); - break; + case NET_DEVICE_CELLULAR: /*TODO */ case NET_DEVICE_WIFI: - *profile_name = g_strdup(profile_info->ProfileInfo.Wlan.essid); - break; - case NET_DEVICE_ETHERNET: - *profile_name = g_strdup(profile_info->ProfileInfo.Ethernet.net_info.DevName); + *profile_name = g_strdup(connman_service_get_name(service)); break; + case NET_DEVICE_ETHERNET: { + const struct service_ethernet *ethernet = + connman_service_get_ethernet(service); + *profile_name = g_strdup(ethernet->interface); + } break; case NET_DEVICE_BLUETOOTH: { char *bt_name = strrchr(profile_info->profile_name, '/'); if (bt_name == NULL) @@ -308,7 +312,6 @@ EXPORT_API int connection_profile_get_name(connection_profile_h profile, char** default: return CONNECTION_ERROR_INVALID_PARAMETER; } - */ if (*profile_name == NULL) return CONNECTION_ERROR_OUT_OF_MEMORY;