summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/lib/parser.cc15
-rw-r--r--noncore/net/opietooth/lib/remotedevice.cc6
-rw-r--r--noncore/net/opietooth/lib/remotedevice.h4
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
@@ -56,9 +56,9 @@ void Parser::parse( const QString& string) {
56 m_complete = true; 56 m_complete = true;
57 QStringList list = QStringList::split('\n', string,TRUE ); 57 QStringList list = QStringList::split('\n', string,TRUE );
58 QStringList::Iterator it; 58 QStringList::Iterator it;
59 for (it = list.begin(); it != list.end(); ++it ) { 59 for (it = list.begin(); it != list.end(); ++it ) {
60 qWarning("line:%s:line", (*it).latin1() ); 60 //qWarning("line:%s:line", (*it).latin1() );
61 if ( (*it).startsWith("Browsing") ) continue; 61 if ( (*it).startsWith("Browsing") ) continue;
62 62
63 if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins 63 if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins
64 qWarning("could add"); 64 qWarning("could add");
@@ -79,9 +79,9 @@ void Parser::parse( const QString& string) {
79 if (parseProfile( (*it) ) ) ;//continue; 79 if (parseProfile( (*it) ) ) ;//continue;
80 } 80 }
81 // missed the last one 81 // missed the last one
82 if (m_complete) { 82 if (m_complete) {
83 qWarning("adding"); 83// qWarning("adding");
84 if (!m_item.serviceName().isEmpty() ) 84 if (!m_item.serviceName().isEmpty() )
85 m_list.append(m_item ); 85 m_list.append(m_item );
86 } 86 }
87 QValueList<Services>::Iterator it2; 87 QValueList<Services>::Iterator it2;
@@ -117,12 +117,15 @@ bool Parser::parseRecHandle( const QString& str) {
117 return false; 117 return false;
118} 118}
119bool Parser::parseClassId( const QString& str) { 119bool Parser::parseClassId( const QString& str) {
120 if (str.startsWith("Service Class ID List:") ) { 120 if (str.startsWith("Service Class ID List:") ) {
121 qWarning("found class id" );
122 qWarning("line:%s", str.latin1() );
121 m_classOver = true; 123 m_classOver = true;
122 return true; 124 return true;
123 }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place 125 }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place
124 126 qWarning("line with class id" );
127 qWarning("%s",str.latin1() );
125 128
126 // "Obex Object Push" (0x1105) 129 // "Obex Object Push" (0x1105)
127 // find backwards the " and the from 0 to pos and the mid pos+1 130 // find backwards the " and the from 0 to pos and the mid pos+1
128 // then stripWhiteSpace add name replace '"' with "" 131 // then stripWhiteSpace add name replace '"' with ""
@@ -133,10 +136,12 @@ bool Parser::parseClassId( const QString& str) {
133 qWarning("ids %d", ids ); 136 qWarning("ids %d", ids );
134 m_item.insertClassId( ids, classes ); 137 m_item.insertClassId( ids, classes );
135 138
136 return true; 139 return true;
137 }else 140 }else{
141 qWarning("Else %d", m_classOver );
138 m_classOver = false; 142 m_classOver = false;
143 }
139 return false; 144 return false;
140} 145}
141bool Parser::parseProtocol( const QString& str) { 146bool Parser::parseProtocol( const QString& str) {
142 if (str.startsWith("Protocol Descriptor List:") ) { 147 if (str.startsWith("Protocol Descriptor List:") ) {
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
@@ -45,4 +45,10 @@ QString RemoteDevice::name() const{
45} 45}
46void RemoteDevice::setName( const QString& name ){ 46void RemoteDevice::setName( const QString& name ){
47 m_name = name; 47 m_name = name;
48} 48}
49bool RemoteDevice::equals( const RemoteDevice& dev ) const {
50 if ( m_mac == dev.m_mac && m_name == dev.m_name )
51 return true;
52 else
53 return false;
54};
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
@@ -11,18 +11,20 @@ namespace OpieTooth{
11 RemoteDevice(); 11 RemoteDevice();
12 RemoteDevice(const RemoteDevice& ); 12 RemoteDevice(const RemoteDevice& );
13 RemoteDevice(const QString &mac, const QString &name ); 13 RemoteDevice(const QString &mac, const QString &name );
14 ~RemoteDevice(); 14 ~RemoteDevice();
15 friend bool operator==(const RemoteDevice&, const RemoteDevice&); 15// friend bool operator==(const RemoteDevice&, const RemoteDevice&);
16 RemoteDevice &operator=(const RemoteDevice& ); 16 RemoteDevice &operator=(const RemoteDevice& );
17 bool isEmpty()const; 17 bool isEmpty()const;
18 QString mac()const; 18 QString mac()const;
19 void setMac(const QString& mac ); 19 void setMac(const QString& mac );
20 QString name()const; 20 QString name()const;
21 void setName( const QString& name ); 21 void setName( const QString& name );
22 bool equals( const RemoteDevice& )const;
22 private: 23 private:
23 QString m_name; 24 QString m_name;
24 QString m_mac; 25 QString m_mac;
25 }; 26 };
27 bool operator==( const RemoteDevice&, const RemoteDevice& );
26}; 28};
27 29
28#endif 30#endif