diff options
author | Ajay KV <ajay.k.v@intel.com> | 2024-02-13 23:57:01 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2024-02-13 15:41:06 -0500 |
commit | 93d88ecd0714fc32b62109904b5ac7eff1b9aa26 (patch) | |
tree | 65f76ba087cf06324b23cd5692ceac191a5e30f2 | |
parent | 24d97e35fcde16ab988699dd1516d992053c50ac (diff) |
lib/uuid: Add support to compare 16bit uuids
-rw-r--r-- | lib/uuid.c | 9 | ||||
-rw-r--r-- | lib/uuid.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/uuid.c b/lib/uuid.c index 1d2e1f7328..9a216e7cef 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -120,6 +120,15 @@ int bt_uuid_cmp(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2) return bt_uuid128_cmp(&u1, &u2); } +int bt_uuid16_cmp(const bt_uuid_t *uuid1, uint16_t uuid2) +{ + + if (!uuid1 || (uuid1->type != BT_UUID16)) + return 0; + + return (uuid1->value.u16 == uuid2); +} + /* * convert the UUID to string, copying a maximum of n characters. */ diff --git a/lib/uuid.h b/lib/uuid.h index ff1b071b52..8404b287ed 100644 --- a/lib/uuid.h +++ b/lib/uuid.h @@ -263,6 +263,7 @@ int bt_uuid32_create(bt_uuid_t *btuuid, uint32_t value); int bt_uuid128_create(bt_uuid_t *btuuid, uint128_t value); int bt_uuid_cmp(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2); +int bt_uuid16_cmp(const bt_uuid_t *uuid1, uint16_t uuid2); void bt_uuid_to_uuid128(const bt_uuid_t *src, bt_uuid_t *dst); #define MAX_LEN_UUID_STR 37 |