All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input
@ 2012-10-18 22:03 Lucas De Marchi
  2012-10-18 22:03 ` [RFC 1/6] input: Fix not sending PropertiesChanged signal Lucas De Marchi
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

Here is a patch set to convert SAP and HEALTH profiles to DBus.Properties. It's
only compile-tested.

Patch 0002 contains a fix to sap server. Unless I'm blind, GetProperties()
callback was doing random things using that pointer.

Patch 0001 adds the missing update to PropertiesChanged signal in INPUT profile.

Finally last patch convert HEALTH's documentation to a format similar to what
we have in other profiles.

Lucas De Marchi (6):
  input: Fix not sending PropertiesChanged signal
  sap: Fix usage of wrong struct in get_properties()
  sap: Convert to DBus.Properties
  health: Convert HealthChannel to DBus.Properties
  health: Convert HealthDevice to DBus.Properties
  doc: Update Health to BlueZ 5

 doc/health-api.txt      | 198 ++++++++++++++++++++++++------------------------
 doc/sap-api.txt         |  12 ---
 profiles/health/hdp.c   | 124 +++++++++++++++---------------
 profiles/input/device.c |  13 +---
 profiles/sap/server.c   |  61 +++++----------
 5 files changed, 184 insertions(+), 224 deletions(-)

-- 
1.7.12.3


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

* [RFC 1/6] input: Fix not sending PropertiesChanged signal
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
@ 2012-10-18 22:03 ` Lucas De Marchi
  2012-10-18 22:03 ` [RFC 2/6] sap: Fix usage of wrong struct in get_properties() Lucas De Marchi
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

---
 profiles/input/device.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 997235b..9dd8002 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -148,7 +148,6 @@ static void input_device_free(struct input_device *idev)
 static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
 {
 	struct input_device *idev = data;
-	gboolean connected = FALSE;
 	char address[18];
 
 	ba2str(&idev->dst, address);
@@ -161,9 +160,8 @@ static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data
 	if ((cond & (G_IO_HUP | G_IO_ERR)) && idev->ctrl_watch)
 		g_io_channel_shutdown(chan, TRUE, NULL);
 
-	emit_property_changed(idev->path,
-				INPUT_DEVICE_INTERFACE, "Connected",
-				DBUS_TYPE_BOOLEAN, &connected);
+	g_dbus_emit_property_changed(idev->conn, idev->path,
+					INPUT_DEVICE_INTERFACE, "Connected");
 
 	device_remove_disconnect_watch(idev->device, idev->dc_id);
 	idev->dc_id = 0;
@@ -496,7 +494,6 @@ static void disconnect_cb(struct btd_device *device, gboolean removal,
 
 static int input_device_connected(struct input_device *idev)
 {
-	dbus_bool_t connected;
 	int err;
 
 	if (idev->intr_io == NULL || idev->ctrl_io == NULL)
@@ -506,10 +503,8 @@ static int input_device_connected(struct input_device *idev)
 	if (err < 0)
 		return err;
 
-	connected = TRUE;
-	emit_property_changed(idev->path,
-				INPUT_DEVICE_INTERFACE, "Connected",
-				DBUS_TYPE_BOOLEAN, &connected);
+	g_dbus_emit_property_changed(idev->conn, idev->path,
+					INPUT_DEVICE_INTERFACE, "Connected");
 
 	idev->dc_id = device_add_disconnect_watch(idev->device, disconnect_cb,
 							idev, NULL);
-- 
1.7.12.3


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

* [RFC 2/6] sap: Fix usage of wrong struct in get_properties()
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
  2012-10-18 22:03 ` [RFC 1/6] input: Fix not sending PropertiesChanged signal Lucas De Marchi
@ 2012-10-18 22:03 ` Lucas De Marchi
  2012-10-18 22:03 ` [RFC 3/6] sap: Convert to DBus.Properties Lucas De Marchi
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

---
 profiles/sap/server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index 9a7cb72..cbe00b9 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -1294,7 +1294,8 @@ static DBusMessage *disconnect(DBusConnection *conn, DBusMessage *msg,
 static DBusMessage *get_properties(DBusConnection *c,
 				DBusMessage *msg, void *data)
 {
-	struct sap_connection *conn = data;
+	struct sap_server *server = data;
+	struct sap_connection *conn = server->conn;
 	DBusMessage *reply;
 	DBusMessageIter iter;
 	DBusMessageIter dict;
-- 
1.7.12.3


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

* [RFC 3/6] sap: Convert to DBus.Properties
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
  2012-10-18 22:03 ` [RFC 1/6] input: Fix not sending PropertiesChanged signal Lucas De Marchi
  2012-10-18 22:03 ` [RFC 2/6] sap: Fix usage of wrong struct in get_properties() Lucas De Marchi
@ 2012-10-18 22:03 ` Lucas De Marchi
  2012-10-18 22:03 ` [RFC 4/6] health: Convert HealthChannel " Lucas De Marchi
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

---
 doc/sap-api.txt       | 12 -----------
 profiles/sap/server.c | 58 ++++++++++++++++-----------------------------------
 2 files changed, 18 insertions(+), 52 deletions(-)

diff --git a/doc/sap-api.txt b/doc/sap-api.txt
index b8b7253..92bdd9e 100644
--- a/doc/sap-api.txt
+++ b/doc/sap-api.txt
@@ -17,18 +17,6 @@ Methods		void Disconnect()
 
 			Possible errors: org.bluez.Error.Failed
 
-		dict GetProperties()
-
-			Return all properties for the interface. See the
-			properties section for available properties.
-
-			Possible Errors: org.bluez.Error.Failed
-
-Signals		PropertyChanged(string name, variant value)
-
-			This signal indicates a changed value of the given
-			property.
-
 Properties	boolean Connected [readonly]
 
 			Indicates if SAP client is connected to the server.
diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index cbe00b9..530f994 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -618,13 +618,10 @@ static gboolean guard_timeout(gpointer data)
 
 static void sap_set_connected(struct sap_server *server)
 {
-	gboolean connected = TRUE;
-
-	emit_property_changed(server->path,
-				SAP_SERVER_INTERFACE, "Connected",
-				DBUS_TYPE_BOOLEAN, &connected);
-
 	server->conn->state = SAP_STATE_CONNECTED;
+
+	g_dbus_emit_property_changed(btd_get_dbus_connection(), server->path,
+					SAP_SERVER_INTERFACE, "Connected");
 }
 
 int sap_connect_rsp(void *sap_device, uint8_t status)
@@ -1136,7 +1133,6 @@ static void sap_io_destroy(void *data)
 {
 	struct sap_server *server = data;
 	struct sap_connection *conn = server->conn;
-	gboolean connected = FALSE;
 
 	DBG("conn %p", conn);
 
@@ -1146,10 +1142,10 @@ static void sap_io_destroy(void *data)
 	stop_guard_timer(server);
 
 	if (conn->state != SAP_STATE_CONNECT_IN_PROGRESS &&
-			conn->state != SAP_STATE_CONNECT_MODEM_BUSY)
-		emit_property_changed(server->path,
-					SAP_SERVER_INTERFACE, "Connected",
-					DBUS_TYPE_BOOLEAN, &connected);
+				conn->state != SAP_STATE_CONNECT_MODEM_BUSY)
+		g_dbus_emit_property_changed(btd_get_dbus_connection(),
+					server->path, SAP_SERVER_INTERFACE,
+					"Connected");
 
 	if (conn->state == SAP_STATE_CONNECT_IN_PROGRESS ||
 			conn->state == SAP_STATE_CONNECT_MODEM_BUSY ||
@@ -1291,50 +1287,31 @@ static DBusMessage *disconnect(DBusConnection *conn, DBusMessage *msg,
 	return dbus_message_new_method_return(msg);
 }
 
-static DBusMessage *get_properties(DBusConnection *c,
-				DBusMessage *msg, void *data)
+static gboolean server_property_get_connected(
+					const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
 {
 	struct sap_server *server = data;
 	struct sap_connection *conn = server->conn;
-	DBusMessage *reply;
-	DBusMessageIter iter;
-	DBusMessageIter dict;
 	dbus_bool_t connected;
 
 	if (!conn)
-		return message_failed(msg, "Server internal error.");
-
-	reply = dbus_message_new_method_return(msg);
-	if (!reply)
-		return NULL;
-
-	dbus_message_iter_init_append(reply, &iter);
-
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+		return FALSE;
 
 	connected = (conn->state == SAP_STATE_CONNECTED ||
 				conn->state == SAP_STATE_GRACEFUL_DISCONNECT);
-	dict_append_entry(&dict, "Connected", DBUS_TYPE_BOOLEAN, &connected);
-
-	dbus_message_iter_close_container(&iter, &dict);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &connected);
 
-	return reply;
+	return TRUE;
 }
 
 static const GDBusMethodTable server_methods[] = {
-	{ GDBUS_METHOD("GetProperties",
-			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
-			get_properties) },
 	{ GDBUS_METHOD("Disconnect", NULL, NULL, disconnect) },
 	{ }
 };
 
-static const GDBusSignalTable server_signals[] = {
-	{ GDBUS_SIGNAL("PropertyChanged",
-			GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
+static const GDBusPropertyTable server_properties[] = {
+	{ "Connected", "b", server_property_get_connected },
 	{ }
 };
 
@@ -1411,8 +1388,9 @@ int sap_server_register(const char *path, const bdaddr_t *src)
 
 	if (!g_dbus_register_interface(btd_get_dbus_connection(),
 					server->path, SAP_SERVER_INTERFACE,
-					server_methods, server_signals, NULL,
-					server, destroy_sap_interface)) {
+					server_methods, NULL,
+					server_properties, server,
+					destroy_sap_interface)) {
 		error("D-Bus failed to register %s interface",
 							SAP_SERVER_INTERFACE);
 		goto server_err;
-- 
1.7.12.3


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

* [RFC 4/6] health: Convert HealthChannel to DBus.Properties
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
                   ` (2 preceding siblings ...)
  2012-10-18 22:03 ` [RFC 3/6] sap: Convert to DBus.Properties Lucas De Marchi
@ 2012-10-18 22:03 ` Lucas De Marchi
  2012-10-18 22:03 ` [RFC 5/6] health: Convert HealthDevice " Lucas De Marchi
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

Also remove a needless strdup to send type property.
---
 profiles/health/hdp.c | 68 +++++++++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 32 deletions(-)

diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index fd21a23..845155e 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -418,44 +418,43 @@ static const GDBusMethodTable health_manager_methods[] = {
 	{ }
 };
 
-static DBusMessage *channel_get_properties(DBusConnection *conn,
-					DBusMessage *msg, void *user_data)
+static gboolean channel_property_get_device(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
 {
-	struct hdp_channel *chan = user_data;
-	DBusMessageIter iter, dict;
-	DBusMessage *reply;
-	const char *path;
-	char *type;
+	struct hdp_channel *chan = data;
+	const char *path = device_get_path(chan->dev->dev);
 
-	reply = dbus_message_new_method_return(msg);
-	if (reply == NULL)
-		return NULL;
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
 
-	dbus_message_iter_init_append(reply, &iter);
+	return TRUE;
+}
 
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+static gboolean channel_property_get_application(
+					const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct hdp_channel *chan = data;
+	const char *path = chan->app->path;
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
 
-	path = device_get_path(chan->dev->dev);
-	dict_append_entry(&dict, "Device", DBUS_TYPE_OBJECT_PATH, &path);
+	return TRUE;
+}
 
-	path = chan->app->path;
-	dict_append_entry(&dict, "Application", DBUS_TYPE_OBJECT_PATH, &path);
+static gboolean channel_property_get_type(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct hdp_channel *chan = data;
+	const char *type;
 
 	if (chan->config == HDP_RELIABLE_DC)
-		type = g_strdup("Reliable");
+		type = "Reliable";
 	else
-		type = g_strdup("Streaming");
-
-	dict_append_entry(&dict, "Type", DBUS_TYPE_STRING, &type);
-
-	g_free(type);
+		type = "Streaming";
 
-	dbus_message_iter_close_container(&iter, &dict);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &type);
 
-	return reply;
+	return TRUE;
 }
 
 static void hdp_tmp_dc_data_destroy(gpointer data)
@@ -720,9 +719,6 @@ end:
 }
 
 static const GDBusMethodTable health_channels_methods[] = {
-	{ GDBUS_METHOD("GetProperties",
-			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
-			channel_get_properties) },
 	{ GDBUS_ASYNC_METHOD("Acquire",
 			NULL, GDBUS_ARGS({ "fd", "h" }),
 			channel_acquire) },
@@ -730,6 +726,13 @@ static const GDBusMethodTable health_channels_methods[] = {
 	{ }
 };
 
+static const GDBusPropertyTable health_channels_properties[] = {
+	{ "Device", "o",  channel_property_get_device },
+	{ "Application", "o", channel_property_get_application },
+	{ "Type", "s", channel_property_get_type },
+	{ }
+};
+
 static struct hdp_channel *create_channel(struct hdp_device *dev,
 						uint8_t config,
 						struct mcap_mdl *mdl,
@@ -768,8 +771,9 @@ static struct hdp_channel *create_channel(struct hdp_device *dev,
 
 	if (!g_dbus_register_interface(btd_get_dbus_connection(),
 					hdp_chann->path, HEALTH_CHANNEL,
-					health_channels_methods, NULL, NULL,
-					hdp_chann, health_channel_destroy)) {
+					health_channels_methods, NULL,
+					health_channels_properties, hdp_chann,
+					health_channel_destroy)) {
 		g_set_error(err, HDP_ERROR, HDP_UNSPECIFIED_ERROR,
 					"Can't register the channel interface");
 		health_channel_destroy(hdp_chann);
-- 
1.7.12.3


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

* [RFC 5/6] health: Convert HealthDevice to DBus.Properties
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
                   ` (3 preceding siblings ...)
  2012-10-18 22:03 ` [RFC 4/6] health: Convert HealthChannel " Lucas De Marchi
@ 2012-10-18 22:03 ` Lucas De Marchi
  2012-10-18 22:03 ` [RFC 6/6] doc: Update Health to BlueZ 5 Lucas De Marchi
  2012-10-19  7:40 ` [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Johan Hedberg
  6 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

---
 profiles/health/hdp.c | 56 ++++++++++++++++++++++++---------------------------
 1 file changed, 26 insertions(+), 30 deletions(-)

diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 845155e..0692d43 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -968,9 +968,9 @@ static void hdp_mcap_mdl_connected_cb(struct mcap_mdl *mdl, void *data)
 
 	dev->fr = hdp_channel_ref(chan);
 
-	emit_property_changed(device_get_path(dev->dev),
-				HEALTH_DEVICE, "MainChannel",
-				DBUS_TYPE_OBJECT_PATH, &dev->fr->path);
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+				device_get_path(dev->dev), HEALTH_DEVICE,
+				"MainChannel");
 
 end:
 	hdp_channel_unref(dev->ndc);
@@ -1690,9 +1690,9 @@ static void hdp_mdl_conn_cb(struct mcap_mdl *mdl, GError *err, gpointer data)
 
 	dev->fr = hdp_channel_ref(hdp_chann);
 
-	emit_property_changed(device_get_path(dev->dev),
-				HEALTH_DEVICE, "MainChannel",
-				DBUS_TYPE_OBJECT_PATH, &dev->fr->path);
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+				device_get_path(dev->dev), HEALTH_DEVICE,
+				"MainChannel");
 }
 
 static void device_create_mdl_cb(struct mcap_mdl *mdl, uint8_t conf,
@@ -2049,31 +2049,26 @@ fail:
 	return reply;
 }
 
-static DBusMessage *device_get_properties(DBusConnection *conn,
-					DBusMessage *msg, void *user_data)
+static gboolean dev_property_exists_main_channel(
+				const GDBusPropertyTable *property, void *data)
 {
-	struct hdp_device *device = user_data;
-	DBusMessageIter iter, dict;
-	DBusMessage *reply;
-
-	reply = dbus_message_new_method_return(msg);
-	if (reply == NULL)
-		return NULL;
+	struct hdp_device *device = data;
+	return device->fr != NULL;
+}
 
-	dbus_message_iter_init_append(reply, &iter);
+static gboolean dev_property_get_main_channel(
+					const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct hdp_device *device = data;
 
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+	if (device->fr == NULL)
+		return FALSE;
 
-	if (device->fr != NULL)
-		dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH,
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH,
 							&device->fr->path);
 
-	dbus_message_iter_close_container(&iter, &dict);
-
-	return reply;
+	return TRUE;
 }
 
 static void health_device_destroy(void *data)
@@ -2104,9 +2099,6 @@ static const GDBusMethodTable health_device_methods[] = {
 	{ GDBUS_ASYNC_METHOD("DestroyChannel",
 			GDBUS_ARGS({ "channel", "o" }), NULL,
 			device_destroy_channel) },
-	{ GDBUS_METHOD("GetProperties",
-			NULL, GDBUS_ARGS({ "properties", "a{sv}" }),
-			device_get_properties) },
 	{ }
 };
 
@@ -2115,8 +2107,12 @@ static const GDBusSignalTable health_device_signals[] = {
 			GDBUS_ARGS({ "channel", "o" })) },
 	{ GDBUS_SIGNAL("ChannelDeleted",
 			GDBUS_ARGS({ "channel", "o" })) },
-	{ GDBUS_SIGNAL("PropertyChanged",
-			GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
+	{ }
+};
+
+static const GDBusPropertyTable health_device_properties[] = {
+	{ "MainChannel", "o", dev_property_get_main_channel, NULL,
+					dev_property_exists_main_channel },
 	{ }
 };
 
-- 
1.7.12.3


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

* [RFC 6/6] doc: Update Health to BlueZ 5
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
                   ` (4 preceding siblings ...)
  2012-10-18 22:03 ` [RFC 5/6] health: Convert HealthDevice " Lucas De Marchi
@ 2012-10-18 22:03 ` Lucas De Marchi
  2012-10-19  7:40 ` [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Johan Hedberg
  6 siblings, 0 replies; 8+ messages in thread
From: Lucas De Marchi @ 2012-10-18 22:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lucas De Marchi

From: Lucas De Marchi <lucas.de.marchi@gmail.com>

Adapt to the new DBus.Properties and cleanup the format used in this
documentation to be similar to the other profiles.
---
 doc/health-api.txt | 198 ++++++++++++++++++++++++++---------------------------
 1 file changed, 98 insertions(+), 100 deletions(-)

diff --git a/doc/health-api.txt b/doc/health-api.txt
index 7a000cb..728280a 100644
--- a/doc/health-api.txt
+++ b/doc/health-api.txt
@@ -5,162 +5,160 @@ BlueZ D-Bus Health API description
 	José Antonio Santos-Cadenas <santoscadenas@gmail.com>
 	Elvis Pfützenreuter <epx@signove.com>
 
-Health Device Profile hierarchy
-===============================
+HealthManager hierarchy
+=======================
 
 Service		org.bluez
 Interface	org.bluez.HealthManager
 Object path	/org/bluez/
 
-Methods:
+Methods		object CreateApplication(dict config)
 
-	object	CreateApplication(dict config)
+			Returns the path of the new registered application.
+			Application will be closed by the call or implicitly
+			when the programs leaves the bus.
 
-		Returns the path of the new registered application.
+			config:
+				uint16 DataType:
 
-		Dict is defined as below:
-		{
-			"DataType": uint16, (mandatory)
-			"Role" : ("Source" or "Sink"), (mandatory)
-			"Description" : string, (optional)
-			"ChannelType" : ("Reliable" or "Streaming")
-						(just for Sources, optional)
-		}
+					Mandatory
 
-		Application will be closed by the call or implicitly when the
-		programs leaves the bus.
+				string Role:
 
-		Possible errors: org.bluez.Error.InvalidArguments
+					Mandatory. Possible values: "Source",
+									"Sink"
 
-	void	DestroyApplication(object application)
+				string Description:
 
-		Closes the HDP application identified by the object path. Also
-		application will be closed if the process that started it leaves
-		the bus. Only the creator of the application will be able to
-		destroy it.
+					Optional
 
-		Possible errors: org.bluez.Error.InvalidArguments
-				org.bluez.Error.NotFound
-				org.bluez.Error.NotAllowed
+				ChannelType:
 
---------------------------------------------------------------------------------
+					Optional, just for sources. Possible
+					values: "Reliable", "Streaming"
 
-Service		org.bluez
-Interface	org.bluez.HealthDevice
-Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
+			Possible Errors: org.bluez.Error.InvalidArguments
+
+		void DestroyApplication(object application)
 
-Methods:
+			Closes the HDP application identified by the object
+			path. Also application will be closed if the process
+			that started it leaves the bus. Only the creator of the
+			application will be able to destroy it.
 
-	dict GetProperties()
+			Possible errors: org.bluez.Error.InvalidArguments
+					 org.bluez.Error.NotFound
+					 org.bluez.Error.NotAllowed
 
-		Returns all properties for the interface. See the properties
-		section for available properties.
+HealthDevice hierarchy
+======================
 
-		Posible errors: org.bluez.Error.NotAllowed
+Service		org.bluez
+Interface	org.bluez.HealthDevice
+Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
 
-	Boolean Echo()
+Methods		dict GetProperties()
 
-		Sends an echo petition to the remote service. Returns True if
-		response matches with the buffer sent. If some error is detected
-		False value is returned.
+			Returns all properties for the interface. See the
+			properties section for available properties.
 
-		Possible errors: org.bluez.Error.InvalidArguments
-				org.bluez.Error.OutOfRange
+			Posible errors: org.bluez.Error.NotAllowed
 
-	object CreateChannel(object application, string configuration)
+		boolean Echo()
 
-		Creates a new data channel.
-		The configuration should indicate the channel quality of
-		service using one of this values "Reliable", "Streaming", "Any".
+			Sends an echo petition to the remote service. Returns
+			True if response matches with the buffer sent. If some
+			error is detected False value is returned.
 
-		Returns the object path that identifies the data channel that
-		is already connected.
+			Possible errors: org.bluez.Error.InvalidArguments
+			org.bluez.Error.OutOfRange
 
-		Possible errors: org.bluez.Error.InvalidArguments
-				org.bluez.Error.HealthError
+		object CreateChannel(object application, string configuration)
 
-	void DestroyChannel(object channel)
+			Creates a new data channel.  The configuration should
+			indicate the channel quality of service using one of
+			this values "Reliable", "Streaming", "Any".
 
-		Destroys the data channel object. Only the creator of the
-		channel or the creator of the HealthApplication that received
-		the data channel will be able to destroy it.
+			Returns the object path that identifies the data
+			channel that is already connected.
 
-		Possible errors: org.bluez.Error.InvalidArguments
-				org.bluez.Error.NotFound
-				org.bluez.Error.NotAllowed
+			Possible errors: org.bluez.Error.InvalidArguments
+			org.bluez.Error.HealthError
 
-Signals:
+		void DestroyChannel(object channel)
 
-	void ChannelConnected(object channel)
+			Destroys the data channel object. Only the creator of
+			the channel or the creator of the HealthApplication
+			that received the data channel will be able to destroy
+			it.
 
-		This signal is launched when a new data channel is created or
-		when a known data channel is reconnected.
+			Possible errors: org.bluez.Error.InvalidArguments
+			org.bluez.Error.NotFound org.bluez.Error.NotAllowed
 
-	void ChannelDeleted(object channel)
+Signals		void ChannelConnected(object channel)
 
-		This signal is launched when a data channel is deleted.
+			This signal is launched when a new data channel is
+			created or when a known data channel is reconnected.
 
-		After this signal the data channel path will not be valid and
-		its path can be reused for future data channels.
+		void ChannelDeleted(object channel)
 
-	void PropertyChanged(string name, variant value)
+			This signal is launched when a data channel is deleted.
 
-		This signal indicates a changed value of the given property.
+			After this signal the data channel path will not be
+			valid and its path can be reused for future data
+			channels.
 
-Properties:
+		void PropertyChanged(string name, variant value)
 
-	object MainChannel [readonly]
+			This signal indicates a changed value of the given
+			property.
 
-		The first reliable channel opened. It is needed by upper
-		applications in order to send specific protocol data units. The
-		first reliable can change after a reconnection.
+Properties	object MainChannel [readonly]
 
---------------------------------------------------------------------------------
+			The first reliable channel opened. It is needed by
+			upper applications in order to send specific protocol
+			data units. The first reliable can change after a
+			reconnection.
+
+HealthChannel hierarchy
+=======================
 
 Service		org.bluez
 Interface	org.bluez.HealthChannel
 Object path	[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/chanZZZ
 
 Only the process that created the data channel or the creator of the
-HealthApplication that received it will be able to call this methods.
-
-Methods:
-
-	dict GetProperties()
-
-		Returns all properties for the interface. See the properties
-		section for available properties.
-
-		Possible errors: org.bluez.Error.NotAllowed
-
-	fd Acquire()
+HealthApplication that received it will be able to call these methods.
 
-		Returns the file descriptor for this data channel. If the data
-		channel is not connected it will also reconnect.
+Methods		fd Acquire()
 
-		Possible errors: org.bluez.Error.NotConnected
-				org.bluez.Error.NotAllowed
+			Returns the file descriptor for this data channel. If
+			the data channel is not connected it will also
+			reconnect.
 
-	void Release()
+			Possible Errors: org.bluez.Error.NotConnected
+					 org.bluez.Error.NotAllowed
 
-		Releases the fd. Application should also need to close() it.
+		void Release()
 
-		Possible errors: org.bluez.Error.NotAcquired
-				org.bluez.Error.NotAllowed
+			Releases the fd. Application should also need to
+			close() it.
 
-Properties:
+			Possible Errors: org.bluez.Error.NotAcquired
+					 org.bluez.Error.NotAllowed
 
-	string Type [readonly]
+Properties	string Type [readonly]
 
-		The quality of service of the data channel. ("Reliable" or
-		"Streaming")
+			The quality of service of the data channel. ("Reliable"
+			or "Streaming")
 
-	object Device [readonly]
+		object Device [readonly]
 
-		Identifies the Remote Device that is connected with. Maps with
-		a HealthDevice object.
+			Identifies the Remote Device that is connected with.
+			Maps with a HealthDevice object.
 
-	object Application [readonly]
+		object Application [readonly]
 
-		Identifies the HealthApplication to which this channel is
-		related to (which indirectly defines its role and data type).
+			Identifies the HealthApplication to which this channel
+			is related to (which indirectly defines its role and
+			data type).
-- 
1.7.12.3


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

* Re: [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input
  2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
                   ` (5 preceding siblings ...)
  2012-10-18 22:03 ` [RFC 6/6] doc: Update Health to BlueZ 5 Lucas De Marchi
@ 2012-10-19  7:40 ` Johan Hedberg
  6 siblings, 0 replies; 8+ messages in thread
From: Johan Hedberg @ 2012-10-19  7:40 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: linux-bluetooth, Lucas De Marchi

Hi Lucas,

On Thu, Oct 18, 2012, Lucas De Marchi wrote:
> Here is a patch set to convert SAP and HEALTH profiles to
> DBus.Properties. It's only compile-tested.
> 
> Patch 0002 contains a fix to sap server. Unless I'm blind,
> GetProperties() callback was doing random things using that pointer.
> 
> Patch 0001 adds the missing update to PropertiesChanged signal in
> INPUT profile.
> 
> Finally last patch convert HEALTH's documentation to a format similar
> to what we have in other profiles.
> 
> Lucas De Marchi (6):
>   input: Fix not sending PropertiesChanged signal
>   sap: Fix usage of wrong struct in get_properties()
>   sap: Convert to DBus.Properties
>   health: Convert HealthChannel to DBus.Properties
>   health: Convert HealthDevice to DBus.Properties
>   doc: Update Health to BlueZ 5
> 
>  doc/health-api.txt      | 198 ++++++++++++++++++++++++------------------------
>  doc/sap-api.txt         |  12 ---
>  profiles/health/hdp.c   | 124 +++++++++++++++---------------
>  profiles/input/device.c |  13 +---
>  profiles/sap/server.c   |  61 +++++----------
>  5 files changed, 184 insertions(+), 224 deletions(-)

I didn't see any major issues so I went ahead and pushed this set. I
didn't see any updates to the test scripts though. Is it so that they
don't use the old properties interfaces?

Johan

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

end of thread, other threads:[~2012-10-19  7:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18 22:03 [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Lucas De Marchi
2012-10-18 22:03 ` [RFC 1/6] input: Fix not sending PropertiesChanged signal Lucas De Marchi
2012-10-18 22:03 ` [RFC 2/6] sap: Fix usage of wrong struct in get_properties() Lucas De Marchi
2012-10-18 22:03 ` [RFC 3/6] sap: Convert to DBus.Properties Lucas De Marchi
2012-10-18 22:03 ` [RFC 4/6] health: Convert HealthChannel " Lucas De Marchi
2012-10-18 22:03 ` [RFC 5/6] health: Convert HealthDevice " Lucas De Marchi
2012-10-18 22:03 ` [RFC 6/6] doc: Update Health to BlueZ 5 Lucas De Marchi
2012-10-19  7:40 ` [RFC 0/6] DBus.Properties: Converting SAP, HEALTH and fix to input Johan Hedberg

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.