All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] dundee: export Bluetooth address in as D-Bus property
@ 2013-06-24 16:14 Gustavo Padovan
  2013-06-24 16:14 ` [PATCH 2/2] dundee: return error if there is a connection procedure ongoing Gustavo Padovan
  2013-06-29 19:07 ` [PATCH 1/2] dundee: export Bluetooth address in as D-Bus property Daniel Wagner
  0 siblings, 2 replies; 5+ messages in thread
From: Gustavo Padovan @ 2013-06-24 16:14 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3155 bytes --]

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

---
 dundee/bluez4.c |  1 +
 dundee/bluez5.c |  1 +
 dundee/device.c | 24 ++++++++++++++++++++++++
 dundee/dundee.h |  2 ++
 4 files changed, 28 insertions(+)

diff --git a/dundee/bluez4.c b/dundee/bluez4.c
index 58355d3..c9fbee8 100644
--- a/dundee/bluez4.c
+++ b/dundee/bluez4.c
@@ -183,6 +183,7 @@ static int bt_probe(const char *path, const char *dev_addr,
 		goto free;
 
 	dundee_device_set_name(device, bt->name);
+	dundee_device_set_address(device, bt->address);
 
 	if (dundee_device_register(device) < 0) {
 		g_free(device);
diff --git a/dundee/bluez5.c b/dundee/bluez5.c
index 79b5ade..0608e40 100644
--- a/dundee/bluez5.c
+++ b/dundee/bluez5.c
@@ -282,6 +282,7 @@ static struct bluetooth_device *bluetooth_device_register(GDBusProxy *proxy)
 
 	dundee_device_set_data(device, bt_device);
 	dundee_device_set_name(device, bt_device->name);
+	dundee_device_set_address(device, bt_device->address);
 
 	if (dundee_device_register(device) < 0) {
 		g_free(device);
diff --git a/dundee/device.c b/dundee/device.c
index 2d84aaa..76fb692 100644
--- a/dundee/device.c
+++ b/dundee/device.c
@@ -57,6 +57,7 @@ struct dundee_device {
 	GAtChat *chat;
 
 	char *name;
+	char *address;
 	gboolean active;
 	struct ipv4_settings settings;
 
@@ -137,6 +138,9 @@ void __dundee_device_append_properties(struct dundee_device *device,
 	ofono_dbus_dict_append(dict, "Name", DBUS_TYPE_STRING,
 				&device->name);
 
+	ofono_dbus_dict_append(dict, "Address", DBUS_TYPE_STRING,
+				&device->address);
+
 	ofono_dbus_dict_append(dict, "Active", DBUS_TYPE_BOOLEAN,
 				&device->active);
 }
@@ -586,6 +590,7 @@ static void destroy_device(gpointer user)
 
 	g_free(device->path);
 	g_free(device->name);
+	g_free(device->address);
 
 	g_free(device);
 }
@@ -666,6 +671,25 @@ int dundee_device_set_name(struct dundee_device *device, const char *name)
 	return 0;
 }
 
+int dundee_device_set_address(struct dundee_device *device, const char *address)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+
+	DBG("%p address %s", device, address);
+
+	g_free(device->address);
+	device->address = g_strdup(address);
+
+	if (device->registered == FALSE)
+		return 0;
+
+	ofono_dbus_signal_property_changed(conn, device->path,
+					DUNDEE_DEVICE_INTERFACE, "Address",
+					DBUS_TYPE_STRING, &device->address);
+
+	return 0;
+}
+
 static void device_shutdown(gpointer key, gpointer value, gpointer user_data)
 {
 	struct dundee_device *device = value;
diff --git a/dundee/dundee.h b/dundee/dundee.h
index 1889d84..56c6913 100644
--- a/dundee/dundee.h
+++ b/dundee/dundee.h
@@ -137,6 +137,8 @@ void dundee_device_set_data(struct dundee_device *device, void *data);
 void *dundee_device_get_data(struct dundee_device *device);
 
 int dundee_device_set_name(struct dundee_device *device, const char *name);
+int dundee_device_set_address(struct dundee_device *device,
+							const char *address);
 
 typedef void (*dundee_device_foreach_func)(struct dundee_device *device,
 						void *data);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-29 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-24 16:14 [PATCH 1/2] dundee: export Bluetooth address in as D-Bus property Gustavo Padovan
2013-06-24 16:14 ` [PATCH 2/2] dundee: return error if there is a connection procedure ongoing Gustavo Padovan
2013-06-29 19:08   ` Daniel Wagner
2013-06-29 19:12   ` Daniel Wagner
2013-06-29 19:07 ` [PATCH 1/2] dundee: export Bluetooth address in as D-Bus property Daniel Wagner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.