From: Marcel Holtmann Date: Fri, 17 Jul 2009 01:40:17 +0000 (+0200) Subject: If the WiFi signal strength is below 20 then don't show network X-Git-Tag: 2.0_alpha~3494 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a35547571675998c5723d224f28d8d034303d0d0;p=framework%2Fconnectivity%2Fconnman.git If the WiFi signal strength is below 20 then don't show network --- diff --git a/src/connman.h b/src/connman.h index d717664..6dd57cc 100644 --- a/src/connman.h +++ b/src/connman.h @@ -237,6 +237,7 @@ connman_bool_t __connman_network_has_driver(struct connman_network *network); const char *__connman_network_get_type(struct connman_network *network); const char *__connman_network_get_group(struct connman_network *network); const char *__connman_network_get_ident(struct connman_network *network); +connman_bool_t __connman_network_get_weakness(struct connman_network *network); int __connman_profile_add_network(struct connman_network *network); int __connman_profile_remove_network(struct connman_network *network); diff --git a/src/network.c b/src/network.c index ce621e2..ea4d8bc 100644 --- a/src/network.c +++ b/src/network.c @@ -651,6 +651,29 @@ const char *__connman_network_get_ident(struct connman_network *network) return __connman_device_get_ident(network->device); } +connman_bool_t __connman_network_get_weakness(struct connman_network *network) +{ + if (network->secondary == TRUE) + return FALSE; + + switch (network->type) { + case CONNMAN_NETWORK_TYPE_UNKNOWN: + case CONNMAN_NETWORK_TYPE_VENDOR: + case CONNMAN_NETWORK_TYPE_BLUETOOTH_PAN: + case CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN: + case CONNMAN_NETWORK_TYPE_MBM: + case CONNMAN_NETWORK_TYPE_HSO: + case CONNMAN_NETWORK_TYPE_WIMAX: + break; + case CONNMAN_NETWORK_TYPE_WIFI: + if (network->strength < 20) + return TRUE; + break; + } + + return FALSE; +} + /** * connman_network_set_available: * @network: network structure diff --git a/src/service.c b/src/service.c index 092ca85..15a6447 100644 --- a/src/service.c +++ b/src/service.c @@ -1575,6 +1575,9 @@ struct connman_service *__connman_service_create_from_network(struct connman_net if (group == NULL) return NULL; + if (__connman_network_get_weakness(network) == TRUE) + return NULL; + name = g_strdup_printf("%s_%s_%s", __connman_network_get_type(network), ident, group);