summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-06-16 09:44:53 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-06-16 15:26:11 +0200
commit914e310b8b5cb0c1495d4b9479a8e00d2f2caa21 (patch)
tree7d38852d82146461ca580f4348280431e75c0be8
parentc4a2cdcfcae4ee047616bb4455508f22bd1fbb54 (diff)
downloadconnman-914e310b8b5cb0c1495d4b9479a8e00d2f2caa21.tar.gz
connman-914e310b8b5cb0c1495d4b9479a8e00d2f2caa21.tar.bz2
connman-914e310b8b5cb0c1495d4b9479a8e00d2f2caa21.zip
network: Use setter/getters for connman_network_set/get_uint8()
-rw-r--r--include/network.h6
-rw-r--r--src/network.c49
-rw-r--r--src/service.c4
3 files changed, 12 insertions, 47 deletions
diff --git a/include/network.h b/include/network.h
index 1ed6f6ab..b2d491cb 100644
--- a/include/network.h
+++ b/include/network.h
@@ -110,6 +110,7 @@ int connman_network_set_name(struct connman_network *network,
const char *name);
int connman_network_set_strength(struct connman_network *network,
connman_uint8_t strength);
+connman_uint8_t connman_network_get_strength(struct connman_network *network);
int connman_network_set_roaming(struct connman_network *network,
connman_bool_t roaming);
@@ -121,10 +122,7 @@ int connman_network_set_bool(struct connman_network *network,
const char *key, connman_bool_t value);
connman_bool_t connman_network_get_bool(struct connman_network *network,
const char *key);
-int connman_network_set_uint8(struct connman_network *network,
- const char *key, connman_uint8_t value);
-connman_uint8_t connman_network_get_uint8(struct connman_network *network,
- const char *key);
+
int connman_network_set_uint16(struct connman_network *network,
const char *key, connman_uint16_t value);
connman_uint16_t connman_network_get_uint16(struct connman_network *network,
diff --git a/src/network.c b/src/network.c
index 9f906c1b..e6c03f14 100644
--- a/src/network.c
+++ b/src/network.c
@@ -1299,6 +1299,7 @@ int connman_network_set_name(struct connman_network *network,
*
* Set signal strength value for network
*/
+
int connman_network_set_strength(struct connman_network *network,
connman_uint8_t strength)
{
@@ -1306,8 +1307,12 @@ int connman_network_set_strength(struct connman_network *network,
network->strength = strength;
- return connman_element_set_uint8(&network->element,
- "Strength", strength);
+ return 0;
+}
+
+connman_uint8_t connman_network_get_strength(struct connman_network *network)
+{
+ return network->strength;
}
/**
@@ -1324,8 +1329,7 @@ int connman_network_set_roaming(struct connman_network *network,
network->roaming = roaming;
- return connman_element_set_bool(&network->element,
- "Roaming", roaming);
+ return 0;
}
/**
@@ -1480,43 +1484,6 @@ connman_bool_t connman_network_get_bool(struct connman_network *network,
}
/**
- * connman_network_set_uint8:
- * @network: network structure
- * @key: unique identifier
- * @value: integer value
- *
- * Set integer value for specific key
- */
-int connman_network_set_uint8(struct connman_network *network,
- const char *key, connman_uint8_t value)
-{
- DBG("network %p key %s value %d", network, key, value);
-
- if (g_strcmp0(key, "Strength") == 0)
- return connman_network_set_strength(network, value);
-
- return connman_element_set_uint8(&network->element, key, value);
-}
-
-/**
- * connman_network_get_uint8:
- * @network: network structure
- * @key: unique identifier
- *
- * Get integer value for specific key
- */
-connman_uint8_t connman_network_get_uint8(struct connman_network *network,
- const char *key)
-{
- DBG("network %p key %s", network, key);
-
- if (g_str_equal(key, "Strength") == TRUE)
- return network->strength;
-
- return connman_element_get_uint8(&network->element, key);
-}
-
-/**
* connman_network_set_uint16:
* @network: network structure
* @key: unique identifier
diff --git a/src/service.c b/src/service.c
index deb09017..89c751a2 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4703,7 +4703,7 @@ static void update_from_network(struct connman_service *service,
service->hidden = TRUE;
}
- service->strength = connman_network_get_uint8(network, "Strength");
+ service->strength = connman_network_get_strength(network);
service->roaming = connman_network_get_bool(network, "Roaming");
if (service->strength == 0) {
@@ -4850,7 +4850,7 @@ void __connman_service_update_from_network(struct connman_network *network)
if (service->type == CONNMAN_SERVICE_TYPE_WIFI)
service->wps = connman_network_get_bool(network, "WiFi.WPS");
- strength = connman_network_get_uint8(service->network, "Strength");
+ strength = connman_network_get_strength(service->network);
if (strength == service->strength)
goto roaming;