From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/8] obexd/client: Parse PBAP record
Date: Mon, 1 Dec 2014 10:47:12 +0200 [thread overview]
Message-ID: <1417423638-29222-2-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 add parsing to PBAP record to extract version and supported
features.
---
obexd/client/pbap.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
index 11574e7..c33de3f 100644
--- a/obexd/client/pbap.c
+++ b/obexd/client/pbap.c
@@ -33,6 +33,7 @@
#include <gdbus/gdbus.h>
#include <bluetooth/bluetooth.h>
+#include <bluetooth/sdp.h>
#include <gobex/gobex-apparam.h>
#include "log.h"
@@ -73,6 +74,17 @@
#define PHONEBOOKSIZE_TAG 0X08
#define NEWMISSEDCALLS_TAG 0X09
+#define DOWNLOAD_FEATURE 0x00000001
+#define BROWSE_FEATURE 0x00000002
+#define DATABASEID_FEATURE 0x00000004
+#define FOLDER_VERSION_FEATURE 0x00000008
+#define VCARD_SELECTING_FEATURE 0x00000010
+#define ENHANCED_CALLS_FEATURE 0x00000020
+#define UCI_FEATURE 0x00000040
+#define UID_FEATURE 0x00000080
+#define REFERENCING_FEATURE 0x00000100
+#define DEFAULT_IMAGE_FEATURE 0x00000200
+
static const char *filter_list[] = {
"VERSION",
"FN",
@@ -119,6 +131,8 @@ static const char *filter_list[] = {
struct pbap_data {
struct obc_session *session;
char *path;
+ uint16_t version;
+ uint32_t supported_features;
};
struct pending_request {
@@ -966,6 +980,35 @@ static void pbap_free(void *data)
g_free(pbap);
}
+static void parse_service_record(struct pbap_data *pbap)
+{
+ const void *data;
+
+ /* Version */
+ data = obc_session_get_attribute(pbap->session,
+ SDP_ATTR_PFILE_DESC_LIST);
+ if (!data)
+ return;
+
+ pbap->version = GPOINTER_TO_UINT(data);
+
+ /*
+ * If the PbapSupportedFeatures attribute is not present
+ * 0x00000003 shall be assumed for a remote PSE.
+ */
+ pbap->supported_features = 0x00000003;
+
+ if (pbap->version < 0x0102)
+ return;
+
+ /* Supported Feature Bits */
+ data = obc_session_get_attribute(pbap->session,
+ SDP_ATTR_PBAP_SUPPORTED_FEATURES);
+ if (data)
+ pbap->supported_features = *(uint32_t *) data;
+
+}
+
static int pbap_probe(struct obc_session *session)
{
struct pbap_data *pbap;
@@ -981,6 +1024,11 @@ static int pbap_probe(struct obc_session *session)
pbap->session = obc_session_ref(session);
+ parse_service_record(pbap);
+
+ DBG("%s, version 0x%04x supported features 0x%08x", path, pbap->version,
+ pbap->supported_features);
+
if (!g_dbus_register_interface(conn, path, PBAP_INTERFACE, pbap_methods,
NULL, NULL, pbap, pbap_free)) {
pbap_free(pbap);
--
1.9.3
next prev 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 ` Luiz Augusto von Dentz [this message]
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 ` [PATCH BlueZ 7/8] obexd/client: Add UpdateVersion to PhonebookAccess Luiz Augusto von Dentz
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-2-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