From: Marcel Holtmann Date: Sat, 19 Sep 2009 11:14:16 +0000 (-0700) Subject: Add support for network roaming property X-Git-Tag: 2.0_alpha~3217 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3890dce1fbfaeb6e0e339f120dcc2bac5ed5dfcb;p=framework%2Fconnectivity%2Fconnman.git Add support for network roaming property --- diff --git a/include/network.h b/include/network.h index b892d2b..3558d5a 100644 --- a/include/network.h +++ b/include/network.h @@ -89,11 +89,17 @@ 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); +int connman_network_set_roaming(struct connman_network *network, + connman_bool_t roaming); int connman_network_set_string(struct connman_network *network, const char *key, const char *value); const char *connman_network_get_string(struct connman_network *network, const char *key); +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, diff --git a/src/network.c b/src/network.c index b7cc82f..7e842f8 100644 --- a/src/network.c +++ b/src/network.c @@ -39,6 +39,7 @@ struct connman_network { connman_bool_t secondary; connman_bool_t available; connman_bool_t connected; + connman_bool_t roaming; connman_bool_t hidden; connman_uint8_t strength; connman_uint16_t frequency; @@ -964,6 +965,24 @@ int connman_network_set_strength(struct connman_network *network, } /** + * connman_network_set_roaming: + * @network: network structure + * @roaming: roaming state + * + * Set roaming state for network + */ +int connman_network_set_roaming(struct connman_network *network, + connman_bool_t roaming) +{ + DBG("network %p roaming %d", network, roaming); + + network->roaming = roaming; + + return connman_element_set_bool(&network->element, + "Roaming", roaming); +} + +/** * connman_network_set_string: * @network: network structure * @key: unique identifier @@ -1028,6 +1047,43 @@ const char *connman_network_get_string(struct connman_network *network, } /** + * connman_network_set_bool: + * @network: network structure + * @key: unique identifier + * @value: boolean value + * + * Set boolean value for specific key + */ +int connman_network_set_bool(struct connman_network *network, + const char *key, connman_bool_t value) +{ + DBG("network %p key %s value %d", network, key, value); + + if (g_strcmp0(key, "Roaming") == 0) + return connman_network_set_roaming(network, value); + + return connman_element_set_bool(&network->element, key, value); +} + +/** + * connman_network_get_bool: + * @network: network structure + * @key: unique identifier + * + * Get boolean value for specific key + */ +connman_bool_t connman_network_get_bool(struct connman_network *network, + const char *key) +{ + DBG("network %p key %s", network, key); + + if (g_str_equal(key, "Roaming") == TRUE) + return network->roaming; + + return connman_element_get_bool(&network->element, key); +} + +/** * connman_network_set_uint8: * @network: network structure * @key: unique identifier