obexd:Add Operation property to transfer properties
PATCH 1/2 obexd:Add Operation property to transfer properties
Sometime, operation property is needed by the Bluetooth APP. Therefore, add the property to transfer properties
--- obexd/src/manager.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
obexd/src/manager.c +38 -0
@@ -35,6 +35,7 @@#include <btio/btio.h> #include <gobex/gobex.h> +#include <gobex/gobex-packet.h> #include "obexd.h" #include "obex.h"
@@ -515,6 +516,41 @@ static gboolean transfer_get_filename(const GDBusPropertyTable *property,return TRUE; } +static gboolean transfer_operation_exists (const GDBusPropertyTable *property, +void *data) +{ +struct obex_transfer *transfer = data; +struct obex_session *session = transfer->session; + +if (session->cmd ==G_OBEX_OP_PUT && + session->size !=OBJECT_SIZE_DELETE ) +return TRUE; +else if (session->cmd ==G_OBEX_OP_GET ) +return TRUE; +else +return FALSE; +} + +static gboolean transfer_get_operation (const GDBusPropertyTable *property, +DBusMessageIter *iter,void *data) +{ +struct obex_transfer *transfer = data; +struct obex_session *session = transfer->session; +const char *operation; + +if (session->cmd ==G_OBEX_OP_PUT && + session->size !=OBJECT_SIZE_DELETE ) + operation ="PUT" ; +else if (session->cmd ==G_OBEX_OP_GET ) + operation ="GET" ; +else +return FALSE; + +dbus_message_iter_append_basic (iter,DBUS_TYPE_STRING , &operation); + +return TRUE; +} +static gboolean transfer_get_transferred (const GDBusPropertyTable *property,DBusMessageIter *iter,void *data) {
@@ -549,6 +585,8 @@ static const GDBusPropertyTable transfer_properties[] = { { "Time", "t", transfer_get_time, NULL, transfer_time_exists }, { "Filename", "s", transfer_get_filename, NULL, transfer_filename_exists }, + { "Operation", "s", transfer_get_operation, NULL, + transfer_operation_exists }, { "Transferred", "t", transfer_get_transferred }, { } };
Signature · 1 line
1.7.7
PATCH 1/2 obexd:Add Operation property to transfer properties
Hi Luiz,
Can you help review the patches? Thanks
Best Regards
Zheng Wu
Quoted 88 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wu Zheng
Sent: Tuesday, September 24, 2013 3:37 PM
To: [email protected]
Cc: Zheng, Wu
Subject: [PATCH 1/2] obexd:Add Operation property to transfer propertiesSometime, operation property is needed by the Bluetooth APP. Therefore, add the property to transfer properties
---obexd/src/manager.c| 38
++++++++++++++++++++++++++++++++++++++1 files changed, 38 insertions(+), 0 deletions(-)obexd/src/manager.c index renamed from obexd/src/manager.c +0
-0f64b7b9..96976ec 100644
obexd/src/manager.c +31
-0@@ -35,6 +35,7 @@#include <btio/btio.h> #include <gobex/gobex.h> +#include <gobex/gobex-packet.h> #include "obexd.h" #include "obex.h" @@ -515,6 +516,41 @@ static gboolean transfer_get_filename(constGDBusPropertyTable *property, return TRUE; } +static gboolean transfer_operation_exists (const GDBusPropertyTable *property, +void *data) +{ +struct obex_transfer *transfer = data; +struct obex_session *session = transfer->session; + +if (session->cmd ==G_OBEX_OP_PUT && + session->size !=OBJECT_SIZE_DELETE ) +return TRUE; +else if (session->cmd ==G_OBEX_OP_GET ) +return TRUE; +else +return FALSE; +} + +static gboolean transfer_get_operation (const GDBusPropertyTable *property, +DBusMessageIter *iter,void *data) { +struct obex_transfer *transfer = data; +struct obex_session *session = transfer->session; +const char *operation; + +if (session->cmd ==G_OBEX_OP_PUT && + session->size !=OBJECT_SIZE_DELETE ) + operation ="PUT" ; +else if (session->cmd ==G_OBEX_OP_GET ) + operation ="GET" ; +else +return FALSE; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,&operation);
obexd/src/manager.c +4
-0+ +return TRUE; +} +static gboolean transfer_get_transferred(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data) { @@ -549,6+585,8 @@ static const GDBusPropertyTable transfer_properties[] = {
{ "Time", "t",transfer_get_time, NULL,transfer_time_exists}, { "Filename", "s",transfer_get_filename, NULL,
transfer_filename_exists},obexd/src/manager.c +2
-0+ {"Operation" ,"s" , transfer_get_operation,NULL , + transfer_operation_exists },{ "Transferred", "t", transfer_get_transferred }, { } };--
1.7.7--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Luiz Augusto von Dentz
maintainerHi,
Quoted 3 lines · Wu
Hi Luiz,
Can you help review the patches? Thanks
First, please do not top post.
Quoted 14 lines
Best Regards
Zheng WuQuoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Wu Zheng
Sent: Tuesday, September 24, 2013 3:37 PM
To: [email protected]
Cc: Zheng, Wu
Subject: [PATCH 1/2] obexd:Add Operation property to transfer propertiesSometime, operation property is needed by the Bluetooth APP. Therefore, add the property to transfer properties
---
You probably need to work on to why we need such property, I have no idea what you are reference to a Bluetooth APP, obviously is not the application that have created the transfer since that know should know what operation will be used.
If this is for some kind of download manager application that you are talking about Im not sure why it would like to know the operation? Is that to display the direction? Im not really sure this will be convenient for a download manager but I would not expose the operation itself probably upload/download or add new status uploading/downloading.
Signature · 1 line
Luiz Augusto von Dentz