Added CAPI to get AP disconnect reason. 52/81752/4 tizen_tv_devel
authorNiraj Kumar Goit <niraj.g@samsung.com>
Thu, 28 Jul 2016 07:12:16 +0000 (12:42 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Fri, 9 Sep 2016 12:20:52 +0000 (05:20 -0700)
Change-Id: Ibde64fb3f510072d5eb9ab5f80e12b61e7734f4c
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
src/net_wifi_ap.c
test/wifi_test.c

index 35595beb7641b1ae30b554291edc712e31d37943..52cf4606186d6941004e4cd4a2159473d4ce30e9 100755 (executable)
@@ -1820,4 +1820,37 @@ EXPORT_API int wifi_ap_set_prefix_length(wifi_ap_h ap, unsigned char prefix_len)
 
        return _wifi_update_ap_info(profile_info);
 }
+
+EXPORT_API int wifi_ap_get_disconnect_reason(wifi_ap_h ap,
+                               wifi_disconnect_reason_e *disconnect_reason)
+{
+
+       CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+       int rv = NET_ERR_NONE;
+
+       if (_wifi_libnet_check_ap_validity(ap) == false || disconnect_reason == NULL) {
+               WIFI_LOG(WIFI_ERROR,"[App<--TizenMW] Wrong Parameter Passed\n");
+               return WIFI_ERROR_INVALID_PARAMETER;
+       }
+
+       net_profile_info_t *profile_info = ap;
+       net_profile_info_t ap_info_local;
+
+       rv = net_get_profile_info(profile_info->ProfileName, &ap_info_local);
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied");
+               return WIFI_ERROR_PERMISSION_DENIED;
+       } else if (rv != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to Get profile_info");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       *disconnect_reason = ap_info_local.ProfileInfo.Wlan.disconnect_reason;
+
+       WIFI_LOG(WIFI_INFO, "[App<--TizenMW]disconnect_reason %d\n",
+                *disconnect_reason);
+
+       return WIFI_ERROR_NONE;
+}
 #endif /* #if defined TIZEN_TV */
index 6bead5d08787216040ca15591286831c2c093530..33f231f10ce5143b6182e0e7559645369f244a30 100755 (executable)
@@ -802,6 +802,9 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
        wifi_encryption_type_e enc_type;
        wifi_eap_type_e eap_type;
        wifi_eap_auth_type_e eap_auth_type;
+#if defined TIZEN_TV
+       wifi_disconnect_reason_e disconnect_reason;
+#endif
        bool bool_value;
        char *ap_name_part = (char*)user_data;
 #if defined TIZEN_TV
@@ -962,7 +965,12 @@ static bool __test_found_print_ap_info_callback(wifi_ap_h ap, void *user_data)
                        printf("WPS supported : %s\n", bool_value ? "TRUE" : "FALSE");
                else
                        printf("Fail to get WPS supported\n");
-
+#if defined TIZEN_TV
+               if (wifi_ap_get_disconnect_reason(ap, &disconnect_reason) == WIFI_ERROR_NONE)
+                       printf("Disconnect Reason of AP : %d\n", disconnect_reason);
+               else
+                       printf("Fail to get Disconnect Reason\n");
+#endif
                if (sec_type != WIFI_SECURITY_TYPE_EAP) {
                        g_free(ap_name);
                        return false;