summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNishant Chaprana <n.chaprana@samsung.com>2019-04-30 17:52:29 +0530
committerNishant Chaprana <n.chaprana@samsung.com>2019-08-27 10:04:53 +0530
commit99b2c81f38ae73c1f31b8f310f4445dcab534fe8 (patch)
treeae32a8743d0fb8137a81d0113ae3aae8ea18c8c1
parentd9c4473ac7a38978f0c8922ddb72849320faab75 (diff)
downloadconnman-99b2c81f38ae73c1f31b8f310f4445dcab534fe8.tar.gz
connman-99b2c81f38ae73c1f31b8f310f4445dcab534fe8.tar.bz2
connman-99b2c81f38ae73c1f31b8f310f4445dcab534fe8.zip
Update RSSI/Strength of connected service using SignalPoll event
This patch reduced the SignalPoll monitor from 30 second to 10 second frequency. This patch also extracts already available parameter strength/RSSI in SignalPoll and update connected service's RSSI/Strength accordingly. Change-Id: Ie9bbb21bf50ad0b8c72e3ca2fc9f7f6500c77f23 Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
-rw-r--r--gsupplicant/gsupplicant.h4
-rw-r--r--gsupplicant/supplicant.c9
-rw-r--r--plugins/wifi.c13
-rw-r--r--src/connman.h3
-rwxr-xr-xsrc/network.c3
-rw-r--r--src/service.c24
6 files changed, 50 insertions, 6 deletions
diff --git a/gsupplicant/gsupplicant.h b/gsupplicant/gsupplicant.h
index b9e99a44..0fbb4d44 100644
--- a/gsupplicant/gsupplicant.h
+++ b/gsupplicant/gsupplicant.h
@@ -297,8 +297,8 @@ typedef void (*GSupplicantInterfaceCallback) (int result,
void *user_data);
#if defined TIZEN_EXT
-typedef void (*GSupplicantMaxSpeedCallback) (int result,
- int maxspeed, void *user_data);
+typedef void (*GSupplicantMaxSpeedCallback) (int result, int maxspeed,
+ uint8_t strength, void *user_data);
#endif
void g_supplicant_interface_cancel(GSupplicantInterface *interface);
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 66644c8b..d27fe0db 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -5506,6 +5506,7 @@ static void interface_signalpoll_result(const char *error,
struct interface_signalpoll_data *data = user_data;
int err = 0;
dbus_int32_t maxspeed = 0;
+ unsigned char strength = 0;
DBusMessageIter sub_iter, dict;
if (error) {
@@ -5534,13 +5535,19 @@ static void interface_signalpoll_result(const char *error,
SUPPLICANT_DBG("linkspeed = %d", maxspeed);
break;
}
+ case DBUS_TYPE_BYTE:
+ if (g_strcmp0(key, "rssi") == 0) {
+ dbus_message_iter_get_basic(&value, &strength);
+ SUPPLICANT_DBG("Strength = %d", strength);
+ break;
+ }
}
dbus_message_iter_next(&dict);
}
out:
if(data->callback)
- data->callback(err, maxspeed, data->user_data);
+ data->callback(err, maxspeed, strength, data->user_data);
g_free(data->path);
dbus_free(data);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 8f994230..4204c927 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3619,7 +3619,8 @@ static void set_connection_mode(struct connman_network *network,
connman_network_set_connection_mode(network, conn_mode);
}
-static void signalpoll_callback(int result, int maxspeed, void *user_data)
+static void signalpoll_callback(int result, int maxspeed, uint8_t strength,
+ void *user_data)
{
struct connman_network *network = user_data;
@@ -3628,8 +3629,13 @@ static void signalpoll_callback(int result, int maxspeed, void *user_data)
return;
}
- DBG("maxspeed = %d", maxspeed);
+ strength += 120;
+ if (strength > 100)
+ strength = 100;
+
+ DBG("maxspeed = %d, strength = %d", maxspeed, strength);
if (network) {
+ connman_network_set_strength(network, strength);
connman_network_set_maxspeed(network, maxspeed);
set_connection_mode(network, maxspeed);
}
@@ -4034,7 +4040,7 @@ static void interface_state(GSupplicantInterface *interface)
if (ret < 0)
DBG("Fail to get max speed !!");
else
- wifi->automaxspeed_timeout = g_timeout_add_seconds(30, autosignalpoll_timeout, wifi);
+ wifi->automaxspeed_timeout = g_timeout_add_seconds(10, autosignalpoll_timeout, wifi);
}
g_hash_table_remove_all(failed_bssids);
@@ -4055,6 +4061,7 @@ static void interface_state(GSupplicantInterface *interface)
case G_SUPPLICANT_STATE_DISCONNECTED:
#if defined TIZEN_EXT
+ connman_network_set_strength(network, 0);
connman_network_set_maxspeed(network, 0);
if (wifi->automaxspeed_timeout != 0) {
diff --git a/src/connman.h b/src/connman.h
index 610f63bc..bb4c0e59 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -724,6 +724,9 @@ struct connman_service *__connman_service_create_from_network(struct connman_net
struct connman_service *__connman_service_create_from_provider(struct connman_provider *provider);
bool __connman_service_index_is_default(int index);
struct connman_service *__connman_service_get_default(void);
+#if defined TIZEN_EXT
+void __connman_service_notify_strength_changed(struct connman_network *network);
+#endif
void __connman_service_update_from_network(struct connman_network *network);
void __connman_service_remove_from_network(struct connman_network *network);
void __connman_service_read_ip4config(struct connman_service *service);
diff --git a/src/network.c b/src/network.c
index 4a53bba3..9e5d9619 100755
--- a/src/network.c
+++ b/src/network.c
@@ -2243,6 +2243,9 @@ int connman_network_set_strength(struct connman_network *network,
uint8_t strength)
{
network->strength = strength;
+#if defined TIZEN_EXT
+ __connman_service_notify_strength_changed(network);
+#endif
return 0;
}
diff --git a/src/service.c b/src/service.c
index 6331ae41..85bcc318 100644
--- a/src/service.c
+++ b/src/service.c
@@ -9282,6 +9282,30 @@ struct connman_service * __connman_service_create_from_network(struct connman_ne
return service;
}
+#if defined TIZEN_EXT
+void __connman_service_notify_strength_changed(struct connman_network *network)
+{
+ struct connman_service *service;
+ uint8_t strength = 0;
+
+ service = connman_service_lookup_from_network(network);
+ if (!service)
+ return;
+
+ if (!service->network)
+ return;
+
+ strength = connman_network_get_strength(service->network);
+ if (strength == service->strength)
+ return;
+
+ service->strength = strength;
+ DBG("Strength %d", strength);
+ strength_changed(service);
+ service_list_sort();
+}
+#endif
+
void __connman_service_update_from_network(struct connman_network *network)
{
bool need_sort = false;