summaryrefslogtreecommitdiff
path: root/core/obex/obexserver.cpp
Unidiff
Diffstat (limited to 'core/obex/obexserver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexserver.cpp24
1 files changed, 14 insertions, 10 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 @@
39#include <stdlib.h> 39#include <stdlib.h>
40#include <stdio.h> 40#include <stdio.h>
41#include <fcntl.h> 41#include <fcntl.h>
42#include <qapplication.h> 42#include <qapplication.h>
43#include <opie2/oprocctrl.h> 43#include <opie2/oprocctrl.h>
44#include <qstring.h> 44#include <qstring.h>
45#include <qfile.h> 45#include <qfile.h>
46 46
47using namespace Opie::Core; 47using namespace Opie::Core;
48using namespace Opie::Core::Internal; 48using namespace Opie::Core::Internal;
49using namespace OpieObex; 49using namespace OpieObex;
50 50
51ObexServer::ObexServer() : 51ObexServer::ObexServer(int trans) :
52 OProcess(tr("ObexServer"), 0, "ObexServer") 52 OProcess(tr("ObexServer"), 0, "ObexServer")
53{ 53{
54 transport = trans;
54 m_obex = NULL; 55 m_obex = NULL;
55} 56}
56 57
57ObexServer::~ObexServer() 58ObexServer::~ObexServer()
58{ 59{
59 stop(); 60 stop();
60} 61}
61 62
62/** 63/**
63 * Function handles the file received 64 * Function handles the file received
64 * @param name the file name 65 * @param name the file name
65 * @param data the file data 66 * @param data the file data
@@ -320,37 +321,40 @@ errout:
320 sdp_list_free(proto[2], 0); 321 sdp_list_free(proto[2], 0);
321 sdp_list_free(apseq, 0); 322 sdp_list_free(apseq, 0);
322 sdp_list_free(aproto, 0); 323 sdp_list_free(aproto, 0);
323 324
324 return lsession; 325 return lsession;
325} 326}
326 327
327int ObexServer::initObex(void) 328int ObexServer::initObex(void)
328{ 329{
329 int channel = 10; //Channel on which we do listen 330 int channel = 10; //Channel on which we do listen
330 if (m_obex) 331 if (m_obex)
331 return 0; 332 return 0;
332 m_obex = ::OBEX_Init(OBEX_TRANS_BLUETOOTH, obex_event, 0); 333 m_obex = ::OBEX_Init(transport, obex_event, 0);
333 if (!m_obex) { 334 if (!m_obex) {
334 printf("OBEX initialization error %d\n", errno); 335 printf("OBEX initialization error %d\n", errno);
335 return -1; 336 return -1;
336 } 337 }
337 ::BtOBEX_ServerRegister(m_obex, NULL, channel); 338 if (transport == OBEX_TRANS_BLUETOOTH) {
338 m_session = addOpushSvc(channel, "OBEX push service"); 339 ::BtOBEX_ServerRegister(m_obex, NULL, channel);
339 if (!m_session) { 340 m_session = addOpushSvc(channel, "OBEX push service");
340 printf("OBEX registration error %d\n", errno); 341 if (!m_session) {
341 ::OBEX_Cleanup(m_obex); 342 printf("OBEX registration error %d\n", errno);
342 m_obex = NULL; 343 ::OBEX_Cleanup(m_obex);
343 return -1; 344 m_obex = NULL;
344 } 345 return -1;
346 }
347 } else if (transport == OBEX_TRANS_IRDA)
348 ::IrOBEX_ServerRegister(m_obex, "OBEX");
345 return 0; 349 return 0;
346} 350}
347 351
348bool ObexServer::start(RunMode runmode, Communication comm) 352bool ObexServer::start(RunMode runmode, Communication comm)
349{ 353{
350 if ( runs ) 354 if ( runs )
351 { 355 {
352 return false; // cannot start a process that is already running 356 return false; // cannot start a process that is already running
353 // or if no executable has been assigned 357 // or if no executable has been assigned
354 } 358 }
355 run_mode = runmode; 359 run_mode = runmode;
356 status = 0; 360 status = 0;