summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib/manager.cc
authorharlekin <harlekin>2003-03-07 22:55:36 (UTC)
committer harlekin <harlekin>2003-03-07 22:55:36 (UTC)
commitee1d48a9a5f3672f329301a844e69f2e184afcac (patch) (side-by-side diff)
treea549cd37f837e2704527b7b40a0f9f8ef9372a7b /noncore/net/opietooth/lib/manager.cc
parenteeb28ead6d3050d662783696661d9360a049104f (diff)
downloadopie-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) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/manager.cc33
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() {
}
}
void Manager::slotConnectionExited( OProcess* proc ) {
- qWarning("<<<<<<<<<<<<<<<<<exited");
ConnectionState::ValueList list;
list = parseConnections( m_hcitoolCon );
emit connections(list );
@@ -301,3 +300,35 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
}
return list2;
}
+
+void Manager::signalStrength( const QString &mac ) {
+
+ OProcess* sig_proc = new OProcess();
+
+ connect(sig_proc, SIGNAL(processExited(OProcess*) ),
+ this, SLOT(slotSignalStrengthExited( OProcess*) ) );
+ connect(sig_proc, SIGNAL(receivedStdout(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;
+}