Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been removed. Files that were using them have been updated to use `zephyr/logging/log.h` instead. Those replacement have been done consequently: - `/BT_DBG/LOG_DBG/` - `/BT_ERR/LOG_ERR/` - `/BT_WARN/LOG_WRN/` - `/BT_INFO/LOG_INF/` - `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/` - `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/` Also, some files were relying on the `common/log.h` include to include `zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has been added. For files that were including `common/log.h` but not using any logs, the include has been removed and not replaced. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
parent
808266a493
commit
e458f5aae6
253 changed files with 7131 additions and 7180 deletions
|
@ -23,9 +23,10 @@
|
|||
#include <zephyr/bluetooth/audio/pacs.h>
|
||||
#include "../host/conn_internal.h"
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_PACS)
|
||||
#define LOG_MODULE_NAME bt_pacs
|
||||
#include "common/log.h"
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
LOG_MODULE_REGISTER(bt_pacs, CONFIG_BT_PACS_LOG_LEVEL);
|
||||
|
||||
#include "common/bt_str.h"
|
||||
|
||||
#include "audio_internal.h"
|
||||
|
@ -190,7 +191,7 @@ static void get_pac_records(struct bt_conn *conn, sys_slist_t *list,
|
|||
|
||||
static void available_context_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
||||
{
|
||||
BT_DBG("attr %p value 0x%04x", attr, value);
|
||||
LOG_DBG("attr %p value 0x%04x", attr, value);
|
||||
}
|
||||
|
||||
static ssize_t available_contexts_read(struct bt_conn *conn,
|
||||
|
@ -202,8 +203,7 @@ static ssize_t available_contexts_read(struct bt_conn *conn,
|
|||
.src = sys_cpu_to_le16(src_available_contexts),
|
||||
};
|
||||
|
||||
BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
|
||||
offset);
|
||||
LOG_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset);
|
||||
|
||||
return bt_gatt_attr_read(conn, attr, buf, len, offset, &context,
|
||||
sizeof(context));
|
||||
|
@ -212,7 +212,7 @@ static ssize_t available_contexts_read(struct bt_conn *conn,
|
|||
static void supported_context_cfg_changed(const struct bt_gatt_attr *attr,
|
||||
uint16_t value)
|
||||
{
|
||||
BT_DBG("attr %p value 0x%04x", attr, value);
|
||||
LOG_DBG("attr %p value 0x%04x", attr, value);
|
||||
}
|
||||
|
||||
static ssize_t supported_context_read(struct bt_conn *conn,
|
||||
|
@ -224,8 +224,7 @@ static ssize_t supported_context_read(struct bt_conn *conn,
|
|||
.src = sys_cpu_to_le16(src_supported_contexts),
|
||||
};
|
||||
|
||||
BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
|
||||
offset);
|
||||
LOG_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset);
|
||||
|
||||
return bt_gatt_attr_read(conn, attr, buf, len, offset, &context,
|
||||
sizeof(context));
|
||||
|
@ -264,8 +263,7 @@ static PACS(snk_pacs, pac_notify_snk);
|
|||
static ssize_t snk_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
|
||||
offset);
|
||||
LOG_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset);
|
||||
|
||||
get_pac_records(conn, &snk_pacs.list, &read_buf);
|
||||
|
||||
|
@ -275,7 +273,7 @@ static ssize_t snk_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
|
||||
static void snk_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
||||
{
|
||||
BT_DBG("attr %p value 0x%04x", attr, value);
|
||||
LOG_DBG("attr %p value 0x%04x", attr, value);
|
||||
}
|
||||
|
||||
static inline int set_snk_available_contexts(uint16_t contexts)
|
||||
|
@ -300,8 +298,7 @@ static ssize_t snk_loc_read(struct bt_conn *conn,
|
|||
{
|
||||
uint32_t location = sys_cpu_to_le32(snk_location.location);
|
||||
|
||||
BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
|
||||
offset);
|
||||
LOG_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset);
|
||||
|
||||
return bt_gatt_attr_read(conn, attr, buf, len, offset, &location,
|
||||
sizeof(location));
|
||||
|
@ -309,7 +306,7 @@ static ssize_t snk_loc_read(struct bt_conn *conn,
|
|||
|
||||
static void snk_loc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
||||
{
|
||||
BT_DBG("attr %p value 0x%04x", attr, value);
|
||||
LOG_DBG("attr %p value 0x%04x", attr, value);
|
||||
}
|
||||
|
||||
static int set_snk_location(enum bt_audio_location audio_location)
|
||||
|
@ -349,13 +346,13 @@ static ssize_t snk_loc_write(struct bt_conn *conn,
|
|||
|
||||
location = (enum bt_audio_location)sys_get_le32(data);
|
||||
if (location > BT_AUDIO_LOCATION_MASK || location == 0) {
|
||||
BT_DBG("Invalid location value: 0x%08X", location);
|
||||
LOG_DBG("Invalid location value: 0x%08X", location);
|
||||
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
|
||||
}
|
||||
|
||||
err = set_snk_location(location);
|
||||
if (err != 0) {
|
||||
BT_DBG("write_location returned %d", err);
|
||||
LOG_DBG("write_location returned %d", err);
|
||||
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
|
||||
}
|
||||
|
||||
|
@ -370,8 +367,7 @@ static PACS(src_pacs, pac_notify_src);
|
|||
static ssize_t src_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
||||
void *buf, uint16_t len, uint16_t offset)
|
||||
{
|
||||
BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
|
||||
offset);
|
||||
LOG_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset);
|
||||
|
||||
get_pac_records(conn, &src_pacs.list, &read_buf);
|
||||
|
||||
|
@ -381,7 +377,7 @@ static ssize_t src_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
|
|||
|
||||
static void src_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
||||
{
|
||||
BT_DBG("attr %p value 0x%04x", attr, value);
|
||||
LOG_DBG("attr %p value 0x%04x", attr, value);
|
||||
}
|
||||
|
||||
static inline int set_src_available_contexts(uint16_t contexts)
|
||||
|
@ -406,8 +402,7 @@ static ssize_t src_loc_read(struct bt_conn *conn,
|
|||
{
|
||||
uint32_t location = sys_cpu_to_le32(src_location.location);
|
||||
|
||||
BT_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len,
|
||||
offset);
|
||||
LOG_DBG("conn %p attr %p buf %p len %u offset %u", conn, attr, buf, len, offset);
|
||||
|
||||
return bt_gatt_attr_read(conn, attr, buf, len, offset, &location,
|
||||
sizeof(location));
|
||||
|
@ -415,7 +410,7 @@ static ssize_t src_loc_read(struct bt_conn *conn,
|
|||
|
||||
static void src_loc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value)
|
||||
{
|
||||
BT_DBG("attr %p value 0x%04x", attr, value);
|
||||
LOG_DBG("attr %p value 0x%04x", attr, value);
|
||||
}
|
||||
|
||||
static int set_src_location(enum bt_audio_location audio_location)
|
||||
|
@ -455,13 +450,13 @@ static ssize_t src_loc_write(struct bt_conn *conn,
|
|||
|
||||
location = (enum bt_audio_location)sys_get_le32(data);
|
||||
if (location > BT_AUDIO_LOCATION_MASK || location == 0) {
|
||||
BT_DBG("Invalid location value: 0x%08X", location);
|
||||
LOG_DBG("Invalid location value: 0x%08X", location);
|
||||
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
|
||||
}
|
||||
|
||||
err = set_src_location(location);
|
||||
if (err != 0) {
|
||||
BT_DBG("write_location returned %d", err);
|
||||
LOG_DBG("write_location returned %d", err);
|
||||
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
|
||||
}
|
||||
|
||||
|
@ -535,7 +530,7 @@ static void pac_notify_snk_loc(struct k_work *work)
|
|||
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SNK_LOC, pacs_svc.attrs, &location_le,
|
||||
sizeof(location_le));
|
||||
if (err != 0 && err != -ENOTCONN) {
|
||||
BT_WARN("PACS notify_loc failed: %d", err);
|
||||
LOG_WRN("PACS notify_loc failed: %d", err);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_PAC_SNK_LOC */
|
||||
|
@ -550,7 +545,7 @@ static void pac_notify_src_loc(struct k_work *work)
|
|||
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SRC_LOC, pacs_svc.attrs, &location_le,
|
||||
sizeof(location_le));
|
||||
if (err != 0 && err != -ENOTCONN) {
|
||||
BT_WARN("PACS notify_loc failed: %d", err);
|
||||
LOG_WRN("PACS notify_loc failed: %d", err);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_PAC_SRC_LOC */
|
||||
|
@ -566,7 +561,7 @@ static void pac_notify_snk(struct k_work *work)
|
|||
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SNK, pacs_svc.attrs,
|
||||
read_buf.data, read_buf.len);
|
||||
if (err != 0 && err != -ENOTCONN) {
|
||||
BT_WARN("PACS notify failed: %d", err);
|
||||
LOG_WRN("PACS notify failed: %d", err);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_PAC_SNK */
|
||||
|
@ -582,7 +577,7 @@ static void pac_notify_src(struct k_work *work)
|
|||
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_SRC, pacs_svc.attrs,
|
||||
read_buf.data, read_buf.len);
|
||||
if (err != 0 && err != -ENOTCONN) {
|
||||
BT_WARN("PACS notify failed: %d", err);
|
||||
LOG_WRN("PACS notify failed: %d", err);
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BT_PAC_SRC */
|
||||
|
@ -603,7 +598,7 @@ static void available_contexts_notify(struct k_work *work)
|
|||
err = bt_gatt_notify_uuid(NULL, BT_UUID_PACS_AVAILABLE_CONTEXT, pacs_svc.attrs,
|
||||
&context, sizeof(context));
|
||||
if (err != 0 && err != -ENOTCONN) {
|
||||
BT_WARN("Available Audio Contexts notify failed: %d", err);
|
||||
LOG_WRN("Available Audio Contexts notify failed: %d", err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -641,7 +636,7 @@ void bt_pacs_cap_foreach(enum bt_audio_dir dir, bt_pacs_cap_foreach_func_t func,
|
|||
struct pacs *pac;
|
||||
|
||||
CHECKIF(func == NULL) {
|
||||
BT_ERR("func is NULL");
|
||||
LOG_ERR("func is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -667,7 +662,7 @@ int bt_pacs_cap_register(enum bt_audio_dir dir, struct bt_pacs_cap *cap)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
BT_DBG("cap %p dir 0x%02x codec 0x%02x codec cid 0x%04x "
|
||||
LOG_DBG("cap %p dir 0x%02x codec 0x%02x codec cid 0x%04x "
|
||||
"codec vid 0x%04x", cap, dir, cap->codec->id,
|
||||
cap->codec->cid, cap->codec->vid);
|
||||
|
||||
|
@ -692,7 +687,7 @@ int bt_pacs_cap_unregister(enum bt_audio_dir dir, struct bt_pacs_cap *cap)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
BT_DBG("cap %p dir 0x%02x", cap, dir);
|
||||
LOG_DBG("cap %p dir 0x%02x", cap, dir);
|
||||
|
||||
if (!sys_slist_find_and_remove(&pac->list, &cap->_node)) {
|
||||
return -ENOENT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue