linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 7/8] obexd/client: Add UpdateVersion to PhonebookAccess
Date: Mon,  1 Dec 2014 10:47:17 +0200	[thread overview]
Message-ID: <1417423638-29222-7-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1417423638-29222-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds UpdateVersion method to PhonebookAccess interface.
---
 doc/obex-api.txt    |  8 ++++----
 obexd/client/pbap.c | 23 ++++++++++++++++++++---
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/doc/obex-api.txt b/doc/obex-api.txt
index 32f9a79..0cd359b 100644
--- a/doc/obex-api.txt
+++ b/doc/obex-api.txt
@@ -433,12 +433,12 @@ Methods		void Select(string location, string phonebook)
 			Possible errors: org.bluez.obex.Error.Forbidden
 					 org.bluez.obex.Error.Failed
 
-		uint16, uint16 GetVersion()
+		void UpdateVersion()
 
-			Return the primary and secondary folder version counters
-			for the selected phonebook.
+			Attempt to update PrimaryCounter and SecondaryCounter.
 
-			Possible errors: org.bluez.obex.Error.Forbidden
+			Possible errors: org.bluez.obex.Error.NotSupported
+					 org.bluez.obex.Error.Forbidden
 					 org.bluez.obex.Error.Failed
 
 		array{string} ListFilterFields()
diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
index 2398071..812a7fb 100644
--- a/obexd/client/pbap.c
+++ b/obexd/client/pbap.c
@@ -383,9 +383,11 @@ static void phonebook_size_callback(struct obc_session *session,
 	read_return_apparam(transfer, request->pbap, &phone_book_size,
 							&new_missed_calls);
 
-	dbus_message_append_args(reply,
-			DBUS_TYPE_UINT16, &phone_book_size,
-			DBUS_TYPE_INVALID);
+	if (dbus_message_is_method_call(request->msg, PBAP_INTERFACE,
+								"GetSize"))
+		dbus_message_append_args(reply,
+					DBUS_TYPE_UINT16, &phone_book_size,
+					DBUS_TYPE_INVALID);
 
 send:
 	g_dbus_send_message(conn, reply);
@@ -1014,6 +1016,19 @@ static DBusMessage *pbap_list_filter_fields(DBusConnection *connection,
 	return reply;
 }
 
+static DBusMessage *pbap_update_version(DBusConnection *connection,
+					DBusMessage *message, void *user_data)
+{
+	struct pbap_data *pbap = user_data;
+
+	if (!(pbap->supported_features & FOLDER_VERSION_FEATURE))
+		return g_dbus_create_error(message,
+					ERROR_INTERFACE ".NotSupported",
+					"Operation is not supported");
+
+	return pbap_get_size(connection, message, user_data);
+}
+
 static const GDBusMethodTable pbap_methods[] = {
 	{ GDBUS_ASYNC_METHOD("Select",
 			GDBUS_ARGS({ "location", "s" }, { "phonebook", "s" }),
@@ -1045,6 +1060,8 @@ static const GDBusMethodTable pbap_methods[] = {
 	{ GDBUS_METHOD("ListFilterFields",
 				NULL, GDBUS_ARGS({ "fields", "as" }),
 				pbap_list_filter_fields) },
+	{ GDBUS_ASYNC_METHOD("UpdateVersion", NULL, NULL,
+				pbap_update_version) },
 	{ }
 };
 
-- 
1.9.3


  parent reply	other threads:[~2014-12-01  8:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01  8:47 [PATCH BlueZ 1/8] obexd/client: Add support for reading version Luiz Augusto von Dentz
2014-12-01  8:47 ` [PATCH BlueZ 2/8] obexd/client: Parse PBAP record Luiz Augusto von Dentz
2014-12-01  8:47 ` [PATCH BlueZ 3/8] obexd/client: Add Folder property Luiz Augusto von Dentz
2014-12-01  8:47 ` [PATCH BlueZ 4/8] obexd/client: Add DatabaseIdentifier property Luiz Augusto von Dentz
2014-12-01  8:47 ` [PATCH BlueZ 5/8] obexd/client: Add folder counters properties Luiz Augusto von Dentz
2014-12-01  8:47 ` [PATCH BlueZ 6/8] obexd/client: Add FixedImageSize property Luiz Augusto von Dentz
2014-12-01  8:47 ` Luiz Augusto von Dentz [this message]
2014-12-01  8:47 ` [PATCH BlueZ 8/8] obexd/client: Add supported_features support Luiz Augusto von Dentz
2014-12-01 12:17   ` Gowtham Anandha Babu
2014-12-01 12:51     ` Luiz Augusto von Dentz
2014-12-01 13:31       ` Gowtham Anandha Babu
2014-12-01 13:34         ` Luiz Augusto von Dentz
2014-12-01 14:00           ` Luiz Augusto von Dentz
     [not found]             ` <003c01d00d71$f818ba20$e84a2e60$@samsung.com>
2014-12-01 14:41               ` Luiz Augusto von Dentz
2014-12-02  6:37                 ` Gowtham Anandha Babu
2014-12-02  9:32                   ` Luiz Augusto von Dentz
2014-12-02  9:39 ` [PATCH BlueZ 1/8] obexd/client: Add support for reading version Luiz Augusto von Dentz

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=1417423638-29222-7-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.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).