From: Patrik Flykt Date: Fri, 20 Jan 2012 14:30:38 +0000 (+0200) Subject: technology: Add 'Connected' Technology property X-Git-Tag: 0.79~147 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=824447883b5136781bcec309b6adfae6c2c7b6b3;p=platform%2Fupstream%2Fconnman.git technology: Add 'Connected' Technology property Set Technology property 'Connected' to true if at least one service for the Technology is connected; false otherwise. --- diff --git a/src/connman.h b/src/connman.h index 158f51f..8e725f4 100644 --- a/src/connman.h +++ b/src/connman.h @@ -378,6 +378,8 @@ int __connman_technology_enabled(enum connman_service_type type); int __connman_technology_disabled(enum connman_service_type type); int __connman_technology_set_offlinemode(connman_bool_t offlinemode); connman_bool_t __connman_technology_get_offlinemode(void); +void __connman_technology_set_connected(enum connman_service_type type, + connman_bool_t connected); int __connman_technology_add_rfkill(unsigned int index, enum connman_service_type type, diff --git a/src/notifier.c b/src/notifier.c index cb6af85..91b52ea 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -123,6 +123,7 @@ static void technology_connected(enum connman_service_type type, { DBG("type %d connected %d", type, connected); + __connman_technology_set_connected(type, connected); state_changed(connected); } diff --git a/src/technology.c b/src/technology.c index 1f3cdf5..3cf9332 100644 --- a/src/technology.c +++ b/src/technology.c @@ -59,6 +59,7 @@ struct connman_technology { GSList *device_list; int enabled; char *regdom; + connman_bool_t connected; connman_bool_t tethering; char *tethering_ident; @@ -421,6 +422,10 @@ static void append_properties(DBusMessageIter *iter, connman_dbus_dict_append_basic(&dict, "Powered", DBUS_TYPE_BOOLEAN, &powered); + connman_dbus_dict_append_basic(&dict, "Connected", + DBUS_TYPE_BOOLEAN, + &technology->connected); + connman_dbus_dict_append_basic(&dict, "Tethering", DBUS_TYPE_BOOLEAN, &technology->tethering); @@ -1085,6 +1090,24 @@ int __connman_technology_set_offlinemode(connman_bool_t offlinemode) return err; } +void __connman_technology_set_connected(enum connman_service_type type, + connman_bool_t connected) +{ + struct connman_technology *technology; + + technology = technology_find(type); + if (technology == NULL) + return; + + DBG("technology %p connected %d", technology, connected); + + technology->connected = connected; + + connman_dbus_property_changed_basic(technology->path, + CONNMAN_TECHNOLOGY_INTERFACE, "Connected", + DBUS_TYPE_BOOLEAN, &connected); +} + int __connman_technology_add_rfkill(unsigned int index, enum connman_service_type type, connman_bool_t softblock,