author | harlekin <harlekin> | 2003-03-07 22:55:36 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-07 22:55:36 (UTC) |
commit | ee1d48a9a5f3672f329301a844e69f2e184afcac (patch) (unidiff) | |
tree | a549cd37f837e2704527b7b40a0f9f8ef9372a7b /noncore/net/opietooth/lib/manager.cc | |
parent | eeb28ead6d3050d662783696661d9360a049104f (diff) | |
download | opie-ee1d48a9a5f3672f329301a844e69f2e184afcac.zip opie-ee1d48a9a5f3672f329301a844e69f2e184afcac.tar.gz opie-ee1d48a9a5f3672f329301a844e69f2e184afcac.tar.bz2 |
show signal strength for connections
Diffstat (limited to 'noncore/net/opietooth/lib/manager.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/opietooth/lib/manager.cc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index 8ddcfe8..c89d325 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc | |||
@@ -260,7 +260,6 @@ void Manager::searchConnections() { | |||
260 | } | 260 | } |
261 | } | 261 | } |
262 | void Manager::slotConnectionExited( OProcess* proc ) { | 262 | void Manager::slotConnectionExited( OProcess* proc ) { |
263 | qWarning("<<<<<<<<<<<<<<<<<exited"); | ||
264 | ConnectionState::ValueList list; | 263 | ConnectionState::ValueList list; |
265 | list = parseConnections( m_hcitoolCon ); | 264 | list = parseConnections( m_hcitoolCon ); |
266 | emit connections(list ); | 265 | emit connections(list ); |
@@ -301,3 +300,35 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) { | |||
301 | } | 300 | } |
302 | return list2; | 301 | return list2; |
303 | } | 302 | } |
303 | |||
304 | void Manager::signalStrength( const QString &mac ) { | ||
305 | |||
306 | OProcess* sig_proc = new OProcess(); | ||
307 | |||
308 | connect(sig_proc, SIGNAL(processExited(OProcess*) ), | ||
309 | this, SLOT(slotSignalStrengthExited( OProcess*) ) ); | ||
310 | connect(sig_proc, SIGNAL(receivedStdout(OProcess*, char*, int) ), | ||
311 | this, SLOT(slotSignalStrengthOutput(OProcess*, char*, int) ) ); | ||
312 | *sig_proc << "hcitool"; | ||
313 | *sig_proc << "lq"; | ||
314 | *sig_proc << mac; | ||
315 | |||
316 | sig_proc->setName( mac.latin1() ); | ||
317 | |||
318 | if (!sig_proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { | ||
319 | emit signalStrength( mac, "-1" ); | ||
320 | delete sig_proc; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | void Manager::slotSignalStrengthOutput(OProcess* proc, char* cha, int len) { | ||
325 | QCString str(cha, len ); | ||
326 | QString temp = QString(str).stripWhiteSpace(); | ||
327 | QStringList value = QStringList::split(' ', temp ); | ||
328 | emit signalStrength( proc->name(), value[2].latin1() ); | ||
329 | } | ||
330 | |||
331 | |||
332 | void Manager::slotSignalStrengthExited( OProcess* proc ) { | ||
333 | delete proc; | ||
334 | } | ||