Bluetooth: UUID: Expose bt_uuid_to_str to application
Expose the bt_uuid_to_str function as an API to the application. This aligns this function with the bt_addr_to_str function call. This allows the application to use this function without having to enable the BT_DEBUG option. Move the in-place bt_uuid_str to internal logging, this is mainly done due to the limitation in the log_strdup that shouldn't be exposed to the application. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
87e917a925
commit
b30b480c7c
6 changed files with 40 additions and 49 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <logging/log.h>
|
||||
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/uuid.h>
|
||||
#include <bluetooth/hci.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -68,10 +69,13 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL);
|
|||
/* NOTE: These helper functions always encodes into the same buffer storage.
|
||||
* It is the responsibility of the user of this function to copy the information
|
||||
* in this string if needed.
|
||||
*
|
||||
* NOTE: These functions are not thread-safe!
|
||||
*/
|
||||
const char *bt_hex_real(const void *buf, size_t len);
|
||||
const char *bt_addr_str_real(const bt_addr_t *addr);
|
||||
const char *bt_addr_le_str_real(const bt_addr_le_t *addr);
|
||||
const char *bt_uuid_str_real(const struct bt_uuid *uuid);
|
||||
|
||||
/* NOTE: log_strdup does not guarantee a duplication of the string.
|
||||
* It is therefore still the responsibility of the user to handle the
|
||||
|
@ -80,6 +84,7 @@ const char *bt_addr_le_str_real(const bt_addr_le_t *addr);
|
|||
#define bt_hex(buf, len) log_strdup(bt_hex_real(buf, len))
|
||||
#define bt_addr_str(addr) log_strdup(bt_addr_str_real(addr))
|
||||
#define bt_addr_le_str(addr) log_strdup(bt_addr_le_str_real(addr))
|
||||
#define bt_uuid_str(uuid) log_strdup(bt_uuid_str_real(uuid))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue