Diffstat (limited to 'noncore/net/opietooth/lib/manager.cc') (more/less context) (ignore 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 @@ -261,5 +261,4 @@ void Manager::searchConnections() { } void Manager::slotConnectionExited( OProcess* proc ) { - qWarning("<<<<<<<<<<<<<<<<<exited"); ConnectionState::ValueList list; list = parseConnections( m_hcitoolCon ); @@ -302,2 +301,34 @@ 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; +} |