summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2014-03-24 16:25:42 -0300
committerJohan Hedberg <johan.hedberg@intel.com>2014-03-24 22:18:34 +0200
commit3d4d9147a8cd086908e658f513a4c4c4cdecaea5 (patch)
tree11071cd2f990d355dc8d64faf7aa8c27084b58a6
parent454a30731b202e7e7f41befdd96f0a1fa3d33a38 (diff)
downloadbluez-3d4d9147a8cd086908e658f513a4c4c4cdecaea5.tar.gz
core: Fix creating 128-bit uuid_t based on GATT service
sdp_uuid128_create() gets the 128-bit UUID on big-endian (human-readable format) byte order. Service declaration attributes puts the UUIDs in the attribute value field using little endian order. This patch converts the 128-bit UUID from little-endian to big-endian before creating uuid_t.
-rw-r--r--src/attrib-server.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 953a3f231..114c8a147 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -318,9 +318,13 @@ static uint32_t attrib_create_sdp_new(struct gatt_server *server,
if (a->len == 2)
sdp_uuid16_create(&svc, get_le16(a->data));
- else if (a->len == 16)
- sdp_uuid128_create(&svc, a->data);
- else
+ else if (a->len == 16) {
+ uint8_t be128[16];
+
+ /* Converting from LE to BE */
+ bswap_128(a->data, be128);
+ sdp_uuid128_create(&svc, be128);
+ } else
return 0;
record = server_record_new(&svc, handle, end);