diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2015-02-13 15:38:45 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2015-02-16 11:21:24 +0200 |
commit | 82a19daa377d0aed0b85188ee71f48e1fe1eb64e (patch) | |
tree | a12c9e4cc5f7b4500de84b09ca5efb41c0945ae0 /lib/uuid.c | |
parent | d2c3df7b052c1b6d05fc5c753c86c19fd2ffa010 (diff) | |
download | bluez-82a19daa377d0aed0b85188ee71f48e1fe1eb64e.tar.gz |
uuid: Add bt_uuid_to_le
This adds bt_uuid_to_le and replace the use of put_uuid_le.
Diffstat (limited to 'lib/uuid.c')
-rw-r--r-- | lib/uuid.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/uuid.c b/lib/uuid.c index e3f31df94..97b2d9d1b 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -290,3 +290,24 @@ int bt_uuid_strcmp(const void *a, const void *b) { return strcasecmp(a, b); } + +int bt_uuid_to_le(const bt_uuid_t *src, void *dst) +{ + bt_uuid_t uuid; + + switch (src->type) { + case BT_UUID16: + bt_put_le16(src->value.u16, dst); + return 0; + case BT_UUID32: + bt_uuid_to_uuid128(src, &uuid); + ntoh128(&uuid.value.u128, dst); + return 0; + case BT_UUID128: + ntoh128(&src->value.u128, dst); + return 0; + case BT_UUID_UNSPEC: + default: + return -EINVAL; + } +} |