From e0677f561465615d84ca81b48955dbf8e169e02e Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 20 May 2014 01:47:23 +0200 Subject: remove gatouint128, simplify gatouuid encoding --- gatoperipheral.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'gatoperipheral.cpp') 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(&data[pos])); - break; - case 32/8: - uuid = GatoUUID(qFromLittleEndian(&data[pos])); - break; - case 128/8: - uuid = GatoUUID(qFromLittleEndian(&data[pos])); - break; - } + char *ptr = reinterpret_cast(&data[pos]); + QByteArray ba = QByteArray::fromRawData(ptr, size/8); - service_uuids.insert(uuid); + service_uuids.insert(bytearray_to_gatouuid(ba)); } } -- cgit v1.2.3