summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/device.cc
Side-by-side diff
Diffstat (limited to 'noncore/net/opietooth/lib/device.cc') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/device.cc9
1 files changed, 4 insertions, 5 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,23 +1,22 @@
#include <signal.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;
}
}
@@ -41,29 +40,29 @@ 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(Opie::Core::OProcess*) ),
- this, SLOT( slotExited(OProcess* ) ) );
+ this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ),
- this, SLOT(slotStdOut(OProcess*,char*,int ) ) );
+ this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) );
connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ),
- this, SLOT(slotStdErr(OProcess*,char*,int) ) );
+ this, SLOT(slotStdErr(Opie::Core::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 ){
@@ -90,25 +89,25 @@ void Device::slotExited( OProcess* proc)
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(Opie::Core::OProcess*) ),
- this, SLOT( slotExited(OProcess* ) ) );
+ this, SLOT( slotExited(Opie::Core::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 );
}
}