summaryrefslogtreecommitdiff
path: root/plugins/wifi.c
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2018-11-06 10:37:10 +0000
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>2018-11-06 10:37:10 +0000
commit271ae828d35c8814e18b3de80cb835513640c0db (patch)
tree6b76406bfcef81ef4e07d77933c01ea4e103745d /plugins/wifi.c
parentae2e73a206fa707a9f490f0e7c51a855ed874cbe (diff)
parent071fe548f78efbfa84ee6841c013713903a7e28c (diff)
downloadconnman-271ae828d35c8814e18b3de80cb835513640c0db.tar.gz
connman-271ae828d35c8814e18b3de80cb835513640c0db.tar.bz2
connman-271ae828d35c8814e18b3de80cb835513640c0db.zip
Merge "[CONNMAN][Change AP's max speed logic]" into tizen
Diffstat (limited to 'plugins/wifi.c')
-rw-r--r--plugins/wifi.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c
index fe753d75..92e70f42 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3426,6 +3426,59 @@ static int network_disconnect(struct connman_network *network)
return err;
}
+#if defined TIZEN_EXT
+static unsigned int automaxspeed_timeout = 0;
+
+static void signalpoll_callback(int result, int maxspeed, void *user_data)
+{
+ struct connman_network *network = user_data;
+
+ if (result != 0) {
+ DBG("Failed to get maxspeed from signalpoll !");
+ return;
+ }
+
+ DBG("maxspeed = %d", maxspeed);
+ if (network)
+ connman_network_set_maxspeed(network, maxspeed);
+}
+
+static int network_signalpoll(struct connman_network *network)
+{
+ struct connman_device *device = connman_network_get_device(network);
+ struct wifi_data *wifi;
+ GSupplicantInterface *interface;
+
+ DBG("network %p", network);
+ wifi = connman_device_get_data(device);
+
+ if (!wifi)
+ return -ENODEV;
+
+ interface = wifi->interface;
+
+ return g_supplicant_interface_signalpoll(interface, signalpoll_callback, network);
+}
+
+static gboolean autosignalpoll_timeout(gpointer data)
+{
+ struct connman_network *network = data;
+ int ret = 0;
+
+ automaxspeed_timeout = 0;
+ ret = network_signalpoll(network);
+
+ if (ret < 0) {
+ DBG("Fail to get max speed !!");
+ return FALSE;
+ }
+
+ automaxspeed_timeout = g_timeout_add_seconds(30, autosignalpoll_timeout, network);
+
+ return FALSE;
+}
+#endif
+
static struct connman_network_driver network_driver = {
.name = "wifi",
.type = CONNMAN_NETWORK_TYPE_WIFI,
@@ -3768,6 +3821,11 @@ static void interface_state(GSupplicantInterface *interface)
CONNMAN_SERVICE_TYPE_WIFI, false);
connman_device_unref(device);
}
+
+ if (!automaxspeed_timeout) {
+ DBG("Going to start signalpoll timer!!");
+ autosignalpoll_timeout(network);
+ }
#else
/* though it should be already stopped: */
stop_autoscan(device);
@@ -3784,6 +3842,15 @@ static void interface_state(GSupplicantInterface *interface)
break;
case G_SUPPLICANT_STATE_DISCONNECTED:
+#if defined TIZEN_EXT
+ connman_network_set_maxspeed(network, 0);
+
+ if (automaxspeed_timeout != 0) {
+ g_source_remove(automaxspeed_timeout);
+ automaxspeed_timeout = 0;
+ DBG("Remove signalpoll timer!!");
+ }
+#endif
/*
* If we're in one of the idle modes, we have
* not started association yet and thus setting