Bluetooth: Make use of bt_uuid_to_str
This make use of bt_uuid_to_str to when printing UUID values, to make it simpler when it is just going to print so the patch introduces a new function that does the conversion in place using a static variable. Change-Id: Idfedf05a5ad201653fff2e01387f046cd5647c83 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
118dc75cea
commit
6cb42e1e20
4 changed files with 34 additions and 11 deletions
|
@ -176,6 +176,17 @@ int bt_uuid_cmp(const struct bt_uuid *u1, const struct bt_uuid *u2);
|
|||
* @return none
|
||||
*/
|
||||
void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len);
|
||||
|
||||
/** @brief Convert Bluetooth UUID to string in place.
|
||||
*
|
||||
* Converts Bluetooth UUID to string in place. UUID has to be in 16 bits or
|
||||
* 128 bits format.
|
||||
*
|
||||
* @param uuid Bluetooth UUID
|
||||
*
|
||||
* @return String representation of the UUID given
|
||||
*/
|
||||
const char *bt_uuid_str(struct bt_uuid *uuid);
|
||||
#endif /* CONFIG_BLUETOOTH_DEBUG */
|
||||
|
||||
#endif /* __BT_UUID_H */
|
||||
|
|
|
@ -607,8 +607,8 @@ static uint8_t att_read_type_req(struct bt_att *att, struct bt_buf *buf)
|
|||
return BT_ATT_ERR_UNLIKELY;
|
||||
}
|
||||
|
||||
BT_DBG("start_handle 0x%04x end_handle 0x%04x type 0x%04x\n",
|
||||
start_handle, end_handle, uuid.u16);
|
||||
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %s\n",
|
||||
start_handle, end_handle, bt_uuid_str(&uuid));
|
||||
|
||||
if (!range_is_valid(start_handle, end_handle, &err_handle)) {
|
||||
send_err_rsp(conn, BT_ATT_OP_READ_TYPE_REQ, err_handle,
|
||||
|
@ -953,8 +953,8 @@ static uint8_t att_read_group_req(struct bt_att *att, struct bt_buf *buf)
|
|||
return BT_ATT_ERR_UNLIKELY;
|
||||
}
|
||||
|
||||
BT_DBG("start_handle 0x%04x end_handle 0x%04x type 0x%04x\n",
|
||||
start_handle, end_handle, uuid.u16);
|
||||
BT_DBG("start_handle 0x%04x end_handle 0x%04x type %s\n",
|
||||
start_handle, end_handle, bt_uuid_str(&uuid));
|
||||
|
||||
if (!range_is_valid(start_handle, end_handle, &err_handle)) {
|
||||
send_err_rsp(conn, BT_ATT_OP_READ_GROUP_REQ, err_handle,
|
||||
|
|
|
@ -655,8 +655,9 @@ static int att_find_type(struct bt_conn *conn,
|
|||
req->type = sys_cpu_to_le16(BT_UUID_GATT_SECONDARY);
|
||||
}
|
||||
|
||||
BT_DBG("uuid 0x%04x start_handle 0x%04x end_handle 0x%04x\n",
|
||||
params->uuid->u16, params->start_handle, params->end_handle);
|
||||
BT_DBG("uuid %s start_handle 0x%04x end_handle 0x%04x\n",
|
||||
bt_uuid_str(params->uuid), params->start_handle,
|
||||
params->end_handle);
|
||||
|
||||
switch (params->uuid->type) {
|
||||
case BT_UUID_16:
|
||||
|
@ -733,8 +734,9 @@ static uint16_t parse_include(const void *pdu,
|
|||
break;
|
||||
}
|
||||
|
||||
BT_DBG("handle 0x%04x start_handle 0x%04x end_handle 0x%04x\n",
|
||||
handle, value.start_handle, value.end_handle);
|
||||
BT_DBG("handle 0x%04x uuid %s start_handle 0x%04x "
|
||||
"end_handle 0x%04x\n", handle, bt_uuid_str(&uuid),
|
||||
value.start_handle, value.end_handle);
|
||||
|
||||
/* Skip if UUID is set but doesn't match */
|
||||
if (params->uuid && bt_uuid_cmp(&uuid, params->uuid)) {
|
||||
|
@ -811,8 +813,9 @@ static uint16_t parse_characteristic(const void *pdu,
|
|||
break;
|
||||
}
|
||||
|
||||
BT_DBG("handle 0x%04x properties 0x%02x value_handle 0x%04x\n",
|
||||
handle, value.properties, value.value_handle);
|
||||
BT_DBG("handle 0x%04x uuid %s properties 0x%02x "
|
||||
"value_handle 0x%04x\n", handle, bt_uuid_str(&uuid),
|
||||
value.properties, value.value_handle);
|
||||
|
||||
/* Skip if UUID is set but doesn't match */
|
||||
if (params->uuid && bt_uuid_cmp(&uuid, params->uuid)) {
|
||||
|
@ -962,7 +965,7 @@ static void att_find_info_rsp(struct bt_conn *conn, uint8_t err,
|
|||
break;
|
||||
}
|
||||
|
||||
BT_DBG("handle 0x%04x\n", handle);
|
||||
BT_DBG("handle 0x%04x uuid %s\n", handle, bt_uuid_str(&uuid));
|
||||
|
||||
/* Skip if UUID is set but doesn't match */
|
||||
if (params->uuid && bt_uuid_cmp(&uuid, params->uuid)) {
|
||||
|
|
|
@ -101,4 +101,13 @@ void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const char *bt_uuid_str(struct bt_uuid *uuid)
|
||||
{
|
||||
static char str[37];
|
||||
|
||||
bt_uuid_to_str(uuid, str, sizeof(str));
|
||||
|
||||
return str;
|
||||
}
|
||||
#endif /* CONFIG_BLUETOOTH_DEBUG */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue