-rw-r--r-- | core/obex/obexserver.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/obex/obexserver.cpp b/core/obex/obexserver.cpp index 95196de..25d8224 100644 --- a/core/obex/obexserver.cpp +++ b/core/obex/obexserver.cpp @@ -39,27 +39,28 @@ #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <qapplication.h> #include <opie2/oprocctrl.h> #include <qstring.h> #include <qfile.h> using namespace Opie::Core; using namespace Opie::Core::Internal; using namespace OpieObex; -ObexServer::ObexServer() : +ObexServer::ObexServer(int trans) : OProcess(tr("ObexServer"), 0, "ObexServer") { + transport = trans; m_obex = NULL; } ObexServer::~ObexServer() { stop(); } /** * Function handles the file received * @param name the file name * @param data the file data @@ -320,37 +321,40 @@ errout: sdp_list_free(proto[2], 0); sdp_list_free(apseq, 0); sdp_list_free(aproto, 0); return lsession; } int ObexServer::initObex(void) { int channel = 10; //Channel on which we do listen if (m_obex) return 0; - m_obex = ::OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0); + m_obex = ::OBEX_Init(transport, obex_event, 0); if (!m_obex) { printf("OBEX initialization error %d\n", errno); return -1; } + if (transport == OBEX_TRANS_BLUETOOTH) { ::BtOBEX_ServerRegister(m_obex, NULL, channel); m_session = addOpushSvc(channel, "OBEX push service"); if (!m_session) { printf("OBEX registration error %d\n", errno); ::OBEX_Cleanup(m_obex); m_obex = NULL; return -1; } + } else if (transport == OBEX_TRANS_IRDA) + ::IrOBEX_ServerRegister(m_obex, "OBEX"); return 0; } bool ObexServer::start(RunMode runmode, Communication comm) { if ( runs ) { return false; // cannot start a process that is already running // or if no executable has been assigned } run_mode = runmode; status = 0; |