From 4f68b6b51aaa1788589645392ace1b681eeb812e Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 16 Nov 2008 17:17:00 +0200 Subject: [PATCH] obexd: Add Nokia PC Suite support This patch adds a --pcsuite command line option which enables features needed for Nokia PC Suite to work with obexd. --- obexd/src/main.c | 11 +++++++++++ obexd/src/manager.c | 46 +++++++++++++++++++++++++++++++++++++++++++++ obexd/src/obex.c | 3 ++- obexd/src/obex.h | 1 + 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/obexd/src/main.c b/obexd/src/main.c index c7be4ad71..d8da5bdb8 100644 --- a/obexd/src/main.c +++ b/obexd/src/main.c @@ -52,6 +52,7 @@ #define OPP_CHANNEL 9 #define FTP_CHANNEL 10 #define PBAP_CHANNEL 15 +#define PCSUITE_CHANNEL 24 #define DEFAULT_ROOT_PATH "/tmp" @@ -117,6 +118,7 @@ static gboolean option_autoaccept = FALSE; static gboolean option_opp = FALSE; static gboolean option_ftp = FALSE; static gboolean option_pbap = FALSE; +static gboolean option_pcsuite = FALSE; static GOptionEntry options[] = { { "nodaemon", 'n', G_OPTION_FLAG_REVERSE, @@ -138,6 +140,8 @@ static GOptionEntry options[] = { "Enable File Transfer server" }, { "pbap", 'p', 0, G_OPTION_ARG_NONE, &option_pbap, "Enable Phonebook Access server" }, + { "pcsuite", 's', 0, G_OPTION_ARG_NONE, &option_pcsuite, + "Enable PC Suite Services server" }, { NULL }, }; @@ -273,6 +277,13 @@ int main(int argc, char *argv[]) PBAP_CHANNEL, TRUE, FALSE, NULL); } + if (option_pcsuite == TRUE) { + services |= OBEX_PCSUITE; + bluetooth_init(OBEX_PCSUITE, "Nokia OBEX PC Suite Services", + option_root, PCSUITE_CHANNEL, TRUE, + option_autoaccept, option_capability); + } + if (option_devnode) devnode_setup(); diff --git a/obexd/src/manager.c b/obexd/src/manager.c index adcadb358..96bb09872 100644 --- a/obexd/src/manager.c +++ b/obexd/src/manager.c @@ -170,6 +170,49 @@ const static gchar *pbap_record = " \ \ "; +const static gchar *pcsuite_record = +" \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +"; #define TRANSFER_INTERFACE OPENOBEX_SERVICE ".Transfer" #define SESSION_INTERFACE OPENOBEX_SERVICE ".Session" @@ -473,6 +516,9 @@ static gchar *create_xml_record(const char *name, case OBEX_PBAP: xml = g_markup_printf_escaped(pbap_record, channel, name); break; + case OBEX_PCSUITE: + xml = g_markup_printf_escaped(pcsuite_record, channel, name); + break; default: xml = NULL; break; diff --git a/obexd/src/obex.c b/obexd/src/obex.c index 7197c94c3..2c1b41ce9 100644 --- a/obexd/src/obex.c +++ b/obexd/src/obex.c @@ -219,7 +219,8 @@ static void cmd_connect(struct obex_session *os, continue; if (memcmp(hd.bs, FTP_TARGET, TARGET_SIZE) == 0 && - os->server->services & OBEX_FTP) { + os->server->services & + (OBEX_FTP | OBEX_PCSUITE)) { os->target = FTP_TARGET; os->cmds = &ftp; break; diff --git a/obexd/src/obex.h b/obexd/src/obex.h index 56a5f37c5..a1b41bbf4 100644 --- a/obexd/src/obex.h +++ b/obexd/src/obex.h @@ -33,6 +33,7 @@ #define OBEX_FTP (1 << 2) #define OBEX_BIP (1 << 3) #define OBEX_PBAP (1 << 4) +#define OBEX_PCSUITE (1 << 5) #define OBJECT_SIZE_UNKNOWN -1 #define OBJECT_SIZE_DELETE -2 -- 2.47.3