summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth
authorharlekin <harlekin>2003-03-06 22:22:51 (UTC)
committer harlekin <harlekin>2003-03-06 22:22:51 (UTC)
commite2165a29b9fc618037295fc7515e0364b9a3da4f (patch) (side-by-side diff)
tree72dfa3c16132e83f84c8300150c47c05e0da7cde /noncore/net/opietooth
parent56eadb23f09da3823da787d98c0f2478620a15b3 (diff)
downloadopie-e2165a29b9fc618037295fc7515e0364b9a3da4f.zip
opie-e2165a29b9fc618037295fc7515e0364b9a3da4f.tar.gz
opie-e2165a29b9fc618037295fc7515e0364b9a3da4f.tar.bz2
activate connections tab
Diffstat (limited to 'noncore/net/opietooth') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/manager.cc7
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp2
-rw-r--r--noncore/net/opietooth/manager/btconnectionitem.cpp1
3 files changed, 6 insertions, 4 deletions
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index 1281116..59ade6d 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -238,58 +238,59 @@ void Manager::connectTo( const QString& mac) {
proc << "cc";
proc << mac;
proc.start(OProcess::DontCare); // the lib does not care at this point
}
void Manager::searchConnections() {
qWarning("searching connections?");
OProcess* proc = new OProcess();
m_hcitoolCon = QString::null;
connect(proc, SIGNAL(processExited(OProcess*) ),
this, SLOT(slotConnectionExited( OProcess*) ) );
connect(proc, SIGNAL(receivedStdout(OProcess*, char*, int) ),
this, SLOT(slotConnectionOutput(OProcess*, char*, int) ) );
*proc << "hcitool";
*proc << "con";
if (!proc->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
ConnectionState::ValueList list;
emit connections( list );
delete proc;
}
}
-void Manager::slotConnectionExited( OProcess* /*proc*/ ) {
- qWarning("exited");
+void Manager::slotConnectionExited( OProcess* proc ) {
+ qWarning("<<<<<<<<<<<<<<<<<exited");
ConnectionState::ValueList list;
list = parseConnections( m_hcitoolCon );
emit connections(list );
+ delete proc;
}
void Manager::slotConnectionOutput(OProcess* proc, char* cha, int len) {
QCString str(cha, len );
m_hcitoolCon.append( str );
- delete proc;
+ //delete proc;
}
ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
ConnectionState::ValueList list2;
QStringList list = QStringList::split('\n', out );
QStringList::Iterator it;
for (it = list.begin(); it != list.end(); ++it ) {
QString row = (*it).stripWhiteSpace();
QStringList value = QStringList::split(' ', row );
qWarning("0: %s", value[0].latin1() );
qWarning("1: %s", value[1].latin1() );
qWarning("2: %s", value[2].latin1() );
qWarning("3: %s", value[3].latin1() );
qWarning("4: %s", value[4].latin1() );
qWarning("5: %s", value[5].latin1() );
qWarning("6: %s", value[6].latin1() );
qWarning("7: %s", value[7].latin1() );
qWarning("8: %s", value[8].latin1() );
ConnectionState con;
con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
con.setConnectionMode( value[1] );
con.setMac( value[2] );
con.setHandle( value[4].toInt() );
con.setState( value[6].toInt() );
con.setLinkMode( value[8] == QString::fromLatin1("MASTER") ? Master : Client );
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index d3abb54..5c5f069 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -397,49 +397,49 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s
list = (*it2).classIdList();
classIt = list.begin();
int classId=0;
if ( classIt != list.end() ) {
classId = classIt.key();
}
serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) );
}
} else {
Services s1;
s1.setServiceName( tr("no serives found") );
serviceItem = new BTServiceItem( deviceItem, s1 );
}
// now remove them from the list
m_deviceList.remove( it );
}
/**
* Add the existing connections (pairs) to the connections tab.
* This one triggers the search
*/
void BlueBase::addConnectedDevices() {
- m_localDevice->searchConnections();
+ m_localDevice->searchConnections();
}
/**
* This adds the found connections to the connection tab.
* @param connectionList the ValueList with all current connections
*/
void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) {
// clear the ListView first
ListView4->clear();
QValueList<OpieTooth::ConnectionState>::Iterator it;
BTConnectionItem * connectionItem;
if ( !connectionList.isEmpty() ) {
for (it = connectionList.begin(); it != connectionList.end(); ++it) {
connectionItem = new BTConnectionItem( ListView4 , (*it) );
}
} else {
ConnectionState con;
con.setMac( tr("No connections found") );
connectionItem = new BTConnectionItem( ListView4 , con );
diff --git a/noncore/net/opietooth/manager/btconnectionitem.cpp b/noncore/net/opietooth/manager/btconnectionitem.cpp
index 6fb9c11..b57d1b3 100644
--- a/noncore/net/opietooth/manager/btconnectionitem.cpp
+++ b/noncore/net/opietooth/manager/btconnectionitem.cpp
@@ -1,23 +1,24 @@
#include <connection.h>
#include "btconnectionitem.h"
using namespace OpieTooth;
BTConnectionItem::BTConnectionItem( QListView* parent, const ConnectionState& con )
: BTListItem( parent ){
m_con = con;
setText(0, m_con.mac() );
+ setText(1, m_con.connectionMode() );
}
BTConnectionItem::~BTConnectionItem() {
}
QString BTConnectionItem::type() const {
return QString::fromLatin1("connection");
}
int BTConnectionItem::typeId() const {
return Connection;
}
ConnectionState BTConnectionItem::connection() const {
return m_con;
}