From: Marcel Holtmann Date: Wed, 25 Mar 2009 12:04:40 +0000 (+0100) Subject: Add support for device address property X-Git-Tag: 0.14~23 X-Git-Url: http://git.maemo.org/git/?p=connman;a=commitdiff_plain;h=e22390fe984f7becb4689d5181a64907fae1d4aa Add support for device address property --- diff --git a/doc/device-api.txt b/doc/device-api.txt index ce50be7..a45046d 100644 --- a/doc/device-api.txt +++ b/doc/device-api.txt @@ -43,7 +43,11 @@ Signals PropertyChanged(string name, variant value) This signal indicates a changed value of the given property. -Properties string Name [readonly] +Properties string Address [readonly] + + The address of the device. + + string Name [readonly] The device name (for example "Wireless" etc.) diff --git a/src/device.c b/src/device.c index aa6a397..54a74f1 100644 --- a/src/device.c +++ b/src/device.c @@ -43,6 +43,7 @@ struct connman_device { connman_uint16_t scan_interval; char *name; char *node; + char *address; char *interface; unsigned int connections; guint scan_timeout; @@ -311,6 +312,10 @@ static DBusMessage *get_properties(DBusConnection *conn, connman_dbus_dict_append_variant(&dict, "Type", DBUS_TYPE_STRING, &str); + if (device->address != NULL) + connman_dbus_dict_append_variant(&dict, "Address", + DBUS_TYPE_STRING, &device->address); + if (device->interface != NULL) connman_dbus_dict_append_variant(&dict, "Interface", DBUS_TYPE_STRING, &device->interface); @@ -804,6 +809,7 @@ static void device_destruct(struct connman_element *element) g_free(device->node); g_free(device->name); + g_free(device->address); g_free(device->interface); g_free(device->last_network); @@ -1383,7 +1389,10 @@ int connman_device_set_string(struct connman_device *device, { DBG("device %p key %s value %s", device, key, value); - if (g_str_equal(key, "Name") == TRUE) { + if (g_str_equal(key, "Address") == TRUE) { + g_free(device->address); + device->address = g_strdup(value); + } else if (g_str_equal(key, "Name") == TRUE) { g_free(device->name); device->name = g_strdup(value); } else if (g_str_equal(key, "Node") == TRUE) { @@ -1406,7 +1415,9 @@ const char *connman_device_get_string(struct connman_device *device, { DBG("device %p key %s", device, key); - if (g_str_equal(key, "Name") == TRUE) + if (g_str_equal(key, "Address") == TRUE) + return device->address; + else if (g_str_equal(key, "Name") == TRUE) return device->name; else if (g_str_equal(key, "Node") == TRUE) return device->node;