author | zecke <zecke> | 2004-03-14 13:22:42 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 13:22:42 (UTC) |
commit | 0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44 (patch) (side-by-side diff) | |
tree | f6a68afa76a9be4099c3de7a286caeadd250c966 /noncore/net/opietooth | |
parent | d9d68663164078b8dbdbfe70d291291b9fd5aacf (diff) | |
download | opie-0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44.zip opie-0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44.tar.gz opie-0f7217afa7cdcb108dd2afba0ff6b42c97ab6f44.tar.bz2 |
Convert net to ODP and QtAUX
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/device.h | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.cc | 22 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.h | 26 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startdunconnection.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startdunconnection.h | 8 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startpanconnection.cpp | 10 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/startpanconnection.h | 8 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/main.cpp | 4 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 7 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.h | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.cpp | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/pppdialog.h | 4 |
14 files changed, 72 insertions, 57 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 817936d..93b2c67 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -1,85 +1,85 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> .>+-= _;:, .> :=|. This library is free software; you can .> <, > . <= redistribute it and/or modify it under :=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%+i> _;_. .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=| MERCHANTABILITY or FITNESS FOR A _.=:. : :=>: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. . .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-= this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bluezapplet.h" #include <qapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/config.h> #include <qpe/resource.h> -#include <opie/odevice.h> +#include <opie2/odevice.h> #include <qpoint.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> #include <qtimer.h> #include <qpopupmenu.h> #include <device.h> using namespace Opie; namespace OpieTooth { BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedHeight( 18 ); setFixedWidth( 14 ); bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); startTimer(4000); btDevice = 0; bluezactive = false; bluezDiscoveryActive = false; } BluezApplet::~BluezApplet() { if ( btDevice ) { delete btDevice; } } bool BluezApplet::checkBluezStatus() { if (btDevice) { if (btDevice->isLoaded() ) { return true; } else { return false; } } else { return false; } } int BluezApplet::setBluezStatus(int c) { diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index bae1c47..d913853 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc @@ -1,147 +1,149 @@ #include <signal.h> -#include <opie/oprocess.h> +#include <opie2/oprocess.h> #include "device.h" using namespace OpieTooth; +using namespace Opie::Core; +using namespace Opie::Core; namespace { int parsePid( const QCString& par ){ int id=0; QString string( par ); QStringList list = QStringList::split( '\n', string ); for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ qWarning("parsePID: %s", (*it).latin1() ); if( !(*it).startsWith("CSR") ){ id = (*it).toInt(); break; } } return id; } } Device::Device(const QString &device, const QString &mode, const QString &speed ) : QObject(0, "device") { qWarning("OpieTooth::Device create" ); m_hci = 0; m_process = 0; m_attached = false; m_device = device; m_mode = mode; m_speed = speed; attach(); } Device::~Device(){ detach(); } void Device::attach(){ qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); if(m_process == 0 ){ m_output.resize(0); qWarning("new process to create" ); m_process = new OProcess(); *m_process << "hciattach"; *m_process << "-p"; *m_process << m_device << m_mode << m_speed; - connect(m_process, SIGNAL( processExited(OProcess*) ), + connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(OProcess* ) ) ); - connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ), + connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); - connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ), + connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotStdErr(OProcess*,char*,int) ) ); if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ qWarning("Could not start" ); delete m_process; m_process = 0; } }; } void Device::detach(){ delete m_hci; delete m_process; // kill the pid we got if(m_attached ){ //kill the pid qWarning( "killing" ); kill(pid, 9); } qWarning("detached" ); } bool Device::isLoaded()const{ return m_attached; } QString Device::devName()const { return QString::fromLatin1("hci0"); }; void Device::slotExited( OProcess* proc) { qWarning("prcess exited" ); if(proc== m_process ){ qWarning("proc == m_process" ); if( m_process->normalExit() ){ // normal exit qWarning("normalExit" ); int ret = m_process->exitStatus(); if( ret == 0 ){ // attached qWarning("attached" ); qWarning("Output: %s", m_output.data() ); pid = parsePid( m_output ); qWarning("Pid = %d", pid ); // now hciconfig hci0 up ( determine hciX FIXME) // and call hciconfig hci0 up // FIXME hardcoded to hci0 now :( m_hci = new OProcess( ); *m_hci << "hciconfig"; *m_hci << "hci0 up"; - connect(m_hci, SIGNAL( processExited(OProcess*) ), + connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), this, SLOT( slotExited(OProcess* ) ) ); if(!m_hci->start() ){ qWarning("could not start" ); m_attached = false; emit device("hci0", false ); } }else{ qWarning("crass" ); m_attached = false; emit device("hci0", false ); } } delete m_process; m_process = 0; }else if(proc== m_hci ){ qWarning("M HCI exited" ); if( m_hci->normalExit() ){ qWarning("normal exit" ); int ret = m_hci->exitStatus(); if( ret == 0 ){ qWarning("attached really really attached" ); m_attached = true; emit device("hci0", true ); }else{ qWarning( "failed" ); emit device("hci0", false ); m_attached = false; } }// normal exit delete m_hci; m_hci = 0; } } void Device::slotStdOut(OProcess* proc, char* chars, int len) { qWarning("std out" ); if( len <1 ){ qWarning( "len < 1 " ); return; } if(proc == m_process ){ QCString string( chars, len+1 ); // \0 == +1 qWarning("output: %s", string.data() ); m_output.append( string.data() ); } } void Device::slotStdErr(OProcess* proc, char* chars, int len) diff --git a/noncore/net/opietooth/lib/device.h b/noncore/net/opietooth/lib/device.h index ce7fccc..f3339fc 100644 --- a/noncore/net/opietooth/lib/device.h +++ b/noncore/net/opietooth/lib/device.h @@ -1,88 +1,88 @@ #ifndef OpieToothDevice_H #define OpieToothDevice_H #include <qobject.h> #include <qstring.h> #include <qvaluelist.h> #include <sys/types.h> -class OProcess; +namespace Opie {namespace Core {class Opie::Core::OProcess;}} namespace OpieTooth { /** * Device takes care of attaching serial * devices to the blueZ stack. * After attaching it hciconfig ups it */ class Device : public QObject { Q_OBJECT public: /** * Brings up an device. * Usage example: new Device(/dev/ttySB0, csr) * * @param &device QString the device name * @param &mode QString the mode * @param &speed QString the speed of the device, can be left blank */ Device(const QString &device, const QString& mode, const QString& speed); /** * unloads the device */ ~Device(); /** * attach the device */ void attach(); /** * detach the device */ void detach(); /** * Is the device loaded? * @return bool, if the device is loaded */ bool isLoaded()const; /** * Returns the device name * @return QString, the device name */ QString devName()const ; // hci0 signals: /** * Signals devicename and up status * @return &device QString, Devicename * @return up bool, if the device is up or not. */ void device(const QString& device, bool up ); private slots: - virtual void slotExited( OProcess* ); - virtual void slotStdOut(OProcess*, char*, int ); - virtual void slotStdErr(OProcess*, char*, int ); + virtual void slotExited( Opie::Core::OProcess* ); + virtual void slotStdOut(Opie::Core::OProcess*, char*, int ); + virtual void slotStdErr(Opie::Core::OProcess*, char*, int ); private: class Private; Private *d; QString m_device; bool m_attached:1; - OProcess* m_hci; - OProcess* m_process; + Opie::Core::OProcess* m_hci; + Opie::Core::OProcess* m_process; QString m_devId; QString m_mode; QString m_speed; pid_t pid; QCString m_output; }; }; #endif diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index c89d325..56156a8 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc @@ -1,160 +1,162 @@ -#include <opie/oprocess.h> +#include <opie2/oprocess.h> #include "parser.h" #include "manager.h" using namespace OpieTooth; +using namespace Opie::Core; +using namespace Opie::Core; Manager::Manager( const QString& dev ) : QObject() { qWarning("created"); m_device = dev; m_hcitool = 0; m_sdp = 0; } Manager::Manager( Device* /*dev*/ ) : QObject() { m_hcitool = 0; m_sdp = 0; } Manager::Manager() : QObject() { m_hcitool = 0; m_sdp = 0; } Manager::~Manager(){ delete m_hcitool; delete m_sdp; } void Manager::setDevice( const QString& dev ){ m_device = dev; } void Manager::setDevice( Device* /*dev*/ ){ } void Manager::isAvailable( const QString& device ){ OProcess* l2ping = new OProcess(); l2ping->setName( device.latin1() ); *l2ping << "l2ping" << "-c1" << device; - connect(l2ping, SIGNAL(processExited(OProcess* ) ), + connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ), this, SLOT(slotProcessExited(OProcess*) ) ); if (!l2ping->start() ) { emit available( device, false ); delete l2ping; } } void Manager::isAvailable( Device* /*dev*/ ){ } void Manager::searchDevices( const QString& device ){ qWarning("search devices"); OProcess* hcitool = new OProcess(); hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); *hcitool << "hcitool" << "scan"; - connect( hcitool, SIGNAL(processExited(OProcess*) ) , + connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , this, SLOT(slotHCIExited(OProcess* ) ) ); - connect( hcitool, SIGNAL(receivedStdout(OProcess*, char*, int ) ), + connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotHCIOut(OProcess*, char*, int ) ) ); if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning("could not start"); RemoteDevice::ValueList list; emit foundDevices( device, list ); delete hcitool; } } void Manager::searchDevices(Device* /*d*/ ){ } void Manager::addService(const QString& name ){ OProcess proc; proc << "sdptool" << "add" << name; bool bo = true; if (!proc.start(OProcess::DontCare ) ) bo = false; emit addedService( name, bo ); } void Manager::addServices(const QStringList& list){ QStringList::ConstIterator it; for (it = list.begin(); it != list.end(); ++it ) addService( (*it) ); } void Manager::removeService( const QString& name ){ OProcess prc; prc << "sdptool" << "del" << name; bool bo = true; if (!prc.start(OProcess::DontCare ) ) bo = false; emit removedService( name, bo ); } void Manager::removeServices( const QStringList& list){ QStringList::ConstIterator it; for (it = list.begin(); it != list.end(); ++it ) removeService( (*it) ); } void Manager::searchServices( const QString& remDevice ){ OProcess *m_sdp =new OProcess(); *m_sdp << "sdptool" << "browse" << remDevice; m_sdp->setName( remDevice.latin1() ); qWarning("search Services for %s", remDevice.latin1() ); - connect(m_sdp, SIGNAL(processExited(OProcess*) ), + connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotSDPExited(OProcess* ) ) ); - connect(m_sdp, SIGNAL(receivedStdout(OProcess*, char*, int ) ), + connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning("could not start sdptool" ); delete m_sdp; Services::ValueList list; emit foundServices( remDevice, list ); } } void Manager::searchServices( const RemoteDevice& dev){ searchServices( dev.mac() ); } QString Manager::toDevice( const QString& /*mac*/ ){ return QString::null; } QString Manager::toMac( const QString &/*device*/ ){ return QString::null; } void Manager::slotProcessExited(OProcess* proc ) { bool conn= false; if (proc->normalExit() && proc->exitStatus() == 0 ) conn = true; QString name = QString::fromLatin1(proc->name() ); emit available( name, conn ); delete proc; } void Manager::slotSDPOut(OProcess* proc, char* ch, int len) { QCString str(ch, len+1 ); qWarning("SDP:%s", str.data() ); QMap<QString, QString>::Iterator it; it = m_out.find(proc->name() ); QString string; if ( it != m_out.end() ) { string = it.data(); } string.append( str ); m_out.replace( proc->name(), string ); } void Manager::slotSDPExited( OProcess* proc) { qWarning("proc name %s", proc->name() ); Services::ValueList list; if (proc->normalExit() ) { QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); if ( it != m_out.end() ) { qWarning("found process" ); @@ -201,134 +203,134 @@ void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { } string.append( str ); m_devices.replace( proc->name(), string ); } RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { qWarning("parseHCI %s", output.latin1() ); RemoteDevice::ValueList list; QStringList strList = QStringList::split('\n', output ); QStringList::Iterator it; QString str; for ( it = strList.begin(); it != strList.end(); ++it ) { str = (*it).stripWhiteSpace(); qWarning("OpieTooth %s", str.latin1() ); int pos = str.findRev(':' ); if ( pos > 0 ) { QString mac = str.left(17 ); str.remove( 0, 17 ); qWarning("mac %s", mac.latin1() ); qWarning("rest:%s", str.latin1() ); RemoteDevice rem( mac , str.stripWhiteSpace() ); list.append( rem ); } } return list; } ////// hcitool cc and hcitool con /** * Create it on the stack as don't care * so we don't need to care for it * cause hcitool gets reparented */ void Manager::connectTo( const QString& mac) { OProcess proc; proc << "hcitool"; proc << "cc"; proc << mac; proc.start(OProcess::DontCare); // the lib does not care at this point } void Manager::searchConnections() { qWarning("searching connections?"); OProcess* proc = new OProcess(); m_hcitoolCon = QString::null; - connect(proc, SIGNAL(processExited(OProcess*) ), + connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotConnectionExited( OProcess*) ) ); - connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), + connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); *proc << "hcitool"; *proc << "con"; if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { ConnectionState::ValueList list; emit connections( list ); delete proc; } } void Manager::slotConnectionExited( OProcess* proc ) { ConnectionState::ValueList list; list = parseConnections( m_hcitoolCon ); emit connections(list ); delete proc; } void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) { QCString str(cha, len ); m_hcitoolCon.append( str ); //delete proc; } ConnectionState::ValueList Manager::parseConnections( const QString& out ) { ConnectionState::ValueList list2; QStringList list = QStringList::split('\n', out ); QStringList::Iterator it; // remove the first line ( "Connections:") it = list.begin(); it = list.remove( it ); for (; it != list.end(); ++it ) { QString row = (*it).stripWhiteSpace(); QStringList value = QStringList::split(' ', row ); qWarning("0: %s", value[0].latin1() ); qWarning("1: %s", value[1].latin1() ); qWarning("2: %s", value[2].latin1() ); qWarning("3: %s", value[3].latin1() ); qWarning("4: %s", value[4].latin1() ); qWarning("5: %s", value[5].latin1() ); qWarning("6: %s", value[6].latin1() ); qWarning("7: %s", value[7].latin1() ); qWarning("8: %s", value[8].latin1() ); ConnectionState con; con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); con.setConnectionMode( value[1] ); con.setMac( value[2] ); con.setHandle( value[4].toInt() ); con.setState( value[6].toInt() ); con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); list2.append( con ); } return list2; } void Manager::signalStrength( const QString &mac ) { OProcess* sig_proc = new OProcess(); - connect(sig_proc, SIGNAL(processExited(OProcess*) ), + connect(sig_proc, SIGNAL(processExited(Opie::Core::OProcess*) ), this, SLOT(slotSignalStrengthExited( OProcess*) ) ); - connect(sig_proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), + connect(sig_proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), this, SLOT(slotSignalStrengthOutput(OProcess*, char*, int) ) ); *sig_proc << "hcitool"; *sig_proc << "lq"; *sig_proc << mac; sig_proc->setName( mac.latin1() ); if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { emit signalStrength( mac, "-1" ); delete sig_proc; } } void Manager::slotSignalStrengthOutput(OProcess* proc, char* cha, int len) { QCString str(cha, len ); QString temp = QString(str).stripWhiteSpace(); QStringList value = QStringList::split(' ', temp ); emit signalStrength( proc->name(), value[2].latin1() ); } void Manager::slotSignalStrengthExited( OProcess* proc ) { delete proc; } diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h index abc8ba1..9b1c714 100644 --- a/noncore/net/opietooth/lib/manager.h +++ b/noncore/net/opietooth/lib/manager.h @@ -1,62 +1,62 @@ #ifndef OpieToothManager_H #define OpieToothManager_H #include <qobject.h> #include <qstring.h> #include <qmap.h> #include <qvaluelist.h> #include "connection.h" #include "remotedevice.h" #include "services.h" -class OProcess; +namespace Opie {namespace Core {class Opie::Core::OProcess;}} namespace OpieTooth { class Device; /** Manager manages a blueZ device (hci0 for example) * without Manager you can control the things you * could do from command line in a OO and asynchronus * way. */ class Manager : public QObject { Q_OBJECT public: /** c'tor whichs create a new Manager * @param device is the device to use. Either a mac or blueZ device name * */ Manager( const QString &device ); /** c'tor * @param dev The Device to be managed * We don't care of Device so you need to delete it */ Manager( Device* dev ); /** * c'tor */ Manager(); ~Manager(); /** Set the manager to control a new device * @param device the new device to control (hci0 ) */ void setDevice( const QString& device ); /** * Convience functions for setting a new device */ void setDevice( Device *dev ); /** * Wether or not a device is connected. The function * is asynchron * If device is empty it will take the currently managed * device and see if it's up * for Remote devices it will ping and see. * @param either mac or hciX */ void isAvailable(const QString& device= QString::null ); @@ -97,77 +97,77 @@ namespace OpieTooth { /** * Removes a list from the sdpd */ void removeServices(const QStringList& ); /** * search for services on a remote device * */ void searchServices( const QString& remDevice ); /** * search for services on a remote device */ void searchServices( const RemoteDevice& ); /** * Starts to connect to the device * in @param */ void connectTo(const QString& ); /** * Searches for active connections * the result is emitted with the * connections signal */ void searchConnections(); void signalStrength( const QString &mac ); //// not implemented yet /*static*/ QString toDevice( const QString& mac ); /*static*/ QString toMac( const QString &device ); //// not implemented yet over signals: // device either mac or dev name // the first device is the device which you access void available( const QString& device, bool connected ); void addedService( const QString& service, bool added ); void removedService( const QString& service, bool removed ); void foundServices( const QString& device, Services::ValueList ); void foundDevices( const QString& device, RemoteDevice::ValueList ); void connections( ConnectionState::ValueList ); void signalStrength( const QString& mac, const QString& strengh ); private slots: - void slotProcessExited(OProcess* ); + void slotProcessExited(Opie::Core::OProcess* ); - void slotSDPExited(OProcess*); - void slotSDPOut(OProcess*, char*, int); + void slotSDPExited(Opie::Core::OProcess*); + void slotSDPOut(Opie::Core::OProcess*, char*, int); - void slotHCIExited(OProcess* ); - void slotHCIOut(OProcess*, char*, int ); + void slotHCIExited(Opie::Core::OProcess* ); + void slotHCIOut(Opie::Core::OProcess*, char*, int ); - void slotConnectionExited(OProcess* ); - void slotConnectionOutput(OProcess*, char*, int ); + void slotConnectionExited(Opie::Core::OProcess* ); + void slotConnectionOutput(Opie::Core::OProcess*, char*, int ); - void slotSignalStrengthOutput( OProcess*, char*, int ); - void slotSignalStrengthExited( OProcess* ); + void slotSignalStrengthOutput( Opie::Core::OProcess*, char*, int ); + void slotSignalStrengthExited( Opie::Core::OProcess* ); private: Services::ValueList parseSDPOutput( const QString& ); RemoteDevice::ValueList parseHCIOutput( const QString& ); ConnectionState::ValueList parseConnections( const QString& ); - OProcess *m_hcitool; - OProcess *m_sdp; // not only one + Opie::Core::OProcess *m_hcitool; + Opie::Core::OProcess *m_sdp; // not only one QString m_device; QMap<QString, int> m_signalStrength; QMap<QString, QString> m_out; QMap<QString, QString> m_devices; - QMap<OProcess*, QString> m_signalMac; + QMap<Opie::Core::OProcess*, QString> m_signalMac; QString m_hcitoolCon; }; }; #endif diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index c3850eb..90ef04a 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp @@ -1,67 +1,69 @@ #include "startdunconnection.h" using namespace OpieTooth; +using namespace Opie::Core; +using namespace Opie::Core; StartDunConnection::StartDunConnection() { m_dunConnect = 0l; setConnectionType(); } StartDunConnection::~StartDunConnection() { delete m_dunConnect; } StartDunConnection::StartDunConnection( QString mac ) { m_dunConnect = 0l; m_mac = mac; setConnectionType(); } void StartDunConnection::setName( QString name ) { m_name = name; } QString StartDunConnection::name() { return m_name; } void StartDunConnection::setConnectionType() { m_connectionType = Pan; } StartConnection::ConnectionType StartDunConnection::type() { return m_connectionType; } void StartDunConnection::start() { m_dunConnect = new OProcess(); *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; - connect( m_dunConnect, SIGNAL( processExited(OProcess*) ) , + connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(OProcess*) ) ); - connect( m_dunConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), + connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(OProcess*,char*,int) ) ); if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning( "could not start" ); delete m_dunConnect; } } void StartDunConnection::slotExited( OProcess* proc ) { delete m_dunConnect; } void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) {} void StartDunConnection::stop() { if ( m_dunConnect ) { delete m_dunConnect; m_dunConnect = 0l; } } diff --git a/noncore/net/opietooth/lib/startdunconnection.h b/noncore/net/opietooth/lib/startdunconnection.h index 43a852a..f6107f6 100644 --- a/noncore/net/opietooth/lib/startdunconnection.h +++ b/noncore/net/opietooth/lib/startdunconnection.h @@ -1,40 +1,40 @@ #ifndef startdunconnection_h #define startdunconnection_h #include <qobject.h> #include "connection.h" -#include <opie/oprocess.h> +#include <opie2/oprocess.h> namespace OpieTooth { class StartDunConnection : StartConnection { Q_OBJECT public: StartDunConnection(); StartDunConnection( QString mac ); ~StartDunConnection(); QString name(); void setName( QString name ); StartConnection::ConnectionType type(); void setConnectionType( ); void start(); void stop(); private: QString m_name; QString m_mac; ConnectionType m_connectionType; - OProcess* m_dunConnect; + Opie::Core::OProcess* m_dunConnect; private slots: - void slotExited( OProcess* proc ); - void slotStdOut( OProcess* proc, char* chars, int len ); + void slotExited( Opie::Core::OProcess* proc ); + void slotStdOut( Opie::Core::OProcess* proc, char* chars, int len ); }; } #endif diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index a42b407..fef35d9 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp @@ -1,82 +1,84 @@ #include "startpanconnection.h" using namespace OpieTooth; +using namespace Opie::Core; +using namespace Opie::Core; StartPanConnection::StartPanConnection() { m_panConnect = 0l; setConnectionType(); } StartPanConnection::~StartPanConnection() { delete m_panConnect; } StartPanConnection::StartPanConnection( QString mac ) { m_panConnect = 0l; m_mac = mac; setConnectionType(); } void StartPanConnection::setName( QString name ) { m_name = name; } QString StartPanConnection::name() { return m_name; } void StartPanConnection::setConnectionType() { m_connectionType = Pan; } StartConnection::ConnectionType StartPanConnection::type() { return m_connectionType; } void StartPanConnection::start() { m_panConnect = new OProcess(); qDebug( "IM START " + m_mac ); *m_panConnect << "pand" << "--connect" << m_mac; - connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , + connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(OProcess*) ) ); - connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), + connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning( "could not start" ); delete m_panConnect; } } void StartPanConnection::slotExited( OProcess* proc ) { delete m_panConnect; m_panConnect = 0l; } void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) {} void StartPanConnection::stop() { if ( m_panConnect ) { delete m_panConnect; m_panConnect = 0l; } m_panConnect = new OProcess(); qDebug("IM STOP " + m_mac); *m_panConnect << "pand" << "--kill" << m_mac; - connect( m_panConnect, SIGNAL( processExited(OProcess*) ) , + connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(OProcess*) ) ); - connect( m_panConnect, SIGNAL( receivedStdout(OProcess*,char*,int) ), + connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { qWarning( "could not stop" ); delete m_panConnect; } } diff --git a/noncore/net/opietooth/lib/startpanconnection.h b/noncore/net/opietooth/lib/startpanconnection.h index 7e5bd95..e12dad0 100644 --- a/noncore/net/opietooth/lib/startpanconnection.h +++ b/noncore/net/opietooth/lib/startpanconnection.h @@ -1,40 +1,40 @@ #ifndef startpanconnection_h #define startpanconnection_h #include <qobject.h> #include "connection.h" -#include <opie/oprocess.h> +#include <opie2/oprocess.h> namespace OpieTooth { class StartPanConnection : StartConnection { Q_OBJECT public: StartPanConnection(); StartPanConnection( QString mac ); ~StartPanConnection(); QString name(); void setName( QString name ); StartConnection::ConnectionType type(); void setConnectionType( ); void start(); void stop(); private: QString m_name; QString m_mac; ConnectionType m_connectionType; - OProcess* m_panConnect; + Opie::Core::OProcess* m_panConnect; private slots: - void slotExited( OProcess* proc ); - void slotStdOut( OProcess* proc, char* chars, int len ); + void slotExited( Opie::Core::OProcess* proc ); + void slotStdOut( Opie::Core::OProcess* proc, char* chars, int len ); }; } #endif diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp index 82aeebd..a96f128 100644 --- a/noncore/net/opietooth/manager/main.cpp +++ b/noncore/net/opietooth/manager/main.cpp @@ -1,25 +1,27 @@ /* +using namespace Opie::Core; +using namespace Opie::Core; * main.cpp * * --------------------- * * begin : Sun 10 17:20:00 CEST 2002 * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "bluebase.h" #include <qpe/qpeapplication.h> -#include <opie/oapplicationfactory.h> +#include <opie2/oapplicationfactory.h> OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::BlueBase> ) diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 46a0e3d..1ef862a 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -1,64 +1,67 @@ #include "obexdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <qfileinfo.h> #include <qpe/resource.h> -#include <opie/oprocess.h> -#include <opie/ofiledialog.h> +#include <opie2/oprocess.h> +#include <opie2/ofiledialog.h> using namespace OpieTooth; +using namespace Opie::Core; +using namespace Opie::Ui; +using namespace Opie::Core; ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "ObexDialog" ); setCaption( tr( "beam files " ) ) ; m_device = device; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Which file should be beamed?") ); cmdLine = new QLineEdit( this ); QPushButton *browserButton; browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); chNameLine = new QLineEdit( this ); sendButton = new QPushButton( this ); sendButton->setText( tr( "Send" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(browserButton); layout->addWidget(chNameLine); layout->addWidget(sendButton); connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); } ObexDialog::~ObexDialog() { } void ObexDialog::browse() { MimeTypes types; QStringList all; all << "*/*"; types.insert("All Files", all ); QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); cmdLine->setText( str ); diff --git a/noncore/net/opietooth/manager/obexdialog.h b/noncore/net/opietooth/manager/obexdialog.h index b3d5e6d..d5b5682 100644 --- a/noncore/net/opietooth/manager/obexdialog.h +++ b/noncore/net/opietooth/manager/obexdialog.h @@ -1,39 +1,39 @@ #ifndef OBEXDIALOG_H #define OBEXDIALOG_H #include <qdialog.h> -#include <opie/oprocess.h> +#include <opie2/oprocess.h> class QVBoxLayout; class QPushButton; class QMultiLineEdit; class QLineEdit; namespace OpieTooth { class ObexDialog : public QDialog { Q_OBJECT public: ObexDialog( QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0, const QString& device = 0); ~ObexDialog(); private slots: void browse(); void sendData(); protected: QVBoxLayout* layout; QLineEdit* cmdLine; QLineEdit* chNameLine; QPushButton* sendButton; private: // Device that is used QString m_device; }; } #endif diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 4e58552..870e7fd 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp @@ -1,68 +1,70 @@ #include "pppdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> -#include <opie/oprocess.h> +#include <opie2/oprocess.h> using namespace OpieTooth; +using namespace Opie::Core; +using namespace Opie::Core; PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "PPPDialog" ); setCaption( tr( "ppp connection " ) ) ; m_device = device; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Enter an ppp script name:") ); cmdLine = new QLineEdit( this ); outPut = new QMultiLineEdit( this ); QFont outPut_font( outPut->font() ); outPut_font.setPointSize( 8 ); outPut->setFont( outPut_font ); outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); connectButton = new QPushButton( this ); connectButton->setText( tr( "Connect" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(outPut); layout->addWidget(connectButton); connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); } PPPDialog::~PPPDialog() { } void PPPDialog::connectToDevice() { outPut->clear(); // vom popupmenu beziehen QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); OProcess* pppDial = new OProcess(); *pppDial << "pppd" << m_device << "call" << connectScript; - connect( pppDial, SIGNAL(receivedStdout(OProcess*,char*,int) ), + connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT(fillOutPut(OProcess*,char*,int) ) ); if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { qWarning("could not start"); delete pppDial; } } void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { QCString str(cha, len ); outPut->insertLine( str ); delete pppDial; } diff --git a/noncore/net/opietooth/manager/pppdialog.h b/noncore/net/opietooth/manager/pppdialog.h index bb8b734..05894e2 100644 --- a/noncore/net/opietooth/manager/pppdialog.h +++ b/noncore/net/opietooth/manager/pppdialog.h @@ -1,37 +1,37 @@ #ifndef PPPDIALOG_H #define PPPDIALOG_H #include <qdialog.h> -#include <opie/oprocess.h> +#include <opie2/oprocess.h> class QVBoxLayout; class QPushButton; class QMultiLineEdit; class QLineEdit; namespace OpieTooth { class PPPDialog : public QDialog { Q_OBJECT public: PPPDialog( QWidget* parent = 0, const char* name = 0, bool modal = TRUE, WFlags fl = 0, const QString& device = 0); ~PPPDialog(); private slots: void connectToDevice(); - void fillOutPut( OProcess* pppDial, char* cha, int len ); + void fillOutPut( Opie::Core::OProcess* pppDial, char* cha, int len ); protected: QVBoxLayout* layout; QLineEdit* cmdLine; QPushButton* connectButton; QMultiLineEdit* outPut; private: QString m_device; }; } #endif |