summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
index 9069c09..3fd877f 100644
--- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp
@@ -250,80 +250,83 @@ QString OTSDPAttribute::getURL() {
250 250
251const OTSDPAttribute::int128_t & OTSDPAttribute::getInt() { 251const OTSDPAttribute::int128_t & OTSDPAttribute::getInt() {
252 assert(type == INT); 252 assert(type == INT);
253 return *Value.intVal; 253 return *Value.intVal;
254} 254}
255 255
256 256
257const OTSDPAttribute::uint128_t & OTSDPAttribute::getUInt() { 257const OTSDPAttribute::uint128_t & OTSDPAttribute::getUInt() {
258 assert(type == UINT); 258 assert(type == UINT);
259 return *Value.uintVal; 259 return *Value.uintVal;
260} 260}
261 261
262const OTUUID & OTSDPAttribute::getUUID() { 262const OTUUID & OTSDPAttribute::getUUID() {
263 assert(type == UUID); 263 assert(type == UUID);
264 return *Value.uuidVal; 264 return *Value.uuidVal;
265} 265}
266 266
267bool OTSDPAttribute::getBool() { 267bool OTSDPAttribute::getBool() {
268 assert(type == BOOLEAN); 268 assert(type == BOOLEAN);
269 return Value.boolVal; 269 return Value.boolVal;
270} 270}
271 271
272AttributeVector * OTSDPAttribute::getSequence() { 272AttributeVector * OTSDPAttribute::getSequence() {
273 assert(type == SEQUENCE); 273 assert(type == SEQUENCE);
274 return Value.sequenceVal; 274 return Value.sequenceVal;
275} 275}
276 276
277AttributeVector * OTSDPAttribute::getAlternative() { 277AttributeVector * OTSDPAttribute::getAlternative() {
278 assert(type == ALTERNATIVE); 278 assert(type == ALTERNATIVE);
279 return Value.sequenceVal; 279 return Value.sequenceVal;
280} 280}
281 281
282UUIDVector OTSDPAttribute::getAllUUIDs() { 282UUIDVector OTSDPAttribute::getAllUUIDs() {
283 283
284 UUIDVector uuids; 284 UUIDVector uuids;
285 285
286 if (getType() == UUID) { 286 if (getType() == UUID) {
287 uuids.resize( uuids.size()+1 ); 287 uuids.resize( uuids.size()+1 );
288 uuids[uuids.size()-1] = getUUID(); 288 uuids[uuids.size()-1] = getUUID();
289 } else { 289 } else {
290 AttributeVector * subAttributes = 0 ; 290 AttributeVector * subAttributes = 0 ;
291 291
292 if (getType() == SEQUENCE) { 292 if (getType() == SEQUENCE) {
293 subAttributes = getSequence(); 293 subAttributes = getSequence();
294 } else if (getType() == ALTERNATIVE) { 294 } else if (getType() == ALTERNATIVE) {
295 subAttributes = getAlternative(); 295 subAttributes = getAlternative();
296 } 296 }
297 297
298 if (!subAttributes)
299 return 0;
300
298 int os; 301 int os;
299 for( unsigned int i = 0; i < subAttributes->count(); i++ ) { 302 for( unsigned int i = 0; i < subAttributes->count(); i++ ) {
300 UUIDVector subUUIDs = (*subAttributes)[i]->getAllUUIDs(); 303 UUIDVector subUUIDs = (*subAttributes)[i]->getAllUUIDs();
301 304
302 os = uuids.size(); 305 os = uuids.size();
303 uuids.resize( uuids.size()+subUUIDs.count() ); 306 uuids.resize( uuids.size()+subUUIDs.count() );
304 307
305 for( unsigned int k = 0; k < subUUIDs.count(); k++ ) { 308 for( unsigned int k = 0; k < subUUIDs.count(); k++ ) {
306 uuids[os + k] = subUUIDs[k]; 309 uuids[os + k] = subUUIDs[k];
307 } 310 }
308 } 311 }
309 } 312 }
310 return uuids; 313 return uuids;
311} 314}
312 315
313static char * Attr2String[] = { 316static char * Attr2String[] = {
314 "Invalid", 317 "Invalid",
315 "Nil", 318 "Nil",
316 "UInt", 319 "UInt",
317 "int", 320 "int",
318 "UUID", 321 "UUID",
319 "Boolean", 322 "Boolean",
320 "String", 323 "String",
321 "Sequence", 324 "Sequence",
322 "Alternative", 325 "Alternative",
323 "URL", 326 "URL",
324 "Unknown" 327 "Unknown"
325}; 328};
326 329
327const char * OTSDPAttribute::getTypeString() { 330const char * OTSDPAttribute::getTypeString() {
328 return Attr2String[type]; 331 return Attr2String[type];
329} 332}