From patchwork Thu Mar 5 08:55:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kishore X-Patchwork-Id: 197311 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEFFFC3F2D7 for ; Thu, 5 Mar 2020 09:18:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD0642146E for ; Thu, 5 Mar 2020 09:18:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726259AbgCEJSy (ORCPT ); Thu, 5 Mar 2020 04:18:54 -0500 Received: from mga14.intel.com ([192.55.52.115]:48950 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgCEJSy (ORCPT ); Thu, 5 Mar 2020 04:18:54 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 01:18:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,517,1574150400"; d="scan'208";a="259126118" Received: from unknown (HELO ajay-desktop.iind.intel.com) ([10.223.96.133]) by orsmga002.jf.intel.com with ESMTP; 05 Mar 2020 01:18:52 -0800 From: Ajay Kishore To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 2/6] obexd: Add parsers for conversation filters Date: Thu, 5 Mar 2020 14:25:20 +0530 Message-Id: <1583398524-18749-2-git-send-email-ajay.kishore@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583398524-18749-1-git-send-email-ajay.kishore@intel.com> References: <1583398524-18749-1-git-send-email-ajay.kishore@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 */ }; From patchwork Thu Mar 5 08:55:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kishore X-Patchwork-Id: 197310 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9E31C3F2D1 for ; Thu, 5 Mar 2020 09:18:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 809D421556 for ; Thu, 5 Mar 2020 09:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbgCEJS6 (ORCPT ); Thu, 5 Mar 2020 04:18:58 -0500 Received: from mga14.intel.com ([192.55.52.115]:48950 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgCEJS6 (ORCPT ); Thu, 5 Mar 2020 04:18:58 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 01:18:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,517,1574150400"; d="scan'208";a="259126130" Received: from unknown (HELO ajay-desktop.iind.intel.com) ([10.223.96.133]) by orsmga002.jf.intel.com with ESMTP; 05 Mar 2020 01:18:56 -0800 From: Ajay Kishore To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 5/6] obexd: Handle MAP Event Report v1.1 and v1.2 Date: Thu, 5 Mar 2020 14:25:23 +0530 Message-Id: <1583398524-18749-5-git-send-email-ajay.kishore@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583398524-18749-1-git-send-email-ajay.kishore@intel.com> References: <1583398524-18749-1-git-send-email-ajay.kishore@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Changes made to add handler function for the corresponding events mentioned in extended event reports 1.1 and 1.2. --- obexd/client/map-event.h | 8 +++++++- obexd/client/map.c | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/obexd/client/map-event.h b/obexd/client/map-event.h index 5414b26..c41bb67 100644 --- a/obexd/client/map-event.h +++ b/obexd/client/map-event.h @@ -32,7 +32,13 @@ enum map_event_type { MAP_ET_MEMORY_FULL, MAP_ET_MEMORY_AVAILABLE, MAP_ET_MESSAGE_DELETED, - MAP_ET_MESSAGE_SHIFT + MAP_ET_MESSAGE_SHIFT, + MAP_ET_READ_STATUS_CHANGED, + MAP_ET_MESSAGE_REMOVED, + MAP_ET_MESSAGE_EXTENDED_DATA_CHANGED, + MAP_ET_PARTICIPANT_PRESENCE_CHANGED, + MAP_ET_PARTICIPANT_CHAT_STATE_CHANGED, + MAP_ET_CONVERSATION_CHANGED }; struct map_event { diff --git a/obexd/client/map.c b/obexd/client/map.c index 8a059ab..3bcb4a3 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -2550,6 +2550,12 @@ static void map_handle_folder_changed(struct map_data *map, "Folder"); } +static void map_handle_remove_message(struct map_data *map, + struct map_event *event) +{ + g_hash_table_remove(map->messages, &event->handle); +} + static void map_handle_notification(struct map_event *event, void *user_data) { struct map_data *map = user_data; @@ -2582,6 +2588,19 @@ static void map_handle_notification(struct map_event *event, void *user_data) case MAP_ET_MESSAGE_SHIFT: map_handle_folder_changed(map, event, event->folder); break; + case MAP_ET_READ_STATUS_CHANGED: + map_handle_status_changed(map, event, "read"); + break; + case MAP_ET_MESSAGE_REMOVED: + map_handle_remove_message(map, event); + break; + case MAP_ET_MESSAGE_EXTENDED_DATA_CHANGED: + map_handle_status_changed(map, event, + "message-extended-data-changed"); + break; + case MAP_ET_PARTICIPANT_PRESENCE_CHANGED: + case MAP_ET_PARTICIPANT_CHAT_STATE_CHANGED: + case MAP_ET_CONVERSATION_CHANGED: case MAP_ET_MEMORY_FULL: case MAP_ET_MEMORY_AVAILABLE: default: From patchwork Thu Mar 5 08:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kishore X-Patchwork-Id: 197309 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB3EDC3F2D7 for ; Thu, 5 Mar 2020 09:18:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9368A21556 for ; Thu, 5 Mar 2020 09:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726764AbgCEJS7 (ORCPT ); Thu, 5 Mar 2020 04:18:59 -0500 Received: from mga14.intel.com ([192.55.52.115]:48950 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgCEJS7 (ORCPT ); Thu, 5 Mar 2020 04:18:59 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 01:18:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,517,1574150400"; d="scan'208";a="259126132" Received: from unknown (HELO ajay-desktop.iind.intel.com) ([10.223.96.133]) by orsmga002.jf.intel.com with ESMTP; 05 Mar 2020 01:18:58 -0800 From: Ajay Kishore To: linux-bluetooth@vger.kernel.org Subject: [PATCH v3 6/6] doc/obex-api: Update documentation Date: Thu, 5 Mar 2020 14:25:24 +0530 Message-Id: <1583398524-18749-6-git-send-email-ajay.kishore@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583398524-18749-1-git-send-email-ajay.kishore@intel.com> References: <1583398524-18749-1-git-send-email-ajay.kishore@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This adds documentation with the conversation listing feature --- doc/obex-api.txt | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/doc/obex-api.txt b/doc/obex-api.txt index f39355a..ef81460 100644 --- a/doc/obex-api.txt +++ b/doc/obex-api.txt @@ -712,6 +712,44 @@ Methods void SetFolder(string name) Possible errors: org.bluez.obex.Error.InvalidArguments org.bluez.obex.Error.Failed + array{object, dict} ListConversations(string folder, dict filter) + + Returns an array containing the conversations found in the + given subfolder of the current folder, or in the current + folder if folder is empty. + + Possible Filters: MaxListCount, LastActivityBegin, LastActivityEnd, + ReadStatus, Recipient + + Each message is represented by an object path followed + by a dictionary of the properties. + + Properties: + + string id: + + Conversation unique identification + + string last_activity: + + Conversation timestamp for the last activity + + string chat_state: + + Conversation current chat state of the participants + + string presence_availability: + + Conversation participants availability + + string presence_text: + + User defined status of the conversation + + Possible errors: org.bluez.obex.Error.InvalidArguments + org.bluez.obex.Error.Failed + + void UpdateInbox(void) Request remote to update its inbox. @@ -799,6 +837,18 @@ Filter: uint16 Offset: Possible values: True for high priority or False for non-high priority + string LastActivityBegin: + + Filter conversations by starting period. + + Possible values: Date in "YYYYMMDDTHHMMSS" format. + + string LastActivityEnd: + + Filter conversations by ending period. + + Possible values: Date in "YYYYMMDDTHHMMSS" format. + Message hierarchy =================