summaryrefslogtreecommitdiff
authorzecke <zecke>2002-06-12 16:37:52 (UTC)
committer zecke <zecke>2002-06-12 16:37:52 (UTC)
commitac707e366de561cabc8074b62025d143200869d7 (patch) (unidiff)
treead30bac3657fde6e664e7784eb34873989e94699
parent9b87f7a2f2de6b5c1bad4f35f76fc7a0fd1ad021 (diff)
downloadopie-ac707e366de561cabc8074b62025d143200869d7.zip
opie-ac707e366de561cabc8074b62025d143200869d7.tar.gz
opie-ac707e366de561cabc8074b62025d143200869d7.tar.bz2
OBEX time
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/obex/obex.cc32
-rw-r--r--core/applets/obex/obex.h10
-rw-r--r--core/applets/obex/obex.pro8
-rw-r--r--core/applets/obex/obeximpl.cc25
-rw-r--r--core/applets/obex/obeximpl.h5
5 files changed, 44 insertions, 36 deletions
diff --git a/core/applets/obex/obex.cc b/core/applets/obex/obex.cc
index f2ceff8..582ebbc 100644
--- a/core/applets/obex/obex.cc
+++ b/core/applets/obex/obex.cc
@@ -1,6 +1,6 @@
1 1
2 2
3#include "kprocess.h" 3#include <opie/oprocess.h>
4#include "obex.h" 4#include "obex.h"
5 5
6using namespace OpieObex; 6using namespace OpieObex;
@@ -17,16 +17,16 @@ Obex::~Obex() {
17 delete m_send; 17 delete m_send;
18} 18}
19void Obex::receive() { 19void Obex::receive() {
20 m_rec = new KProcess(); 20 m_rec = new OProcess();
21 *m_rec << "irobex_palm3"; 21 *m_rec << "irobex_palm3";
22 // connect to the necessary slots 22 // connect to the necessary slots
23 connect(m_rec, SIGNAL(processExited(KProcess*) ), 23 connect(m_rec, SIGNAL(processExited(OProcess*) ),
24 this, SLOT(slotExited(KProcess*) ) ); 24 this, SLOT(slotExited(OProcess*) ) );
25 25
26 connect(m_rec, SIGNAL(receivedStdout(KProcess*, char*, int ) ), 26 connect(m_rec, SIGNAL(receivedStdout(OProcess*, char*, int ) ),
27 this, SLOT(slotStdOut(KProcess*, char*, int) ) ); 27 this, SLOT(slotStdOut(OProcess*, char*, int) ) );
28 28
29 if(!m_rec->start(KProcess::NotifyOnExit, KProcess::AllOutput) ) { 29 if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
30 qWarning("could not start :("); 30 qWarning("could not start :(");
31 emit done( false ); 31 emit done( false );
32 } 32 }
@@ -42,18 +42,18 @@ void Obex::sendNow(){
42 if ( m_count >= 15 ) { // could not send 42 if ( m_count >= 15 ) { // could not send
43 emit error(-1 ); 43 emit error(-1 );
44 } 44 }
45 // KProcess inititialisation 45 // OProcess inititialisation
46 m_send = new KProcess(); 46 m_send = new OProcess();
47 *m_send << "irobex_palm3"; 47 *m_send << "irobex_palm3";
48 *m_send << m_file; 48 *m_send << m_file;
49 49
50 // connect to slots Exited and and StdOut 50 // connect to slots Exited and and StdOut
51 connect(m_send, SIGNAL(processExited(KProcess*) ), 51 connect(m_send, SIGNAL(processExited(OProcess*) ),
52 this, SLOT(slotExited(KProcess*)) ); 52 this, SLOT(slotExited(OProcess*)) );
53 connect(m_send, SIGNAL(receivedStdout(KProcess*, char*, int )), 53 connect(m_send, SIGNAL(receivedStdout(OProcess*, char*, int )),
54 this, SLOT(slotStdOut(KProcess*, char*, int) ) ); 54 this, SLOT(slotStdOut(OProcess*, char*, int) ) );
55 // now start it 55 // now start it
56 if (!m_send->start(/*KProcess::NotifyOnExit, KProcess::AllOutput*/ ) ) { 56 if (!m_send->start(/*OProcess::NotifyOnExit, OProcess::AllOutput*/ ) ) {
57 m_count = 15; 57 m_count = 15;
58 emit error(-1 ); 58 emit error(-1 );
59 } 59 }
@@ -62,14 +62,14 @@ void Obex::sendNow(){
62 emit currentTry( m_count ); 62 emit currentTry( m_count );
63} 63}
64 64
65void Obex::slotExited(KProcess* proc ){ 65void Obex::slotExited(OProcess* proc ){
66 if (proc == m_rec ) { // recieve process 66 if (proc == m_rec ) { // recieve process
67 recieved(); 67 recieved();
68 }else if ( proc == m_send ) { 68 }else if ( proc == m_send ) {
69 sendEnd(); 69 sendEnd();
70 } 70 }
71} 71}
72void Obex::slotStdOut(KProcess* proc, char* buf, int len){ 72void Obex::slotStdOut(OProcess* proc, char* buf, int len){
73 if ( proc == m_rec ) { // only recieve 73 if ( proc == m_rec ) { // only recieve
74 QCString cstring( buf, len ); 74 QCString cstring( buf, len );
75 m_outp.append( cstring.data() ); 75 m_outp.append( cstring.data() );
diff --git a/core/applets/obex/obex.h b/core/applets/obex/obex.h
index 17b8141..4e78015 100644
--- a/core/applets/obex/obex.h
+++ b/core/applets/obex/obex.h
@@ -5,7 +5,7 @@
5 5
6#include <qobject.h> 6#include <qobject.h>
7 7
8class KProcess; 8class OProcess;
9class QCopChannel; 9class QCopChannel;
10namespace OpieObex { 10namespace OpieObex {
11 class Obex : public QObject { 11 class Obex : public QObject {
@@ -53,8 +53,8 @@ namespace OpieObex {
53 uint m_count; 53 uint m_count;
54 QString m_file; 54 QString m_file;
55 QString m_outp; 55 QString m_outp;
56 KProcess *m_send; 56 OProcess *m_send;
57 KProcess *m_rec; 57 OProcess *m_rec;
58 58
59 private slots: 59 private slots:
60 60
@@ -65,8 +65,8 @@ namespace OpieObex {
65 //void send(const QString&); 65 //void send(const QString&);
66 66
67 // the process exited 67 // the process exited
68 void slotExited(KProcess* proc) ; 68 void slotExited(OProcess* proc) ;
69 void slotStdOut(KProcess*, char*, int); 69 void slotStdOut(OProcess*, char*, int);
70 70
71 private: 71 private:
72 void sendNow(); 72 void sendNow();
diff --git a/core/applets/obex/obex.pro b/core/applets/obex/obex.pro
index ce07ac9..72ad78f 100644
--- a/core/applets/obex/obex.pro
+++ b/core/applets/obex/obex.pro
@@ -1,11 +1,11 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt warn_on release
3 HEADERS= kprocess.h kprocctrl.h obex.h 3 HEADERS= obex.h obeximpl.h
4 SOURCES= kprocess.cpp kprocctrl.cpp obex.cc 4 SOURCES= obex.cc obeximpl.cc
5 TARGET = obex 5 TARGET = obex
6 DESTDIR = ../../plugins/applets 6 DESTDIR = ../../plugins/obex
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe -lopie
10 VERSION = 0.0.1 10 VERSION = 0.0.1
11 11
diff --git a/core/applets/obex/obeximpl.cc b/core/applets/obex/obeximpl.cc
index a3004ab..fa2a30a 100644
--- a/core/applets/obex/obeximpl.cc
+++ b/core/applets/obex/obeximpl.cc
@@ -1,16 +1,21 @@
1 1
2#include <qdatastream.h>
3#include <qpe/qcom.h>
2 4
3#include "obex.h" 5#include "obex.h"
4#include "obeximpl.h" 6#include "obeximpl.h"
5 7
8
9
6using namespace OpieObex; 10using namespace OpieObex;
7 11
8ObexImpl::ObexImpl( ) 12ObexImpl::ObexImpl( )
9 : QObject { 13 : QObject() {
10 // register to a channel 14 // register to a channel
15 qWarning( "c'tor" );
11 m_obex = new Obex(this, "obex"); 16 m_obex = new Obex(this, "obex");
12 m_chan = new QCopChannel("QPE/Obex" ); 17 m_chan = new QCopChannel("QPE/Obex" );
13 cconnect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ), 18 connect(m_chan, SIGNAL(received(const QCString&, const QByteArray& ) ),
14 this, SLOT(slotMessage(const QCString&, const QByteArray&) ) ); 19 this, SLOT(slotMessage(const QCString&, const QByteArray&) ) );
15} 20}
16ObexImpl::~ObexImpl() { 21ObexImpl::~ObexImpl() {
@@ -19,32 +24,34 @@ ObexImpl::~ObexImpl() {
19} 24}
20QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 25QRESULT ObexImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
21 *iface = 0; 26 *iface = 0;
22 if( uuid == IID_QUknown ) 27 if( uuid == IID_QUnknown )
23 *iface = this; 28 *iface = this;
24 else if( uuid == IID_ObexInterface ) 29 else if( uuid == IID_ObexInterface )
25 *iface = this; 30 *iface = this;
26 31
32 qWarning("query" );
27 if(*iface ) 33 if(*iface )
28 (*iface)->addRef(); 34 (*iface)->addRef();
29 return QS_OK; 35 return QS_OK;
30 36
31} 37}
32void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) { 38void ObexImpl::slotMessage( const QCString& msg, const QByteArray&data ) {
33 QDataStrean stream( data, IO_ReadOnly ); 39 QDataStream stream( data, IO_ReadOnly );
40 qWarning("Message %s", msg.data() );
34 if(msg == "send(QString,QString,QString)" ) { 41 if(msg == "send(QString,QString,QString)" ) {
35 QString desc; 42 QString desc;
36 stream >> desc; 43 stream >> desc;
37 QString filename; 44 QString filename;
38 stream >> filename; 45 stream >> filename;
39 m_obex->send(filename ); 46 m_obex->send(filename );
40 QCopEnvelope e ("QPE/Obex", "done(QString)" ): 47 QCopEnvelope e ("QPE/Obex", "done(QString)" );
41 e << filename; 48 e << filename;
42 }else if( ) { 49 }else if(msg == "receive(bool)" ) {
43 50 ;
44 } 51 }
45} 52}
46 53
47Q_EXPORT_INTERFACE() 54Q_EXPORT_INTERFACE()
48{ 55{
49 Q_CREATE_INSTANCE( IrdaAppletImpl ) 56 Q_CREATE_INSTANCE( ObexImpl )
50} 57}
diff --git a/core/applets/obex/obeximpl.h b/core/applets/obex/obeximpl.h
index 996627b..d5159e1 100644
--- a/core/applets/obex/obeximpl.h
+++ b/core/applets/obex/obeximpl.h
@@ -2,16 +2,17 @@
2#ifndef OpieObexImpl_H 2#ifndef OpieObexImpl_H
3#define OpieObexImpl_H 3#define OpieObexImpl_H
4 4
5#include <qobject.h>
5#include "../obexinterface.h" 6#include "../obexinterface.h"
6#include <qpe/qcopenvelope_qws.h> 7#include <qpe/qcopenvelope_qws.h>
7 8
8namespace OpieObex { 9namespace OpieObex {
9 class Obex; 10 class Obex;
10 class ObexImpl : public ObexInterface, public QObject { 11 class ObexImpl : public QObject, public ObexInterface {
11 Q_OBJECT 12 Q_OBJECT
12 public: 13 public:
13 ObexImpl(); 14 ObexImpl();
14 virtual ObexImpl(); 15 virtual ~ObexImpl();
15 QRESULT queryInterface( const QUuid&, QUnknownInterface** ); 16 QRESULT queryInterface( const QUuid&, QUnknownInterface** );
16 Q_REFCOUNT // for reference counting (macro ) 17 Q_REFCOUNT // for reference counting (macro )
17 private: 18 private: