author | aquadran <aquadran> | 2006-05-04 05:40:22 (UTC) |
---|---|---|
committer | aquadran <aquadran> | 2006-05-04 05:40:22 (UTC) |
commit | 9e9148941974ce65fb733b14dd8bb15fe099ec2c (patch) (side-by-side diff) | |
tree | e07db54c1bef85853f7037478c0f0ff56b09779e | |
parent | 1240155cf5865df0d0ce0e4bd04dfec68ec1ede5 (diff) | |
download | opie-9e9148941974ce65fb733b14dd8bb15fe099ec2c.zip opie-9e9148941974ce65fb733b14dd8bb15fe099ec2c.tar.gz opie-9e9148941974ce65fb733b14dd8bb15fe099ec2c.tar.bz2 |
fixed compilation opieobex
-rw-r--r-- | core/obex/btobex.cpp | 4 | ||||
-rw-r--r-- | core/obex/btobex.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/core/obex/btobex.cpp b/core/obex/btobex.cpp index bb5c06d..b8556da 100644 --- a/core/obex/btobex.cpp +++ b/core/obex/btobex.cpp @@ -1,132 +1,132 @@ #include "btobex.h" -#include <manager.h> -#include <services.h> +#include <opietooth/manager.h> +#include <opietooth/services.h> /* OPIE */ #include <opie2/oprocess.h> #include <opie2/odebug.h> /* QT */ #include <qfileinfo.h> #include <qstring.h> #include <qmap.h> #include <qmessagebox.h> using namespace OpieObex; using namespace Opie::Core; /* TRANSLATOR OpieObex::Obex */ using namespace OpieTooth; BtObex::BtObex( QObject *parent, const char* name ) : QObject(parent, name ) { m_rec = 0; m_send=0; m_count = 0; m_receive = false; connect( this, SIGNAL(error(int) ), // for recovering to receive SLOT(slotError() ) ); connect( this, SIGNAL(sent(bool) ), SLOT(slotError() ) ); btManager = NULL; }; BtObex::~BtObex() { if (btManager) delete btManager; delete m_rec; delete m_send; } void BtObex::receive() { m_receive = true; m_outp = QString::null; m_rec = new OProcess(); // TODO mbhaynie: No idea if this actually works -- maybe opd is better. *m_rec << "obexftpd" << "-b"; // connect to the necessary slots connect(m_rec, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotExited(Opie::Core::OProcess*) ) ); connect(m_rec, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotStdOut(Opie::Core::OProcess*, char*, int) ) ); if(!m_rec->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { emit done( false ); delete m_rec; m_rec = 0; } } void BtObex::send( const QString& fileName, const QString& bdaddr) { // if currently receiving stop it send receive m_count = 0; m_file = fileName; m_bdaddr = bdaddr; if (m_rec != 0 ) { if (m_rec->isRunning() ) { emit error(-1 ); delete m_rec; m_rec = 0; }else{ emit error( -1 ); // we did not delete yet but it's not running slotExited is pending return; } } //Now we need to find out if the OBEX push is supported for this device //And get the port number if (!btManager) { btManager = new Manager("hci0"); connect(btManager, SIGNAL(foundServices(const QString&, Services::ValueList)), this, SLOT(slotFoundServices(const QString&, Services::ValueList))); } btManager->searchServices(bdaddr); } /** * This function reacts on the service discovery finish */ void BtObex::slotFoundServices(const QString&, Services::ValueList svcList) { QValueList<OpieTooth::Services>::Iterator it; QMap<int, QString> classList; //The classes list QMap<int, QString>::Iterator classIt; //Iterator in the class list int portNum = -1; //The desired port number odebug << "BtObex slotFoundServices" << oendl; if (svcList.isEmpty()) { QMessageBox::critical(NULL, tr("Object send"), tr("No services found")); emit error(-1); return; } for (it = svcList.begin(); it != svcList.end(); it++) { classList = (*it).classIdList(); classIt = classList.begin(); if (classIt == classList.end()) continue; ////We really need symbolic names for service IDs //Ok, we have found the object push service if (classIt.key() == 4357) { portNum = (*it).protocolDescriptorList().last().port(); break; } } if (portNum == -1) { QMessageBox::critical(NULL, tr("Object send"), tr("No OBEX Push service")); emit error(-1); return; } m_port = portNum; sendNow(); } void BtObex::sendNow(){ if ( m_count >= 25 ) { // could not send emit error(-1 ); emit sent(false); return; diff --git a/core/obex/btobex.h b/core/obex/btobex.h index 099f04a..ba50064 100644 --- a/core/obex/btobex.h +++ b/core/obex/btobex.h @@ -1,86 +1,86 @@ #ifndef OpieBtObex_H #define OpieBtObex_H #include <qobject.h> -#include <services.h> -#include <manager.h> +#include <opietooth/services.h> +#include <opietooth/manager.h> namespace Opie {namespace Core {class OProcess;}} class QCopChannel; using namespace OpieTooth; namespace OpieObex { // Maybe this should be derved from Obex. class BtObex : public QObject { Q_OBJECT public: /** * BtObex c'tor look */ BtObex( QObject *parent, const char* name); /** * d'tor */ ~BtObex(); /** TODO mbhaynie -- Maybe opd would be a better way to receive. * Starting listening to Bluetooth after enabled by the applet * a signal gets emitted when received a file */ void receive(); void send( const QString&, const QString& ); void setReceiveEnabled( bool = false ); signals: /** * a signal * @param path The path to the received file */ void receivedFile( const QString& path); /** * error signal if the program couldn't be started or the * the connection timed out */ void error( int ); /** * The current try to receive data */ void currentTry(unsigned int); /** * signal sent The file got beamed to the remote location */ void sent(bool); void done(bool); private: uint m_count; QString m_file; QString m_outp; QString m_bdaddr; int m_port; Opie::Core::OProcess *m_send; Opie::Core::OProcess *m_rec; bool m_receive : 1; OpieTooth::Manager* btManager; void shutDownReceive(); private slots: // the process exited void slotExited(Opie::Core::OProcess*) ; void slotStdOut(Opie::Core::OProcess*, char*, int); void slotError(); void slotFoundServices(const QString&, Services::ValueList); private: void sendNow(); QString parseOut(); void received(); void sendEnd(); }; }; #endif |