Added dbus method to get whether 6GHz band is supported 78/298678/2
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 12 Sep 2023 07:24:59 +0000 (16:24 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 13 Sep 2023 08:50:30 +0000 (17:50 +0900)
Change-Id: Ic7655ec24fa978f7225c0ccd767fb4aa93feb562
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
gsupplicant/gsupplicant.h
gsupplicant/supplicant.c
include/device.h
plugins/wifi.c
src/connman-robot.conf
src/connman.conf
src/device.c
src/technology.c

index 7f8a7a4..f49ad80 100755 (executable)
@@ -427,6 +427,7 @@ void *g_supplicant_interface_get_data(GSupplicantInterface *interface);
 const char *g_supplicant_interface_get_ifname(GSupplicantInterface *interface);
 #if defined TIZEN_EXT
 bool g_supplicant_interface_get_is_5_0_ghz_supported(GSupplicantInterface *interface);
+bool g_supplicant_interface_get_is_6_0_ghz_supported(GSupplicantInterface *interface);
 unsigned char *g_supplicant_interface_get_add_network_bssid(GSupplicantInterface *interface);
 
 typedef void (*GSupplicantMacPolicyCallback) (int result, unsigned int policy, void *user_data);
index c268703..0f44766 100755 (executable)
@@ -265,6 +265,7 @@ struct _GSupplicantInterface {
        struct added_network_information network_info;
 #if defined TIZEN_EXT
        dbus_bool_t is_5_0_Ghz_supported;
+       dbus_bool_t is_6_0_Ghz_supported;
        int disconnect_reason;
 #endif
 #if defined TIZEN_EXT
@@ -1314,6 +1315,11 @@ static void interface_capability(const char *key, DBusMessageIter *iter,
 
                dbus_message_iter_get_basic(iter, &is_5_0_Ghz_supported);
                interface->is_5_0_Ghz_supported = is_5_0_Ghz_supported;
+       } else if (g_strcmp0(key, "Is6GhzSupported") == 0) {
+               dbus_bool_t is_6_0_Ghz_supported;
+
+               dbus_message_iter_get_basic(iter, &is_6_0_Ghz_supported);
+               interface->is_6_0_Ghz_supported = is_6_0_Ghz_supported;
 #endif
        } else
                SUPPLICANT_DBG("key %s type %c",
@@ -1425,11 +1431,19 @@ const char *g_supplicant_interface_get_ifname(GSupplicantInterface *interface)
 bool g_supplicant_interface_get_is_5_0_ghz_supported(GSupplicantInterface *interface)
 {
        if (!interface)
-               return NULL;
+               return false;
 
        return interface->is_5_0_Ghz_supported;
 }
 
+bool g_supplicant_interface_get_is_6_0_ghz_supported(GSupplicantInterface *interface)
+{
+       if (!interface)
+               return false;
+
+       return interface->is_6_0_Ghz_supported;
+}
+
 unsigned char *g_supplicant_interface_get_add_network_bssid(GSupplicantInterface *interface)
 {
        if (!interface)
index 8cc8cce..acbd1d5 100755 (executable)
@@ -118,7 +118,10 @@ void connman_device_set_max_scan_ssids(struct connman_device *device,
 int connman_device_get_max_scan_ssids(struct connman_device *device);
 void connman_device_set_wifi_5ghz_supported(struct connman_device *device,
                                                        bool is_5_0_ghz_supported);
+void connman_device_set_wifi_6ghz_supported(struct connman_device *device,
+                                                       bool is_6_0_ghz_supported);
 bool connman_device_get_wifi_5ghz_supported(struct connman_device *device);
+bool connman_device_get_wifi_6ghz_supported(struct connman_device *device);
 #endif
 int connman_device_remove_network(struct connman_device *device,
                                        struct connman_network *network);
index befc7e2..36e2262 100755 (executable)
@@ -2718,7 +2718,17 @@ static void interface_create_callback(int result,
 
        wifi->interface = interface;
        g_supplicant_interface_set_data(interface, wifi);
+#ifdef TIZEN_EXT
+       if (interface && wifi->device &&
+                       !connman_device_get_wifi_5ghz_supported(wifi->device) &&
+                       !connman_device_get_wifi_6ghz_supported(wifi->device)) {
+               bool is_5_0_ghz_supported = g_supplicant_interface_get_is_5_0_ghz_supported(interface);
+               bool is_6_0_ghz_supported = g_supplicant_interface_get_is_6_0_ghz_supported(interface);
 
+               connman_device_set_wifi_5ghz_supported(wifi->device, is_5_0_ghz_supported);
+               connman_device_set_wifi_6ghz_supported(wifi->device, is_6_0_ghz_supported);
+       }
+#endif
        if (g_supplicant_interface_get_ready(interface)) {
                wifi->interface_ready = true;
                finalize_interface_creation(wifi);
@@ -4485,6 +4495,7 @@ static void interface_added(GSupplicantInterface *interface)
 
 #if defined TIZEN_EXT
        bool is_5_0_ghz_supported = g_supplicant_interface_get_is_5_0_ghz_supported(interface);
+       bool is_6_0_ghz_supported = g_supplicant_interface_get_is_6_0_ghz_supported(interface);
 #endif
 
        struct wifi_data *wifi;
@@ -4512,6 +4523,7 @@ static void interface_added(GSupplicantInterface *interface)
        connman_device_set_powered(wifi->device, true);
 #if defined TIZEN_EXT
        connman_device_set_wifi_5ghz_supported(wifi->device, is_5_0_ghz_supported);
+       connman_device_set_wifi_6ghz_supported(wifi->device, is_6_0_ghz_supported);
        /* Max number of SSIDs supported by wlan chipset that can be scanned */
        int max_scan_ssids = g_supplicant_interface_get_max_scan_ssids(interface);
        connman_device_set_max_scan_ssids(wifi->device, max_scan_ssids);
index b089f40..f123c25 100644 (file)
@@ -15,6 +15,7 @@
                <allow send_destination="net.connman" send_type="signal"/>
                <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="GetScanState" />
                <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="Get5GhzSupported" />
+               <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="Get6GHzSupported" />
                <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="GetMaxScanSsid" />
 
                <allow send_destination="net.connman" send_interface="net.connman.Manager" send_member="GetTechnologies" />
index 2b96713..997c1ea 100644 (file)
@@ -15,6 +15,7 @@
                <allow send_destination="net.connman" send_type="signal"/>
                <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="GetScanState" />
                <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="Get5GhzSupported" />
+               <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="Get6GHzSupported" />
                <allow send_destination="net.connman" send_interface="net.connman.Technology" send_member="GetMaxScanSsid" />
 
                <check send_destination="net.connman" send_interface="net.connman.Manager" send_member="GetTechnologies" privilege="http://tizen.org/privilege/network.get" />
index 5116900..1e3924b 100755 (executable)
@@ -82,6 +82,7 @@ struct connman_device {
                                    */
        int max_scan_ssids;
        bool is_5_0_ghz_supported;
+       bool is_6_0_ghz_supported;
        unsigned int mac_policy;
        unsigned int preassoc_mac_policy;
        unsigned int random_mac_lifetime;
@@ -1281,10 +1282,21 @@ void connman_device_set_wifi_5ghz_supported(struct connman_device *device,
        device->is_5_0_ghz_supported = is_5_0_ghz_supported;
 }
 
+void connman_device_set_wifi_6ghz_supported(struct connman_device *device,
+                                                       bool is_6_0_ghz_supported)
+{
+       device->is_6_0_ghz_supported = is_6_0_ghz_supported;
+}
+
 bool connman_device_get_wifi_5ghz_supported(struct connman_device *device)
 {
        return device->is_5_0_ghz_supported;
 }
+
+bool connman_device_get_wifi_6ghz_supported(struct connman_device *device)
+{
+       return device->is_6_0_ghz_supported;
+}
 #endif
 
 /**
index 44cd116..4cc540b 100644 (file)
@@ -2104,6 +2104,41 @@ static DBusMessage *get_5ghz_supported(DBusConnection *conn, DBusMessage *msg, v
        return reply;
 }
 
+static DBusMessage *get_6ghz_supported(DBusConnection *conn, DBusMessage *msg, void *data)
+{
+       DBusMessage *reply;
+       DBusMessageIter iter, dict;
+       GSList *list;
+       struct connman_technology *technology = data;
+       dbus_bool_t supported = false;
+       const char *ifname = NULL;
+
+       DBG("technology %p", technology);
+
+       reply = dbus_message_new_method_return(msg);
+       if (!reply)
+               return NULL;
+
+       dbus_message_iter_init_append(reply, &iter);
+       connman_dbus_dict_open(&iter, &dict);
+
+       for (list = technology->device_list; list; list = list->next) {
+               struct connman_device *device = list->data;
+
+               supported = connman_device_get_wifi_6ghz_supported(device);
+               ifname = connman_device_get_string(device, "Interface");
+
+               DBG("ifname %s supported : %d", ifname, supported);
+               connman_dbus_dict_append_basic(&dict, ifname,
+                                               DBUS_TYPE_BOOLEAN,
+                                               &supported);
+       }
+
+       connman_dbus_dict_close(&iter, &dict);
+
+       return reply;
+}
+
 static DBusMessage *get_scan_state(DBusConnection *conn, DBusMessage *msg, void *data)
 {
        DBusMessage *reply;
@@ -2882,6 +2917,8 @@ static const GDBusMethodTable technology_methods[] = {
                        get_scan_state) },
        { GDBUS_METHOD("Get5GhzSupported", NULL, GDBUS_ARGS({ "supported", "a{sv}" }),
                        get_5ghz_supported) },
+       { GDBUS_METHOD("Get6GHzSupported", NULL, GDBUS_ARGS({ "supported", "a{sv}" }),
+                       get_6ghz_supported) },
        { GDBUS_METHOD("GetMaxScanSsid", NULL, GDBUS_ARGS({ "maxscanssid", "a{sv}" }),
                        get_max_scan_ssid) },
        { GDBUS_ASYNC_METHOD("SetDevicePower",