author | zecke <zecke> | 2002-07-14 18:00:04 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-14 18:00:04 (UTC) |
commit | 31e233a6cf72bc853137ea05285f4d0f41665365 (patch) (side-by-side diff) | |
tree | 8443ffd01357792ee935934e6ec4860ccc6a799c | |
parent | 64f081fef7bca90d2ccf8ade9afe2028ef5de7ae (diff) | |
download | opie-31e233a6cf72bc853137ea05285f4d0f41665365.zip opie-31e233a6cf72bc853137ea05285f4d0f41665365.tar.gz opie-31e233a6cf72bc853137ea05285f4d0f41665365.tar.bz2 |
Patch the lib
Scanning services is working now
RemoteDevice update
( now got equals(const RemoteDevice& )
-rw-r--r-- | noncore/net/opietooth/lib/parser.cc | 15 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/remotedevice.cc | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/remotedevice.h | 4 |
3 files changed, 19 insertions, 6 deletions
diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc index 0699309..8baf284 100644 --- a/noncore/net/opietooth/lib/parser.cc +++ b/noncore/net/opietooth/lib/parser.cc @@ -52,17 +52,17 @@ Services::ValueList Parser::services() const { return m_list; } void Parser::parse( const QString& string) { m_list.clear(); m_complete = true; QStringList list = QStringList::split('\n', string,TRUE ); QStringList::Iterator it; for (it = list.begin(); it != list.end(); ++it ) { - qWarning("line:%s:line", (*it).latin1() ); + //qWarning("line:%s:line", (*it).latin1() ); if ( (*it).startsWith("Browsing") ) continue; if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins qWarning("could add"); // now see if complete and add if (m_complete ) { if (!m_item.serviceName().isEmpty() ) m_list.append( m_item ); @@ -75,17 +75,17 @@ void Parser::parse( const QString& string) { if (parseName( (*it) ) ) ;//continue; if (parseRecHandle( (*it) ) ) ;//continue; if (parseClassId( (*it) ) ) ;//continue; if (parseProtocol( (*it) ) ) ;//continue; if (parseProfile( (*it) ) ) ;//continue; } // missed the last one if (m_complete) { - qWarning("adding"); +// qWarning("adding"); if (!m_item.serviceName().isEmpty() ) m_list.append(m_item ); } QValueList<Services>::Iterator it2; if (m_list.isEmpty() ) qWarning("m_list is empty"); for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { @@ -113,34 +113,39 @@ bool Parser::parseRecHandle( const QString& str) { m_item.setRecHandle( value ); return true; } return false; } bool Parser::parseClassId( const QString& str) { if (str.startsWith("Service Class ID List:") ) { + qWarning("found class id" ); + qWarning("line:%s", str.latin1() ); m_classOver = true; return true; - }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place - + }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place + qWarning("line with class id" ); + qWarning("%s",str.latin1() ); // "Obex Object Push" (0x1105) // find backwards the " and the from 0 to pos and the mid pos+1 // then stripWhiteSpace add name replace '"' with "" // and then convert 0x1105 toInt() QString classes; int ids; ids = convert( str, classes ); qWarning("ids %d", ids ); m_item.insertClassId( ids, classes ); return true; - }else + }else{ + qWarning("Else %d", m_classOver ); m_classOver = false; + } return false; } bool Parser::parseProtocol( const QString& str) { if (str.startsWith("Protocol Descriptor List:") ) { m_protocolOver = true; m_protocolAdded = false; return true; diff --git a/noncore/net/opietooth/lib/remotedevice.cc b/noncore/net/opietooth/lib/remotedevice.cc index 08fb397..9cf0cac 100644 --- a/noncore/net/opietooth/lib/remotedevice.cc +++ b/noncore/net/opietooth/lib/remotedevice.cc @@ -41,8 +41,14 @@ void RemoteDevice::setMac( const QString& mac ){ m_mac = mac; } QString RemoteDevice::name() const{ return m_name; } void RemoteDevice::setName( const QString& name ){ m_name = name; } +bool RemoteDevice::equals( const RemoteDevice& dev ) const { + if ( m_mac == dev.m_mac && m_name == dev.m_name ) + return true; + else + return false; +}; diff --git a/noncore/net/opietooth/lib/remotedevice.h b/noncore/net/opietooth/lib/remotedevice.h index 23f98bd..f268ccc 100644 --- a/noncore/net/opietooth/lib/remotedevice.h +++ b/noncore/net/opietooth/lib/remotedevice.h @@ -7,22 +7,24 @@ namespace OpieTooth{ class RemoteDevice { public: typedef QValueList<RemoteDevice> ValueList; RemoteDevice(); RemoteDevice(const RemoteDevice& ); RemoteDevice(const QString &mac, const QString &name ); ~RemoteDevice(); - friend bool operator==(const RemoteDevice&, const RemoteDevice&); +// friend bool operator==(const RemoteDevice&, const RemoteDevice&); RemoteDevice &operator=(const RemoteDevice& ); bool isEmpty()const; QString mac()const; void setMac(const QString& mac ); QString name()const; void setName( const QString& name ); + bool equals( const RemoteDevice& )const; private: QString m_name; QString m_mac; }; + bool operator==( const RemoteDevice&, const RemoteDevice& ); }; #endif |