summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-03-25 13:04:40 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-03-25 13:04:40 +0100
commite22390fe984f7becb4689d5181a64907fae1d4aa (patch)
treee243fb6928b01bbcfe5371487b449daf8f04a8f3
parentb5a6e00c32bf531e9b35b826b2474654d923a27f (diff)
downloadconnman-e22390fe984f7becb4689d5181a64907fae1d4aa.tar.gz
connman-e22390fe984f7becb4689d5181a64907fae1d4aa.tar.bz2
connman-e22390fe984f7becb4689d5181a64907fae1d4aa.zip
Add support for device address property
-rw-r--r--doc/device-api.txt6
-rw-r--r--src/device.c15
2 files changed, 18 insertions, 3 deletions
diff --git a/doc/device-api.txt b/doc/device-api.txt
index ce50be7b..a45046d9 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 aa6a3977..54a74f19 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;