From: Marcel Holtmann Date: Sun, 19 Jul 2009 20:04:41 +0000 (+0200) Subject: Add support for default technology property X-Git-Tag: 2.0_alpha~3434 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5884a7a2ee413798e41825a3665dd48d2331f3b;p=framework%2Fconnectivity%2Fconnman.git Add support for default technology property --- diff --git a/doc/manager-api.txt b/doc/manager-api.txt index 79761ce..e83ac10 100644 --- a/doc/manager-api.txt +++ b/doc/manager-api.txt @@ -147,6 +147,11 @@ Properties string State [readonly] The list of connected technologies. The strings are the same as the ones from the service type. + string DefaultTechnology [readonly] + + The current connected technology which holds the + default route. + boolean OfflineMode [readwrite] The offline mode indicates the global setting for diff --git a/src/connman.h b/src/connman.h index 407bbe7..b30c893 100644 --- a/src/connman.h +++ b/src/connman.h @@ -255,6 +255,7 @@ int __connman_service_init(void); void __connman_service_cleanup(void); void __connman_service_list(DBusMessageIter *iter); +const char *__connman_service_default(void); void __connman_service_put(struct connman_service *service); diff --git a/src/manager.c b/src/manager.c index 814a063..711fa63 100644 --- a/src/manager.c +++ b/src/manager.c @@ -247,6 +247,11 @@ static DBusMessage *get_properties(DBusConnection *conn, append_enabled_technologies(&dict); append_connected_technologies(&dict); + str = __connman_service_default(); + if (str != NULL) + connman_dbus_dict_append_variant(&dict, "DefaultTechnology", + DBUS_TYPE_STRING, &str); + dbus_message_iter_close_container(&array, &dict); return reply; diff --git a/src/service.c b/src/service.c index 557a968..923a958 100644 --- a/src/service.c +++ b/src/service.c @@ -210,6 +210,26 @@ static enum connman_service_error string2error(const char *error) return CONNMAN_SERVICE_ERROR_UNKNOWN; } +const char *__connman_service_default(void) +{ + struct connman_service *service; + GSequenceIter *iter; + + iter = g_sequence_get_begin_iter(service_list); + + if (g_sequence_iter_is_end(iter) == TRUE) + return ""; + + service = g_sequence_get(iter); + if (service == NULL) + return ""; + + if (service->state != CONNMAN_SERVICE_STATE_READY) + return ""; + + return type2string(service->type); +} + static void state_changed(struct connman_service *service) { DBusMessage *signal;