diff options
author | Javier <maemo@javispedro.com> | 2014-05-20 01:47:23 +0200 |
---|---|---|
committer | Javier <maemo@javispedro.com> | 2014-05-20 01:47:23 +0200 |
commit | e0677f561465615d84ca81b48955dbf8e169e02e (patch) | |
tree | 339fb87fbacba43ad514d8017d0f8c8a332732d3 /gatoperipheral.cpp | |
parent | 6163f146b2951c492de312365161b8a0f9d1afd1 (diff) | |
download | libgato-e0677f561465615d84ca81b48955dbf8e169e02e.tar.gz libgato-e0677f561465615d84ca81b48955dbf8e169e02e.zip |
remove gatouint128, simplify gatouuid encoding
Diffstat (limited to 'gatoperipheral.cpp')
-rw-r--r-- | gatoperipheral.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/gatoperipheral.cpp b/gatoperipheral.cpp index c4339ec..cc4d6db 100644 --- a/gatoperipheral.cpp +++ b/gatoperipheral.cpp @@ -430,21 +430,16 @@ void GatoPeripheralPrivate::parseEIRUUIDs(int size, bool complete, quint8 data[] { Q_UNUSED(complete); + if (size != 16/8 && size != 32/8 && size != 128/8) { + qWarning() << "Unhandled UUID size: " << size; + return; + } + for (int pos = 0; pos < len; pos += size) { - GatoUUID uuid; - switch (size) { - case 16/8: - uuid = GatoUUID(qFromLittleEndian<quint16>(&data[pos])); - break; - case 32/8: - uuid = GatoUUID(qFromLittleEndian<quint32>(&data[pos])); - break; - case 128/8: - uuid = GatoUUID(qFromLittleEndian<gatouint128>(&data[pos])); - break; - } + char *ptr = reinterpret_cast<char*>(&data[pos]); + QByteArray ba = QByteArray::fromRawData(ptr, size/8); - service_uuids.insert(uuid); + service_uuids.insert(bytearray_to_gatouuid(ba)); } } |