summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gatoattclient.cpp6
-rw-r--r--helpers.cpp7
-rw-r--r--helpers.h1
3 files changed, 12 insertions, 2 deletions
diff --git a/gatoattclient.cpp b/gatoattclient.cpp
index 54e2212..6cf6d69 100644
--- a/gatoattclient.cpp
+++ b/gatoattclient.cpp
@@ -184,7 +184,8 @@ uint GatoAttClient::requestReadByType(GatoHandle start, GatoHandle end, const Ga
QByteArray data;
QDataStream s(&data, QIODevice::WriteOnly);
s.setByteOrder(QDataStream::LittleEndian);
- s << start << end << gatouuid_to_bytearray(uuid, true, false);
+ s << start << end;
+ write_gatouuid(s, uuid, true, false);
return request(AttOpReadByTypeRequest, data, receiver, member);
}
@@ -204,7 +205,8 @@ uint GatoAttClient::requestReadByGroupType(GatoHandle start, GatoHandle end, con
QByteArray data;
QDataStream s(&data, QIODevice::WriteOnly);
s.setByteOrder(QDataStream::LittleEndian);
- s << start << end << gatouuid_to_bytearray(uuid, true, false);
+ s << start << end;
+ write_gatouuid(s, uuid, true, false);
return request(AttOpReadByGroupTypeRequest, data, receiver, member);
}
diff --git a/helpers.cpp b/helpers.cpp
index ceb4454..c77c054 100644
--- a/helpers.cpp
+++ b/helpers.cpp
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <QtCore/QDataStream>
#include "helpers.h"
static QByteArray reverse(const QByteArray &ba)
@@ -66,3 +67,9 @@ QByteArray gatouuid_to_bytearray(const GatoUUID &uuid, bool use_uuid16, bool use
return reverse(uuid.toRfc4122());
}
+
+void write_gatouuid(QDataStream &s, const GatoUUID &uuid, bool use_uuid16, bool use_uuid32)
+{
+ QByteArray bytes = gatouuid_to_bytearray(uuid, use_uuid16, use_uuid32);
+ s.writeRawData(bytes.constData(), bytes.size());
+}
diff --git a/helpers.h b/helpers.h
index 962026c..55ea706 100644
--- a/helpers.h
+++ b/helpers.h
@@ -31,5 +31,6 @@ void write_le(T src, char *dst)
GatoUUID bytearray_to_gatouuid(const QByteArray &ba);
QByteArray gatouuid_to_bytearray(const GatoUUID &uuid, bool use_uuid16, bool use_uuid32);
+void write_gatouuid(QDataStream &s, const GatoUUID &uuid, bool use_uuid16, bool use_uuid32);
#endif // HELPERS_H