summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 79761ce3..e83ac10d 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 407bbe75..b30c893a 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 814a063a..711fa631 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 557a9689..923a9585 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;