Get the profile name 21/31321/2
authorChengyi Zhao <chengyi1.zhao@archermind.com>
Thu, 4 Dec 2014 02:38:28 +0000 (10:38 +0800)
committerChengyi Zhao <chengyi1.zhao@archermind.com>
Mon, 8 Dec 2014 01:45:07 +0000 (09:45 +0800)
Different methods have been used to get the profile name
based on different profile types.

Change-Id: Id5de80658bbcd74e01818c599f2c275e39bebd6b
Signed-off-by: Chengyi Zhao <chengyi1.zhao@archermind.com>
src/connection_profile.c

index 85bd1131d62bca6481ba6f7530c65798b972e39f..fb455f39465f70586571b0a154707645ae0322f7 100644 (file)
@@ -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;