From: Abhishek Sansanwal Date: Thu, 13 Dec 2018 05:21:58 +0000 (+0530) Subject: Added dbus method to get whether 5Ghz band is supported X-Git-Tag: accepted/tizen/unified/20181218.063104^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fconnman.git;a=commitdiff_plain;h=48e25ec7f60ffcba067708732298fd85a2b3ed47 Added dbus method to get whether 5Ghz band is supported Change-Id: Ib3b189615648a35aa876eab3e3f61c47ac0c1e68 Signed-off-by: Abhishek Sansanwal --- diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h index 597fe75..c3ef5a0 100644 --- a/gsupplicant/gsupplicant.h +++ b/gsupplicant/gsupplicant.h @@ -368,6 +368,9 @@ void g_supplicant_interface_set_data(GSupplicantInterface *interface, void *data); 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); +#endif const char *g_supplicant_interface_get_driver(GSupplicantInterface *interface); GSupplicantState g_supplicant_interface_get_state(GSupplicantInterface *interface); const char *g_supplicant_interface_get_wps_key(GSupplicantInterface *interface); diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index e7dfcb2..bafe478 100644 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -214,6 +214,7 @@ struct _GSupplicantInterface { GSupplicantNetwork *current_network; struct added_network_information network_info; #if defined TIZEN_EXT + dbus_bool_t is_5_0_Ghz_supported; int disconnect_reason; #endif #if defined TIZEN_EXT_WIFI_MESH @@ -1113,7 +1114,13 @@ static void interface_capability(const char *key, DBusMessageIter *iter, if (max_scan_ssid < 2) max_scan_ssid = 0; interface->max_scan_ssids = max_scan_ssid; +#if defined TIZEN_EXT + } else if (g_strcmp0(key, "Is5GhzSupported") == 0) { + dbus_bool_t is_5_0_Ghz_supported; + dbus_message_iter_get_basic(iter, &is_5_0_Ghz_supported); + interface->is_5_0_Ghz_supported = is_5_0_Ghz_supported; +#endif } else SUPPLICANT_DBG("key %s type %c", key, dbus_message_iter_get_arg_type(iter)); @@ -1202,6 +1209,16 @@ const char *g_supplicant_interface_get_ifname(GSupplicantInterface *interface) return interface->ifname; } +#if defined TIZEN_EXT +bool g_supplicant_interface_get_is_5_0_ghz_supported(GSupplicantInterface *interface) +{ + if (!interface) + return NULL; + + return interface->is_5_0_Ghz_supported; +} +#endif + const char *g_supplicant_interface_get_driver(GSupplicantInterface *interface) { if (!interface) diff --git a/include/technology.h b/include/technology.h index 73cd8e7..29cdddf 100755 --- a/include/technology.h +++ b/include/technology.h @@ -83,6 +83,10 @@ struct connman_technology_driver { int connman_technology_driver_register(struct connman_technology_driver *driver); void connman_technology_driver_unregister(struct connman_technology_driver *driver); +#if defined TIZEN_EXT +void connman_techonology_wifi_set_5ghz_supported(struct connman_technology *technology, + bool is_5_0_Ghz_supported); +#endif #ifdef __cplusplus } diff --git a/plugins/wifi.c b/plugins/wifi.c index 33425e0..71727e6 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -3566,6 +3566,10 @@ static void interface_added(GSupplicantInterface *interface) { const char *ifname = g_supplicant_interface_get_ifname(interface); const char *driver = g_supplicant_interface_get_driver(interface); +#if defined TIZEN_EXT + bool is_5_0_ghz_supported = g_supplicant_interface_get_is_5_0_ghz_supported(interface); +#endif + struct wifi_data *wifi; wifi = g_supplicant_interface_get_data(interface); @@ -3589,6 +3593,9 @@ static void interface_added(GSupplicantInterface *interface) } connman_device_set_powered(wifi->device, true); +#if defined TIZEN_EXT + connman_techonology_wifi_set_5ghz_supported(wifi_technology, is_5_0_ghz_supported); +#endif } static bool is_idle(struct wifi_data *wifi) diff --git a/src/connman.conf b/src/connman.conf index e092235..cd9eefb 100644 --- a/src/connman.conf +++ b/src/connman.conf @@ -14,6 +14,7 @@ + diff --git a/src/technology.c b/src/technology.c index 6604599..05ec0c0 100644 --- a/src/technology.c +++ b/src/technology.c @@ -98,6 +98,9 @@ struct connman_technology { #if defined TIZEN_EXT_WIFI_MESH DBusMessage *mesh_dbus_msg; #endif +#if defined TIZEN_EXT + bool is_5_0_ghz_supported; +#endif }; static GSList *driver_list = NULL; @@ -394,6 +397,16 @@ bool connman_technology_get_wifi_tethering(const char **ssid, return true; } +#if defined TIZEN_EXT +void connman_techonology_wifi_set_5ghz_supported(struct connman_technology *wifi_technology, + bool is_5_0_ghz_supported) +{ + DBG(""); + + wifi_technology->is_5_0_ghz_supported = is_5_0_ghz_supported; +} +#endif + static void free_rfkill(gpointer data) { struct connman_rfkill *rfkill = data; @@ -1410,6 +1423,33 @@ static DBusMessage *specific_scan(DBusConnection *conn, DBusMessage *msg, void * return NULL; } +#if defined TIZEN_EXT +static DBusMessage *get_5ghz_supported(DBusConnection *conn, DBusMessage *msg, void *data) +{ + DBusMessage *reply; + DBusMessageIter iter, dict; + struct connman_technology *technology = data; + dbus_bool_t supported = technology->is_5_0_ghz_supported; + + 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); + connman_dbus_dict_append_basic(&dict, "Is5GhzSupported", + DBUS_TYPE_BOOLEAN, + &supported); + + connman_dbus_dict_close(&iter, &dict); + + return reply; +} +#endif + static DBusMessage *get_scan_state(DBusConnection *conn, DBusMessage *msg, void *data) { DBusMessage *reply; @@ -1923,6 +1963,8 @@ static const GDBusMethodTable technology_methods[] = { NULL, specific_scan) }, { GDBUS_METHOD("GetScanState", NULL, GDBUS_ARGS({ "scan_state", "a{sv}" }), get_scan_state) }, + { GDBUS_METHOD("Get5GhzSupported", NULL, GDBUS_ARGS({ "supported", "a{sv}" }), + get_5ghz_supported) }, #endif #if defined TIZEN_EXT_WIFI_MESH { GDBUS_ASYNC_METHOD("MeshCommands",