From: Ajay Kishore <ajay.kishore@intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 2/6] obexd: Add parsers for conversation filters
Date: Tue, 11 Feb 2020 12:06:06 +0530 [thread overview]
Message-ID: <1581402970-1781-2-git-send-email-ajay.kishore@intel.com> (raw)
In-Reply-To: <1581402970-1781-1-git-send-email-ajay.kishore@intel.com>
Changes made to add a new method to parse the map conversation filters.
Filters LastActivityBegin and LastActivityEnd is used to filter the
conversations that are returned in the Conversation-Listing object by
LastActivity.
---
obexd/client/map.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
obexd/src/map_ap.h | 3 +++
2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index adf62d9..6e84a73 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1369,6 +1369,21 @@ static GObexApparam *parse_filter_type(GObexApparam *apparam,
types);
}
+static GObexApparam *parse_la_begin(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ const char *string;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &string);
+
+ return g_obex_apparam_set_string(apparam,
+ MAP_AP_FILTERLASTACTIVITYBEGIN,
+ string);
+}
+
static GObexApparam *parse_period_begin(GObexApparam *apparam,
DBusMessageIter *iter)
{
@@ -1397,6 +1412,20 @@ static GObexApparam *parse_period_end(GObexApparam *apparam,
string);
}
+static GObexApparam *parse_la_end(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ const char *string;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &string);
+
+ return g_obex_apparam_set_string(apparam, MAP_AP_FILTERLASTACTIVITYEND,
+ string);
+}
+
static GObexApparam *parse_filter_read(GObexApparam *apparam,
DBusMessageIter *iter)
{
@@ -1560,6 +1589,19 @@ static DBusMessage *map_list_messages(DBusConnection *connection,
return get_message_listing(map, message, folder, apparam);
}
+static GObexApparam *parse_filter_conv_id(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ guint8 id;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BYTE)
+ return NULL;
+
+ dbus_message_iter_get_basic(iter, &id);
+
+ return g_obex_apparam_set_uint8(apparam, MAP_AP_CONVERSATIONID, id);
+}
+
static GObexApparam *parse_conversation_filters(GObexApparam *apparam,
DBusMessageIter *iter)
{
@@ -1582,8 +1624,28 @@ static GObexApparam *parse_conversation_filters(GObexApparam *apparam,
dbus_message_iter_next(&entry);
dbus_message_iter_recurse(&entry, &value);
- /* TODO: Parse conversation filters */
-
+ if (strcasecmp(key, "Offset") == 0) {
+ if (parse_offset(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "MaxCount") == 0) {
+ if (parse_max_count(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "LastActivityBegin") == 0) {
+ if (parse_la_begin(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "FilterLastActivityEnd") == 0) {
+ if (parse_la_end(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Read") == 0) {
+ if (parse_filter_read(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "Recipient") == 0) {
+ if (parse_filter_recipient(apparam, &value) == NULL)
+ return NULL;
+ } else if (strcasecmp(key, "ConversationId") == 0) {
+ if (parse_filter_conv_id(apparam, &value) == NULL)
+ return NULL;
+ }
dbus_message_iter_next(&array);
}
return apparam;
diff --git a/obexd/src/map_ap.h b/obexd/src/map_ap.h
index da108fe..3773859 100644
--- a/obexd/src/map_ap.h
+++ b/obexd/src/map_ap.h
@@ -31,6 +31,8 @@ enum map_ap_tag {
MAP_AP_FILTERREADSTATUS = 0x06, /* uint8_t */
MAP_AP_FILTERRECIPIENT = 0x07, /* char * */
MAP_AP_FILTERORIGINATOR = 0x08, /* char * */
+ MAP_AP_FILTERLASTACTIVITYBEGIN = 0x08, /* char * */
+ MAP_AP_FILTERLASTACTIVITYEND = 0x09, /* char * */
MAP_AP_FILTERPRIORITY = 0x09, /* uint8_t */
MAP_AP_ATTACHMENT = 0x0A, /* uint8_t */
MAP_AP_TRANSPARENT = 0x0B, /* uint8_t */
@@ -48,4 +50,5 @@ enum map_ap_tag {
MAP_AP_STATUSINDICATOR = 0x17, /* uint8_t */
MAP_AP_STATUSVALUE = 0x18, /* uint8_t */
MAP_AP_MSETIME = 0x19, /* char * */
+ MAP_AP_CONVERSATIONID = 0x1C, /* uint32_t */
};
--
2.7.4
next prev parent reply other threads:[~2020-02-11 6:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-11 6:36 [PATCH v2 1/6] obexd: Add initial support for MAP conversations Ajay Kishore
2020-02-11 6:36 ` Ajay Kishore [this message]
2020-02-11 6:36 ` [PATCH v2 3/6] obexd: Get conversation listings Ajay Kishore
2020-02-11 6:36 ` [PATCH v2 5/6] obexd: Handle MAP Event Report v1.1 and v1.2 Ajay Kishore
2020-02-11 6:36 ` [PATCH v3 4/6] obexd: Add parser for conversation element Ajay Kishore
2020-02-11 6:36 ` [PATCH v3 6/6] doc/obex-api: Update documentation Ajay Kishore
2020-02-11 19:27 ` [PATCH v2 1/6] obexd: Add initial support for MAP conversations Luiz Augusto von Dentz
2020-03-05 9:20 ` Kishore, Ajay
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=1581402970-1781-2-git-send-email-ajay.kishore@intel.com \
--to=ajay.kishore@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).