Open Source Telephony
 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

* [PATCH 2/2] dundee: return error if there is a connection procedure ongoing
  2013-06-24 16:14 [PATCH 1/2] dundee: export Bluetooth address in as D-Bus property Gustavo Padovan
@ 2013-06-24 16:14 ` 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
  1 sibling, 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: 1704 bytes --]

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

---
 dundee/dbus.c   | 7 +++++++
 dundee/device.c | 3 +++
 dundee/dundee.h | 1 +
 3 files changed, 11 insertions(+)

diff --git a/dundee/dbus.c b/dundee/dbus.c
index 90bd76b..a1fd2f9 100644
--- a/dundee/dbus.c
+++ b/dundee/dbus.c
@@ -44,6 +44,13 @@ DBusMessage *__dundee_error_failed(DBusMessage *msg)
 					"Operation failed");
 }
 
+DBusMessage *__dundee_error_in_progress(DBusMessage *msg)
+{
+	return g_dbus_create_error(msg, DUNDEE_ERROR_INTERFACE
+					".InProgress",
+					"Operation already in progress");
+}
+
 DBusMessage *__dundee_error_timed_out(DBusMessage *msg)
 {
 	return g_dbus_create_error(msg, DUNDEE_ERROR_INTERFACE ".Timedout",
diff --git a/dundee/device.c b/dundee/device.c
index 76fb692..2f4ed56 100644
--- a/dundee/device.c
+++ b/dundee/device.c
@@ -460,6 +460,9 @@ static DBusMessage *set_property_active(struct dundee_device *device,
 	if (dbus_message_iter_get_arg_type(var) != DBUS_TYPE_BOOLEAN)
 		return __dundee_error_invalid_args(msg);
 
+	if (device->pending)
+		return __dundee_error_in_progress(msg);
+
 	dbus_message_iter_get_basic(var, &active);
 
 	device->pending = dbus_message_ref(msg);
diff --git a/dundee/dundee.h b/dundee/dundee.h
index 56c6913..4f4fa76 100644
--- a/dundee/dundee.h
+++ b/dundee/dundee.h
@@ -96,6 +96,7 @@ void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply);
 
 DBusMessage *__dundee_error_invalid_args(DBusMessage *msg);
 DBusMessage *__dundee_error_failed(DBusMessage *msg);
+DBusMessage *__dundee_error_in_progress(DBusMessage *msg);
 DBusMessage *__dundee_error_timed_out(DBusMessage *msg);
 
 
-- 
1.8.1.4


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

* Re: [PATCH 1/2] dundee: export Bluetooth address in as D-Bus property
  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:07 ` Daniel Wagner
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2013-06-29 19:07 UTC (permalink / raw)
  To: ofono

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

Hi Gustavo,

I guess you need to figure out which dundee device belongs to which 
BlueZ device, right? I wouldn't mind that information in the commit message.

I have no problem with exposing this information. Please also sent a 
patch for the documentation. BTW, for HFP we expose the BT MAC via the 
Modem.Serial. Should we be consistent with oFono's API here?

cheers,
daniel


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

* Re: [PATCH 2/2] dundee: return error if there is a connection procedure ongoing
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2013-06-29 19:08 UTC (permalink / raw)
  To: ofono

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

Hi Gustavo,

Please also send a patch updating the documentation for this.

Thanks,
daniel

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

* Re: [PATCH 2/2] dundee: return error if there is a connection procedure ongoing
  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
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Wagner @ 2013-06-29 19:12 UTC (permalink / raw)
  To: ofono

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

Hi Gustavo

On 06/24/2013 06:14 PM, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Forgot to mention, applied :)

cheers,
daniel


^ permalink raw reply	[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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox