tests: bluetooth/tester: Convert from SYS_LOG to new logger

Use the LOG_* macros instead of the deprecated SYS_LOG_* ones.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-10-19 10:55:58 +03:00 committed by Carles Cufí
commit a0c22de270
6 changed files with 85 additions and 86 deletions

View file

@ -229,7 +229,7 @@ static u8_t *recv_cb(u8_t *buf, size_t *off)
len = sys_le16_to_cpu(cmd->len); len = sys_le16_to_cpu(cmd->len);
if (len > BTP_MTU - sizeof(*cmd)) { if (len > BTP_MTU - sizeof(*cmd)) {
SYS_LOG_ERR("BT tester: invalid packet length"); LOG_ERR("BT tester: invalid packet length");
*off = 0; *off = 0;
return buf; return buf;
} }
@ -240,7 +240,7 @@ static u8_t *recv_cb(u8_t *buf, size_t *off)
new_buf = k_fifo_get(&avail_queue, K_NO_WAIT); new_buf = k_fifo_get(&avail_queue, K_NO_WAIT);
if (!new_buf) { if (!new_buf) {
SYS_LOG_ERR("BT tester: RX overflow"); LOG_ERR("BT tester: RX overflow");
*off = 0; *off = 0;
return buf; return buf;
} }

View file

@ -24,9 +24,9 @@
#define BTP_STATUS_UNKNOWN_CMD 0x02 #define BTP_STATUS_UNKNOWN_CMD 0x02
#define BTP_STATUS_NOT_READY 0x03 #define BTP_STATUS_NOT_READY 0x03
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_DEBUG #include <logging/log.h>
#define SYS_LOG_DOMAIN "bttester" #define LOG_MODULE_NAME bttester
#include <logging/sys_log.h> LOG_MODULE_REGISTER(LOG_MODULE_NAME);
struct btp_hdr { struct btp_hdr {
u8_t service; u8_t service;

View file

@ -218,7 +218,7 @@ static void start_advertising(const u8_t *data, u16_t len)
for (i = 0, adv_len = 1; i < cmd->adv_data_len; adv_len++) { for (i = 0, adv_len = 1; i < cmd->adv_data_len; adv_len++) {
if (adv_len >= ARRAY_SIZE(ad)) { if (adv_len >= ARRAY_SIZE(ad)) {
SYS_LOG_ERR("ad[] Out of memory"); LOG_ERR("ad[] Out of memory");
goto fail; goto fail;
} }
@ -230,7 +230,7 @@ static void start_advertising(const u8_t *data, u16_t len)
for (i = 0, sd_len = 0; i < cmd->scan_rsp_len; sd_len++) { for (i = 0, sd_len = 0; i < cmd->scan_rsp_len; sd_len++) {
if (sd_len >= ARRAY_SIZE(sd)) { if (sd_len >= ARRAY_SIZE(sd)) {
SYS_LOG_ERR("sd[] Out of memory"); LOG_ERR("sd[] Out of memory");
goto fail; goto fail;
} }
@ -245,7 +245,7 @@ static void start_advertising(const u8_t *data, u16_t len)
/* BTP API don't allow to set empty scan response data. */ /* BTP API don't allow to set empty scan response data. */
if (bt_le_adv_start(adv_conn ? BT_LE_ADV_CONN : BT_LE_ADV_NCONN, if (bt_le_adv_start(adv_conn ? BT_LE_ADV_CONN : BT_LE_ADV_NCONN,
ad, adv_len, sd_len ? sd : NULL, sd_len) < 0) { ad, adv_len, sd_len ? sd : NULL, sd_len) < 0) {
SYS_LOG_ERR("Failed to start advertising"); LOG_ERR("Failed to start advertising");
goto fail; goto fail;
} }
@ -335,14 +335,14 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
/* ignore non-discoverable devices */ /* ignore non-discoverable devices */
if (!(flags & BT_LE_AD_DISCOV_MASK)) { if (!(flags & BT_LE_AD_DISCOV_MASK)) {
SYS_LOG_DBG("Non discoverable, skipping"); LOG_DBG("Non discoverable, skipping");
return; return;
} }
/* if Limited Discovery - ignore general discoverable devices */ /* if Limited Discovery - ignore general discoverable devices */
if ((discovery_flags & GAP_DISCOVERY_FLAG_LIMITED) && if ((discovery_flags & GAP_DISCOVERY_FLAG_LIMITED) &&
!(flags & BT_LE_AD_LIMITED)) { !(flags & BT_LE_AD_LIMITED)) {
SYS_LOG_DBG("General discoverable, skipping"); LOG_DBG("General discoverable, skipping");
return; return;
} }
} }
@ -354,7 +354,7 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
/* skip if there is no pending advertisement */ /* skip if there is no pending advertisement */
if (!adv_buf->len) { if (!adv_buf->len) {
SYS_LOG_INF("No pending advertisement, skipping"); LOG_INF("No pending advertisement, skipping");
return; return;
} }
@ -368,7 +368,7 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
* this one * this one
*/ */
if (bt_addr_le_cmp(addr, &a)) { if (bt_addr_le_cmp(addr, &a)) {
SYS_LOG_INF("Address does not match, skipping"); LOG_INF("Address does not match, skipping");
goto done; goto done;
} }
@ -394,7 +394,7 @@ static void device_found(const bt_addr_le_t *addr, s8_t rssi, u8_t evtype,
/* if Active Scan and scannable event - wait for Scan Response */ /* if Active Scan and scannable event - wait for Scan Response */
if ((discovery_flags & GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN) && if ((discovery_flags & GAP_DISCOVERY_FLAG_LE_ACTIVE_SCAN) &&
(evtype == BT_LE_ADV_IND || evtype == BT_LE_ADV_SCAN_IND)) { (evtype == BT_LE_ADV_IND || evtype == BT_LE_ADV_SCAN_IND)) {
SYS_LOG_DBG("Waiting for scan response"); LOG_DBG("Waiting for scan response");
return; return;
} }
done: done:

View file

@ -88,7 +88,7 @@ static void *gatt_buf_add(const void *data, size_t len)
gatt_buf.len += len; gatt_buf.len += len;
SYS_LOG_DBG("%d/%d used", gatt_buf.len, MAX_BUFFER_SIZE); LOG_DBG("%d/%d used", gatt_buf.len, MAX_BUFFER_SIZE);
return ptr; return ptr;
} }
@ -139,7 +139,7 @@ static struct bt_gatt_attr *gatt_db_add(const struct bt_gatt_attr *pattern,
memcpy(attr->user_data, pattern->user_data, user_data_len); memcpy(attr->user_data, pattern->user_data, user_data_len);
} }
SYS_LOG_DBG("handle 0x%04x", attr->handle); LOG_DBG("handle 0x%04x", attr->handle);
attr_count++; attr_count++;
svc_attr_count++; svc_attr_count++;
@ -725,9 +725,9 @@ static void indicate_cb(struct bt_conn *conn, const struct bt_gatt_attr *attr,
u8_t err) u8_t err)
{ {
if (err != 0) { if (err != 0) {
SYS_LOG_ERR("Indication fail"); LOG_ERR("Indication fail");
} else { } else {
SYS_LOG_DBG("Indication success"); LOG_DBG("Indication success");
} }
} }
@ -1564,7 +1564,7 @@ static u8_t notify_func(struct bt_conn *conn,
const bt_addr_le_t *addr = bt_conn_get_dst(conn); const bt_addr_le_t *addr = bt_conn_get_dst(conn);
if (!data) { if (!data) {
SYS_LOG_DBG("Unsubscribed"); LOG_DBG("Unsubscribed");
(void)memset(params, 0, sizeof(*params)); (void)memset(params, 0, sizeof(*params));
return BT_GATT_ITER_STOP; return BT_GATT_ITER_STOP;
} }
@ -1634,7 +1634,7 @@ static int enable_subscription(struct bt_conn *conn, u16_t ccc_handle,
{ {
/* Fail if there is another subscription enabled */ /* Fail if there is another subscription enabled */
if (subscribe_params.ccc_handle) { if (subscribe_params.ccc_handle) {
SYS_LOG_ERR("Another subscription already enabled"); LOG_ERR("Another subscription already enabled");
return -EEXIST; return -EEXIST;
} }
@ -1655,7 +1655,7 @@ static int disable_subscription(struct bt_conn *conn, u16_t ccc_handle)
{ {
/* Fail if CCC handle doesn't match */ /* Fail if CCC handle doesn't match */
if (ccc_handle != subscribe_params.ccc_handle) { if (ccc_handle != subscribe_params.ccc_handle) {
SYS_LOG_ERR("CCC handle doesn't match"); LOG_ERR("CCC handle doesn't match");
return -EINVAL; return -EINVAL;
} }
@ -1706,7 +1706,7 @@ static void config_subscription(u8_t *data, u16_t len, u16_t op)
} }
} }
SYS_LOG_DBG("Config subscription (op %u) status %u", op, status); LOG_DBG("Config subscription (op %u) status %u", op, status);
bt_conn_unref(conn); bt_conn_unref(conn);
tester_rsp(BTP_SERVICE_ID_GATT, op, CONTROLLER_INDEX, status); tester_rsp(BTP_SERVICE_ID_GATT, op, CONTROLLER_INDEX, status);
@ -1765,12 +1765,12 @@ static void get_attrs(u8_t *data, u16_t len)
goto fail; goto fail;
} }
SYS_LOG_DBG("start 0x%04x end 0x%04x, uuid %s", start_handle, LOG_DBG("start 0x%04x end 0x%04x, uuid %s", start_handle,
end_handle, bt_uuid_str(&uuid.uuid)); end_handle, bt_uuid_str(&uuid.uuid));
foreach.uuid = &uuid.uuid; foreach.uuid = &uuid.uuid;
} else { } else {
SYS_LOG_DBG("start 0x%04x end 0x%04x", start_handle, end_handle); LOG_DBG("start 0x%04x end 0x%04x", start_handle, end_handle);
foreach.uuid = NULL; foreach.uuid = NULL;
} }

View file

@ -213,7 +213,7 @@ static void send_data(u8_t *data, u16_t len)
net_buf_add_mem(buf, cmd->data, data_len); net_buf_add_mem(buf, cmd->data, data_len);
ret = bt_l2cap_chan_send(&chan->le.chan, buf); ret = bt_l2cap_chan_send(&chan->le.chan, buf);
if (ret < 0) { if (ret < 0) {
SYS_LOG_ERR("Unable to send data: %d", -ret); LOG_ERR("Unable to send data: %d", -ret);
net_buf_unref(buf); net_buf_unref(buf);
goto fail; goto fail;
} }

View file

@ -130,7 +130,7 @@ static void get_faults(u8_t *faults, u8_t faults_size, u8_t *dst, u8_t *count)
static int fault_get_cur(struct bt_mesh_model *model, u8_t *test_id, static int fault_get_cur(struct bt_mesh_model *model, u8_t *test_id,
u16_t *company_id, u8_t *faults, u8_t *fault_count) u16_t *company_id, u8_t *faults, u8_t *fault_count)
{ {
SYS_LOG_DBG(""); LOG_DBG("");
*test_id = HEALTH_TEST_ID; *test_id = HEALTH_TEST_ID;
*company_id = CID_LOCAL; *company_id = CID_LOCAL;
@ -143,7 +143,7 @@ static int fault_get_cur(struct bt_mesh_model *model, u8_t *test_id,
static int fault_get_reg(struct bt_mesh_model *model, u16_t company_id, static int fault_get_reg(struct bt_mesh_model *model, u16_t company_id,
u8_t *test_id, u8_t *faults, u8_t *fault_count) u8_t *test_id, u8_t *faults, u8_t *fault_count)
{ {
SYS_LOG_DBG("company_id 0x%04x", company_id); LOG_DBG("company_id 0x%04x", company_id);
if (company_id != CID_LOCAL) { if (company_id != CID_LOCAL) {
return -EINVAL; return -EINVAL;
@ -158,7 +158,7 @@ static int fault_get_reg(struct bt_mesh_model *model, u16_t company_id,
static int fault_clear(struct bt_mesh_model *model, uint16_t company_id) static int fault_clear(struct bt_mesh_model *model, uint16_t company_id)
{ {
SYS_LOG_DBG("company_id 0x%04x", company_id); LOG_DBG("company_id 0x%04x", company_id);
if (company_id != CID_LOCAL) { if (company_id != CID_LOCAL) {
return -EINVAL; return -EINVAL;
@ -172,7 +172,7 @@ static int fault_clear(struct bt_mesh_model *model, uint16_t company_id)
static int fault_test(struct bt_mesh_model *model, uint8_t test_id, static int fault_test(struct bt_mesh_model *model, uint8_t test_id,
uint16_t company_id) uint16_t company_id)
{ {
SYS_LOG_DBG("test_id 0x%02x company_id 0x%04x", test_id, company_id); LOG_DBG("test_id 0x%02x company_id 0x%04x", test_id, company_id);
if (company_id != CID_LOCAL || test_id != HEALTH_TEST_ID) { if (company_id != CID_LOCAL || test_id != HEALTH_TEST_ID) {
return -EINVAL; return -EINVAL;
@ -202,16 +202,16 @@ void show_faults(u8_t test_id, u16_t cid, u8_t *faults, size_t fault_count)
size_t i; size_t i;
if (!fault_count) { if (!fault_count) {
SYS_LOG_DBG("Health Test ID 0x%02x Company ID 0x%04x: " LOG_DBG("Health Test ID 0x%02x Company ID 0x%04x: no faults",
"no faults", test_id, cid); test_id, cid);
return; return;
} }
SYS_LOG_DBG("Health Test ID 0x%02x Company ID 0x%04x Fault Count %zu: ", LOG_DBG("Health Test ID 0x%02x Company ID 0x%04x Fault Count %zu: ",
test_id, cid, fault_count); test_id, cid, fault_count);
for (i = 0; i < fault_count; i++) { for (i = 0; i < fault_count; i++) {
SYS_LOG_DBG("0x%02x", faults[i]); LOG_DBG("0x%02x", faults[i]);
} }
} }
@ -219,7 +219,7 @@ static void health_current_status(struct bt_mesh_health_cli *cli, u16_t addr,
u8_t test_id, u16_t cid, u8_t *faults, u8_t test_id, u16_t cid, u8_t *faults,
size_t fault_count) size_t fault_count)
{ {
SYS_LOG_DBG("Health Current Status from 0x%04x", addr); LOG_DBG("Health Current Status from 0x%04x", addr);
show_faults(test_id, cid, faults, fault_count); show_faults(test_id, cid, faults, fault_count);
} }
@ -247,7 +247,7 @@ static void link_open(bt_mesh_prov_bearer_t bearer)
{ {
struct mesh_prov_link_open_ev ev; struct mesh_prov_link_open_ev ev;
SYS_LOG_DBG("bearer 0x%02x", bearer); LOG_DBG("bearer 0x%02x", bearer);
switch (bearer) { switch (bearer) {
case BT_MESH_PROV_ADV: case BT_MESH_PROV_ADV:
@ -257,7 +257,7 @@ static void link_open(bt_mesh_prov_bearer_t bearer)
ev.bearer = MESH_PROV_BEARER_PB_GATT; ev.bearer = MESH_PROV_BEARER_PB_GATT;
break; break;
default: default:
SYS_LOG_ERR("Invalid bearer"); LOG_ERR("Invalid bearer");
return; return;
} }
@ -270,7 +270,7 @@ static void link_close(bt_mesh_prov_bearer_t bearer)
{ {
struct mesh_prov_link_closed_ev ev; struct mesh_prov_link_closed_ev ev;
SYS_LOG_DBG("bearer 0x%02x", bearer); LOG_DBG("bearer 0x%02x", bearer);
switch (bearer) { switch (bearer) {
case BT_MESH_PROV_ADV: case BT_MESH_PROV_ADV:
@ -280,7 +280,7 @@ static void link_close(bt_mesh_prov_bearer_t bearer)
ev.bearer = MESH_PROV_BEARER_PB_GATT; ev.bearer = MESH_PROV_BEARER_PB_GATT;
break; break;
default: default:
SYS_LOG_ERR("Invalid bearer"); LOG_ERR("Invalid bearer");
return; return;
} }
@ -293,7 +293,7 @@ static int output_number(bt_mesh_output_action_t action, u32_t number)
{ {
struct mesh_out_number_action_ev ev; struct mesh_out_number_action_ev ev;
SYS_LOG_DBG("action 0x%04x number 0x%08x", action, number); LOG_DBG("action 0x%04x number 0x%08x", action, number);
ev.action = sys_cpu_to_le16(action); ev.action = sys_cpu_to_le16(action);
ev.number = sys_cpu_to_le32(number); ev.number = sys_cpu_to_le32(number);
@ -309,7 +309,7 @@ static int output_string(const char *str)
struct mesh_out_string_action_ev *ev; struct mesh_out_string_action_ev *ev;
struct net_buf_simple *buf = NET_BUF_SIMPLE(BTP_DATA_MAX_SIZE); struct net_buf_simple *buf = NET_BUF_SIMPLE(BTP_DATA_MAX_SIZE);
SYS_LOG_DBG("str %s", str); LOG_DBG("str %s", str);
net_buf_simple_init(buf, 0); net_buf_simple_init(buf, 0);
@ -328,7 +328,7 @@ static int input(bt_mesh_input_action_t action, u8_t size)
{ {
struct mesh_in_action_ev ev; struct mesh_in_action_ev ev;
SYS_LOG_DBG("action 0x%04x number 0x%02x", action, size); LOG_DBG("action 0x%04x number 0x%02x", action, size);
input_size = size; input_size = size;
@ -343,7 +343,7 @@ static int input(bt_mesh_input_action_t action, u8_t size)
static void prov_complete(u16_t net_idx, u16_t addr) static void prov_complete(u16_t net_idx, u16_t addr)
{ {
SYS_LOG_DBG("net_idx 0x%04x addr 0x%04x", net_idx, addr); LOG_DBG("net_idx 0x%04x addr 0x%04x", net_idx, addr);
net.net_idx = net_idx, net.net_idx = net_idx,
net.local = addr; net.local = addr;
@ -355,7 +355,7 @@ static void prov_complete(u16_t net_idx, u16_t addr)
static void prov_reset(void) static void prov_reset(void)
{ {
SYS_LOG_DBG(""); LOG_DBG("");
bt_mesh_prov_enable(BT_MESH_PROV_ADV | BT_MESH_PROV_GATT); bt_mesh_prov_enable(BT_MESH_PROV_ADV | BT_MESH_PROV_GATT);
} }
@ -383,7 +383,7 @@ static void config_prov(u8_t *data, u16_t len)
{ {
const struct mesh_config_provisioning_cmd *cmd = (void *) data; const struct mesh_config_provisioning_cmd *cmd = (void *) data;
SYS_LOG_DBG(""); LOG_DBG("");
memcpy(dev_uuid, cmd->uuid, sizeof(dev_uuid)); memcpy(dev_uuid, cmd->uuid, sizeof(dev_uuid));
memcpy(static_auth, cmd->static_auth, sizeof(static_auth)); memcpy(static_auth, cmd->static_auth, sizeof(static_auth));
@ -401,7 +401,7 @@ static void provision_node(u8_t *data, u16_t len)
{ {
const struct mesh_provision_node_cmd *cmd = (void *) data; const struct mesh_provision_node_cmd *cmd = (void *) data;
SYS_LOG_DBG(""); LOG_DBG("");
memcpy(dev_key, cmd->dev_key, sizeof(dev_key)); memcpy(dev_key, cmd->dev_key, sizeof(dev_key));
memcpy(net_key, cmd->net_key, sizeof(net_key)); memcpy(net_key, cmd->net_key, sizeof(net_key));
@ -420,7 +420,7 @@ static void init(u8_t *data, u16_t len)
u8_t status = BTP_STATUS_SUCCESS; u8_t status = BTP_STATUS_SUCCESS;
int err; int err;
SYS_LOG_DBG(""); LOG_DBG("");
err = bt_mesh_init(&prov, &comp); err = bt_mesh_init(&prov, &comp);
if (err) { if (err) {
@ -452,7 +452,7 @@ rsp:
static void reset(u8_t *data, u16_t len) static void reset(u8_t *data, u16_t len)
{ {
SYS_LOG_DBG(""); LOG_DBG("");
bt_mesh_reset(); bt_mesh_reset();
@ -469,7 +469,7 @@ static void input_number(u8_t *data, u16_t len)
number = sys_le32_to_cpu(cmd->number); number = sys_le32_to_cpu(cmd->number);
SYS_LOG_DBG("number 0x%04x", number); LOG_DBG("number 0x%04x", number);
err = bt_mesh_input_number(number); err = bt_mesh_input_number(number);
if (err) { if (err) {
@ -487,14 +487,14 @@ static void input_string(u8_t *data, u16_t len)
u8_t str_auth[16]; u8_t str_auth[16];
int err; int err;
SYS_LOG_DBG(""); LOG_DBG("");
if (cmd->string_len > sizeof(str_auth)) { if (cmd->string_len > sizeof(str_auth)) {
SYS_LOG_ERR("Too long input (%u chars required)", input_size); LOG_ERR("Too long input (%u chars required)", input_size);
status = BTP_STATUS_FAILED; status = BTP_STATUS_FAILED;
goto rsp; goto rsp;
} else if (cmd->string_len < input_size) { } else if (cmd->string_len < input_size) {
SYS_LOG_ERR("Too short input (%u chars required)", input_size); LOG_ERR("Too short input (%u chars required)", input_size);
status = BTP_STATUS_FAILED; status = BTP_STATUS_FAILED;
goto rsp; goto rsp;
} }
@ -515,7 +515,7 @@ static void ivu_test_mode(u8_t *data, u16_t len)
{ {
const struct mesh_ivu_test_mode_cmd *cmd = (void *) data; const struct mesh_ivu_test_mode_cmd *cmd = (void *) data;
SYS_LOG_DBG("enable 0x%02x", cmd->enable); LOG_DBG("enable 0x%02x", cmd->enable);
bt_mesh_iv_update_test(cmd->enable ? true : false); bt_mesh_iv_update_test(cmd->enable ? true : false);
@ -527,11 +527,11 @@ static void ivu_toggle_state(u8_t *data, u16_t len)
{ {
bool result; bool result;
SYS_LOG_DBG(""); LOG_DBG("");
result = bt_mesh_iv_update(); result = bt_mesh_iv_update();
if (!result) { if (!result) {
SYS_LOG_ERR("Failed to toggle the IV Update state"); LOG_ERR("Failed to toggle the IV Update state");
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_IVU_TOGGLE_STATE, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_IVU_TOGGLE_STATE, CONTROLLER_INDEX,
@ -544,12 +544,12 @@ static void lpn(u8_t *data, u16_t len)
bool enable; bool enable;
int err; int err;
SYS_LOG_DBG("enable 0x%02x", cmd->enable); LOG_DBG("enable 0x%02x", cmd->enable);
enable = cmd->enable ? true : false; enable = cmd->enable ? true : false;
err = bt_mesh_lpn_set(enable); err = bt_mesh_lpn_set(enable);
if (err) { if (err) {
SYS_LOG_ERR("Failed to toggle LPN (err %d)", err); LOG_ERR("Failed to toggle LPN (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN, CONTROLLER_INDEX,
@ -560,11 +560,11 @@ static void lpn_poll(u8_t *data, u16_t len)
{ {
int err; int err;
SYS_LOG_DBG(""); LOG_DBG("");
err = bt_mesh_lpn_poll(); err = bt_mesh_lpn_poll();
if (err) { if (err) {
SYS_LOG_ERR("Failed to send poll msg (err %d)", err); LOG_ERR("Failed to send poll msg (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_POLL, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_POLL, CONTROLLER_INDEX,
@ -583,14 +583,14 @@ static void net_send(u8_t *data, u16_t len)
}; };
int err; int err;
SYS_LOG_DBG("ttl 0x%02x dst 0x%04x payload_len %d", ctx.send_ttl, LOG_DBG("ttl 0x%02x dst 0x%04x payload_len %d", ctx.send_ttl,
ctx.addr, cmd->payload_len); ctx.addr, cmd->payload_len);
net_buf_simple_add_mem(&msg, cmd->payload, cmd->payload_len); net_buf_simple_add_mem(&msg, cmd->payload, cmd->payload_len);
err = bt_mesh_model_send(&vnd_models[0], &ctx, &msg, NULL, NULL); err = bt_mesh_model_send(&vnd_models[0], &ctx, &msg, NULL, NULL);
if (err) { if (err) {
SYS_LOG_ERR("Failed to send (err %d)", err); LOG_ERR("Failed to send (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_NET_SEND, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_NET_SEND, CONTROLLER_INDEX,
@ -625,7 +625,7 @@ static void health_generate_faults(u8_t *data, u16_t len)
static void health_clear_faults(u8_t *data, u16_t len) static void health_clear_faults(u8_t *data, u16_t len)
{ {
SYS_LOG_DBG(""); LOG_DBG("");
(void)memset(cur_faults, 0, sizeof(cur_faults)); (void)memset(cur_faults, 0, sizeof(cur_faults));
(void)memset(reg_faults, 0, sizeof(reg_faults)); (void)memset(reg_faults, 0, sizeof(reg_faults));
@ -661,20 +661,20 @@ static void model_send(u8_t *data, u16_t len)
} }
if (!model) { if (!model) {
SYS_LOG_ERR("Model not found"); LOG_ERR("Model not found");
err = -EINVAL; err = -EINVAL;
goto fail; goto fail;
} }
SYS_LOG_DBG("src 0x%04x dst 0x%04x model %p payload_len %d", src, LOG_DBG("src 0x%04x dst 0x%04x model %p payload_len %d", src,
ctx.addr, model, cmd->payload_len); ctx.addr, model, cmd->payload_len);
net_buf_simple_add_mem(&msg, cmd->payload, cmd->payload_len); net_buf_simple_add_mem(&msg, cmd->payload, cmd->payload_len);
err = bt_mesh_model_send(model, &ctx, &msg, NULL, NULL); err = bt_mesh_model_send(model, &ctx, &msg, NULL, NULL);
if (err) { if (err) {
SYS_LOG_ERR("Failed to send (err %d)", err); LOG_ERR("Failed to send (err %d)", err);
} }
fail: fail:
@ -689,11 +689,11 @@ static void lpn_subscribe(u8_t *data, u16_t len)
u16_t address = sys_le16_to_cpu(cmd->address); u16_t address = sys_le16_to_cpu(cmd->address);
int err; int err;
SYS_LOG_DBG("address 0x%04x", address); LOG_DBG("address 0x%04x", address);
err = bt_test_mesh_lpn_group_add(address); err = bt_test_mesh_lpn_group_add(address);
if (err) { if (err) {
SYS_LOG_ERR("Failed to subscribe (err %d)", err); LOG_ERR("Failed to subscribe (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_SUBSCRIBE, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_SUBSCRIBE, CONTROLLER_INDEX,
@ -706,11 +706,11 @@ static void lpn_unsubscribe(u8_t *data, u16_t len)
u16_t address = sys_le16_to_cpu(cmd->address); u16_t address = sys_le16_to_cpu(cmd->address);
int err; int err;
SYS_LOG_DBG("address 0x%04x", address); LOG_DBG("address 0x%04x", address);
err = bt_test_mesh_lpn_group_remove(&address, 1); err = bt_test_mesh_lpn_group_remove(&address, 1);
if (err) { if (err) {
SYS_LOG_ERR("Failed to unsubscribe (err %d)", err); LOG_ERR("Failed to unsubscribe (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_UNSUBSCRIBE, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_LPN_UNSUBSCRIBE, CONTROLLER_INDEX,
@ -721,11 +721,11 @@ static void rpl_clear(u8_t *data, u16_t len)
{ {
int err; int err;
SYS_LOG_DBG(""); LOG_DBG("");
err = bt_test_mesh_rpl_clear(); err = bt_test_mesh_rpl_clear();
if (err) { if (err) {
SYS_LOG_ERR("Failed to clear RPL (err %d)", err); LOG_ERR("Failed to clear RPL (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_RPL_CLEAR, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_RPL_CLEAR, CONTROLLER_INDEX,
@ -737,11 +737,11 @@ static void proxy_identity_enable(u8_t *data, u16_t len)
{ {
int err; int err;
SYS_LOG_DBG(""); LOG_DBG("");
err = bt_mesh_proxy_identity_enable(); err = bt_mesh_proxy_identity_enable();
if (err) { if (err) {
SYS_LOG_ERR("Failed to enable proxy identity (err %d)", err); LOG_ERR("Failed to enable proxy identity (err %d)", err);
} }
tester_rsp(BTP_SERVICE_ID_MESH, MESH_PROXY_IDENTITY, CONTROLLER_INDEX, tester_rsp(BTP_SERVICE_ID_MESH, MESH_PROXY_IDENTITY, CONTROLLER_INDEX,
@ -823,12 +823,11 @@ void net_recv_ev(u8_t ttl, u8_t ctl, u16_t src, u16_t dst, const void *payload,
NET_BUF_SIMPLE_DEFINE(buf, UINT8_MAX); NET_BUF_SIMPLE_DEFINE(buf, UINT8_MAX);
struct mesh_net_recv_ev *ev; struct mesh_net_recv_ev *ev;
SYS_LOG_DBG("ttl 0x%02x ctl 0x%02x src 0x%04x dst 0x%04x " LOG_DBG("ttl 0x%02x ctl 0x%02x src 0x%04x dst 0x%04x payload_len %zu",
"payload_len %d", ttl, ctl, src, dst, payload_len); ttl, ctl, src, dst, payload_len);
if (payload_len > net_buf_simple_tailroom(&buf)) { if (payload_len > net_buf_simple_tailroom(&buf)) {
SYS_LOG_ERR("Payload size exceeds buffer size"); LOG_ERR("Payload size exceeds buffer size");
return; return;
} }
@ -849,8 +848,8 @@ static void model_bound_cb(u16_t addr, struct bt_mesh_model *model,
{ {
int i; int i;
SYS_LOG_DBG("remote addr 0x%04x key_idx 0x%04x model %p", LOG_DBG("remote addr 0x%04x key_idx 0x%04x model %p",
addr, key_idx, model); addr, key_idx, model);
for (i = 0; i < ARRAY_SIZE(model_bound); i++) { for (i = 0; i < ARRAY_SIZE(model_bound); i++) {
if (!model_bound[i].model) { if (!model_bound[i].model) {
@ -862,7 +861,7 @@ static void model_bound_cb(u16_t addr, struct bt_mesh_model *model,
} }
} }
SYS_LOG_ERR("model_bound is full"); LOG_ERR("model_bound is full");
} }
static void model_unbound_cb(u16_t addr, struct bt_mesh_model *model, static void model_unbound_cb(u16_t addr, struct bt_mesh_model *model,
@ -870,8 +869,8 @@ static void model_unbound_cb(u16_t addr, struct bt_mesh_model *model,
{ {
int i; int i;
SYS_LOG_DBG("remote addr 0x%04x key_idx 0x%04x model %p", LOG_DBG("remote addr 0x%04x key_idx 0x%04x model %p",
addr, key_idx, model); addr, key_idx, model);
for (i = 0; i < ARRAY_SIZE(model_bound); i++) { for (i = 0; i < ARRAY_SIZE(model_bound); i++) {
if (model_bound[i].model == model) { if (model_bound[i].model == model) {
@ -883,7 +882,7 @@ static void model_unbound_cb(u16_t addr, struct bt_mesh_model *model,
} }
} }
SYS_LOG_INF("model not found"); LOG_INF("model not found");
} }
static void invalid_bearer_cb(u8_t opcode) static void invalid_bearer_cb(u8_t opcode)
@ -892,7 +891,7 @@ static void invalid_bearer_cb(u8_t opcode)
.opcode = opcode, .opcode = opcode,
}; };
SYS_LOG_DBG("opcode 0x%02x", opcode); LOG_DBG("opcode 0x%02x", opcode);
tester_send(BTP_SERVICE_ID_MESH, MESH_EV_INVALID_BEARER, tester_send(BTP_SERVICE_ID_MESH, MESH_EV_INVALID_BEARER,
CONTROLLER_INDEX, (u8_t *) &ev, sizeof(ev)); CONTROLLER_INDEX, (u8_t *) &ev, sizeof(ev));