From: Wu Zheng <wu.zheng@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Wu Zheng <wu.zheng@intel.com>
Subject: [PATCH 2/2] obexd:Add get_address property to transfer properties
Date: Tue, 24 Sep 2013 15:37:30 +0800 [thread overview]
Message-ID: <1380008250-30536-1-git-send-email-wu.zheng@intel.com> (raw)
Sometime, address is needed by the Bluetooth OBEX APP.
Therefore, add the property to transfer properties
---
obexd/src/manager.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index 96976ec..b338a72 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -551,6 +551,41 @@ static gboolean transfer_get_operation(const GDBusPropertyTable *property,
return TRUE;
}
+static gboolean transfer_address_exists(const GDBusPropertyTable *property,
+ void *data)
+{
+ struct obex_transfer *transfer = data;
+ struct obex_session *session = transfer->session;
+ char *address;
+ int err;
+
+ err = obex_getpeername(session, &address);
+ if (err < 0)
+ return FALSE;
+
+ g_free(address);
+
+ return TRUE;
+}
+
+static gboolean transfer_get_address(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *data)
+{
+ struct obex_transfer *transfer = data;
+ struct obex_session *session = transfer->session;
+ char *address;
+ int err;
+
+ err = obex_getpeername(session, &address);
+ if (err < 0)
+ return FALSE;
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &address);
+ g_free(address);
+
+ return TRUE;
+}
+
static gboolean transfer_get_transferred(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
@@ -587,6 +622,8 @@ static const GDBusPropertyTable transfer_properties[] = {
transfer_filename_exists },
{ "Operation", "s", transfer_get_operation, NULL,
transfer_operation_exists },
+ { "Address", "s", transfer_get_address, NULL,
+ transfer_address_exists },
{ "Transferred", "t", transfer_get_transferred },
{ }
};
--
1.7.7
next reply other threads:[~2013-09-24 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 7:37 Wu Zheng [this message]
2013-09-29 8:40 ` [PATCH 2/2] obexd:Add get_address property to transfer properties 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=1380008250-30536-1-git-send-email-wu.zheng@intel.com \
--to=wu.zheng@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