Diff between 994f21ff4688e6913bdb30c54072f77762e73d38 and 4586a896a10581f0f4e6bb21a5f03f9f55bab5a5

Changed Files

File Additions Deletions Status
obexd/src/obex.c +18 -0 modified
obexd/src/obex.h +1 -0 modified

Full Patch

diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 54ae5af..f039476 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -48,6 +48,7 @@
 #include "dbus.h"
 #include "mimetype.h"
 #include "service.h"
+#include "btio.h"
 
 /* Default MTU's */
 #define DEFAULT_RX_MTU 32767
@@ -1179,3 +1180,20 @@ int obex_remove(struct OBEX_session *os, const char *path)
 
 	return os->driver->remove(path);
 }
+
+/* TODO: find a way to do this for tty or fix syncevolution */
+char *obex_get_id(struct OBEX_session *os)
+{
+	GError *gerr = NULL;
+	gchar address[18];
+	guint8 channel;
+
+	bt_io_get(os->io, BT_IO_RFCOMM, &gerr,
+			BT_IO_OPT_DEST, address,
+			BT_IO_OPT_CHANNEL, &channel,
+			BT_IO_OPT_INVALID);
+	if (gerr)
+		return NULL;
+
+	return g_strdup_printf("%s+%d", address, channel);
+}
diff --git a/obexd/src/obex.h b/obexd/src/obex.h
index 12f6117..62498f5 100644
--- a/obexd/src/obex.h
+++ b/obexd/src/obex.h
@@ -102,6 +102,7 @@ gboolean obex_get_symlinks(struct OBEX_session *os);
 const char *obex_get_capability_path(struct OBEX_session *os);
 gboolean obex_get_auto_accept(struct OBEX_session *os);
 int obex_remove(struct OBEX_session *os, const char *path);
+char *obex_get_id(struct OBEX_session *os);
 
 void server_free(struct server *server);
 int tty_init(gint service, const gchar *folder, const gchar *capability,