Added CAPI to check for 6Ghz band support 10/298510/1
authorJaehyun Kim <jeik01.kim@samsung.com>
Fri, 8 Sep 2023 06:46:35 +0000 (15:46 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Fri, 8 Sep 2023 06:46:35 +0000 (15:46 +0900)
Change-Id: Ibb229a514d42ce84a4bcc173de24f87e65fba139
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
include/wifi-manager.h [changed mode: 0644->0755]
src/network_dbus.c [changed mode: 0644->0755]
src/network_dbus.h [changed mode: 0644->0755]
src/network_interface.c
src/network_interface.h
src/wifi_internal.c
src/wifi_internal.h
src/wifi_manager.c

old mode 100644 (file)
new mode 100755 (executable)
index 7771739..780169f
@@ -4458,6 +4458,24 @@ int wifi_manager_get_ip_conflict_state(wifi_manager_h wifi,
 int wifi_manager_is_5ghz_band_supported(wifi_manager_h wifi, bool *supported);
 
 /**
+ * @brief Gets whether 6Ghz Wi-Fi band is supported.
+ * @since_tizen 8.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.get
+ * @param[in] wifi          The Wi-Fi handle
+ * @param[out] supported   @c true if 6Ghz Wi-Fi band is supported,
+ *             otherwise   @c false if 6Ghz Wi-Fi band is not supported.
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE                 Successful
+ * @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED      Not initialized
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER    Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED     Operation failed
+ * @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED    Permission Denied
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED        Not supported
+ */
+int wifi_manager_is_6ghz_band_supported(wifi_manager_h wifi, bool *supported);
+
+/**
  * @}
  */
 
old mode 100644 (file)
new mode 100755 (executable)
index 42b96ba..85128ec
@@ -2788,6 +2788,51 @@ int _net_dbus_get_5ghz_support(network_info_s *network_info, gboolean *supported
        return Error;
 }
 
+int _net_dbus_get_6ghz_support(network_info_s *network_info, gboolean *supported)
+{
+       __NETWORK_FUNC_ENTER__;
+
+       net_err_e Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+       GVariant *value = NULL;
+       GVariantIter *iter = NULL;
+       gchar *key = NULL;
+       gboolean is_6ghz_supported = FALSE;
+
+       message = _net_invoke_dbus_method(network_info,
+                       CONNMAN_SERVICE, CONNMAN_WIFI_TECHNOLOGY_PREFIX,
+                       CONNMAN_TECHNOLOGY_INTERFACE, "Get6GHzSupported",
+                       NULL, &Error);
+       if (message == NULL) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get technology properties");
+
+               __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, network_info->interface_name) == 0) {
+                       is_6ghz_supported = g_variant_get_boolean(value);
+                       g_variant_unref(value);
+                       g_free(key);
+                       break;
+               }
+       }
+
+       *supported = is_6ghz_supported;
+
+       WIFI_LOG(WIFI_INFO, "Successfully get 6GHz band supported: %d, ifname: %s",
+                       *supported, network_info->interface_name);
+
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
 int _net_dbus_get_auto_connect_mode(network_info_s *network_info,
                int *connect_mode)
 {
old mode 100644 (file)
new mode 100755 (executable)
index 19f3d93..1ba146d
@@ -202,6 +202,7 @@ int _net_dbus_wifi_set_autoconnect(network_info_s *network_info,
 int _net_dbus_wifi_get_autoconnect(network_info_s *network_info,
                const char *profile_name, gboolean *autoconnect);
 int _net_dbus_get_5ghz_support(network_info_s *network_info, gboolean *supported);
+int _net_dbus_get_6ghz_support(network_info_s *network_info, gboolean *supported);
 int _net_dbus_set_ip_conflict_period(network_info_s *network_info, unsigned int initial_time);
 
 int _net_dbus_dpp_enter_peer_uri(network_info_s *network_info,
index 28ee41b..0fa4bd8 100644 (file)
@@ -2007,6 +2007,25 @@ EXPORT_API int net_wifi_get_5ghz_support(network_info_s *network_info, gboolean
        return NET_ERR_NONE;
 }
 
+EXPORT_API int net_wifi_get_6ghz_support(network_info_s *network_info, gboolean *supported)
+{
+       __NETWORK_CAPI_FUNC_ENTER__;
+
+       net_err_e Error = NET_ERR_NONE;
+
+       if ((Error = _net_dbus_get_6ghz_support(network_info, supported)) != NET_ERR_NONE) {
+               WIFI_LOG(WIFI_ERROR,
+                               "Failed to get 6 GHz band supported. Error [%s]",
+                               _net_print_error(Error));
+
+               __NETWORK_CAPI_FUNC_EXIT__;
+               return Error;
+       }
+
+       __NETWORK_CAPI_FUNC_EXIT__;
+       return NET_ERR_NONE;
+}
+
 EXPORT_API int net_wifi_get_auto_connect_mode(network_info_s *network_info,
                int *connect_mode)
 {
index f0b0a61..74f2907 100644 (file)
@@ -384,6 +384,7 @@ int net_wifi_get_ip_conflict_period(network_info_s *network_info,
 wifi_tech_state_e net_get_technology_state(network_info_s *network_info);
 int net_get_service_state(network_info_s *network_info);
 int net_wifi_get_5ghz_support(network_info_s *network_info, gboolean *supported);
+int net_wifi_get_6ghz_support(network_info_s *network_info, gboolean *supported);
 
 int net_dpp_enter_peer_uri(network_info_s *network_info,
                guint32 peer_id, guint32 own_id, const char *uri);
index 0858865..8dbe608 100644 (file)
@@ -2576,6 +2576,21 @@ int _wifi_get_5ghz_support(wifi_manager_h wifi, bool *supported)
        return rv;
 }
 
+int _wifi_get_6ghz_support(wifi_manager_h wifi, bool *supported)
+{
+       int rv = NET_ERR_NONE;
+       wifi_manager_handle_s *wifi_handle = wifi;
+       gboolean is_supported = FALSE;
+
+       rv = net_wifi_get_6ghz_support(wifi_handle->network_info, &is_supported);
+       rv = __convert_to_ap_error_type(rv);
+
+       if (rv != WIFI_MANAGER_ERROR_NONE)
+               WIFI_LOG(WIFI_ERROR, "Failed to get 6 GHz band supported");
+
+       *supported = is_supported;
+       return rv;
+}
 
 int _wifi_set_ap_auto_connect(wifi_manager_ap_h ap, bool autoconnect)
 {
index 5cef866..9f7ef54 100644 (file)
@@ -524,6 +524,7 @@ typedef enum {
 extern tizen_profile_t _get_tizen_profile();
 int _wifi_get_service_state(wifi_manager_handle_s *wifi_handle);
 int _wifi_get_5ghz_support(wifi_manager_h wifi, bool *supported);
+int _wifi_get_6ghz_support(wifi_manager_h wifi, bool *supported);
 
 /* WIFI DPP */
 
index 6fdd4d2..4394943 100644 (file)
@@ -363,6 +363,28 @@ EXPORT_API int wifi_manager_is_5ghz_band_supported(wifi_manager_h wifi, bool *su
        return rv;
 }
 
+EXPORT_API int wifi_manager_is_6ghz_band_supported(wifi_manager_h wifi, bool *supported)
+{
+       __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 (supported == 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_6ghz_support(wifi, supported);
+
+       __NETWORK_CAPI_FUNC_EXIT__;
+       return rv;
+}
+
 EXPORT_API int wifi_manager_is_activated(wifi_manager_h wifi, bool *activated)
 {
        __NETWORK_CAPI_FUNC_ENTER__;