summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/lib
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
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') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/manager.cc33
-rw-r--r--noncore/net/opietooth/lib/manager.h7
2 files changed, 39 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
@@ -262,3 +262,2 @@ void Manager::searchConnections() {
void Manager::slotConnectionExited( OProcess* proc ) {
- qWarning("<<<<<<<<<<<<<<<<<exited");
ConnectionState::ValueList list;
@@ -303 +302,33 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
}
+
+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;
+}
diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h
index 0ebe1b3..abc8ba1 100644
--- a/noncore/net/opietooth/lib/manager.h
+++ b/noncore/net/opietooth/lib/manager.h
@@ -126,2 +126,3 @@ namespace OpieTooth {
+ void signalStrength( const QString &mac );
//// not implemented yet
@@ -140,2 +141,3 @@ namespace OpieTooth {
void connections( ConnectionState::ValueList );
+ void signalStrength( const QString& mac, const QString& strengh );
@@ -152,2 +154,5 @@ private slots:
void slotConnectionOutput(OProcess*, char*, int );
+
+ void slotSignalStrengthOutput( OProcess*, char*, int );
+ void slotSignalStrengthExited( OProcess* );
private:
@@ -159,4 +164,6 @@ private slots:
QString m_device;
+ QMap<QString, int> m_signalStrength;
QMap<QString, QString> m_out;
QMap<QString, QString> m_devices;
+ QMap<OProcess*, QString> m_signalMac;
QString m_hcitoolCon;