summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/device.cc
Unidiff
Diffstat (limited to 'noncore/net/opietooth/lib/device.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/device.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc
index 5edfc03..bae1c47 100644
--- a/noncore/net/opietooth/lib/device.cc
+++ b/noncore/net/opietooth/lib/device.cc
@@ -20,34 +20,36 @@ namespace {
20 } 20 }
21 } 21 }
22 return id; 22 return id;
23 } 23 }
24} 24}
25 25
26Device::Device(const QString &device, const QString &mode ) 26Device::Device(const QString &device, const QString &mode, const QString &speed )
27 : QObject(0, "device" ) { 27 : QObject(0, "device") {
28
28 qWarning("OpieTooth::Device create" ); 29 qWarning("OpieTooth::Device create" );
29 m_hci = 0; 30 m_hci = 0;
30 m_process = 0; 31 m_process = 0;
31 m_attached = false; 32 m_attached = false;
32 m_device = device; 33 m_device = device;
33 m_mode = mode; 34 m_mode = mode;
35 m_speed = speed;
34 attach(); 36 attach();
35} 37}
36Device::~Device(){ 38Device::~Device(){
37 detach(); 39 detach();
38} 40}
39void Device::attach(){ 41void Device::attach(){
40 qWarning("attaching %s %s", m_device.latin1(), m_mode.latin1() ); 42 qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() );
41 if(m_process == 0 ){ 43 if(m_process == 0 ){
42 m_output.resize(0); 44 m_output.resize(0);
43 qWarning("new process to create" ); 45 qWarning("new process to create" );
44 m_process = new OProcess(); 46 m_process = new OProcess();
45 *m_process << "hciattach"; 47 *m_process << "hciattach";
46 *m_process << "-p"; 48 *m_process << "-p";
47 *m_process << m_device << m_mode; 49 *m_process << m_device << m_mode << m_speed;
48 connect(m_process, SIGNAL( processExited(OProcess*) ), 50 connect(m_process, SIGNAL( processExited(OProcess*) ),
49 this, SLOT( slotExited(OProcess* ) ) ); 51 this, SLOT( slotExited(OProcess* ) ) );
50 connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ), 52 connect(m_process, SIGNAL( receivedStdout(OProcess*, char*, int) ),
51 this, SLOT(slotStdOut(OProcess*,char*,int ) ) ); 53 this, SLOT(slotStdOut(OProcess*,char*,int ) ) );
52 connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ), 54 connect(m_process, SIGNAL(receivedStderr(OProcess*, char*, int ) ),
53 this, SLOT(slotStdErr(OProcess*,char*,int) ) ); 55 this, SLOT(slotStdErr(OProcess*,char*,int) ) );
@@ -131,13 +133,13 @@ void Device::slotExited( OProcess* proc)
131} 133}
132void Device::slotStdOut(OProcess* proc, char* chars, int len) 134void Device::slotStdOut(OProcess* proc, char* chars, int len)
133{ 135{
134 qWarning("std out" ); 136 qWarning("std out" );
135 if( len <1 ){ 137 if( len <1 ){
136 qWarning( "len < 1 " ); 138 qWarning( "len < 1 " );
137 return; 139 return;
138 } 140 }
139 if(proc == m_process ){ 141 if(proc == m_process ){
140 QCString string( chars, len+1 ); // \0 == +1 142 QCString string( chars, len+1 ); // \0 == +1
141 qWarning("output: %s", string.data() ); 143 qWarning("output: %s", string.data() );
142 m_output.append( string.data() ); 144 m_output.append( string.data() );
143 } 145 }