Execute netlink scan only in softap mode. 20/172920/2 accepted/tizen/unified/20180322.145026 submit/tizen/20180322.015431
authorNiraj Kumar Goit <niraj.g@samsung.com>
Sat, 17 Mar 2018 13:13:10 +0000 (18:43 +0530)
committertaesub kim <taesub.kim@samsung.com>
Thu, 22 Mar 2018 01:43:03 +0000 (10:43 +0900)
Change-Id: Ief6f72edbd6906a783a395c3d660db39624c83df
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
src/wifi_internal.c

index bf9a518..9b60cd0 100755 (executable)
@@ -1895,18 +1895,24 @@ int _wifi_netlink_scan_request(wifi_manager_h wifi, wifi_manager_netlink_scan_h
                wifi_manager_netlink_scan_finished_cb callback, void *user_data)
 {
        int rv;
-       wifi_manager_device_state_e device_state;
+       bool enable;
+       int is_on = 0;
+       int vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP;
        wifi_netlink_scan_s *nl_scan = (wifi_netlink_scan_s *)netlink_scan;
 
-       /** When tethering is enabled wlan interface is available but wifi device is
-       in deactivated state and so to search APs wifi_manager_netlink_scan() API is used.
-       When wifi device is in activated state use wifi_manager_scan() API instead. */
-       rv = _wifi_get_wifi_device_state(&device_state);
-       if (rv == WIFI_MANAGER_ERROR_NONE) {
-               if (WIFI_MANAGER_DEVICE_STATE_ACTIVATED == device_state) {
-                       WIFI_LOG(WIFI_ERROR, "Invalid Operation, Device state activated.");
-                       return WIFI_MANAGER_ERROR_INVALID_OPERATION;
-               }
+       /** When softap mode is enabled wifi device is in deactivated state,
+         so to search APs wifi_manager_netlink_scan() API is used.
+         When wifi device is in activated state use wifi_manager_scan() API instead. */
+       if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &is_on) != 0) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get vconf key of hotspot mode");
+               return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+       }
+
+       enable = is_on & vconf_type ? true : false;
+
+       if (enable == false) {
+               WIFI_LOG(WIFI_ERROR, "SoftAP is not enabled");
+               return WIFI_MANAGER_ERROR_INVALID_OPERATION;
        }
 
        rv = net_netlink_scan_wifi(nl_scan->ssids, nl_scan->vsie);