All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] test: Fix opp-client not printing progress
@ 2013-04-10 14:17 Luiz Augusto von Dentz
  2013-04-10 14:17 ` [PATCH BlueZ 2/2] obexd: Fix using the same prefix for client and server sessions Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-04-10 14:17 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This avoid KeyError expection and fixes print usage.
---
 test/opp-client | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/test/opp-client b/test/opp-client
index 3078d49..878c263 100755
--- a/test/opp-client
+++ b/test/opp-client
@@ -49,23 +49,25 @@ class OppClient:
 			print("Transfer created: %s" % path)
 
 	def error(self, err):
-		print err
+		print(err)
 		mainloop.quit()
 
 	def properties_changed(self, interface, properties, invalidated, path):
 		if path != self.transfer_path:
 			return
 
-		if properties['Status'] == 'complete' or \
-				properties['Status'] == 'error':
+		if "Status" in properties and \
+				(properties["Status"] == "complete" or \
+				properties["Status"] == "error"):
 			if self.verbose:
-				print("Transfer %s" % properties['Status'])
+				print("Transfer %s" % properties["Status"])
 			mainloop.quit()
 			return
 
-		if properties["Transferred"] == None:
+		if "Transferred" not in properties:
 			return
 
+		value = properties["Transferred"]
 		speed = (value - self.transferred) / 1000
 		print("Transfer progress %d/%d at %d kBps" % (value,
 							self.transfer_size,
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH BlueZ 2/2] obexd: Fix using the same prefix for client and server sessions
  2013-04-10 14:17 [PATCH BlueZ 1/2] test: Fix opp-client not printing progress Luiz Augusto von Dentz
@ 2013-04-10 14:17 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2013-04-10 14:17 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This avoids using the same path for different sessions which fail since
it cannot register a second time causing an unexpected error.
---
 doc/obex-api.txt       | 17 +++++++++--------
 obexd/client/session.c |  2 +-
 obexd/src/manager.c    |  9 ++++++---
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/doc/obex-api.txt b/doc/obex-api.txt
index 759c4d8..22449c4 100644
--- a/doc/obex-api.txt
+++ b/doc/obex-api.txt
@@ -44,7 +44,8 @@ Session hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.Session1
-Object path	/org/bluez/obex/session{0, 1, 2, ...}
+Object path	/org/bluez/obex/server/session{0, 1, 2, ...} or
+		/org/bluez/obex/client/session{0, 1, 2, ...}
 
 Methods		string GetCapabilities()
 
@@ -79,7 +80,7 @@ Transfer hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.Transfer1
-Object path	/org/bluez/obex/session{0, 1, 2, ...}/transfer{0, 1, 2, ...}
+Object path	[Session object path]/transfer{0, 1, 2, ...}
 
 Methods		void Cancel()
 
@@ -141,7 +142,7 @@ Object Push hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.ObjectPush1
-Object path	/org/bluez/obex/session{0, 1, 2, ...}
+Object path	[Session object path]
 
 Methods		object, dict SendFile(string sourcefile)
 
@@ -201,7 +202,7 @@ File Transfer hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.FileTransfer
-Object path	/org/bluez/obex/session{0, 1, 2, ...}
+Object path	[Session object path]
 
 Methods		void ChangeFolder(string folder)
 
@@ -298,7 +299,7 @@ Phonebook Access hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.PhonebookAccess1
-Object path	/org/bluez/obex/session{0, 1, 2, ...}
+Object path	[Session object path]
 
 Methods		void Select(string location, string phonebook)
 
@@ -448,7 +449,7 @@ Synchronization hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.Synchronization1
-Object path	/org/bluez/obex/session{0, 1, 2, ...}
+Object path	[Session object path]
 
 Methods		void SetLocation(string location)
 
@@ -503,7 +504,7 @@ Message Access hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.MessageAccess1
-Object path	[variable prefix]/{session0,session1,...}
+Object path	[Session object path]
 
 Methods		void SetFolder(string name)
 
@@ -715,7 +716,7 @@ Message hierarchy
 
 Service		org.bluez.obex
 Interface	org.bluez.obex.Message1
-Object path	[variable prefix]/{session0,session1,...}/{message0,...}
+Object path	[Session object path]/{message0,...}
 
 Methods		object, dict Get(string targetfile, boolean attachment)
 
diff --git a/obexd/client/session.c b/obexd/client/session.c
index 2e8b113..7d16c26 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -47,7 +47,7 @@
 
 #define SESSION_INTERFACE "org.bluez.obex.Session1"
 #define ERROR_INTERFACE "org.bluez.obex.Error"
-#define SESSION_BASEPATH "/org/bluez/obex"
+#define SESSION_BASEPATH "/org/bluez/obex/client"
 
 #define OBEX_IO_ERROR obex_io_error_quark()
 #define OBEX_IO_ERROR_FIRST (0xff + 1)
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index c0887ca..b67567b 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -45,6 +45,7 @@
 #include "service.h"
 
 #define OBEX_BASE_PATH "/org/bluez/obex"
+#define SESSION_BASE_PATH OBEX_BASE_PATH "/server"
 #define OBEX_MANAGER_INTERFACE OBEXD_SERVICE ".AgentManager1"
 #define ERROR_INTERFACE OBEXD_SERVICE ".Error"
 #define TRANSFER_INTERFACE OBEXD_SERVICE ".Transfer1"
@@ -354,7 +355,7 @@ static gboolean transfer_get_session(const GDBusPropertyTable *property,
 	if (session == NULL)
 		return FALSE;
 
-	path = g_strdup_printf("%s/session%u", OBEX_BASE_PATH, session->id);
+	path = g_strdup_printf("%s/session%u", SESSION_BASE_PATH, session->id);
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
 
@@ -614,7 +615,7 @@ struct obex_transfer *manager_register_transfer(struct obex_session *os)
 
 	transfer = g_new0(struct obex_transfer, 1);
 	transfer->path = g_strdup_printf("%s/session%u/transfer%u",
-					OBEX_BASE_PATH, os->id, id++);
+					SESSION_BASE_PATH, os->id, id++);
 	transfer->session = os;
 
 	if (!g_dbus_register_interface(connection, transfer->path,
@@ -800,7 +801,9 @@ static const GDBusMethodTable session_methods[] = {
 
 void manager_register_session(struct obex_session *os)
 {
-	char *path = g_strdup_printf("%s/session%u", OBEX_BASE_PATH, os->id);
+	char *path;
+
+	path = g_strdup_printf("%s/session%u", SESSION_BASE_PATH, os->id);
 
 	if (!g_dbus_register_interface(connection, path,
 				SESSION_INTERFACE,
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-10 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 14:17 [PATCH BlueZ 1/2] test: Fix opp-client not printing progress Luiz Augusto von Dentz
2013-04-10 14:17 ` [PATCH BlueZ 2/2] obexd: Fix using the same prefix for client and server sessions Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.