From: Ajay Kishore <ajay.kishore@intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v2 1/6] obexd: Add initial support for MAP conversations
Date: Tue, 11 Feb 2020 12:06:05 +0530 [thread overview]
Message-ID: <1581402970-1781-1-git-send-email-ajay.kishore@intel.com> (raw)
Changes made to add a new method for MAP conversation listing i.e
"ListConversations" to handle conversation listing object
"x-bt/MAP-convo-listing".
---
obexd/client/map.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 550c5af..adf62d9 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -1560,6 +1560,69 @@ static DBusMessage *map_list_messages(DBusConnection *connection,
return get_message_listing(map, message, folder, apparam);
}
+static GObexApparam *parse_conversation_filters(GObexApparam *apparam,
+ DBusMessageIter *iter)
+{
+ DBusMessageIter array;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY) {
+ DBG("Not of type array");
+ return NULL;
+ }
+
+ dbus_message_iter_recurse(iter, &array);
+
+ while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
+ const char *key;
+ DBusMessageIter value, entry;
+
+ dbus_message_iter_recurse(&array, &entry);
+ dbus_message_iter_get_basic(&entry, &key);
+
+ dbus_message_iter_next(&entry);
+ dbus_message_iter_recurse(&entry, &value);
+
+ /* TODO: Parse conversation filters */
+
+ dbus_message_iter_next(&array);
+ }
+ return apparam;
+}
+
+static DBusMessage *map_list_conversations(DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data)
+{
+ struct map_data *map = user_data;
+ const char *folder;
+ GObexApparam *apparam;
+ DBusMessageIter args;
+
+ dbus_message_iter_init(message, &args);
+
+ if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+
+ dbus_message_iter_get_basic(&args, &folder);
+
+ apparam = g_obex_apparam_set_uint16(NULL, MAP_AP_MAXLISTCOUNT,
+ DEFAULT_COUNT);
+ apparam = g_obex_apparam_set_uint16(apparam, MAP_AP_STARTOFFSET,
+ DEFAULT_OFFSET);
+
+ dbus_message_iter_next(&args);
+
+ if (parse_conversation_filters(apparam, &args) == NULL) {
+ g_obex_apparam_free(apparam);
+ return g_dbus_create_error(message,
+ ERROR_INTERFACE ".InvalidArguments", NULL);
+ }
+
+ /*TODO: Return conversation listing */
+ return NULL;
+}
+
static char **get_filter_strs(uint64_t filter, int *size)
{
char **list, **item;
@@ -1817,6 +1880,10 @@ static const GDBusMethodTable map_methods[] = {
GDBUS_ARGS({ "folder", "s" }, { "filter", "a{sv}" }),
GDBUS_ARGS({ "messages", "a{oa{sv}}" }),
map_list_messages) },
+ { GDBUS_ASYNC_METHOD("ListConversations",
+ GDBUS_ARGS({ "folder", "s" }, { "filter", "a{sv}" }),
+ GDBUS_ARGS({ "conversations", "a{oa{sv}}" }),
+ map_list_conversations) },
{ GDBUS_METHOD("ListFilterFields",
NULL,
GDBUS_ARGS({ "fields", "as" }),
--
2.7.4
next 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 Ajay Kishore [this message]
2020-02-11 6:36 ` [PATCH v2 2/6] obexd: Add parsers for conversation filters Ajay Kishore
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-1-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).