summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib
Unidiff
Diffstat (limited to 'noncore/net/opietooth/lib') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/device.cc9
-rw-r--r--noncore/net/opietooth/lib/manager.cc18
-rw-r--r--noncore/net/opietooth/lib/startdunconnection.cpp5
-rw-r--r--noncore/net/opietooth/lib/startpanconnection.cpp8
4 files changed, 19 insertions, 21 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc
index d913853..18d26e4 100644
--- a/noncore/net/opietooth/lib/device.cc
+++ b/noncore/net/opietooth/lib/device.cc
@@ -1,126 +1,125 @@
1 1
2#include <signal.h> 2#include <signal.h>
3 3
4#include <opie2/oprocess.h> 4#include <opie2/oprocess.h>
5 5
6#include "device.h" 6#include "device.h"
7 7
8using namespace OpieTooth; 8using namespace OpieTooth;
9 9
10using namespace Opie::Core; 10using namespace Opie::Core;
11using namespace Opie::Core;
12namespace { 11namespace {
13 int parsePid( const QCString& par ){ 12 int parsePid( const QCString& par ){
14 int id=0; 13 int id=0;
15 QString string( par ); 14 QString string( par );
16 QStringList list = QStringList::split( '\n', string ); 15 QStringList list = QStringList::split( '\n', string );
17 for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ 16 for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){
18 qWarning("parsePID: %s", (*it).latin1() ); 17 qWarning("parsePID: %s", (*it).latin1() );
19 if( !(*it).startsWith("CSR") ){ 18 if( !(*it).startsWith("CSR") ){
20 id = (*it).toInt(); 19 id = (*it).toInt();
21 break; 20 break;
22 } 21 }
23 } 22 }
24 return id; 23 return id;
25 } 24 }
26} 25}
27 26
28Device::Device(const QString &device, const QString &mode, const QString &speed ) 27Device::Device(const QString &device, const QString &mode, const QString &speed )
29 : QObject(0, "device") { 28 : QObject(0, "device") {
30 29
31 qWarning("OpieTooth::Device create" ); 30 qWarning("OpieTooth::Device create" );
32 m_hci = 0; 31 m_hci = 0;
33 m_process = 0; 32 m_process = 0;
34 m_attached = false; 33 m_attached = false;
35 m_device = device; 34 m_device = device;
36 m_mode = mode; 35 m_mode = mode;
37 m_speed = speed; 36 m_speed = speed;
38 attach(); 37 attach();
39} 38}
40Device::~Device(){ 39Device::~Device(){
41 detach(); 40 detach();
42} 41}
43void Device::attach(){ 42void Device::attach(){
44 qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); 43 qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() );
45 if(m_process == 0 ){ 44 if(m_process == 0 ){
46 m_output.resize(0); 45 m_output.resize(0);
47 qWarning("new process to create" ); 46 qWarning("new process to create" );
48 m_process = new OProcess(); 47 m_process = new OProcess();
49 *m_process << "hciattach"; 48 *m_process << "hciattach";
50 *m_process << "-p"; 49 *m_process << "-p";
51 *m_process << m_device << m_mode << m_speed; 50 *m_process << m_device << m_mode << m_speed;
52 connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), 51 connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ),
53 this, SLOT( slotExited(OProcess* ) ) ); 52 this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
54 connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), 53 connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ),
55 this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); 54 this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) );
56 connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), 55 connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ),
57 this, SLOT(slotStdErr(OProcess*,char*,int) ) ); 56 this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) );
58 if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ 57 if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){
59 qWarning("Could not start" ); 58 qWarning("Could not start" );
60 delete m_process; 59 delete m_process;
61 m_process = 0; 60 m_process = 0;
62 } 61 }
63 }; 62 };
64} 63}
65void Device::detach(){ 64void Device::detach(){
66 delete m_hci; 65 delete m_hci;
67 delete m_process; 66 delete m_process;
68 // kill the pid we got 67 // kill the pid we got
69 if(m_attached ){ 68 if(m_attached ){
70 //kill the pid 69 //kill the pid
71 qWarning( "killing" ); 70 qWarning( "killing" );
72 kill(pid, 9); 71 kill(pid, 9);
73 } 72 }
74 qWarning("detached" ); 73 qWarning("detached" );
75} 74}
76bool Device::isLoaded()const{ 75bool Device::isLoaded()const{
77 return m_attached; 76 return m_attached;
78} 77}
79QString Device::devName()const { 78QString Device::devName()const {
80 return QString::fromLatin1("hci0"); 79 return QString::fromLatin1("hci0");
81}; 80};
82void Device::slotExited( OProcess* proc) 81void Device::slotExited( OProcess* proc)
83{ 82{
84 qWarning("prcess exited" ); 83 qWarning("prcess exited" );
85 if(proc== m_process ){ 84 if(proc== m_process ){
86 qWarning("proc == m_process" ); 85 qWarning("proc == m_process" );
87 if( m_process->normalExit() ){ // normal exit 86 if( m_process->normalExit() ){ // normal exit
88 qWarning("normalExit" ); 87 qWarning("normalExit" );
89 int ret = m_process->exitStatus(); 88 int ret = m_process->exitStatus();
90 if( ret == 0 ){ // attached 89 if( ret == 0 ){ // attached
91 qWarning("attached" ); 90 qWarning("attached" );
92 qWarning("Output: %s", m_output.data() ); 91 qWarning("Output: %s", m_output.data() );
93 pid = parsePid( m_output ); 92 pid = parsePid( m_output );
94 qWarning("Pid = %d", pid ); 93 qWarning("Pid = %d", pid );
95 // now hciconfig hci0 up ( determine hciX FIXME) 94 // now hciconfig hci0 up ( determine hciX FIXME)
96 // and call hciconfig hci0 up 95 // and call hciconfig hci0 up
97 // FIXME hardcoded to hci0 now :( 96 // FIXME hardcoded to hci0 now :(
98 m_hci = new OProcess( ); 97 m_hci = new OProcess( );
99 *m_hci << "hciconfig"; 98 *m_hci << "hciconfig";
100 *m_hci << "hci0 up"; 99 *m_hci << "hci0 up";
101 connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), 100 connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ),
102 this, SLOT( slotExited(OProcess* ) ) ); 101 this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
103 if(!m_hci->start() ){ 102 if(!m_hci->start() ){
104 qWarning("could not start" ); 103 qWarning("could not start" );
105 m_attached = false; 104 m_attached = false;
106 emit device("hci0", false ); 105 emit device("hci0", false );
107 } 106 }
108 }else{ 107 }else{
109 qWarning("crass" ); 108 qWarning("crass" );
110 m_attached = false; 109 m_attached = false;
111 emit device("hci0", false ); 110 emit device("hci0", false );
112 111
113 } 112 }
114 } 113 }
115 delete m_process; 114 delete m_process;
116 m_process = 0; 115 m_process = 0;
117 }else if(proc== m_hci ){ 116 }else if(proc== m_hci ){
118 qWarning("M HCI exited" ); 117 qWarning("M HCI exited" );
119 if( m_hci->normalExit() ){ 118 if( m_hci->normalExit() ){
120 qWarning("normal exit" ); 119 qWarning("normal exit" );
121 int ret = m_hci->exitStatus(); 120 int ret = m_hci->exitStatus();
122 if( ret == 0 ){ 121 if( ret == 0 ){
123 qWarning("attached really really attached" ); 122 qWarning("attached really really attached" );
124 m_attached = true; 123 m_attached = true;
125 emit device("hci0", true ); 124 emit device("hci0", true );
126 }else{ 125 }else{
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index 56156a8..7c9ea5b 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -24,116 +24,116 @@ Manager::Manager( Device* /*dev*/ )
24 m_hcitool = 0; 24 m_hcitool = 0;
25 m_sdp = 0; 25 m_sdp = 0;
26} 26}
27Manager::Manager() 27Manager::Manager()
28 : QObject() 28 : QObject()
29{ 29{
30 m_hcitool = 0; 30 m_hcitool = 0;
31 m_sdp = 0; 31 m_sdp = 0;
32} 32}
33Manager::~Manager(){ 33Manager::~Manager(){
34 delete m_hcitool; 34 delete m_hcitool;
35 delete m_sdp; 35 delete m_sdp;
36} 36}
37void Manager::setDevice( const QString& dev ){ 37void Manager::setDevice( const QString& dev ){
38 m_device = dev; 38 m_device = dev;
39} 39}
40void Manager::setDevice( Device* /*dev*/ ){ 40void Manager::setDevice( Device* /*dev*/ ){
41 41
42} 42}
43void Manager::isAvailable( const QString& device ){ 43void Manager::isAvailable( const QString& device ){
44 OProcess* l2ping = new OProcess(); 44 OProcess* l2ping = new OProcess();
45 l2ping->setName( device.latin1() ); 45 l2ping->setName( device.latin1() );
46 *l2ping << "l2ping" << "-c1" << device; 46 *l2ping << "l2ping" << "-c1" << device;
47 connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ), 47 connect(l2ping, SIGNAL(processExited(Opie::Core::OProcess* ) ),
48 this, SLOT(slotProcessExited(OProcess*) ) ); 48 this, SLOT(slotProcessExited(Opie::Core::OProcess*) ) );
49 if (!l2ping->start() ) { 49 if (!l2ping->start() ) {
50 emit available( device, false ); 50 emit available( device, false );
51 delete l2ping; 51 delete l2ping;
52 } 52 }
53 53
54} 54}
55 55
56void Manager::isAvailable( Device* /*dev*/ ){ 56void Manager::isAvailable( Device* /*dev*/ ){
57 57
58 58
59} 59}
60void Manager::searchDevices( const QString& device ){ 60void Manager::searchDevices( const QString& device ){
61 qWarning("search devices"); 61 qWarning("search devices");
62 OProcess* hcitool = new OProcess(); 62 OProcess* hcitool = new OProcess();
63 hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); 63 hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() );
64 *hcitool << "hcitool" << "scan"; 64 *hcitool << "hcitool" << "scan";
65 connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , 65 connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) ,
66 this, SLOT(slotHCIExited(OProcess* ) ) ); 66 this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) );
67 connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), 67 connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
68 this, SLOT(slotHCIOut(OProcess*, char*, int ) ) ); 68 this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) );
69 if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 69 if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
70 qWarning("could not start"); 70 qWarning("could not start");
71 RemoteDevice::ValueList list; 71 RemoteDevice::ValueList list;
72 emit foundDevices( device, list ); 72 emit foundDevices( device, list );
73 delete hcitool; 73 delete hcitool;
74 } 74 }
75} 75}
76 76
77void Manager::searchDevices(Device* /*d*/ ){ 77void Manager::searchDevices(Device* /*d*/ ){
78 78
79 79
80} 80}
81void Manager::addService(const QString& name ){ 81void Manager::addService(const QString& name ){
82 OProcess proc; 82 OProcess proc;
83 proc << "sdptool" << "add" << name; 83 proc << "sdptool" << "add" << name;
84 bool bo = true; 84 bool bo = true;
85 if (!proc.start(OProcess::DontCare ) ) 85 if (!proc.start(OProcess::DontCare ) )
86 bo = false; 86 bo = false;
87 emit addedService( name, bo ); 87 emit addedService( name, bo );
88} 88}
89void Manager::addServices(const QStringList& list){ 89void Manager::addServices(const QStringList& list){
90 QStringList::ConstIterator it; 90 QStringList::ConstIterator it;
91 for (it = list.begin(); it != list.end(); ++it ) 91 for (it = list.begin(); it != list.end(); ++it )
92 addService( (*it) ); 92 addService( (*it) );
93} 93}
94void Manager::removeService( const QString& name ){ 94void Manager::removeService( const QString& name ){
95 OProcess prc; 95 OProcess prc;
96 prc << "sdptool" << "del" << name; 96 prc << "sdptool" << "del" << name;
97 bool bo = true; 97 bool bo = true;
98 if (!prc.start(OProcess::DontCare ) ) 98 if (!prc.start(OProcess::DontCare ) )
99 bo = false; 99 bo = false;
100 emit removedService( name, bo ); 100 emit removedService( name, bo );
101} 101}
102void Manager::removeServices( const QStringList& list){ 102void Manager::removeServices( const QStringList& list){
103 QStringList::ConstIterator it; 103 QStringList::ConstIterator it;
104 for (it = list.begin(); it != list.end(); ++it ) 104 for (it = list.begin(); it != list.end(); ++it )
105 removeService( (*it) ); 105 removeService( (*it) );
106} 106}
107void Manager::searchServices( const QString& remDevice ){ 107void Manager::searchServices( const QString& remDevice ){
108 OProcess *m_sdp =new OProcess(); 108 OProcess *m_sdp =new OProcess();
109 *m_sdp << "sdptool" << "browse" << remDevice; 109 *m_sdp << "sdptool" << "browse" << remDevice;
110 m_sdp->setName( remDevice.latin1() ); 110 m_sdp->setName( remDevice.latin1() );
111 qWarning("search Services for %s", remDevice.latin1() ); 111 qWarning("search Services for %s", remDevice.latin1() );
112 connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), 112 connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ),
113 this, SLOT(slotSDPExited(OProcess* ) ) ); 113 this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) );
114 connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), 114 connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
115 this, SLOT(slotSDPOut(OProcess*, char*, int) ) ); 115 this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) );
116 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 116 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
117 qWarning("could not start sdptool" ); 117 qWarning("could not start sdptool" );
118 delete m_sdp; 118 delete m_sdp;
119 Services::ValueList list; 119 Services::ValueList list;
120 emit foundServices( remDevice, list ); 120 emit foundServices( remDevice, list );
121 } 121 }
122} 122}
123void Manager::searchServices( const RemoteDevice& dev){ 123void Manager::searchServices( const RemoteDevice& dev){
124 searchServices( dev.mac() ); 124 searchServices( dev.mac() );
125} 125}
126QString Manager::toDevice( const QString& /*mac*/ ){ 126QString Manager::toDevice( const QString& /*mac*/ ){
127 return QString::null; 127 return QString::null;
128} 128}
129QString Manager::toMac( const QString &/*device*/ ){ 129QString Manager::toMac( const QString &/*device*/ ){
130 return QString::null; 130 return QString::null;
131} 131}
132void Manager::slotProcessExited(OProcess* proc ) { 132void Manager::slotProcessExited(OProcess* proc ) {
133 bool conn= false; 133 bool conn= false;
134 if (proc->normalExit() && proc->exitStatus() == 0 ) 134 if (proc->normalExit() && proc->exitStatus() == 0 )
135 conn = true; 135 conn = true;
136 136
137 QString name = QString::fromLatin1(proc->name() ); 137 QString name = QString::fromLatin1(proc->name() );
138 emit available( name, conn ); 138 emit available( name, conn );
139 delete proc; 139 delete proc;
@@ -228,51 +228,51 @@ RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) {
228} 228}
229 229
230////// hcitool cc and hcitool con 230////// hcitool cc and hcitool con
231 231
232/** 232/**
233 * Create it on the stack as don't care 233 * Create it on the stack as don't care
234 * so we don't need to care for it 234 * so we don't need to care for it
235 * cause hcitool gets reparented 235 * cause hcitool gets reparented
236 */ 236 */
237void Manager::connectTo( const QString& mac) { 237void Manager::connectTo( const QString& mac) {
238 OProcess proc; 238 OProcess proc;
239 proc << "hcitool"; 239 proc << "hcitool";
240 proc << "cc"; 240 proc << "cc";
241 proc << mac; 241 proc << mac;
242 proc.start(OProcess::DontCare); // the lib does not care at this point 242 proc.start(OProcess::DontCare); // the lib does not care at this point
243} 243}
244 244
245 245
246void Manager::searchConnections() { 246void Manager::searchConnections() {
247 qWarning("searching connections?"); 247 qWarning("searching connections?");
248 OProcess* proc = new OProcess(); 248 OProcess* proc = new OProcess();
249 m_hcitoolCon = QString::null; 249 m_hcitoolCon = QString::null;
250 250
251 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), 251 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ),
252 this, SLOT(slotConnectionExited( OProcess*) ) ); 252 this, SLOT(slotConnectionExited( Opie::Core::OProcess*) ) );
253 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), 253 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ),
254 this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) ); 254 this, SLOT(slotConnectionOutput(Opie::Core::OProcess*, char*, int) ) );
255 *proc << "hcitool"; 255 *proc << "hcitool";
256 *proc << "con"; 256 *proc << "con";
257 257
258 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 258 if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
259 ConnectionState::ValueList list; 259 ConnectionState::ValueList list;
260 emit connections( list ); 260 emit connections( list );
261 delete proc; 261 delete proc;
262 } 262 }
263} 263}
264void Manager::slotConnectionExited( OProcess* proc ) { 264void Manager::slotConnectionExited( OProcess* proc ) {
265 ConnectionState::ValueList list; 265 ConnectionState::ValueList list;
266 list = parseConnections( m_hcitoolCon ); 266 list = parseConnections( m_hcitoolCon );
267 emit connections(list ); 267 emit connections(list );
268 delete proc; 268 delete proc;
269} 269}
270void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) { 270void Manager::slotConnectionOutput(OProcess* /*proc*/, char* cha, int len) {
271 QCString str(cha, len ); 271 QCString str(cha, len );
272 m_hcitoolCon.append( str ); 272 m_hcitoolCon.append( str );
273 //delete proc; 273 //delete proc;
274} 274}
275ConnectionState::ValueList Manager::parseConnections( const QString& out ) { 275ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
276 ConnectionState::ValueList list2; 276 ConnectionState::ValueList list2;
277 QStringList list = QStringList::split('\n', out ); 277 QStringList list = QStringList::split('\n', out );
278 QStringList::Iterator it; 278 QStringList::Iterator it;
@@ -287,50 +287,50 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
287 qWarning("2: %s", value[2].latin1() ); 287 qWarning("2: %s", value[2].latin1() );
288 qWarning("3: %s", value[3].latin1() ); 288 qWarning("3: %s", value[3].latin1() );
289 qWarning("4: %s", value[4].latin1() ); 289 qWarning("4: %s", value[4].latin1() );
290 qWarning("5: %s", value[5].latin1() ); 290 qWarning("5: %s", value[5].latin1() );
291 qWarning("6: %s", value[6].latin1() ); 291 qWarning("6: %s", value[6].latin1() );
292 qWarning("7: %s", value[7].latin1() ); 292 qWarning("7: %s", value[7].latin1() );
293 qWarning("8: %s", value[8].latin1() ); 293 qWarning("8: %s", value[8].latin1() );
294 ConnectionState con; 294 ConnectionState con;
295 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); 295 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
296 con.setConnectionMode( value[1] ); 296 con.setConnectionMode( value[1] );
297 con.setMac( value[2] ); 297 con.setMac( value[2] );
298 con.setHandle( value[4].toInt() ); 298 con.setHandle( value[4].toInt() );
299 con.setState( value[6].toInt() ); 299 con.setState( value[6].toInt() );
300 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client ); 300 con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client );
301 list2.append( con ); 301 list2.append( con );
302 } 302 }
303 return list2; 303 return list2;
304} 304}
305 305
306void Manager::signalStrength( const QString &mac ) { 306void Manager::signalStrength( const QString &mac ) {
307 307
308 OProcess* sig_proc = new OProcess(); 308 OProcess* sig_proc = new OProcess();
309 309
310 connect(sig_proc, SIGNAL(processExited(Opie::Core::OProcess*) ), 310 connect(sig_proc, SIGNAL(processExited(Opie::Core::OProcess*) ),
311 this, SLOT(slotSignalStrengthExited( OProcess*) ) ); 311 this, SLOT(slotSignalStrengthExited( Opie::Core::OProcess*) ) );
312 connect(sig_proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), 312 connect(sig_proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ),
313 this, SLOT(slotSignalStrengthOutput(OProcess*, char*, int) ) ); 313 this, SLOT(slotSignalStrengthOutput(Opie::Core::OProcess*, char*, int) ) );
314 *sig_proc << "hcitool"; 314 *sig_proc << "hcitool";
315 *sig_proc << "lq"; 315 *sig_proc << "lq";
316 *sig_proc << mac; 316 *sig_proc << mac;
317 317
318 sig_proc->setName( mac.latin1() ); 318 sig_proc->setName( mac.latin1() );
319 319
320 if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 320 if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
321 emit signalStrength( mac, "-1" ); 321 emit signalStrength( mac, "-1" );
322 delete sig_proc; 322 delete sig_proc;
323 } 323 }
324} 324}
325 325
326void Manager::slotSignalStrengthOutput(OProcess* proc, char* cha, int len) { 326void Manager::slotSignalStrengthOutput(OProcess* proc, char* cha, int len) {
327 QCString str(cha, len ); 327 QCString str(cha, len );
328 QString temp = QString(str).stripWhiteSpace(); 328 QString temp = QString(str).stripWhiteSpace();
329 QStringList value = QStringList::split(' ', temp ); 329 QStringList value = QStringList::split(' ', temp );
330 emit signalStrength( proc->name(), value[2].latin1() ); 330 emit signalStrength( proc->name(), value[2].latin1() );
331} 331}
332 332
333 333
334void Manager::slotSignalStrengthExited( OProcess* proc ) { 334void Manager::slotSignalStrengthExited( OProcess* proc ) {
335 delete proc; 335 delete proc;
336} 336}
diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp
index 90ef04a..09b19d2 100644
--- a/noncore/net/opietooth/lib/startdunconnection.cpp
+++ b/noncore/net/opietooth/lib/startdunconnection.cpp
@@ -1,69 +1,68 @@
1 1
2#include "startdunconnection.h" 2#include "startdunconnection.h"
3 3
4using namespace OpieTooth; 4using namespace OpieTooth;
5 5
6 6
7using namespace Opie::Core; 7using namespace Opie::Core;
8using namespace Opie::Core;
9StartDunConnection::StartDunConnection() { 8StartDunConnection::StartDunConnection() {
10 m_dunConnect = 0l; 9 m_dunConnect = 0l;
11 setConnectionType(); 10 setConnectionType();
12} 11}
13 12
14StartDunConnection::~StartDunConnection() { 13StartDunConnection::~StartDunConnection() {
15 delete m_dunConnect; 14 delete m_dunConnect;
16} 15}
17 16
18StartDunConnection::StartDunConnection( QString mac ) { 17StartDunConnection::StartDunConnection( QString mac ) {
19 m_dunConnect = 0l; 18 m_dunConnect = 0l;
20 m_mac = mac; 19 m_mac = mac;
21 setConnectionType(); 20 setConnectionType();
22} 21}
23 22
24void StartDunConnection::setName( QString name ) { 23void StartDunConnection::setName( QString name ) {
25 m_name = name; 24 m_name = name;
26} 25}
27 26
28QString StartDunConnection::name() { 27QString StartDunConnection::name() {
29 return m_name; 28 return m_name;
30} 29}
31 30
32void StartDunConnection::setConnectionType() { 31void StartDunConnection::setConnectionType() {
33 m_connectionType = Pan; 32 m_connectionType = Pan;
34} 33}
35 34
36StartConnection::ConnectionType StartDunConnection::type() { 35StartConnection::ConnectionType StartDunConnection::type() {
37 return m_connectionType; 36 return m_connectionType;
38} 37}
39 38
40void StartDunConnection::start() { 39void StartDunConnection::start() {
41 m_dunConnect = new OProcess(); 40 m_dunConnect = new OProcess();
42 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; 41 *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac;
43 42
44 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 43 connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
45 this, SLOT( slotExited(OProcess*) ) ); 44 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
46 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 45 connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
47 this, SLOT( slotStdOut(OProcess*,char*,int) ) ); 46 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
48 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 47 if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
49 qWarning( "could not start" ); 48 qWarning( "could not start" );
50 delete m_dunConnect; 49 delete m_dunConnect;
51 } 50 }
52} 51}
53 52
54 53
55void StartDunConnection::slotExited( OProcess* proc ) { 54void StartDunConnection::slotExited( OProcess* proc ) {
56 delete m_dunConnect; 55 delete m_dunConnect;
57} 56}
58 57
59void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) 58void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len)
60{} 59{}
61 60
62 61
63void StartDunConnection::stop() { 62void StartDunConnection::stop() {
64 if ( m_dunConnect ) { 63 if ( m_dunConnect ) {
65 delete m_dunConnect; 64 delete m_dunConnect;
66 m_dunConnect = 0l; 65 m_dunConnect = 0l;
67 } 66 }
68} 67}
69 68
diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp
index fef35d9..24ac530 100644
--- a/noncore/net/opietooth/lib/startpanconnection.cpp
+++ b/noncore/net/opietooth/lib/startpanconnection.cpp
@@ -22,63 +22,63 @@ StartPanConnection::StartPanConnection( QString mac ) {
22} 22}
23 23
24void StartPanConnection::setName( QString name ) { 24void StartPanConnection::setName( QString name ) {
25 m_name = name; 25 m_name = name;
26} 26}
27 27
28QString StartPanConnection::name() { 28QString StartPanConnection::name() {
29 return m_name; 29 return m_name;
30} 30}
31 31
32void StartPanConnection::setConnectionType() { 32void StartPanConnection::setConnectionType() {
33 m_connectionType = Pan; 33 m_connectionType = Pan;
34} 34}
35 35
36StartConnection::ConnectionType StartPanConnection::type() { 36StartConnection::ConnectionType StartPanConnection::type() {
37 return m_connectionType; 37 return m_connectionType;
38} 38}
39 39
40void StartPanConnection::start() { 40void StartPanConnection::start() {
41 m_panConnect = new OProcess(); 41 m_panConnect = new OProcess();
42 qDebug( "IM START " + m_mac ); 42 qDebug( "IM START " + m_mac );
43 *m_panConnect << "pand" << "--connect" << m_mac; 43 *m_panConnect << "pand" << "--connect" << m_mac;
44 44
45 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 45 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
46 this, SLOT( slotExited(OProcess*) ) ); 46 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
47 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 47 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
48 this, SLOT( slotStdOut(OProcess*,char*,int) ) ); 48 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
49 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 49 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
50 qWarning( "could not start" ); 50 qWarning( "could not start" );
51 delete m_panConnect; 51 delete m_panConnect;
52 } 52 }
53} 53}
54 54
55 55
56void StartPanConnection::slotExited( OProcess* proc ) { 56void StartPanConnection::slotExited( OProcess* proc ) {
57 delete m_panConnect; 57 delete m_panConnect;
58 m_panConnect = 0l; 58 m_panConnect = 0l;
59} 59}
60 60
61void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) 61void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len)
62{} 62{}
63 63
64 64
65void StartPanConnection::stop() { 65void StartPanConnection::stop() {
66 if ( m_panConnect ) { 66 if ( m_panConnect ) {
67 delete m_panConnect; 67 delete m_panConnect;
68 m_panConnect = 0l; 68 m_panConnect = 0l;
69 } 69 }
70 m_panConnect = new OProcess(); 70 m_panConnect = new OProcess();
71 qDebug("IM STOP " + m_mac); 71 qDebug("IM STOP " + m_mac);
72 72
73 *m_panConnect << "pand" << "--kill" << m_mac; 73 *m_panConnect << "pand" << "--kill" << m_mac;
74 74
75 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , 75 connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) ,
76 this, SLOT( slotExited(OProcess*) ) ); 76 this, SLOT( slotExited(Opie::Core::OProcess*) ) );
77 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), 77 connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ),
78 this, SLOT( slotStdOut(OProcess*,char*,int) ) ); 78 this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) );
79 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { 79 if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) {
80 qWarning( "could not stop" ); 80 qWarning( "could not stop" );
81 delete m_panConnect; 81 delete m_panConnect;
82 } 82 }
83} 83}
84 84