linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: martin.xu@linux.intel.com
To: linux-bluetooth@vger.kernel.org
Cc: Martin <martin.xu@linux.intel.com>
Subject: [PATCH] obexd/client: Add client session properties
Date: Mon,  1 Jul 2013 11:11:12 +0800	[thread overview]
Message-ID: <1372648272-5801-1-git-send-email-martin.xu@linux.intel.com> (raw)

From: Martin <martin.xu@linux.intel.com>

---
 obexd/client/session.c |   38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/obexd/client/session.c b/obexd/client/session.c
index 8d32ed0..e9cbf00 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -630,9 +630,6 @@ static gboolean get_source(const GDBusPropertyTable *property,
 {
 	struct obc_session *session = data;
 
-	if (session->source == NULL)
-		return FALSE;
-
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
 							&session->source);
 
@@ -675,10 +672,35 @@ static const GDBusMethodTable session_methods[] = {
 	{ }
 };
 
+static gboolean get_target(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct obc_session *session = data;
+	char *uuid;
+
+	uuid = g_strdup(session->driver->uuid);
+
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &uuid);
+	g_free(uuid);
+
+	return TRUE;
+}
+
+static gboolean session_target_exists(const GDBusPropertyTable *property,
+								void *data)
+{
+	struct obc_session *session = data;
+	if (session->driver)
+		return session->driver->uuid ? TRUE : FALSE;
+
+	return FALSE;
+}
+
 static const GDBusPropertyTable session_properties[] = {
 	{ "Source", "s", get_source, NULL, source_exists },
 	{ "Destination", "s", get_destination },
 	{ "Channel", "y", get_channel },
+	{ "Target", "s", get_target, NULL, session_target_exists },
 	{ }
 };
 
@@ -854,9 +876,13 @@ const char *obc_session_register(struct obc_session *session,
 	session->path = g_strdup_printf("%s/session%ju",
 						SESSION_BASEPATH, counter++);
 
-	if (g_dbus_register_interface(session->conn, session->path,
-					SESSION_INTERFACE, session_methods,
-					NULL, NULL, session, destroy) == FALSE)
+	if (g_dbus_register_interface(session->conn,
+					session->path,
+					SESSION_INTERFACE,
+					session_methods,
+					NULL,
+					session_properties,
+					session, destroy) == FALSE)
 		goto fail;
 
 	if (session->driver->probe && session->driver->probe(session) < 0) {
-- 
1.7.10.4


             reply	other threads:[~2013-07-01  3:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01  3:11 martin.xu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-07-05  9:38 [PATCH] obexd/client: Add client session properties martin.xu
2013-07-05 10:04 ` Luiz Augusto von Dentz
2013-07-08  0:21   ` Xu, Martin
2013-07-05  9:08 martin.xu
2013-07-08 15:52 ` Luiz Augusto von Dentz
2013-07-01  3:13 martin.xu
2013-07-02  8:11 ` Luiz Augusto von Dentz
2013-06-28  8:13 martin.xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372648272-5801-1-git-send-email-martin.xu@linux.intel.com \
    --to=martin.xu@linux.intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).