Added CAPI to get the maximum scan SSIDs. 97/196197/7
authorNiraj Kumar Goit <niraj.g@samsung.com>
Wed, 26 Dec 2018 03:27:59 +0000 (08:57 +0530)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 4 Jun 2019 09:02:50 +0000 (09:02 +0000)
Added CAPI to get the maximum number of scan SSIDs
supported by wlan chipset.

Change-Id: I44991b5bde6d6ce1bd8d5f44150fff9957616f7b
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
include/network_dbus.h
include/network_interface.h
include/wifi_internal.h
src/network_dbus.c
src/network_interface.c
src/wifi_internal.c
src/wifi_manager.c

index b7b5cb1..2aac720 100755 (executable)
@@ -115,6 +115,7 @@ int _net_dbus_netlink_scan_request(GSList *nl_scan_list, const char *vsie);
 int _net_dbus_get_passpoint(int *enabled);
 int _net_dbus_set_passpoint(int enable);
 int _net_dbus_multi_scan_request(GSList *multi_scan_list);
+int _net_dbus_get_max_scan_ssids(int *max_scan_ssids);
 
 int _net_dbus_cancel_wps(void);
 int _net_dbus_open_connection_without_ssid();
index 125d4a2..d758b8a 100755 (executable)
@@ -301,6 +301,7 @@ int net_wifi_get_passpoint(int *enable);
 int net_wifi_set_passpoint(int enable);
 int net_wifi_get_scan_state(int *scan_state);
 int net_multi_scan_wifi(GSList *specific_scan_list, gboolean multi_scan_type[]);
+int net_wifi_get_max_scan_ssids(int *max_scan_ssids);
 
 int net_wifi_add_vsie(unsigned int frame_id, const char *vsie_str);
 int net_wifi_get_vsie(unsigned int frame_id, char **vsie_str);
index 4fb99e2..03d5486 100755 (executable)
@@ -335,6 +335,7 @@ int _wifi_specific_scan_set_freq(wifi_manager_specific_scan_h specific_scan,
 int _wifi_start_multi_scan(wifi_manager_h wifi,
                wifi_manager_specific_scan_h specific_scan,
                wifi_manager_scan_finished_cb callback, void *user_data);
+int _wifi_get_max_scan_ssids(int *max_scan_ssids);
 
 /* WIFI Configuration */
 bool _wifi_check_config_validity(wifi_manager_config_h config_h);
index 1631840..0868308 100755 (executable)
@@ -3524,4 +3524,44 @@ int _net_dbus_multi_scan_request(GSList *multi_scan_list)
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
+
+int _net_dbus_get_max_scan_ssids(int *max_scan_ssids)
+{
+       __NETWORK_FUNC_ENTER__;
+
+       net_err_e Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+       GVariant *value = NULL;
+       GVariantIter *iter = NULL;
+       gchar *key = NULL;
+
+       message = _net_invoke_dbus_method(
+                       CONNMAN_SERVICE, CONNMAN_WIFI_TECHNOLOGY_PREFIX,
+                       CONNMAN_TECHNOLOGY_INTERFACE, "GetMaxScanSsid", NULL, &Error);
+       if (message == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get Max scan SSIDs.");
+               *max_scan_ssids = 0;
+
+               __NETWORK_FUNC_EXIT__;
+               return Error;
+       }
+
+       g_variant_get(message, "(a{sv})", &iter);
+
+       while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+               if (g_strcmp0(key, "MaxScanSSID") == 0) {
+                       *max_scan_ssids = g_variant_get_int32(value);
+                       WIFI_LOG(WIFI_INFO, "Successfully get Max scan SSIDs: %d", *max_scan_ssids);
+                       g_variant_unref(value);
+                       g_free(key);
+                       break;
+               }
+       }
+
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
 //LCOV_EXCL_STOP
index 35df3ae..4b63a18 100755 (executable)
@@ -3850,4 +3850,29 @@ int net_get_service_state()
        return _net_get_service_state();
 }
 
+int net_wifi_get_max_scan_ssids(int *max_scan_ssids)
+{
+       __NETWORK_CAPI_FUNC_ENTER__;
+
+       net_err_e Error = NET_ERR_NONE;
+
+       if (NetworkInfo.ref_count < 1) {
+               WIFI_LOG(WIFI_ERROR, "Application is not registered");
+               __NETWORK_CAPI_FUNC_EXIT__;
+               return NET_ERR_APP_NOT_REGISTERED;
+       }
+
+       Error = _net_dbus_get_max_scan_ssids(max_scan_ssids);
+       if (Error != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR,
+                               "Failed to get Max scan SSIDs. Error [%s]",
+                               _net_print_error(Error));
+
+               __NETWORK_CAPI_FUNC_EXIT__;
+               return Error;
+       }
+
+       __NETWORK_CAPI_FUNC_EXIT__;
+       return NET_ERR_NONE;
+}
 //LCOV_EXCL_STOP
index 224d75b..efa1c57 100755 (executable)
@@ -3530,3 +3530,20 @@ int _wifi_get_service_state()
 
        return ret;
 }
+
+int _wifi_get_max_scan_ssids(int *max_scan_ssids)
+{
+       int rv;
+
+       rv = net_wifi_get_max_scan_ssids(max_scan_ssids);
+
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+       } else if (rv != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get driver_max_scan_ssids"); //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+       }
+
+       return WIFI_MANAGER_ERROR_NONE;
+}
index 5e7b40f..29a8c24 100755 (executable)
@@ -1731,6 +1731,27 @@ EXPORT_API int wifi_manager_specific_scan_destroy(wifi_manager_h wifi,
        return WIFI_MANAGER_ERROR_NONE;
 }
 
+EXPORT_API int wifi_manager_specific_scan_get_max_ssid(wifi_manager_h wifi, int *max_scan_ssids)
+{
+       __NETWORK_CAPI_FUNC_ENTER__;
+
+       CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+       int rv;
+
+       RET_ERR_IF_HANDLE_IS_NOT_VALID_OR_NOT_INITIALIZED(wifi, __NETWORK_CAPI_FUNC_EXIT__);
+
+       if (max_scan_ssids == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+               __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+               return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+       }
+
+       rv = _wifi_get_max_scan_ssids(max_scan_ssids);
+
+       __NETWORK_CAPI_FUNC_EXIT__;
+       return rv;
+}
+
 EXPORT_API int wifi_manager_specific_scan_set_ssid(wifi_manager_specific_scan_h specific_scan,
                const char *essid)
 {