linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add UUID property to GATT service object
@ 2011-02-04 14:01 Elvis Pfützenreuter
  2011-02-08 23:00 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Elvis Pfützenreuter @ 2011-02-04 14:01 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: epx

---
 attrib/client.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index 44638d3..e8b814d 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -940,6 +940,7 @@ static DBusMessage *prim_get_properties(DBusConnection *conn, DBusMessage *msg,
 	DBusMessageIter dict;
 	GSList *l;
 	char **chars;
+	char *uuid;
 	int i;
 
 	reply = dbus_message_new_method_return(msg);
@@ -962,6 +963,10 @@ static DBusMessage *prim_get_properties(DBusConnection *conn, DBusMessage *msg,
 
 	dict_append_array(&dict, "Characteristics", DBUS_TYPE_OBJECT_PATH,
 								&chars, i);
+	uuid = g_strdup(prim->att->uuid);
+	dict_append_entry(&dict, "UUID", DBUS_TYPE_STRING, &uuid);
+
+	g_free(uuid);
 	g_free(chars);
 
 	dbus_message_iter_close_container(&iter, &dict);
-- 
1.7.1


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

* Re: [PATCH] Add UUID property to GATT service object
  2011-02-04 14:01 [PATCH] Add UUID property to GATT service object Elvis Pfützenreuter
@ 2011-02-08 23:00 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2011-02-08 23:00 UTC (permalink / raw)
  To: linux-bluetooth

Hi Elvis,

On Fri, Feb 04, 2011, Elvis Pf??tzenreuter wrote:
> @@ -962,6 +963,10 @@ static DBusMessage *prim_get_properties(DBusConnection *conn, DBusMessage *msg,
>  
>  	dict_append_array(&dict, "Characteristics", DBUS_TYPE_OBJECT_PATH,
>  								&chars, i);
> +	uuid = g_strdup(prim->att->uuid);
> +	dict_append_entry(&dict, "UUID", DBUS_TYPE_STRING, &uuid);
> +
> +	g_free(uuid);
>  	g_free(chars);
>  
>  	dbus_message_iter_close_container(&iter, &dict);

I'd rather avoid the unnecessary memory allocation here. The following
should be enough:

const char *uuid;
...
uuid = prim->att->uuid;
dict_append_entry(..., DBUS_TYPE_STRING, &uuid);

Johan

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

end of thread, other threads:[~2011-02-08 23:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-04 14:01 [PATCH] Add UUID property to GATT service object Elvis Pfützenreuter
2011-02-08 23:00 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).