author | zecke <zecke> | 2002-07-13 12:54:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-07-13 12:54:47 (UTC) |
commit | d7f3722f9b7913731978437085b14cc2cccbfa24 (patch) (unidiff) | |
tree | 1b190105693609cc01d1ad9730e8925e957209c9 | |
parent | 8be0a8e108eaf8ff99301aa175298ddeb48eae67 (diff) | |
download | opie-d7f3722f9b7913731978437085b14cc2cccbfa24.zip opie-d7f3722f9b7913731978437085b14cc2cccbfa24.tar.gz opie-d7f3722f9b7913731978437085b14cc2cccbfa24.tar.bz2 |
LIB updates
Class IdList per Service can have more than one line
-rw-r--r-- | noncore/net/opietooth/lib/parser.cc | 8 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/services.cc | 26 | ||||
-rw-r--r-- | noncore/net/opietooth/lib/services.h | 13 |
3 files changed, 22 insertions, 25 deletions
diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc index 00ec84a..0699309 100644 --- a/noncore/net/opietooth/lib/parser.cc +++ b/noncore/net/opietooth/lib/parser.cc | |||
@@ -115,34 +115,32 @@ bool Parser::parseRecHandle( const QString& str) { | |||
115 | 115 | ||
116 | } | 116 | } |
117 | return false; | 117 | return false; |
118 | } | 118 | } |
119 | bool Parser::parseClassId( const QString& str) { | 119 | bool Parser::parseClassId( const QString& str) { |
120 | if (str.startsWith("Service Class ID List:") ) { | 120 | if (str.startsWith("Service Class ID List:") ) { |
121 | m_classOver = true; | 121 | m_classOver = true; |
122 | return true; | 122 | return true; |
123 | }else if ( m_classOver ) { // ok now are the informations in place | 123 | }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place |
124 | 124 | ||
125 | m_classOver = false; | ||
126 | 125 | ||
127 | // "Obex Object Push" (0x1105) | 126 | // "Obex Object Push" (0x1105) |
128 | // find backwards the " and the from 0 to pos and the mid pos+1 | 127 | // find backwards the " and the from 0 to pos and the mid pos+1 |
129 | // then stripWhiteSpace add name replace '"' with "" | 128 | // then stripWhiteSpace add name replace '"' with "" |
130 | // and then convert 0x1105 toInt() | 129 | // and then convert 0x1105 toInt() |
131 | QString classes; | 130 | QString classes; |
132 | int ids; | 131 | int ids; |
133 | ids = convert( str, classes ); | 132 | ids = convert( str, classes ); |
134 | qWarning("ids %d", ids ); | 133 | qWarning("ids %d", ids ); |
135 | m_item.setClassIdList( classes ); | 134 | m_item.insertClassId( ids, classes ); |
136 | m_item.setClassIdList( ids ); | ||
137 | 135 | ||
138 | return true; | 136 | return true; |
139 | }else | 137 | }else |
140 | m_classOver = true; | 138 | m_classOver = false; |
141 | return false; | 139 | return false; |
142 | } | 140 | } |
143 | bool Parser::parseProtocol( const QString& str) { | 141 | bool Parser::parseProtocol( const QString& str) { |
144 | if (str.startsWith("Protocol Descriptor List:") ) { | 142 | if (str.startsWith("Protocol Descriptor List:") ) { |
145 | m_protocolOver = true; | 143 | m_protocolOver = true; |
146 | m_protocolAdded = false; | 144 | m_protocolAdded = false; |
147 | return true; | 145 | return true; |
148 | 146 | ||
diff --git a/noncore/net/opietooth/lib/services.cc b/noncore/net/opietooth/lib/services.cc index 93ee70a..23b760b 100644 --- a/noncore/net/opietooth/lib/services.cc +++ b/noncore/net/opietooth/lib/services.cc | |||
@@ -108,56 +108,54 @@ Services::Services(const Services& service ){ | |||
108 | (*this) = service; | 108 | (*this) = service; |
109 | } | 109 | } |
110 | Services::~Services(){ | 110 | Services::~Services(){ |
111 | 111 | ||
112 | } | 112 | } |
113 | Services &Services::operator=( const Services& ser){ | 113 | Services &Services::operator=( const Services& ser){ |
114 | m_name = ser.m_name; | 114 | m_name = ser.m_name; |
115 | m_recHandle = ser.m_recHandle; | 115 | m_recHandle = ser.m_recHandle; |
116 | m_classList = ser.m_classList; | 116 | m_classIds = ser.m_classIds; |
117 | m_classId = ser.m_classId; | ||
118 | m_protocols = ser.m_protocols; | 117 | m_protocols = ser.m_protocols; |
119 | m_profiles = ser.m_profiles; | 118 | m_profiles = ser.m_profiles; |
120 | return *this; | 119 | return *this; |
121 | } | 120 | } |
122 | bool operator==( const Services& one, | 121 | bool operator==( const Services& one, |
123 | const Services& two){ | 122 | const Services& two){ |
124 | if ( ( one.recHandle() == two.recHandle() ) && | 123 | if ( ( one.recHandle() == two.recHandle() ) && |
125 | ( one.classIdListInt() == two.classIdListInt() ) && | ||
126 | ( one.serviceName() == two.serviceName() ) && | 124 | ( one.serviceName() == two.serviceName() ) && |
127 | ( one.classIdList() == two.classIdList() ) && | ||
128 | ( one.protocolDescriptorList() == two.protocolDescriptorList() ) && | 125 | ( one.protocolDescriptorList() == two.protocolDescriptorList() ) && |
129 | ( one.profileDescriptor() == two.profileDescriptor() ) ) | 126 | ( one.profileDescriptor() == two.profileDescriptor() ) |
127 | /* ( one.classIdList() == two.classIdList() ) */ ) | ||
130 | return true; | 128 | return true; |
131 | return false; | 129 | return false; |
132 | } | 130 | } |
133 | QString Services::serviceName() const{ | 131 | QString Services::serviceName() const{ |
134 | return m_name; | 132 | return m_name; |
135 | } | 133 | } |
136 | void Services::setServiceName( const QString& service ){ | 134 | void Services::setServiceName( const QString& service ){ |
137 | m_name = service; | 135 | m_name = service; |
138 | } | 136 | } |
139 | int Services::recHandle() const{ | 137 | int Services::recHandle() const{ |
140 | return m_recHandle; | 138 | return m_recHandle; |
141 | } | 139 | } |
142 | void Services::setRecHandle( int handle){ | 140 | void Services::setRecHandle( int handle){ |
143 | m_recHandle = handle; | 141 | m_recHandle = handle; |
144 | } | 142 | } |
145 | QString Services::classIdList() const{ | 143 | QMap<int, QString> Services::classIdList()const { |
146 | return m_classList; | 144 | return m_classIds; |
145 | }; | ||
146 | void Services::insertClassId( int id, const QString& str ) { | ||
147 | m_classIds.insert( id, str ); | ||
147 | } | 148 | } |
148 | void Services::setClassIdList( const QString& str){ | 149 | void Services::removeClassId(int id) { |
149 | m_classList = str; | 150 | m_classIds.remove( id ); |
150 | } | 151 | } |
151 | int Services::classIdListInt() const{ | 152 | void Services::clearClassId() { |
152 | return m_classId; | 153 | m_classIds.clear(); |
153 | } | ||
154 | void Services::setClassIdList(int id){ | ||
155 | m_classId = id; | ||
156 | } | 154 | } |
157 | void Services::insertProtocolDescriptor( const ProtocolDescriptor& prot){ | 155 | void Services::insertProtocolDescriptor( const ProtocolDescriptor& prot){ |
158 | m_protocols.append( prot ); | 156 | m_protocols.append( prot ); |
159 | } | 157 | } |
160 | void Services::clearProtocolDescriptorList(){ | 158 | void Services::clearProtocolDescriptorList(){ |
161 | m_protocols.clear(); | 159 | m_protocols.clear(); |
162 | } | 160 | } |
163 | void Services::removeProtocolDescriptor( const ProtocolDescriptor& prot){ | 161 | void Services::removeProtocolDescriptor( const ProtocolDescriptor& prot){ |
diff --git a/noncore/net/opietooth/lib/services.h b/noncore/net/opietooth/lib/services.h index 881d383..7cce5e1 100644 --- a/noncore/net/opietooth/lib/services.h +++ b/noncore/net/opietooth/lib/services.h | |||
@@ -1,12 +1,13 @@ | |||
1 | 1 | ||
2 | #ifndef OpieToothServices_H | 2 | #ifndef OpieToothServices_H |
3 | #define OpieToothServices_H | 3 | #define OpieToothServices_H |
4 | 4 | ||
5 | #include <qmap.h> | ||
5 | #include <qvaluelist.h> | 6 | #include <qvaluelist.h> |
6 | 7 | ||
7 | namespace OpieTooth { | 8 | namespace OpieTooth { |
8 | /** | 9 | /** |
9 | * Services lets shows you all available services | 10 | * Services lets shows you all available services |
10 | * on a remote device | 11 | * on a remote device |
11 | */ | 12 | */ |
12 | class Services { | 13 | class Services { |
@@ -111,33 +112,33 @@ namespace OpieTooth { | |||
111 | Services &operator=( const Services& ); | 112 | Services &operator=( const Services& ); |
112 | friend bool operator==(const Services&, const Services& ); | 113 | friend bool operator==(const Services&, const Services& ); |
113 | QString serviceName()const; | 114 | QString serviceName()const; |
114 | void setServiceName( const QString& service ); | 115 | void setServiceName( const QString& service ); |
115 | 116 | ||
116 | int recHandle()const; | 117 | int recHandle()const; |
117 | void setRecHandle( int ); | 118 | void setRecHandle( int ); |
118 | 119 | ||
119 | QString classIdList()const; | 120 | |
120 | void setClassIdList( const QString& ); | 121 | QMap<int, QString> classIdList()const; |
121 | int classIdListInt()const; | 122 | void insertClassId( int id, const QString& className ); |
122 | void setClassIdList(int ); | 123 | void removeClassId( int id ); |
124 | void clearClassId(); | ||
123 | 125 | ||
124 | void insertProtocolDescriptor(const ProtocolDescriptor& ); | 126 | void insertProtocolDescriptor(const ProtocolDescriptor& ); |
125 | void clearProtocolDescriptorList(); | 127 | void clearProtocolDescriptorList(); |
126 | void removeProtocolDescriptor( const ProtocolDescriptor& ); | 128 | void removeProtocolDescriptor( const ProtocolDescriptor& ); |
127 | ProtocolDescriptor::ValueList protocolDescriptorList()const; | 129 | ProtocolDescriptor::ValueList protocolDescriptorList()const; |
128 | 130 | ||
129 | void insertProfileDescriptor( const ProfileDescriptor& ); | 131 | void insertProfileDescriptor( const ProfileDescriptor& ); |
130 | void clearProfileDescriptorList(); | 132 | void clearProfileDescriptorList(); |
131 | void removeProfileDescriptor(const ProfileDescriptor& ); | 133 | void removeProfileDescriptor(const ProfileDescriptor& ); |
132 | ProfileDescriptor::ValueList profileDescriptor()const; | 134 | ProfileDescriptor::ValueList profileDescriptor()const; |
133 | 135 | ||
134 | private: | 136 | private: |
137 | QMap<int, QString> m_classIds; | ||
135 | QString m_name; | 138 | QString m_name; |
136 | int m_recHandle; | 139 | int m_recHandle; |
137 | QString m_classList; | ||
138 | int m_classId; | ||
139 | QValueList<ProfileDescriptor> m_profiles; | 140 | QValueList<ProfileDescriptor> m_profiles; |
140 | QValueList<ProtocolDescriptor> m_protocols; | 141 | QValueList<ProtocolDescriptor> m_protocols; |
141 | }; | 142 | }; |
142 | }; | 143 | }; |
143 | #endif | 144 | #endif |