This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 doc/connection-api.txt |   12 ++++++++++++
 src/connection.c       |   11 +++++++++++
 src/connman.h          |    3 +++
 src/element.c          |   24 ++++++++++++++++++++++++
 4 files changed, 50 insertions(+), 0 deletions(-)

New commits:
commit d3a2ba795b3c73199a643eb88b1d98e3b0dafed7
Author: Marcel Holtmann <[email protected]>
Date:   Sat Jan 10 02:36:34 2009 +0100

    Add Device and Network property to connection interface


Diff in this email is a maximum of 400 lines.
diff --git a/doc/connection-api.txt b/doc/connection-api.txt
index a0c97da..8e2e8bc 100644
--- a/doc/connection-api.txt
+++ b/doc/connection-api.txt
@@ -39,6 +39,18 @@ Properties   string Type [readonly]
                        Indicates if it is a default connection. It is
                        possible to have multiple default connections.
 
+               object Device [readonly]
+
+                       The object path of the device this connection has
+                       been established with.
+
+               object Network [readonly]
+
+                       The object path of the network this connection
+                       belongs to.
+
+                       This property is optional and not always present.
+
                string IPv4.Method [readonly]
 
                        Indicates the way how the IPv4 settings were
diff --git a/src/connection.c b/src/connection.c
index ad38147..980b770 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -206,6 +206,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
        DBusMessage *reply;
        DBusMessageIter array, dict;
        connman_uint8_t strength = 0;
+       const char *device, *network;
        const char *type = NULL, *method = NULL;
        const char *address = NULL, *netmask = NULL, *gateway = NULL;
 
@@ -244,6 +245,16 @@ static DBusMessage *get_properties(DBusConnection *conn,
        connman_dbus_dict_append_variant(&dict, "Default",
                                        DBUS_TYPE_BOOLEAN, &element->enabled);
 
+       device = __connman_element_get_device(element);
+       if (device != NULL)
+               connman_dbus_dict_append_variant(&dict, "Device",
+                                       DBUS_TYPE_OBJECT_PATH, &device);
+
+       network = __connman_element_get_network(element);
+       if (network != NULL)
+               connman_dbus_dict_append_variant(&dict, "Network",
+                                       DBUS_TYPE_OBJECT_PATH, &network);
+
        connman_element_get_value(element,
                                CONNMAN_PROPERTY_ID_IPV4_METHOD, &method);
 
diff --git a/src/connman.h b/src/connman.h
index cca7ea8..545183e 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -117,6 +117,9 @@ void __connman_element_list(struct connman_element *element,
 int __connman_element_count(struct connman_element *element,
                                        enum connman_element_type type);
 
+const char *__connman_element_get_device(struct connman_element *element);
+const char *__connman_element_get_network(struct connman_element *element);
+
 const char *__connman_element_type2string(enum connman_element_type type);
 
 static inline void __connman_element_lock(struct connman_element *element)
diff --git a/src/element.c b/src/element.c
index fb11f79..2baeb1a 100644
--- a/src/element.c
+++ b/src/element.c
@@ -427,6 +427,30 @@ int __connman_element_count(struct connman_element 
*element,
        return data.count;
 }
 
+const char *__connman_element_get_device(struct connman_element *element)
+{
+       if (element->type == CONNMAN_ELEMENT_TYPE_DEVICE &&
+                                               element->device != NULL)
+               return element->path;
+
+       if (element->parent == NULL)
+               return NULL;
+
+       return __connman_element_get_device(element->parent);
+}
+
+const char *__connman_element_get_network(struct connman_element *element)
+{
+       if (element->type == CONNMAN_ELEMENT_TYPE_NETWORK &&
+                                               element->network != NULL)
+               return element->path;
+
+       if (element->parent == NULL)
+               return NULL;
+
+       return __connman_element_get_network(element->parent);
+}
+
 static gint compare_priority(gconstpointer a, gconstpointer b)
 {
        const struct connman_driver *driver1 = a;
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to