author | zecke <zecke> | 2002-07-12 17:14:58 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-12 17:14:58 (UTC) |
commit | 89dce758480cc90502ad14b6c4cf80774e6c1845 (patch) (side-by-side diff) | |
tree | 2ff4e635c8aa86385dfd896084f5cd419efd0840 /noncore/net/opietooth/lib | |
parent | 716211b5e06bb25145cfbcf62a11a7c52c79dde5 (diff) | |
download | opie-89dce758480cc90502ad14b6c4cf80774e6c1845.zip opie-89dce758480cc90502ad14b6c4cf80774e6c1845.tar.gz opie-89dce758480cc90502ad14b6c4cf80774e6c1845.tar.bz2 |
- Connection -> ConnectionState
- Factory adjustments
- Factory function
- Refactoring the QListViewItem derived class
BTListItem
|
- BTDeviceItem for RemoteDevices
|
- BTServiceItem for Services
|
- BTConnectionItem for ConnectionState
- misc bug fixes
-rw-r--r-- | noncore/net/opietooth/lib/connection.cpp | 32 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/connection.h | 16 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.cc | 10 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/manager.h | 4 |
4 files changed, 31 insertions, 31 deletions
diff --git a/noncore/net/opietooth/lib/connection.cpp b/noncore/net/opietooth/lib/connection.cpp index 1f9baaf..ef7d925 100644 --- a/noncore/net/opietooth/lib/connection.cpp +++ b/noncore/net/opietooth/lib/connection.cpp @@ -1,90 +1,90 @@ #include "connection.h" using namespace OpieTooth; -Connection::Connection() { +ConnectionState::ConnectionState() { m_direction = Incoming; m_handle = -1; m_state = -1; m_linkMode = -1; }; -Connection::Connection( const Connection& con1 ) { +ConnectionState::ConnectionState( const ConnectionState& con1 ) { (*this) = con1; } -Connection::Connection( bool in, +ConnectionState::ConnectionState( bool in, const QString& conType, const QString& mac, int handle, int state, int linkMode ) { m_direction = in; m_contype = conType; m_mac = mac; m_handle = handle; m_state = state; m_linkMode = linkMode; } -void Connection::setDirection( bool incoming ) { +void ConnectionState::setDirection( bool incoming ) { m_direction = incoming; } -bool Connection::direction() const { +bool ConnectionState::direction() const { return m_direction; } -void Connection::setConnectionMode( const QString& conType ) { +void ConnectionState::setConnectionMode( const QString& conType ) { m_contype = conType; } -QString Connection::connectionMode() const { +QString ConnectionState::connectionMode() const { return m_contype; } -void Connection::setMac( const QString& mac ) { +void ConnectionState::setMac( const QString& mac ) { m_mac = mac; } -QString Connection::mac() const{ +QString ConnectionState::mac() const{ return m_mac; } -void Connection::setHandle( int handle ) { +void ConnectionState::setHandle( int handle ) { m_handle = handle; } -int Connection::handle() const{ +int ConnectionState::handle() const{ return m_handle; } -void Connection::setState( int state ) { +void ConnectionState::setState( int state ) { m_state = state; } -int Connection::state()const { +int ConnectionState::state()const { return m_state; } -void Connection::setLinkMode( int linkMode ) { +void ConnectionState::setLinkMode( int linkMode ) { m_linkMode = linkMode; } -int Connection::linkMode()const{ +int ConnectionState::linkMode()const{ return m_linkMode; } -Connection &Connection::operator=( const Connection& con1 ) { +ConnectionState &ConnectionState::operator=( const ConnectionState& con1 ) { m_direction = con1.m_direction; m_contype = con1.m_contype; m_mac = con1.m_mac; m_handle = con1.m_handle; m_state = con1.m_state; m_linkMode = con1.m_linkMode; return (*this); } diff --git a/noncore/net/opietooth/lib/connection.h b/noncore/net/opietooth/lib/connection.h index 37090ce..76e5dad 100644 --- a/noncore/net/opietooth/lib/connection.h +++ b/noncore/net/opietooth/lib/connection.h @@ -8,63 +8,63 @@ namespace OpieTooth { enum LinkDirection { Incoming= true, Outgoing = false }; enum LinkMode { Master =0, Client }; /** * The Connection class stores * the output of hcitool con * in a OO way */ - class Connection { + class ConnectionState { public: /** * typedef for a list of * Connections */ - typedef QValueList<Connection> ValueList; + typedef QValueList<ConnectionState> ValueList; /** * Copy c'tor. */ - Connection( const Connection& ); + ConnectionState( const ConnectionState& ); /** * Main c'tor * Basicly it holds all values * a blueZ connections can have * @param in If the connection is either incoming or outgoing * @param conType Either ACL or SCO for connection type * @param mac The BD Address( mac ) of the peer * @param handle the blueZ handle * @param state the State of the connection * @param linkMode the linkmode of the connection MASTER or not * * < ACL 00:02:C7:09:2B:53 handle 1 state 1 lm MASTER * */ - Connection( bool in, + ConnectionState( bool in, const QString& conType, const QString& mac, int handle, int state, int linkMode ); /** * C'tor for compability with QValueList * QValueList needs this c'tor. */ - Connection(); + ConnectionState(); /** * Set if the connection is incoming or * outgoing * @param in Whether or not the connection is ingoing or not. * for param use either Incoming or Outgoing * */ void setDirection( bool incoming = Incoming ); /** * direction() will return Incoming( true ) @@ -122,29 +122,29 @@ namespace OpieTooth { * Sets the link mode of the Connection */ void setLinkMode( int linkMode = Master ); /** * returns the linkMode */ int linkMode()const; /** * copy c'tor */ - Connection &operator=( const Connection& ); + ConnectionState &operator=( const ConnectionState& ); private: - class ConnectionPrivate; - ConnectionPrivate *d; + class ConnectionStatePrivate; + ConnectionStatePrivate *d; bool m_direction : 1; QString m_contype; QString m_mac; int m_handle; int m_state; int m_linkMode; }; }; #endif diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc index e07f9da..1281116 100644 --- a/noncore/net/opietooth/lib/manager.cc +++ b/noncore/net/opietooth/lib/manager.cc @@ -245,55 +245,55 @@ 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) ) { - Connection::ValueList list; + ConnectionState::ValueList list; emit connections( list ); delete proc; } } void Manager::slotConnectionExited( OProcess* /*proc*/ ) { qWarning("exited"); - Connection::ValueList list; + ConnectionState::ValueList list; list = parseConnections( m_hcitoolCon ); emit connections(list ); } void Manager::slotConnectionOutput(OProcess* proc, char* cha, int len) { QCString str(cha, len ); m_hcitoolCon.append( str ); delete proc; } -Connection::ValueList Manager::parseConnections( const QString& out ) { - Connection::ValueList list2; +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() ); - Connection con; + 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 ); list2.append( con ); } return list2; } diff --git a/noncore/net/opietooth/lib/manager.h b/noncore/net/opietooth/lib/manager.h index b32327c..0ebe1b3 100644 --- a/noncore/net/opietooth/lib/manager.h +++ b/noncore/net/opietooth/lib/manager.h @@ -128,39 +128,39 @@ namespace OpieTooth { /*static*/ QString toDevice( const QString& mac ); /*static*/ QString toMac( const QString &device ); //// not implemented yet over signals: // device either mac or dev name // the first device is the device which you access void available( const QString& device, bool connected ); void addedService( const QString& service, bool added ); void removedService( const QString& service, bool removed ); void foundServices( const QString& device, Services::ValueList ); void foundDevices( const QString& device, RemoteDevice::ValueList ); - void connections( Connection::ValueList ); + void connections( ConnectionState::ValueList ); private slots: void slotProcessExited(OProcess* ); void slotSDPExited(OProcess*); void slotSDPOut(OProcess*, char*, int); void slotHCIExited(OProcess* ); void slotHCIOut(OProcess*, char*, int ); void slotConnectionExited(OProcess* ); void slotConnectionOutput(OProcess*, char*, int ); private: Services::ValueList parseSDPOutput( const QString& ); RemoteDevice::ValueList parseHCIOutput( const QString& ); - Connection::ValueList parseConnections( const QString& ); + ConnectionState::ValueList parseConnections( const QString& ); OProcess *m_hcitool; OProcess *m_sdp; // not only one QString m_device; QMap<QString, QString> m_out; QMap<QString, QString> m_devices; QString m_hcitoolCon; }; }; #endif |