Get the ESSID 62/32462/1
authorChengyi Zhao <chengyi1.zhao@archermind.com>
Thu, 11 Dec 2014 03:12:36 +0000 (11:12 +0800)
committerChengyi Zhao <chengyi1.zhao@archermind.com>
Thu, 18 Dec 2014 09:52:52 +0000 (17:52 +0800)
Change-Id: I8609936afd44ce49a38089e94284bddd160aaa7d
Signed-off-by: Chengyi Zhao <chengyi1.zhao@archermind.com>
src/connection_profile.c
test/connection_test.c

index cbb970303149e555a82cd45841b2627392de4ec7..0993cf931889f80373cc3b64a0e78467797a3c12 100644 (file)
@@ -903,16 +903,19 @@ EXPORT_API int connection_profile_get_wifi_essid(connection_profile_h profile, c
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       /*
        net_profile_info_t *profile_info = profile;
 
        if (profile_info->profile_type != NET_DEVICE_WIFI)
                return CONNECTION_ERROR_INVALID_PARAMETER;
 
-       *essid = g_strdup(profile_info->ProfileInfo.Wlan.essid);
+       struct connman_service *service =
+                               _connection_libnet_get_service_h(profile);
+       if (service == NULL)
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+
+       *essid = g_strdup(connman_service_get_name(service));
        if (*essid == NULL)
                return CONNECTION_ERROR_OUT_OF_MEMORY;
-        */
 
        return CONNECTION_ERROR_NONE;
 }
index 6f33a9788edd53e294c12d12bde5dc05359226e0..305ee6280018faa56dfb01f449969a0a6a3f818c 100644 (file)
@@ -185,11 +185,14 @@ static bool test_get_user_selected_profile(connection_profile_h *profile, bool s
 
                if (profile_type == CONNECTION_PROFILE_TYPE_WIFI) {
                        char *essid;
-                       connection_profile_get_wifi_essid(profile_h, &essid);
-                       printf("%d. state:[%s], profile name:%s, essid:%s\n",
-                               profile_count, test_print_state(profile_state),
-                               profile_name, (essid)? essid : "");
-                       g_free(essid);
+                       if (connection_profile_get_wifi_essid(profile_h, &essid) != CONNECTION_ERROR_NONE)
+                               printf("Fail to get essid\n");
+                       else {
+                               printf("%d. state:[%s], profile name:%s, essid:%s\n",
+                                       profile_count, test_print_state(profile_state),
+                                       profile_name, (essid) ? essid : "");
+                               g_free(essid);
+                       }
 
                        profile_list[profile_count] = profile_h;
                        profile_count++;