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
|
@ -15,10 +15,6 @@
|
|||
#include <zephyr/bluetooth/bluetooth.h>
|
||||
#include <zephyr/bluetooth/mesh.h>
|
||||
|
||||
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_MESH_DEBUG_MODEL)
|
||||
#define LOG_MODULE_NAME bt_mesh_health_srv
|
||||
#include "common/log.h"
|
||||
|
||||
#include "mesh.h"
|
||||
#include "adv.h"
|
||||
#include "net.h"
|
||||
|
@ -26,6 +22,10 @@
|
|||
#include "access.h"
|
||||
#include "foundation.h"
|
||||
|
||||
#define LOG_LEVEL CONFIG_BT_MESH_MODEL_LOG_LEVEL
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(bt_mesh_health_srv);
|
||||
|
||||
#define HEALTH_TEST_STANDARD 0x00
|
||||
|
||||
/* Health Server context of the primary element */
|
||||
|
@ -38,7 +38,7 @@ static void health_get_registered(struct bt_mesh_model *mod,
|
|||
struct bt_mesh_health_srv *srv = mod->user_data;
|
||||
uint8_t *test_id;
|
||||
|
||||
BT_DBG("Company ID 0x%04x", company_id);
|
||||
LOG_DBG("Company ID 0x%04x", company_id);
|
||||
|
||||
bt_mesh_model_msg_init(msg, OP_HEALTH_FAULT_STATUS);
|
||||
|
||||
|
@ -53,13 +53,13 @@ static void health_get_registered(struct bt_mesh_model *mod,
|
|||
net_buf_simple_tail(msg),
|
||||
&fault_count);
|
||||
if (err) {
|
||||
BT_ERR("Failed to get faults (err %d)", err);
|
||||
LOG_ERR("Failed to get faults (err %d)", err);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
} else {
|
||||
net_buf_simple_add(msg, fault_count);
|
||||
}
|
||||
} else {
|
||||
BT_WARN("No callback for getting faults");
|
||||
LOG_WRN("No callback for getting faults");
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
|||
net_buf_simple_tail(msg),
|
||||
&fault_count);
|
||||
if (err) {
|
||||
BT_ERR("Failed to get faults (err %d)", err);
|
||||
LOG_ERR("Failed to get faults (err %d)", err);
|
||||
sys_put_le16(comp->cid, company_ptr);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
fault_count = 0U;
|
||||
|
@ -96,7 +96,7 @@ static size_t health_get_current(struct bt_mesh_model *mod,
|
|||
net_buf_simple_add(msg, fault_count);
|
||||
}
|
||||
} else {
|
||||
BT_WARN("No callback for getting faults");
|
||||
LOG_WRN("No callback for getting faults");
|
||||
sys_put_le16(comp->cid, company_ptr);
|
||||
*test_id = HEALTH_TEST_STANDARD;
|
||||
fault_count = 0U;
|
||||
|
@ -114,12 +114,12 @@ static int health_fault_get(struct bt_mesh_model *model,
|
|||
|
||||
company_id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("company_id 0x%04x", company_id);
|
||||
LOG_DBG("company_id 0x%04x", company_id);
|
||||
|
||||
health_get_registered(model, company_id, &sdu);
|
||||
|
||||
if (bt_mesh_model_send(model, ctx, &sdu, NULL, NULL)) {
|
||||
BT_ERR("Unable to send Health Current Status response");
|
||||
LOG_ERR("Unable to send Health Current Status response");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -134,7 +134,7 @@ static int health_fault_clear_unrel(struct bt_mesh_model *model,
|
|||
|
||||
company_id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("company_id 0x%04x", company_id);
|
||||
LOG_DBG("company_id 0x%04x", company_id);
|
||||
|
||||
if (srv->cb && srv->cb->fault_clear) {
|
||||
return srv->cb->fault_clear(model, company_id);
|
||||
|
@ -153,7 +153,7 @@ static int health_fault_clear(struct bt_mesh_model *model,
|
|||
|
||||
company_id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("company_id 0x%04x", company_id);
|
||||
LOG_DBG("company_id 0x%04x", company_id);
|
||||
|
||||
if (srv->cb && srv->cb->fault_clear) {
|
||||
int err;
|
||||
|
@ -167,7 +167,7 @@ static int health_fault_clear(struct bt_mesh_model *model,
|
|||
health_get_registered(model, company_id, &sdu);
|
||||
|
||||
if (bt_mesh_model_send(model, ctx, &sdu, NULL, NULL)) {
|
||||
BT_ERR("Unable to send Health Current Status response");
|
||||
LOG_ERR("Unable to send Health Current Status response");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -184,7 +184,7 @@ static int health_fault_test_unrel(struct bt_mesh_model *model,
|
|||
test_id = net_buf_simple_pull_u8(buf);
|
||||
company_id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("test 0x%02x company 0x%04x", test_id, company_id);
|
||||
LOG_DBG("test 0x%02x company 0x%04x", test_id, company_id);
|
||||
|
||||
if (srv->cb && srv->cb->fault_test) {
|
||||
return srv->cb->fault_test(model, test_id, company_id);
|
||||
|
@ -202,19 +202,19 @@ static int health_fault_test(struct bt_mesh_model *model,
|
|||
uint16_t company_id;
|
||||
uint8_t test_id;
|
||||
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
test_id = net_buf_simple_pull_u8(buf);
|
||||
company_id = net_buf_simple_pull_le16(buf);
|
||||
|
||||
BT_DBG("test 0x%02x company 0x%04x", test_id, company_id);
|
||||
LOG_DBG("test 0x%02x company 0x%04x", test_id, company_id);
|
||||
|
||||
if (srv->cb && srv->cb->fault_test) {
|
||||
int err;
|
||||
|
||||
err = srv->cb->fault_test(model, test_id, company_id);
|
||||
if (err) {
|
||||
BT_WARN("Running fault test failed with err %d", err);
|
||||
LOG_WRN("Running fault test failed with err %d", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ static int health_fault_test(struct bt_mesh_model *model,
|
|||
health_get_registered(model, company_id, &sdu);
|
||||
|
||||
if (bt_mesh_model_send(model, ctx, &sdu, NULL, NULL)) {
|
||||
BT_ERR("Unable to send Health Current Status response");
|
||||
LOG_ERR("Unable to send Health Current Status response");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -238,14 +238,14 @@ static int send_attention_status(struct bt_mesh_model *model,
|
|||
|
||||
time = k_ticks_to_ms_floor32(
|
||||
k_work_delayable_remaining_get(&srv->attn_timer)) / 1000U;
|
||||
BT_DBG("%u second%s", time, (time == 1U) ? "" : "s");
|
||||
LOG_DBG("%u second%s", time, (time == 1U) ? "" : "s");
|
||||
|
||||
bt_mesh_model_msg_init(&msg, OP_ATTENTION_STATUS);
|
||||
|
||||
net_buf_simple_add_u8(&msg, time);
|
||||
|
||||
if (bt_mesh_model_send(model, ctx, &msg, NULL, NULL)) {
|
||||
BT_ERR("Unable to send Attention Status");
|
||||
LOG_ERR("Unable to send Attention Status");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -255,7 +255,7 @@ static int attention_get(struct bt_mesh_model *model,
|
|||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
return send_attention_status(model, ctx);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ static int attention_set_unrel(struct bt_mesh_model *model,
|
|||
|
||||
time = net_buf_simple_pull_u8(buf);
|
||||
|
||||
BT_DBG("%u second%s", time, (time == 1U) ? "" : "s");
|
||||
LOG_DBG("%u second%s", time, (time == 1U) ? "" : "s");
|
||||
|
||||
bt_mesh_attention(model, time);
|
||||
|
||||
|
@ -281,7 +281,7 @@ static int attention_set(struct bt_mesh_model *model,
|
|||
{
|
||||
int err;
|
||||
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
err = attention_set_unrel(model, ctx, buf);
|
||||
if (err) {
|
||||
|
@ -302,7 +302,7 @@ static int send_health_period_status(struct bt_mesh_model *model,
|
|||
net_buf_simple_add_u8(&msg, model->pub->period_div);
|
||||
|
||||
if (bt_mesh_model_send(model, ctx, &msg, NULL, NULL)) {
|
||||
BT_ERR("Unable to send Health Period Status");
|
||||
LOG_ERR("Unable to send Health Period Status");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -312,7 +312,7 @@ static int health_period_get(struct bt_mesh_model *model,
|
|||
struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
return send_health_period_status(model, ctx);
|
||||
}
|
||||
|
@ -325,11 +325,11 @@ static int health_period_set_unrel(struct bt_mesh_model *model,
|
|||
|
||||
period = net_buf_simple_pull_u8(buf);
|
||||
if (period > 15) {
|
||||
BT_WARN("Prohibited period value %u", period);
|
||||
LOG_WRN("Prohibited period value %u", period);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
BT_DBG("period %u", period);
|
||||
LOG_DBG("period %u", period);
|
||||
|
||||
model->pub->period_div = period;
|
||||
|
||||
|
@ -342,7 +342,7 @@ static int health_period_set(struct bt_mesh_model *model,
|
|||
{
|
||||
int err;
|
||||
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
err = health_period_set_unrel(model, ctx, buf);
|
||||
if (err) {
|
||||
|
@ -372,7 +372,7 @@ static int health_pub_update(struct bt_mesh_model *mod)
|
|||
struct bt_mesh_model_pub *pub = mod->pub;
|
||||
size_t count;
|
||||
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
count = health_get_current(mod, pub->msg);
|
||||
if (count) {
|
||||
|
@ -416,7 +416,7 @@ static void attention_off(struct k_work *work)
|
|||
struct bt_mesh_health_srv *srv = CONTAINER_OF(dwork,
|
||||
struct bt_mesh_health_srv,
|
||||
attn_timer);
|
||||
BT_DBG("");
|
||||
LOG_DBG("");
|
||||
|
||||
if (srv->cb && srv->cb->attn_off) {
|
||||
srv->cb->attn_off(srv->model);
|
||||
|
@ -428,12 +428,12 @@ static int health_srv_init(struct bt_mesh_model *model)
|
|||
struct bt_mesh_health_srv *srv = model->user_data;
|
||||
|
||||
if (!srv) {
|
||||
BT_ERR("No Health Server context provided");
|
||||
LOG_ERR("No Health Server context provided");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!model->pub) {
|
||||
BT_ERR("Health Server has no publication support");
|
||||
LOG_ERR("Health Server has no publication support");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ void bt_mesh_attention(struct bt_mesh_model *model, uint8_t time)
|
|||
if (!model) {
|
||||
srv = health_srv;
|
||||
if (!srv) {
|
||||
BT_WARN("No Health Server available");
|
||||
LOG_WRN("No Health Server available");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue