From 4586a896a10581f0f4e6bb21a5f03f9f55bab5a5 Mon Sep 17 00:00:00 2001 From: Vinicius Costa Gomes Date: Wed, 3 Mar 2010 19:17:36 -0300 Subject: [PATCH] obexd: Add obex_get_id, which returns an device id. This function returns a string that is unique to each client. For now it is only implemented for Bluetooth. --- obexd/src/obex.c | 18 ++++++++++++++++++ obexd/src/obex.h | 1 + 2 files changed, 19 insertions(+) diff --git a/obexd/src/obex.c b/obexd/src/obex.c index 54ae5af2c..f0394767c 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 12f6117af..62498f5cb 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, -- 2.47.3