-rw-r--r-- | core/obex/btobex.cpp | 2 | ||||
-rw-r--r-- | core/obex/obex.cpp | 3 | ||||
-rw-r--r-- | core/obex/obex.h | 3 | ||||
-rw-r--r-- | core/obex/obexserver.cpp | 24 | ||||
-rw-r--r-- | core/obex/obexserver.h | 4 |
5 files changed, 21 insertions, 15 deletions
diff --git a/core/obex/btobex.cpp b/core/obex/btobex.cpp index 212a084..4e078b0 100644 --- a/core/obex/btobex.cpp +++ b/core/obex/btobex.cpp | |||
@@ -64,9 +64,9 @@ BtObex::~BtObex() { | |||
64 | } | 64 | } |
65 | 65 | ||
66 | void BtObex::receive() { | 66 | void BtObex::receive() { |
67 | ObexBase::receive(); | 67 | ObexBase::receive(); |
68 | m_rec = new ObexServer(); | 68 | m_rec = new ObexServer(OBEX_TRANS_BLUETOOTH); |
69 | 69 | ||
70 | odebug << "BT OBEX do receive" << oendl; | 70 | odebug << "BT OBEX do receive" << oendl; |
71 | // TODO mbhaynie: No idea if this actually works -- maybe opd is better. | 71 | // TODO mbhaynie: No idea if this actually works -- maybe opd is better. |
72 | // connect to the necessary slots | 72 | // connect to the necessary slots |
diff --git a/core/obex/obex.cpp b/core/obex/obex.cpp index 95c561a..e4a3c31 100644 --- a/core/obex/obex.cpp +++ b/core/obex/obex.cpp | |||
@@ -56,10 +56,9 @@ Obex::~Obex() { | |||
56 | delete m_send; | 56 | delete m_send; |
57 | } | 57 | } |
58 | void Obex::receive() { | 58 | void Obex::receive() { |
59 | ObexBase::receive(); | 59 | ObexBase::receive(); |
60 | m_rec = new OProcess(); | 60 | m_rec = new ObexServer(OBEX_TRANS_IRDA); |
61 | *m_rec << "irobex_palm3"; | ||
62 | // connect to the necessary slots | 61 | // connect to the necessary slots |
63 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), | 62 | connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), |
64 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); | 63 | this, SLOT(slotExited(Opie::Core::OProcess*) ) ); |
65 | 64 | ||
diff --git a/core/obex/obex.h b/core/obex/obex.h index 36ff29a..b948ce4 100644 --- a/core/obex/obex.h +++ b/core/obex/obex.h | |||
@@ -33,8 +33,9 @@ | |||
33 | #define OpieObex_H | 33 | #define OpieObex_H |
34 | 34 | ||
35 | #include "obexbase.h" | 35 | #include "obexbase.h" |
36 | #include <qobject.h> | 36 | #include <qobject.h> |
37 | #include "obexserver.h" | ||
37 | 38 | ||
38 | namespace Opie {namespace Core {class OProcess;}} | 39 | namespace Opie {namespace Core {class OProcess;}} |
39 | class QCopChannel; | 40 | class QCopChannel; |
40 | namespace OpieObex { | 41 | namespace OpieObex { |
@@ -83,9 +84,9 @@ namespace OpieObex { | |||
83 | uint m_count; | 84 | uint m_count; |
84 | QString m_file; | 85 | QString m_file; |
85 | QString m_outp; | 86 | QString m_outp; |
86 | Opie::Core::OProcess *m_send; | 87 | Opie::Core::OProcess *m_send; |
87 | Opie::Core::OProcess *m_rec; | 88 | ObexServer* m_rec; //The OBEX server |
88 | bool m_receive : 1; | 89 | bool m_receive : 1; |
89 | void shutDownReceive(); | 90 | void shutDownReceive(); |
90 | 91 | ||
91 | private slots: | 92 | private slots: |
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 | |||
@@ -47,11 +47,12 @@ | |||
47 | using namespace Opie::Core; | 47 | using namespace Opie::Core; |
48 | using namespace Opie::Core::Internal; | 48 | using namespace Opie::Core::Internal; |
49 | using namespace OpieObex; | 49 | using namespace OpieObex; |
50 | 50 | ||
51 | ObexServer::ObexServer() : | 51 | ObexServer::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 | ||
57 | ObexServer::~ObexServer() | 58 | ObexServer::~ObexServer() |
@@ -328,21 +329,24 @@ int 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 | ||
348 | bool ObexServer::start(RunMode runmode, Communication comm) | 352 | bool ObexServer::start(RunMode runmode, Communication comm) |
diff --git a/core/obex/obexserver.h b/core/obex/obexserver.h index 8567105..28577e2 100644 --- a/core/obex/obexserver.h +++ b/core/obex/obexserver.h | |||
@@ -52,13 +52,15 @@ namespace Opie { | |||
52 | namespace Opie {namespace Core {class OProcess;}} | 52 | namespace Opie {namespace Core {class OProcess;}} |
53 | namespace OpieObex { | 53 | namespace OpieObex { |
54 | class ObexServer : public Opie::Core::OProcess { | 54 | class ObexServer : public Opie::Core::OProcess { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | private: | ||
57 | int transport; //The OBEX transport type | ||
56 | public: | 58 | public: |
57 | /** | 59 | /** |
58 | * ObexServer constructor | 60 | * ObexServer constructor |
59 | */ | 61 | */ |
60 | ObexServer(); | 62 | ObexServer(int trans); |
61 | /** | 63 | /** |
62 | * | 64 | * |
63 | */ | 65 | */ |
64 | ~ObexServer(); | 66 | ~ObexServer(); |