summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-07-19 20:04:41 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2009-07-19 20:04:41 (GMT)
commite5884a7a2ee413798e41825a3665dd48d2331f3b (patch)
treef1b77885ee1afa0bd044b09626e043f1f3fa0207
parent278061ec538f9781147f50831720da8600ccbbed (diff)
downloadconnman-e5884a7a2ee413798e41825a3665dd48d2331f3b.zip
connman-e5884a7a2ee413798e41825a3665dd48d2331f3b.tar.gz
connman-e5884a7a2ee413798e41825a3665dd48d2331f3b.tar.bz2
Add support for default technology property
-rw-r--r--doc/manager-api.txt5
-rw-r--r--src/connman.h1
-rw-r--r--src/manager.c5
-rw-r--r--src/service.c20
4 files changed, 31 insertions, 0 deletions
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;