From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> This adds bt_uuid128_to_str which can be used to convert UUID 128 bit binary format into string. --- src/shared/util.c | 12 ++++++++++++ src/shared/util.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/shared/util.c b/src/shared/util.c index 9c2054211..7fb1c01dc 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -1042,6 +1042,18 @@ const char *bt_uuid32_to_str(uint32_t uuid) return "Unknown"; } +const char *bt_uuid128_to_str(const uint8_t uuid[16]) +{ + char uuidstr[37]; + + sprintf(uuidstr, "%8.8x-%4.4x-%4.4x-%4.4x-%8.8x%4.4x", + get_le32(&uuid[12]), get_le16(&uuid[10]), + get_le16(&uuid[8]), get_le16(&uuid[6]), + get_le32(&uuid[2]), get_le16(&uuid[0])); + + return bt_uuidstr_to_str(uuidstr); +} + const char *bt_uuidstr_to_str(const char *uuid) { uint32_t val; diff --git a/src/shared/util.h b/src/shared/util.h index d6de55885..9920b7f76 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -107,6 +107,7 @@ void util_clear_uid(unsigned int *bitmap, uint8_t id); const char *bt_uuid16_to_str(uint16_t uuid); const char *bt_uuid32_to_str(uint32_t uuid); +const char *bt_uuid128_to_str(const uint8_t uuid[16]); const char *bt_uuidstr_to_str(const char *uuid); const char *bt_appear_to_str(uint16_t appearance); -- 2.30.2