[RFC BlueZ v2 06/13] dbus: Add Device property to org.bluez.Service1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

Expose in D-Bus the object path of the device which the service belongs
to.
---
 src/service.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/service.c b/src/service.c
index 0c9477d..3882b60 100644
--- a/src/service.c
+++ b/src/service.c
@@ -352,6 +352,22 @@ void btd_service_disconnecting_complete(struct btd_service *service, int err)
 		change_state(service, BTD_SERVICE_STATE_CONNECTED, err);
 }
 
+static gboolean service_get_device(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct btd_service *service = data;
+	const char *path = device_get_path(service->device);
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
+
+	return TRUE;
+}
+
+static const GDBusPropertyTable service_properties[] = {
+	{ "Device", "o", service_get_device },
+	{ }
+};
+
 static int service_register(struct btd_service *service, unsigned int id)
 {
 	DBusConnection *dbus_conn = btd_get_dbus_connection();
@@ -363,7 +379,7 @@ static int service_register(struct btd_service *service, unsigned int id)
 
 	if (g_dbus_register_interface(dbus_conn,
 					path, SERVICE_INTERFACE,
-					NULL, NULL, NULL, service,
+					NULL, NULL, service_properties, service,
 					NULL) == FALSE) {
 		g_free(path);
 		error("Unable to register service interface for %s",
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux