From 30fd193df0a1ea96a474395e3e5036fca9bbfe3b Mon Sep 17 00:00:00 2001 From: Liu Linyan Date: Thu, 23 Jul 2026 17:18:46 +0800 Subject: [PATCH] feat(ble_audio): Add specific libs for BLE Audio log compression --- components/bt/common/Kconfig.in | 10 + components/bt/esp_ble_audio/CMakeLists.txt | 18 +- components/bt/esp_ble_audio/Kconfig.in | 2 + .../host/adapter/nimble/server.c | 4 +- .../bt/esp_ble_audio/host/common/init.c | 2 +- .../bt/esp_ble_audio/host/services/ots/ots.c | 74 +-- .../host/services/ots/ots_client.c | 466 ++++++++---------- .../host/services/ots/ots_dir_list.c | 12 +- .../host/services/ots/ots_l2cap.c | 46 +- .../host/services/ots/ots_oacp.c | 105 ++-- .../host/services/ots/ots_olcp.c | 32 +- components/bt/esp_ble_audio/lib/lib | 2 +- components/bt/esp_ble_iso/Kconfig.in | 2 + .../host/adapter/bluedroid/gatt/gatt.c | 6 +- components/bt/esp_ble_iso/host/common/gatt.c | 2 +- components/bt/esp_ble_iso/host/utils/timer.c | 66 +-- .../bap/broadcast_sink/sdkconfig.defaults | 12 + .../bap/broadcast_source/sdkconfig.defaults | 12 + .../bap/unicast_client/sdkconfig.defaults | 12 + .../bap/unicast_server/sdkconfig.defaults | 12 + .../cap/acceptor/sdkconfig.defaults | 12 + .../cap/initiator/sdkconfig.defaults | 12 + .../esp_ble_audio/tmap/bmr/sdkconfig.defaults | 12 + .../esp_ble_audio/tmap/bms/sdkconfig.defaults | 12 + .../tmap/central/sdkconfig.defaults | 12 + .../tmap/peripheral/sdkconfig.defaults | 12 + .../big_broadcaster/sdkconfig.defaults | 12 + .../big_receiver/sdkconfig.defaults | 12 + .../cis_central/sdkconfig.defaults | 12 + .../cis_peripheral/sdkconfig.defaults | 12 + 30 files changed, 567 insertions(+), 450 deletions(-) diff --git a/components/bt/common/Kconfig.in b/components/bt/common/Kconfig.in index 98c828220f7..e46e796c8e3 100644 --- a/components/bt/common/Kconfig.in +++ b/components/bt/common/Kconfig.in @@ -230,6 +230,16 @@ menu "BT Logs" Enable mesh log encoding via the async transport. The per-level compression options are configured in: Settings of BLE Log Compression → BLE Mesh log compression. + + config BT_LOG_CRITICAL_ONLY_ISO + bool "ISO: bandwidth-optimized logging" + depends on BT_ISO + select BLE_ISO_COMPRESSED_LOG_ENABLE + default y + help + Enable BLE Audio/ISO log encoding via the async transport. + The per-level compression options are configured in: + Settings of BLE Log Compression → BLE Audio/ISO log compression. endif # BT_LOG_CRITICAL_ONLY source "$IDF_PATH/components/bt/common/ble_log/Kconfig.in" diff --git a/components/bt/esp_ble_audio/CMakeLists.txt b/components/bt/esp_ble_audio/CMakeLists.txt index 8cdaff9965a..8ed17039ce2 100644 --- a/components/bt/esp_ble_audio/CMakeLists.txt +++ b/components/bt/esp_ble_audio/CMakeLists.txt @@ -4,7 +4,23 @@ function(register_ble_audio_libs) endif() if(CONFIG_SOC_BLE_AUDIO_SUPPORTED) - add_prebuilt_library(ble_audio "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/lib/lib/${idf_target}/libble_audio.a") + # Compressed-log builds link the log_compressed/ prebuilt lib (its logs + # call bt_le_audio_lib_compressed_out(), which is only functional under + # the same config); otherwise link the normal lib. + set(ble_audio_lib_dir "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/lib/lib/${idf_target}") + if(CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE) + set(ble_audio_lib "${ble_audio_lib_dir}/log_compressed/libble_audio.a") + if(NOT EXISTS "${ble_audio_lib}") + message(FATAL_ERROR + "BLE_ISO_COMPRESSED_LOG_ENABLE is set but the compressed lib is missing:\n" + " ${ble_audio_lib}\n" + "Build and copy it (in lib/ble_audio_development/tools/lib/):\n" + " ./compile.sh ${idf_target} -c && ./copy_lib.sh ${idf_target} -c") + endif() + else() + set(ble_audio_lib "${ble_audio_lib_dir}/libble_audio.a") + endif() + add_prebuilt_library(ble_audio "${ble_audio_lib}") target_link_libraries(${COMPONENT_LIB} PRIVATE ble_audio) endif() endfunction() diff --git a/components/bt/esp_ble_audio/Kconfig.in b/components/bt/esp_ble_audio/Kconfig.in index 28ce2fdd637..7a81131457a 100644 --- a/components/bt/esp_ble_audio/Kconfig.in +++ b/components/bt/esp_ble_audio/Kconfig.in @@ -151,6 +151,8 @@ menu "BLE Audio Lib Debug Log Level" choice BT_AUDIO_LOG_LEVEL prompt "BLE_AUDIO_LIB_LOG_LEVEL" + default BT_AUDIO_LOG_LEVEL_INFO if BT_LOG_CRITICAL_ONLY_ISO + default BT_AUDIO_LOG_LEVEL_DEBUG if BLE_COMPRESSED_LOG_ENABLE default BT_AUDIO_LOG_LEVEL_WARNING depends on !BT_AUDIO_NO_LOG help diff --git a/components/bt/esp_ble_audio/host/adapter/nimble/server.c b/components/bt/esp_ble_audio/host/adapter/nimble/server.c index 938a05bc241..2e589cac148 100644 --- a/components/bt/esp_ble_audio/host/adapter/nimble/server.c +++ b/components/bt/esp_ble_audio/host/adapter/nimble/server.c @@ -88,7 +88,7 @@ static int gatts_access_cb(uint16_t conn_handle, uint16_t attr_handle, rc = attr->read(conn, attr, (void *)&cb, UINT16_MAX, 0); if (rc < 0) { - LOG_DBG("[N]RdGattErr[%u][%d]", attr_handle, rc); + LOG_WRN("[N]RdGattErr[%u][%d]", attr_handle, rc); return BT_GATT_ERR(rc); } @@ -148,7 +148,7 @@ static int gatts_access_cb(uint16_t conn_handle, uint16_t attr_handle, data = NULL; } if (rc < 0) { - LOG_DBG("[N]WrGattErr[%u][%d]", attr_handle, rc); + LOG_WRN("[N]WrGattErr[%u][%d]", attr_handle, rc); return BT_GATT_ERR(rc); } diff --git a/components/bt/esp_ble_audio/host/common/init.c b/components/bt/esp_ble_audio/host/common/init.c index 6c4f241f174..485f3b42082 100644 --- a/components/bt/esp_ble_audio/host/common/init.c +++ b/components/bt/esp_ble_audio/host/common/init.c @@ -180,7 +180,7 @@ static const uint16_t ext_structs[] = { sizeof(struct bt_bond_info), }; -#define LEA_VERSION (0x20260722) +#define LEA_VERSION (0x20260724) struct lib_ext_cfgs { /* BLE */ diff --git a/components/bt/esp_ble_audio/host/services/ots/ots.c b/components/bt/esp_ble_audio/host/services/ots/ots.c index 292bc9e6be8..05563c2de88 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots.c @@ -121,7 +121,7 @@ static ssize_t ots_feature_read(struct bt_conn *conn, { struct bt_ots *ots = (struct bt_ots *) attr->user_data; - LOG_DBG("OTS Feature GATT Read Operation"); + LOG_DBG("OtsFeatRd"); return bt_gatt_attr_read(conn, attr, buf, len, offset, &ots->features, sizeof(ots->features)); @@ -133,15 +133,15 @@ static ssize_t ots_obj_name_read(struct bt_conn *conn, { struct bt_ots *ots = (struct bt_ots *) attr->user_data; - LOG_DBG("OTS Object Name GATT Read Operation"); + LOG_DBG("OtsObjNameRd"); if (!ots->cur_obj) { - LOG_DBG("No Current Object selected in OTS!"); + LOG_WRN("OtsCurObjNotSel"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } if (!ots->cur_obj->metadata.name) { - LOG_DBG("Current Object has no name!"); + LOG_WRN("OtsCurObjNoName"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } @@ -161,26 +161,26 @@ ssize_t ots_obj_name_write(struct bt_conn *conn, int rc = 0; char name[CONFIG_BT_OTS_OBJ_MAX_NAME_LEN + 1]; - LOG_DBG("OTS Object Name GATT Write Operation"); + LOG_DBG("OtsObjNameWr"); if (!ots->cur_obj) { - LOG_DBG("No Current Object selected in OTS!"); + LOG_WRN("OtsCurObjNotSel"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } if (IS_ENABLED(CONFIG_BT_OTS_DIR_LIST_OBJ) && ots->cur_obj->id == OTS_OBJ_ID_DIR_LIST) { - LOG_DBG("Rejecting name write for the directory list object."); + LOG_WRN("OtsDirListNameWrRej"); return BT_GATT_ERR(BT_GATT_OTS_WRITE_REQUEST_REJECTED); } if (offset > 0) { - LOG_DBG("Rejecting a long write, offset must be 0!"); + LOG_WRN("OtsNameWrInvOft"); return BT_GATT_ERR(BT_GATT_OTS_WRITE_REQUEST_REJECTED); } if (len == 0 || len > CONFIG_BT_OTS_OBJ_MAX_NAME_LEN) { - LOG_DBG("Invalid object name length!"); + LOG_WRN("OtsInvObjNameLen"); return BT_GATT_ERR(BT_GATT_OTS_WRITE_REQUEST_REJECTED); } @@ -191,7 +191,7 @@ ssize_t ots_obj_name_write(struct bt_conn *conn, rc = bt_gatt_ots_obj_manager_first_obj_get(ots->obj_manager, &obj); while (rc == 0) { if (obj != ots->cur_obj && strcmp(name, obj->metadata.name) == 0) { - LOG_DBG("Object name is duplicated!"); + LOG_WRN("OtsObjNameDup"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NAME_ALREADY_EXISTS); } rc = bt_gatt_ots_obj_manager_next_obj_get(ots->obj_manager, obj, &obj); @@ -220,10 +220,10 @@ static ssize_t ots_obj_type_read(struct bt_conn *conn, struct bt_ots *ots = (struct bt_ots *) attr->user_data; struct bt_ots_obj_metadata *obj_meta; - LOG_DBG("OTS Object Type GATT Read Operation"); + LOG_DBG("OtsObjTypeRd"); if (!ots->cur_obj) { - LOG_DBG("No Current Object selected in OTS!"); + LOG_WRN("OtsCurObjNotSel"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } @@ -248,10 +248,10 @@ static ssize_t ots_obj_size_read(struct bt_conn *conn, { struct bt_ots *ots = (struct bt_ots *) attr->user_data; - LOG_DBG("OTS Object Size GATT Read Operation"); + LOG_DBG("OtsObjSizeRd"); if (!ots->cur_obj) { - LOG_DBG("No Current Object selected in OTS!"); + LOG_WRN("OtsCurObjNotSel"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } @@ -268,10 +268,10 @@ static ssize_t ots_obj_id_read(struct bt_conn *conn, uint8_t id[BT_OTS_OBJ_ID_SIZE]; char id_str[BT_OTS_OBJ_ID_STR_LEN]; - LOG_DBG("OTS Object ID GATT Read Operation"); + LOG_DBG("OtsObjIdRd"); if (!ots->cur_obj) { - LOG_DBG("No Current Object selected in OTS!"); + LOG_WRN("OtsCurObjNotSel"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } @@ -279,7 +279,7 @@ static ssize_t ots_obj_id_read(struct bt_conn *conn, bt_ots_obj_id_to_str(ots->cur_obj->id, id_str, sizeof(id_str)); - LOG_DBG("Current Object ID: %s", id_str); + LOG_DBG("OtsCurObjId[%s]", id_str); return bt_gatt_attr_read(conn, attr, buf, len, offset, id, sizeof(id)); } @@ -290,10 +290,10 @@ static ssize_t ots_obj_prop_read(struct bt_conn *conn, { struct bt_ots *ots = (struct bt_ots *) attr->user_data; - LOG_DBG("OTS Object Properties GATT Read Operation"); + LOG_DBG("OtsObjPropRd"); if (!ots->cur_obj) { - LOG_DBG("No Current Object selected in OTS!"); + LOG_WRN("OtsCurObjNotSel"); return BT_GATT_ERR(BT_GATT_OTS_OBJECT_NOT_SELECTED); } @@ -312,13 +312,13 @@ int bt_ots_obj_add_internal(struct bt_ots *ots, struct bt_conn *conn, if (IS_ENABLED(CONFIG_BT_OTS_DIR_LIST_OBJ) && ots->dir_list && !bt_ots_dir_list_is_idle(ots->dir_list)) { - LOG_DBG("Directory Listing Object is being read"); + LOG_DBG("OtsDirListBusy"); return -EBUSY; } err = bt_gatt_ots_obj_manager_obj_add(ots->obj_manager, &new_obj); if (err) { - LOG_ERR("No space available in the object manager"); + LOG_ERR("OtsObjMgrNoSpace"); return err; } @@ -334,7 +334,7 @@ int bt_ots_obj_add_internal(struct bt_ots *ots, struct bt_conn *conn, } if (!ots_obj_validate_prop_against_oacp(created_desc.props, ots->features.oacp)) { - LOG_ERR("Object properties (0x%04X) are not a subset of OACP (0x%04X)", + LOG_ERR("OtsObjPropNotSubsetOacp[%04x][%04x]", created_desc.props, ots->features.oacp); (void)bt_ots_obj_delete(ots, new_obj->id); @@ -342,21 +342,21 @@ int bt_ots_obj_add_internal(struct bt_ots *ots, struct bt_conn *conn, } if (created_desc.name == NULL) { - LOG_ERR("Object name must be set by application after object creation."); + LOG_ERR("OtsObjNameNotSet"); (void)bt_ots_obj_delete(ots, new_obj->id); return -ECANCELED; } if (created_desc.size.alloc < param->size) { - LOG_ERR("Object allocated size must >= requested size."); + LOG_ERR("OtsObjAllocSizeTooSmall"); (void)bt_ots_obj_delete(ots, new_obj->id); return -ECANCELED; } } else { /* obj_created callback is required to populate the descriptor */ - LOG_ERR("obj_created callback is not set"); + LOG_ERR("OtsObjCreatedCbNotSet"); (void)bt_gatt_ots_obj_manager_obj_delete(new_obj); return -EINVAL; @@ -386,7 +386,7 @@ int bt_ots_obj_add(struct bt_ots *ots, const struct bt_ots_obj_add_param *param) } if (obj->metadata.name == NULL) { - LOG_ERR("Object name is NULL"); + LOG_ERR("OtsObjNameNull"); (void)bt_ots_obj_delete(ots, obj->id); return -ECANCELED; @@ -394,14 +394,14 @@ int bt_ots_obj_add(struct bt_ots *ots, const struct bt_ots_obj_add_param *param) name_len = strlen(obj->metadata.name); if (name_len == 0 || name_len > CONFIG_BT_OTS_OBJ_MAX_NAME_LEN) { - LOG_ERR("Invalid name length %zu", name_len); + LOG_ERR("OtsInvNameLen[%zu]", name_len); (void)bt_ots_obj_delete(ots, obj->id); return -ECANCELED; } if (obj->metadata.size.cur > param->size) { - LOG_ERR("Object current size must be less than or equal to requested size."); + LOG_ERR("OtsObjCurSizeTooBig"); (void)bt_ots_obj_delete(ots, obj->id); return -ECANCELED; @@ -416,7 +416,7 @@ int bt_ots_obj_delete(struct bt_ots *ots, uint64_t id) struct bt_gatt_ots_object *obj; CHECKIF(!BT_OTS_VALID_OBJ_ID(id)) { - LOG_DBG("Invalid object ID 0x%016llx", id); + LOG_WRN("OtsInvObjId[%016llx]", id); return -EINVAL; } @@ -432,7 +432,7 @@ int bt_ots_obj_delete(struct bt_ots *ots, uint64_t id) if (IS_ENABLED(CONFIG_BT_OTS_DIR_LIST_OBJ) && ots->dir_list && !bt_ots_dir_list_is_idle(ots->dir_list)) { - LOG_DBG("Directory Listing Object is being read"); + LOG_DBG("OtsDirListBusy"); return -EBUSY; } @@ -514,14 +514,14 @@ int bt_ots_init(struct bt_ots *ots, "Object creation requires object write to be supported"); ots->features.oacp = ots_init->features.oacp; - LOG_DBG("OACP features: 0x%04X", ots->features.oacp); + LOG_DBG("OtsOacpFeat[%04x]", ots->features.oacp); /* Check OLCP supported features against Kconfig. */ if (ots_init->features.olcp & (~((uint32_t) OLCP_FEAT))) { return -ENOTSUP; } ots->features.olcp = ots_init->features.olcp; - LOG_DBG("OLCP features: 0x%04X", ots->features.olcp); + LOG_DBG("OtsOlcpFeat[%04x]", ots->features.olcp); /* Register L2CAP context. */ err = bt_gatt_ots_l2cap_register(&ots->l2cap); @@ -543,7 +543,7 @@ int bt_ots_init(struct bt_ots *ots, k_work_init(&ots->oacp_ind.work, oacp_indicate_work_handler); k_work_init(&ots->olcp_ind.work, olcp_indicate_work_handler); - LOG_DBG("Initialized OTS"); + LOG_DBG("OtsInit"); return 0; } @@ -629,14 +629,14 @@ static void ots_delete_empty_name_objects(struct bt_ots *ots, struct bt_conn *co if (strlen(obj->metadata.name) == 0) { bt_ots_obj_id_to_str(obj->id, id_str, sizeof(id_str)); - LOG_DBG("Deleting object with %s ID due to empty name", id_str); + LOG_DBG("OtsDelEmptyNameObj[%s]", id_str); if (ots->cb && ots->cb->obj_deleted) { ots->cb->obj_deleted(ots, conn, obj->id); } if (bt_gatt_ots_obj_manager_obj_delete(obj)) { - LOG_ERR("Failed to remove object with %s ID from object manager", + LOG_ERR("OtsObjMgrDelFail[%s]", id_str); } } @@ -652,7 +652,7 @@ static void ots_conn_disconnected(struct bt_conn *conn, uint8_t reason) index < instance_cnt; instance++, index++) { - LOG_DBG("Processing disconnect for OTS instance %u", index); + LOG_DBG("OtsInstDisconnect[%u]", index); if (instance->cur_obj != NULL) { __ASSERT(instance->cur_obj->state.type == BT_GATT_OTS_OBJECT_IDLE_STATE, @@ -690,7 +690,7 @@ static int bt_gatt_ots_instances_prepare(void) instance->obj_manager = bt_gatt_ots_obj_manager_assign(); if (!instance->obj_manager) { - LOG_ERR("OTS Object manager instance not available"); + LOG_ERR("OtsObjMgrInstUnavail"); return -ENOMEM; } diff --git a/components/bt/esp_ble_audio/host/services/ots/ots_client.c b/components/bt/esp_ble_audio/host/services/ots/ots_client.c index c563561ba2a..1a2d696cc5e 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots_client.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots_client.c @@ -137,7 +137,7 @@ static void tx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, struct bt_conn *conn) { /* Not doing any writes yet */ - LOG_ERR("Unexpected call, context: %p, conn: %p", l2cap_ctx, (void *)conn); + LOG_ERR("OtsCliUnexpCall"); } static void write_obj_tx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, @@ -147,16 +147,16 @@ static void write_obj_tx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, size_t written; if (cur_inst == NULL) { - LOG_ERR("OTS instance invalid"); + LOG_ERR("OtsCliInstInv"); return; } written = cur_inst->sent_size; - LOG_DBG("ctx: %p, conn: %p, written: %d", l2cap_ctx, (void *)conn, written); + LOG_DBG("OtsCliObjWritten[%zu]", written); err = bt_gatt_ots_l2cap_disconnect(l2cap_ctx); if (err < 0) { - LOG_WRN("Disconnecting L2CAP returned error %d", err); + LOG_WRN("OtsCliL2capDiscErr[%d]", err); } if ((cur_inst->otc_inst != NULL) && (cur_inst->otc_inst->cb != NULL)) { @@ -172,7 +172,7 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, struct bt_conn *conn, struct net_buf *buf) { if (cur_inst == NULL) { - LOG_ERR("OTS instance invalid"); + LOG_ERR("OtsCliInstInv"); return -EINVAL; } @@ -182,8 +182,7 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, &cur_inst->otc_inst->cur_object; int cb_ret; - LOG_DBG("Incoming L2CAP data, context: %p, conn: %p, len: %u, offset: %u", l2cap_ctx, - (void *)conn, buf->len, offset); + LOG_DBG("OtsCliL2capRecv[%u][%u]", buf->len, offset); cur_inst->rcvd_size += buf->len; @@ -192,8 +191,7 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, } if (cur_inst->rcvd_size > cur_object->size.cur) { - LOG_WRN("Received %u but expected maximum %u", cur_inst->rcvd_size, - cur_object->size.cur); + LOG_WRN("OtsCliRecvExceedMax[%u][%u]", cur_inst->rcvd_size, cur_object->size.cur); } if (cur_inst->otc_inst->cb != NULL && cur_inst->otc_inst->cb->obj_data_read != NULL) { @@ -201,7 +199,7 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, buf->len, buf->data, is_complete); } else { - LOG_ERR("obj_data_read callback not set"); + LOG_ERR("OtsCliObjDataRdCbNull"); return -EINVAL; } @@ -209,11 +207,10 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, const uint32_t rcv_size = cur_object->size.cur; int err; - LOG_DBG("Received the whole object (%u bytes). " - "Disconnecting L2CAP CoC", rcv_size); + LOG_DBG("OtsCliRecvWholeObj[%u]", rcv_size); err = bt_gatt_ots_l2cap_disconnect(l2cap_ctx); if (err < 0) { - LOG_WRN("Disconnecting L2CAP returned error %d", err); + LOG_WRN("OtsCliL2capDiscErr[%d]", err); } cur_inst = NULL; @@ -221,12 +218,11 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, const uint32_t rcv_size = cur_object->size.cur; int err; - LOG_DBG("Stopped receiving after%u bytes. " - "Disconnecting L2CAP CoC", rcv_size); + LOG_DBG("OtsCliRecvStopped[%u]", rcv_size); err = bt_gatt_ots_l2cap_disconnect(l2cap_ctx); if (err < 0) { - LOG_WRN("Disconnecting L2CAP returned error %d", err); + LOG_WRN("OtsCliL2capDiscErr[%d]", err); } cur_inst = NULL; @@ -238,7 +234,7 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx, static void chan_closed(struct bt_gatt_ots_l2cap *l2cap_ctx, struct bt_conn *conn) { - LOG_DBG("L2CAP closed, context: %p, conn: %p", l2cap_ctx, (void *)conn); + LOG_DBG("OtsCliL2capClosed"); if (cur_inst) { cur_inst = NULL; } @@ -249,14 +245,14 @@ static void print_oacp_response(enum bt_gatt_ots_oacp_proc_type req_opcode, enum bt_gatt_ots_oacp_res_code result_code) { if (req_opcode < ARRAY_SIZE(lit_request)) { - LOG_DBG("Request OP Code: %s", lit_request[req_opcode]); + LOG_DBG("OtsCliReqOpcode[%s]", lit_request[req_opcode]); } else { - LOG_DBG("Request OP Code: Unknown (0x%02X)", req_opcode); + LOG_DBG("OtsCliReqOpcodeUnk[%02x]", req_opcode); } if (result_code < ARRAY_SIZE(lit_result)) { - LOG_DBG("Result Code : %s", lit_result[result_code]); + LOG_DBG("OtsCliResultCode[%s]", lit_result[result_code]); } else { - LOG_DBG("Result Code : Unknown (0x%02X)", result_code); + LOG_DBG("OtsCliResultCodeUnk[%02x]", result_code); } } @@ -264,14 +260,14 @@ static void print_olcp_response(enum bt_gatt_ots_olcp_proc_type req_opcode, enum bt_gatt_ots_olcp_res_code result_code) { if (req_opcode < ARRAY_SIZE(lit_olcp_request)) { - LOG_DBG("Request OP Code: %s", lit_olcp_request[req_opcode]); + LOG_DBG("OtsCliReqOpcode[%s]", lit_olcp_request[req_opcode]); } else { - LOG_DBG("Request OP Code: Unknown (0x%02X)", req_opcode); + LOG_DBG("OtsCliReqOpcodeUnk[%02x]", req_opcode); } if (result_code < ARRAY_SIZE(lit_olcp_result)) { - LOG_DBG("Result Code : %s", lit_olcp_result[result_code]); + LOG_DBG("OtsCliResultCode[%s]", lit_olcp_result[result_code]); } else { - LOG_DBG("Result Code : Unknown (0x%02X)", result_code); + LOG_DBG("OtsCliResultCodeUnk[%02x]", result_code); } } @@ -296,7 +292,7 @@ static struct bt_otc_internal_instance_t *lookup_inst_by_handle(uint16_t handle) } } - LOG_DBG("Could not find OTS instance with handle 0x%04x", handle); + LOG_DBG("OtsCliLkupInstNotFound[%04x]", handle); return NULL; } @@ -312,7 +308,7 @@ static void on_object_selected(struct bt_conn *conn, otc_inst->cb->obj_selected(otc_inst, conn, res); } - LOG_DBG("Object selected"); + LOG_DBG("OtsCliObjSel"); } static void olcp_ind_handler(struct bt_conn *conn, @@ -323,7 +319,7 @@ static void olcp_ind_handler(struct bt_conn *conn, struct net_buf_simple net_buf; if (length < sizeof(op_code)) { - LOG_DBG("Invalid indication length: %u", length); + LOG_WRN("OtsCliInvIndLen[%u]", length); return; } @@ -331,12 +327,11 @@ static void olcp_ind_handler(struct bt_conn *conn, op_code = net_buf_simple_pull_u8(&net_buf); - LOG_DBG("OLCP indication"); + LOG_DBG("OtsCliOlcpInd"); if (op_code == BT_GATT_OTS_OLCP_PROC_RESP) { if (net_buf.len < (sizeof(uint8_t) + sizeof(uint8_t))) { - LOG_DBG("Invalid indication length for op_code %u: %u", op_code, - net_buf.len); + LOG_WRN("OtsCliInvIndLenForOpcode[%u][%u]", op_code, net_buf.len); return; } @@ -349,46 +344,46 @@ static void olcp_ind_handler(struct bt_conn *conn, switch (req_opcode) { case BT_GATT_OTS_OLCP_PROC_FIRST: - LOG_DBG("First"); + LOG_DBG("OtsCliFirst"); on_object_selected(conn, result_code, otc_inst); break; case BT_GATT_OTS_OLCP_PROC_LAST: - LOG_DBG("Last"); + LOG_DBG("OtsCliLast"); on_object_selected(conn, result_code, otc_inst); break; case BT_GATT_OTS_OLCP_PROC_PREV: - LOG_DBG("Previous"); + LOG_DBG("OtsCliPrev"); on_object_selected(conn, result_code, otc_inst); break; case BT_GATT_OTS_OLCP_PROC_NEXT: - LOG_DBG("Next"); + LOG_DBG("OtsCliNext"); on_object_selected(conn, result_code, otc_inst); break; case BT_GATT_OTS_OLCP_PROC_GOTO: - LOG_DBG("Goto"); + LOG_DBG("OtsCliGoto"); on_object_selected(conn, result_code, otc_inst); break; case BT_GATT_OTS_OLCP_PROC_ORDER: - LOG_DBG("Order"); + LOG_DBG("OtsCliOrder"); on_object_selected(conn, result_code, otc_inst); break; case BT_GATT_OTS_OLCP_PROC_REQ_NUM_OBJS: - LOG_DBG("Request number of objects"); + LOG_DBG("OtsCliReqNumObjs"); if (net_buf.len == sizeof(uint32_t)) { uint32_t obj_cnt = net_buf_simple_pull_le32(&net_buf); - LOG_DBG("Number of objects %u", obj_cnt); + LOG_DBG("OtsCliNumObjs[%u]", obj_cnt); } break; case BT_GATT_OTS_OLCP_PROC_CLEAR_MARKING: - LOG_DBG("Clear marking"); + LOG_DBG("OtsCliClearMarking"); break; default: - LOG_DBG("Invalid indication req opcode %u", req_opcode); + LOG_WRN("OtsCliInvIndReqOpcode[%u]", req_opcode); break; } } else { - LOG_DBG("Invalid indication opcode %u", op_code); + LOG_WRN("OtsCliInvIndOpcode[%u]", op_code); } } @@ -403,7 +398,7 @@ static void oacp_ind_handler(struct bt_conn *conn, struct net_buf_simple net_buf; if (length < sizeof(op_code)) { - LOG_DBG("Invalid indication length: %u", length); + LOG_WRN("OtsCliInvIndLen[%u]", length); return; } @@ -411,35 +406,34 @@ static void oacp_ind_handler(struct bt_conn *conn, op_code = net_buf_simple_pull_u8(&net_buf); - LOG_DBG("OACP indication"); + LOG_DBG("OtsCliOacpInd"); if (op_code == BT_GATT_OTS_OACP_PROC_RESP) { if (net_buf.len >= (sizeof(req_opcode) + sizeof(result_code))) { req_opcode = net_buf_simple_pull_u8(&net_buf); result_code = net_buf_simple_pull_u8(&net_buf); } else { - LOG_ERR("Invalid indication data len %u", net_buf.len); + LOG_WRN("OtsCliInvIndDataLen[%u]", net_buf.len); return; } if (req_opcode == BT_GATT_OTS_OACP_PROC_CHECKSUM_CALC) { if (net_buf.len == sizeof(checksum)) { checksum = net_buf_simple_pull_le32(&net_buf); - LOG_DBG("Object checksum 0x%08x", checksum); + LOG_DBG("OtsCliObjChecksum[%08x]", checksum); if (otc_inst->cb && otc_inst->cb->obj_checksum_calculated) { otc_inst->cb->obj_checksum_calculated( otc_inst, conn, result_code, checksum); } } else { - LOG_ERR("Invalid indication data len %u after opcode and result " - "pulled", net_buf.len); + LOG_WRN("OtsCliInvChecksumLen[%u]", net_buf.len); return; } } print_oacp_response(req_opcode, result_code); } else { - LOG_DBG("Invalid indication opcode %u", op_code); + LOG_WRN("OtsCliInvIndOpcode[%u]", op_code); } } @@ -461,7 +455,7 @@ uint8_t bt_ots_client_indicate_handler(struct bt_conn *conn, */ if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } @@ -491,14 +485,14 @@ static uint8_t read_feature_cb(struct bt_conn *conn, uint8_t err, net_buf_simple_init_with_data(&net_buf, (void *)data, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } inst->busy = false; if (err) { - LOG_DBG("err: 0x%02X", err); + LOG_WRN("OtsCliRdErr[%02x]", err); } else if (data) { if (length == OTS_FEATURE_LEN) { inst->otc_inst->features.oacp = @@ -507,10 +501,9 @@ static uint8_t read_feature_cb(struct bt_conn *conn, uint8_t err, inst->otc_inst->features.olcp = net_buf_simple_pull_le32(&net_buf); - LOG_DBG("features : oacp 0x%x, olcp 0x%x", inst->otc_inst->features.oacp, - inst->otc_inst->features.olcp); + LOG_DBG("OtsCliFeat[%x][%x]", inst->otc_inst->features.oacp, inst->otc_inst->features.olcp); } else { - LOG_DBG("Invalid length %u (expected %u)", length, OTS_FEATURE_LEN); + LOG_WRN("OtsCliInvLen[%u][%u]", length, OTS_FEATURE_LEN); cb_err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } } @@ -527,10 +520,10 @@ int bt_ots_client_register(struct bt_ots_client *otc_inst) continue; } - LOG_DBG("%u", i); + LOG_DBG("OtsCliRegInst[%d]", i); err = bt_gatt_ots_l2cap_register(&otc_insts[i].l2cap_ctx); if (err) { - LOG_WRN("Could not register L2CAP context %d", err); + LOG_WRN("OtsCliL2capCtxRegFail[%d]", err); return err; } @@ -561,20 +554,20 @@ int bt_ots_client_read_feature(struct bt_ots_client *otc_inst, int err; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!otc_inst->feature_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -592,7 +585,7 @@ int bt_ots_client_read_feature(struct bt_ots_client *otc_inst, return err; } - LOG_DBG("Not supported"); + LOG_DBG("OtsCliNotSupp"); return -EOPNOTSUPP; } @@ -602,10 +595,10 @@ static void write_olcp_cb(struct bt_conn *conn, uint8_t err, struct bt_otc_internal_instance_t *inst = lookup_inst_by_handle(params->handle); - LOG_DBG("Write %s (0x%02X)", err ? "failed" : "successful", err); + LOG_DBG("OtsCliWrCpCb[%02x]", err); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return; } @@ -645,7 +638,7 @@ int bt_ots_client_select_id(struct bt_ots_client *otc_inst, uint64_t obj_id) { CHECKIF(!BT_OTS_VALID_OBJ_ID(obj_id)) { - LOG_DBG("Invalid object ID 0x%016llx", obj_id); + LOG_WRN("OtsCliInvObjId[%016llx]", obj_id); return -EINVAL; } @@ -655,20 +648,20 @@ int bt_ots_client_select_id(struct bt_ots_client *otc_inst, uint8_t param[BT_OTS_OBJ_ID_SIZE]; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!otc_inst->olcp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -682,7 +675,7 @@ int bt_ots_client_select_id(struct bt_ots_client *otc_inst, param, BT_OTS_OBJ_ID_SIZE); } - LOG_DBG("Not supported"); + LOG_DBG("OtsCliNotSupp"); return -EOPNOTSUPP; } @@ -693,20 +686,20 @@ int bt_ots_client_select_first(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!otc_inst->olcp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -716,7 +709,7 @@ int bt_ots_client_select_first(struct bt_ots_client *otc_inst, NULL, 0); } - LOG_DBG("Not supported"); + LOG_DBG("OtsCliNotSupp"); return -EOPNOTSUPP; } @@ -727,20 +720,20 @@ int bt_ots_client_select_last(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!otc_inst->olcp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -751,7 +744,7 @@ int bt_ots_client_select_last(struct bt_ots_client *otc_inst, } - LOG_DBG("Not supported"); + LOG_DBG("OtsCliNotSupp"); return -EOPNOTSUPP; } @@ -762,20 +755,20 @@ int bt_ots_client_select_next(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!otc_inst->olcp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -785,7 +778,7 @@ int bt_ots_client_select_next(struct bt_ots_client *otc_inst, NULL, 0); } - LOG_DBG("Not supported"); + LOG_DBG("OtsCliNotSupp"); return -EOPNOTSUPP; } @@ -796,20 +789,20 @@ int bt_ots_client_select_prev(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!otc_inst->olcp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -819,7 +812,7 @@ int bt_ots_client_select_prev(struct bt_ots_client *otc_inst, NULL, 0); } - LOG_DBG("Not supported"); + LOG_DBG("OtsCliNotSupp"); return -EOPNOTSUPP; } @@ -833,18 +826,18 @@ static uint8_t read_object_size_cb(struct bt_conn *conn, uint8_t err, net_buf_simple_init_with_data(&net_buf, (void *)data, length); - LOG_DBG("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } if (err) { - LOG_DBG("err: 0x%02X", err); + LOG_WRN("OtsCliRdErr[%02x]", err); } else if (data) { if (length != OTS_SIZE_LEN) { - LOG_DBG("Invalid length %u (expected %u)", length, OTS_SIZE_LEN); + LOG_WRN("OtsCliInvLen[%u][%u]", length, OTS_SIZE_LEN); err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } else { struct bt_ots_obj_metadata *cur_object = @@ -854,21 +847,14 @@ static uint8_t read_object_size_cb(struct bt_conn *conn, uint8_t err, cur_object->size.alloc = net_buf_simple_pull_le32(&net_buf); - LOG_DBG("Object Size : current size %u, " - "allocated size %u", - cur_object->size.cur, - cur_object->size.alloc); + LOG_DBG("OtsCliObjSize[%u][%u]", cur_object->size.cur, cur_object->size.alloc); if (cur_object->size.cur == 0) { - LOG_WRN("Obj size read returned a current " - "size of 0"); + LOG_WRN("OtsCliObjSizeZero"); } else if (cur_object->size.cur > cur_object->size.alloc && cur_object->size.alloc != 0) { - LOG_WRN("Allocated size %u is smaller than " - "current size %u", - cur_object->size.alloc, - cur_object->size.cur); + LOG_WRN("OtsCliAllocLtCurSize[%u][%u]", cur_object->size.alloc, cur_object->size.cur); } BT_OTS_SET_METADATA_REQ_SIZE(inst->metadata_read); @@ -876,7 +862,7 @@ static uint8_t read_object_size_cb(struct bt_conn *conn, uint8_t err, } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); if (!inst->metadata_err) { inst->metadata_err = err; } @@ -897,15 +883,15 @@ static uint8_t read_obj_id_cb(struct bt_conn *conn, uint8_t err, net_buf_simple_init_with_data(&net_buf, (void *)data, length); - LOG_DBG("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } if (err) { - LOG_DBG("err: 0x%02X", err); + LOG_WRN("OtsCliRdErr[%02x]", err); } else if (data) { if (length == BT_OTS_OBJ_ID_SIZE) { uint64_t obj_id = net_buf_simple_pull_le48(&net_buf); @@ -914,7 +900,7 @@ static uint8_t read_obj_id_cb(struct bt_conn *conn, uint8_t err, &inst->otc_inst->cur_object; (void)bt_ots_obj_id_to_str(obj_id, t, sizeof(t)); - LOG_DBG("Object Id : %s", t); + LOG_DBG("OtsCliObjId[%s]", t); if (cur_object->id != OTS_CLIENT_UNKNOWN_ID && cur_object->id != obj_id) { @@ -922,21 +908,21 @@ static uint8_t read_obj_id_cb(struct bt_conn *conn, uint8_t err, (void)bt_ots_obj_id_to_str(cur_object->id, str, sizeof(str)); - LOG_INF("Read Obj Id %s not selected obj Id %s", t, str); + LOG_INF("OtsCliRdObjIdNotSel[%s][%s]", t, str); } else { - LOG_INF("Read Obj Id confirmed correct Obj Id"); + LOG_INF("OtsCliRdObjIdConfirmed"); cur_object->id = obj_id; BT_OTS_SET_METADATA_REQ_ID(inst->metadata_read); } } else { - LOG_DBG("Invalid length %u (expected %u)", length, BT_OTS_OBJ_ID_SIZE); + LOG_WRN("OtsCliInvLen[%u][%u]", length, BT_OTS_OBJ_ID_SIZE); err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); if (!inst->metadata_err) { inst->metadata_err = err; } @@ -954,10 +940,10 @@ static uint8_t read_obj_name_cb(struct bt_conn *conn, uint8_t err, struct bt_otc_internal_instance_t *inst = lookup_inst_by_handle(params->single.handle); - LOG_DBG("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } @@ -968,14 +954,13 @@ static uint8_t read_obj_name_cb(struct bt_conn *conn, uint8_t err, BT_OTS_SET_METADATA_REQ_NAME(inst->metadata_read); } else { - LOG_WRN("Invalid length %u (expected max %u)", length, - CONFIG_BT_OTS_OBJ_MAX_NAME_LEN); + LOG_WRN("OtsCliInvLen[%u][%u]", length, CONFIG_BT_OTS_OBJ_MAX_NAME_LEN); err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); if (!inst->metadata_err) { inst->metadata_err = err; } @@ -993,10 +978,10 @@ static uint8_t read_obj_type_cb(struct bt_conn *conn, uint8_t err, struct bt_otc_internal_instance_t *inst = lookup_inst_by_handle(params->single.handle); - LOG_DBG("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } @@ -1007,22 +992,22 @@ static uint8_t read_obj_type_cb(struct bt_conn *conn, uint8_t err, &inst->otc_inst->cur_object.type.uuid; if (!bt_uuid_create(uuid, data, length)) { - LOG_WRN("Failed to create UUID from data"); + LOG_WRN("OtsCliUuidCreateFail"); err = BT_ATT_ERR_UNLIKELY; } else { bt_uuid_to_str(uuid, uuid_str, sizeof(uuid_str)); - LOG_DBG("UUID type read: %s", uuid_str); + LOG_DBG("OtsCliUuidTypeRd[%s]", uuid_str); BT_OTS_SET_METADATA_REQ_TYPE(inst->metadata_read); } } else { - LOG_WRN("Invalid length %u (expected max %u)", length, OTS_TYPE_MAX_LEN); + LOG_WRN("OtsCliInvLen[%u][%u]", length, OTS_TYPE_MAX_LEN); err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); if (!inst->metadata_err) { inst->metadata_err = err; } @@ -1043,10 +1028,10 @@ static uint8_t read_obj_created_cb(struct bt_conn *conn, uint8_t err, net_buf_simple_init_with_data(&net_buf, (void *)data, length); - LOG_DBG("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } @@ -1056,14 +1041,13 @@ static uint8_t read_obj_created_cb(struct bt_conn *conn, uint8_t err, &net_buf, &inst->otc_inst->cur_object.first_created); } else { - LOG_WRN("Invalid length %u (expected max %u)", length, - BT_OTS_DATE_TIME_FIELD_SIZE); + LOG_WRN("OtsCliInvLen[%u][%u]", length, BT_OTS_DATE_TIME_FIELD_SIZE); err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); if (!inst->metadata_err) { inst->metadata_err = err; } @@ -1084,10 +1068,10 @@ static uint8_t read_obj_modified_cb(struct bt_conn *conn, uint8_t err, net_buf_simple_init_with_data(&net_buf, (void *)data, length); - LOG_DBG("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } @@ -1096,14 +1080,13 @@ static uint8_t read_obj_modified_cb(struct bt_conn *conn, uint8_t err, date_time_decode(&net_buf, &inst->otc_inst->cur_object.modified); } else { - LOG_WRN("Invalid length %u (expected max %u)", length, - BT_OTS_DATE_TIME_FIELD_SIZE); + LOG_WRN("OtsCliInvLen[%u][%u]", length, BT_OTS_DATE_TIME_FIELD_SIZE); err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); if (!inst->metadata_err) { inst->metadata_err = err; } @@ -1119,10 +1102,10 @@ static int read_attr(struct bt_conn *conn, uint16_t handle, bt_gatt_read_func_t cb) { if (!handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } else if (cb == NULL) { - LOG_ERR("No callback set"); + LOG_ERR("OtsCliCbNull"); return -EINVAL; } @@ -1146,35 +1129,35 @@ static uint8_t read_obj_properties_cb(struct bt_conn *conn, uint8_t err, net_buf_simple_init_with_data(&net_buf, (void *)data, length); - LOG_INF("handle %d, length %u", params->single.handle, length); + LOG_DBG("OtsCliRdCb[%u][%u]", params->single.handle, length); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return BT_GATT_ITER_STOP; } if (err) { - LOG_WRN("err: 0x%02X", err); + LOG_WRN("OtsCliMetaRdErr[%02x]", err); } else if (data && length == OTS_PROPERTIES_LEN) { struct bt_ots_obj_metadata *cur_object = &inst->otc_inst->cur_object; cur_object->props = net_buf_simple_pull_le32(&net_buf); - LOG_INF("Object properties (raw) : 0x%x", cur_object->props); + LOG_INF("OtsCliObjPropsRaw[%x]", cur_object->props); if (!BT_OTS_OBJ_GET_PROP_READ(cur_object->props)) { - LOG_WRN("Obj properties: Obj read not supported"); + LOG_WRN("OtsCliObjRdNotSupp"); } BT_OTS_SET_METADATA_REQ_PROPS(inst->metadata_read); } else { - LOG_WRN("Invalid length %u (expected %u)", length, OTS_PROPERTIES_LEN); + LOG_WRN("OtsCliInvLen[%u][%u]", length, OTS_PROPERTIES_LEN); cb_err = BT_ATT_ERR_INVALID_ATTRIBUTE_LEN; } if (cb_err) { - LOG_WRN("err: 0x%02X", cb_err); + LOG_WRN("OtsCliMetaRdErr[%02x]", cb_err); if (!inst->metadata_err) { inst->metadata_err = cb_err; } @@ -1191,10 +1174,10 @@ static void write_oacp_cp_cb(struct bt_conn *conn, uint8_t err, struct bt_otc_internal_instance_t *inst = lookup_inst_by_handle(params->handle); - LOG_DBG("Write %s (0x%02X)", err ? "failed" : "successful", err); + LOG_DBG("OtsCliWrCpCb[%02x]", err); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return; } @@ -1208,14 +1191,14 @@ static void write_oacp_cp_write_req_cb(struct bt_conn *conn, uint8_t err, lookup_inst_by_handle(params->handle); uint32_t len; - LOG_DBG("Write Object request %s (0x%02X)", err ? "failed" : "successful", err); + LOG_DBG("OtsCliWrObjReqCb[%02x]", err); if (!inst) { - LOG_ERR("Instance not found"); + LOG_ERR("OtsCliInstNotFound"); return; } if (err) { - LOG_WRN("OACP Write request failed (0x%02X), aborting L2CAP send", err); + LOG_WRN("OtsCliOacpWrReqFail[%02x]", err); inst->busy = false; cur_inst = NULL; return; @@ -1225,8 +1208,7 @@ static void write_oacp_cp_write_req_cb(struct bt_conn *conn, uint8_t err, inst->l2cap_ctx.tx.len = 0; err = bt_gatt_ots_l2cap_send(&inst->l2cap_ctx, inst->l2cap_ctx.tx.data, len); if (err) { - LOG_WRN("L2CAP CoC error: %d while trying to execute OACP " - "Write procedure", err); + LOG_WRN("OtsCliL2capSendErr[%d]", err); cur_inst = NULL; } @@ -1242,7 +1224,7 @@ static int oacp_read(struct bt_conn *conn, struct bt_gatt_ots_l2cap *l2cap; if (!inst->otc_inst->oacp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -1256,7 +1238,7 @@ static int oacp_read(struct bt_conn *conn, err = bt_gatt_ots_l2cap_connect(conn, &l2cap); if (err) { - LOG_DBG("Could not connect l2cap: %d", err); + LOG_WRN("OtsCliL2capConnectFail[%d]", err); return err; } @@ -1302,7 +1284,7 @@ static int oacp_write(struct bt_conn *conn, struct bt_otc_internal_instance_t *i struct bt_gatt_ots_l2cap *l2cap; if (!inst->otc_inst->oacp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -1312,7 +1294,7 @@ static int oacp_write(struct bt_conn *conn, struct bt_otc_internal_instance_t *i err = bt_gatt_ots_l2cap_connect(conn, &l2cap); if (err) { - LOG_DBG("Could not connect l2cap: %d", err); + LOG_WRN("OtsCliL2capConnectFail[%d]", err); return err; } @@ -1359,13 +1341,13 @@ static int oacp_checksum(struct bt_conn *conn, struct bt_otc_internal_instance_t int err; if (!inst->otc_inst->oacp_handle) { - LOG_DBG("Handle not set"); + LOG_DBG("OtsCliHdlNotSet"); return -EINVAL; } else if (inst->busy) { - LOG_DBG("Client is busy"); + LOG_DBG("OtsCliBusy"); return -EBUSY; } else if (cur_inst) { - LOG_DBG("Previous operation is not finished"); + LOG_DBG("OtsCliPrevOpNotFinished"); return -EBUSY; } @@ -1401,22 +1383,22 @@ int bt_ots_client_read_object_data(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } if (otc_inst->cur_object.size.cur == 0) { - LOG_WRN("Unknown object size"); + LOG_WRN("OtsCliUnkObjSize"); return -EINVAL; } @@ -1430,18 +1412,18 @@ int bt_ots_client_write_object_data(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; CHECKIF(!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } CHECKIF(!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } CHECKIF((mode != BT_OTS_OACP_WRITE_OP_MODE_NONE) && (mode != BT_OTS_OACP_WRITE_OP_MODE_TRUNCATE)) { - LOG_ERR("Invalid write object mode parameter %d", mode); + LOG_ERR("OtsCliInvWrObjMode[%d]", mode); return -EINVAL; } @@ -1449,42 +1431,41 @@ int bt_ots_client_write_object_data(struct bt_ots_client *otc_inst, * Offset and Length field are UINT32 Length */ CHECKIF(len > UINT32_MAX) { - LOG_ERR("length %zu exceeds UINT32", len); + LOG_ERR("OtsCliLenExceedsUint32[%zu]", len); return -EINVAL; } CHECKIF(len == 0) { - LOG_ERR("length equals zero"); + LOG_ERR("OtsCliLenZero"); return -EINVAL; } CHECKIF((sizeof(offset) > sizeof(uint32_t) && (offset > UINT32_MAX)) || (offset < 0)) { - LOG_ERR("offset %ld exceeds UINT32 and must be >= 0", offset); + LOG_ERR("OtsCliOftExceedsUint32[%ld]", offset); return -EINVAL; } CHECKIF(offset > otc_inst->cur_object.size.cur) { - LOG_ERR("offset %ld exceeds cur size %zu", offset, otc_inst->cur_object.size.cur); + LOG_ERR("OtsCliOftExceedsCurSize[%ld][%u]", offset, otc_inst->cur_object.size.cur); return -EINVAL; } CHECKIF((offset < otc_inst->cur_object.size.cur) && !BT_OTS_OBJ_GET_PROP_PATCH(otc_inst->cur_object.props)) { - LOG_ERR("Patch is not supported"); + LOG_ERR("OtsCliPatchNotSupp"); return -EACCES; } CHECKIF(((uint64_t)len + (uint64_t)offset > otc_inst->cur_object.size.alloc) && !BT_OTS_OBJ_GET_PROP_APPEND(otc_inst->cur_object.props)) { - LOG_ERR("APPEND is not supported. Invalid new end of object %lu alloc %zu." - , (len + offset), otc_inst->cur_object.size.alloc); + LOG_ERR("OtsCliAppendNotSupp[%zu][%u]", (len + offset), otc_inst->cur_object.size.alloc); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } @@ -1497,12 +1478,12 @@ int bt_ots_client_get_object_checksum(struct bt_ots_client *otc_inst, struct bt_ struct bt_otc_internal_instance_t *inst; CHECKIF(!conn) { - LOG_DBG("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } CHECKIF(!otc_inst) { - LOG_DBG("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } @@ -1510,29 +1491,28 @@ int bt_ots_client_get_object_checksum(struct bt_ots_client *otc_inst, struct bt_ * Offset and Length field are UINT32 Length */ CHECKIF(len > UINT32_MAX) { - LOG_DBG("length %zu exceeds UINT32", len); + LOG_WRN("OtsCliLenExceedsUint32[%zu]", len); return -EINVAL; } CHECKIF(len == 0) { - LOG_DBG("length equals zero"); + LOG_WRN("OtsCliLenZero"); return -EINVAL; } CHECKIF((sizeof(offset) > sizeof(uint32_t) && (offset > UINT32_MAX)) || (offset < 0)) { - LOG_DBG("offset exceeds %ld UINT32 and must be >= 0", offset); + LOG_WRN("OtsCliOftExceedsUint32[%ld]", offset); return -EINVAL; } CHECKIF((len + offset) > otc_inst->cur_object.size.cur) { - LOG_DBG("The sum of offset (%ld) and length (%zu) equals %lu which exceeds " - "the Current Size %zu.", offset, len, (len + offset), otc_inst->cur_object.size.cur); + LOG_WRN("OtsCliOftLenExceedSize[%ld][%zu][%u]", offset, len, otc_inst->cur_object.size.cur); return -EINVAL; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_DBG("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } @@ -1546,7 +1526,7 @@ static void read_next_metadata(struct bt_conn *conn, inst->metadata_to_read ^ inst->metadata_read_attempted; int err = 0; - LOG_DBG("Attempting to read metadata 0x%02X", metadata_remaining); + LOG_DBG("OtsCliRdNextMeta[%02x]", metadata_remaining); if (BT_OTS_GET_METADATA_REQ_NAME(metadata_remaining)) { BT_OTS_SET_METADATA_REQ_NAME(inst->metadata_read_attempted); @@ -1588,7 +1568,7 @@ static void read_next_metadata(struct bt_conn *conn, } if (err) { - LOG_DBG("Metadata read failed (%d), trying next", err); + LOG_INF("OtsCliMetaRdFailTryNext[%d]", err); read_next_metadata(conn, inst); } } @@ -1600,20 +1580,20 @@ int bt_ots_client_read_object_metadata(struct bt_ots_client *otc_inst, struct bt_otc_internal_instance_t *inst; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsCliInvConn"); return -ENOTCONN; } else if (!otc_inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (!metadata) { - LOG_WRN("No metadata to read"); + LOG_WRN("OtsCliNoMetaToRd"); return -ENOEXEC; } inst = lookup_inst_by_handle(otc_inst->start_handle); if (!inst) { - LOG_ERR("Invalid OTC instance"); + LOG_ERR("OtsCliInvInst"); return -EINVAL; } else if (inst->busy) { return -EBUSY; @@ -1638,16 +1618,12 @@ static int decode_record(struct net_buf_simple *buf, rec->len = net_buf_simple_pull_le16(buf); if (rec->len < 2 || rec->len > start_len) { - LOG_WRN("incorrect DirListing record length %u, " - "longer than remaining size %u", - rec->len, start_len); + LOG_WRN("OtsCliDirRecLenInv[%u][%u]", rec->len, start_len); return -EINVAL; } if ((start_len - buf->len) + BT_OTS_OBJ_ID_SIZE > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u too short, " - "includes only record length", - rec->len); + LOG_WRN("OtsCliDirRecTooShortNoObjId[%u]", rec->len); return -EINVAL; } @@ -1658,14 +1634,12 @@ static int decode_record(struct net_buf_simple *buf, char t[BT_OTS_OBJ_ID_STR_LEN]; (void)bt_ots_obj_id_to_str(rec->metadata.id, t, sizeof(t)); - LOG_DBG("Object ID 0x%s", t); + LOG_DBG("OtsCliObjId[%s]", t); } #endif if ((start_len - buf->len) + sizeof(uint8_t) > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u too short, " - "includes only record length + ObjId", - rec->len); + LOG_WRN("OtsCliDirRecTooShortNoNameLen[%u]", rec->len); return -EINVAL; } @@ -1675,15 +1649,12 @@ static int decode_record(struct net_buf_simple *buf, uint8_t *name; if ((start_len - buf->len) + rec->name_len > rec->len) { - LOG_WRN("incorrect DirListing record, remaining length " - "%u shorter than name length %u", - rec->len - (start_len - buf->len), - rec->name_len); + LOG_WRN("OtsCliDirRecNameExceedsRemaining[%u][%u]", rec->len - (start_len - buf->len), rec->name_len); return -EINVAL; } if (rec->name_len >= sizeof(rec->metadata.name_c)) { - LOG_WRN("Name length %u too long, invalid record", rec->name_len); + LOG_WRN("OtsCliDirRecNameLenTooLong[%u]", rec->name_len); return -EINVAL; } @@ -1695,36 +1666,31 @@ static int decode_record(struct net_buf_simple *buf, rec->flags = 0; if ((start_len - buf->len) + sizeof(uint8_t) > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u too short, " - "does not include flags", rec->len); + LOG_WRN("OtsCliDirRecTooShortNoFlags[%u]", rec->len); return -EINVAL; } rec->flags = net_buf_simple_pull_u8(buf); - LOG_DBG("flags 0x%x", rec->flags); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); if (BT_OTS_DIR_LIST_GET_FLAG_TYPE_128(rec->flags)) { uint8_t *uuid; if ((start_len - buf->len) + BT_UUID_SIZE_128 > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "flags indicates uuid128, too short", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortUuid128[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } uuid = net_buf_simple_pull_mem(buf, BT_UUID_SIZE_128); if (!bt_uuid_create(&rec->metadata.type.uuid, uuid, BT_UUID_SIZE_128)) { - LOG_DBG("Failed to create UUID"); + LOG_WRN("OtsCliUuidCreateFail"); return -EINVAL; } } else { if ((start_len - buf->len) + BT_UUID_SIZE_16 > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "flags indicates uuid16, too short", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortUuid16[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } @@ -1735,10 +1701,8 @@ static int decode_record(struct net_buf_simple *buf, if (BT_OTS_DIR_LIST_GET_FLAG_CUR_SIZE(rec->flags)) { if ((start_len - buf->len) + sizeof(uint32_t) > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "flags indicates cur_size, too short", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortCurSize[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } @@ -1747,10 +1711,8 @@ static int decode_record(struct net_buf_simple *buf, if (BT_OTS_DIR_LIST_GET_FLAG_ALLOC_SIZE(rec->flags)) { if ((start_len - buf->len) + sizeof(uint32_t) > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "flags indicates allocated size, too short", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortAllocSize[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } @@ -1759,10 +1721,8 @@ static int decode_record(struct net_buf_simple *buf, if (BT_OTS_DIR_LIST_GET_FLAG_FIRST_CREATED(rec->flags)) { if ((start_len - buf->len) + BT_OTS_DATE_TIME_FIELD_SIZE > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "too short flags indicates first_created", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortFirstCreated[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } @@ -1771,10 +1731,8 @@ static int decode_record(struct net_buf_simple *buf, if (BT_OTS_DIR_LIST_GET_FLAG_LAST_MODIFIED(rec->flags)) { if ((start_len - buf->len) + BT_OTS_DATE_TIME_FIELD_SIZE > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "flags indicates las_mod, too short", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortLastModified[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } @@ -1783,10 +1741,8 @@ static int decode_record(struct net_buf_simple *buf, if (BT_OTS_DIR_LIST_GET_FLAG_PROPERTIES(rec->flags)) { if ((start_len - buf->len) + sizeof(uint32_t) > rec->len) { - LOG_WRN("incorrect DirListing record, reclen %u " - "flags indicates properties, too short", - rec->len); - LOG_INF("flags 0x%x", rec->flags); + LOG_WRN("OtsCliDirRecTooShortProps[%u]", rec->len); + LOG_DBG("OtsCliDirRecFlags[%x]", rec->flags); return -EINVAL; } @@ -1819,15 +1775,15 @@ int bt_ots_client_decode_dirlisting(uint8_t *data, uint16_t length, count++; if (net_buf.len < sizeof(uint16_t)) { - LOG_WRN("incorrect DirListing record, len %u too short", net_buf.len); + LOG_WRN("OtsCliDirRecBufTooShort[%u]", net_buf.len); return -EINVAL; } - LOG_DBG("Decoding record %u", count); + LOG_DBG("OtsCliDecodeRec[%d]", count); ret = decode_record(&net_buf, &record); if (ret < 0) { - LOG_WRN("DirListing, record %u invalid", count); + LOG_WRN("OtsCliDirRecInv[%d]", count); return ret; } @@ -1844,59 +1800,59 @@ int bt_ots_client_decode_dirlisting(uint8_t *data, uint16_t length, void bt_ots_metadata_display(struct bt_ots_obj_metadata *metadata, uint16_t count) { - LOG_INF("--- Displaying %u metadata records ---", count); + LOG_INF("OtsCliDisplayMetaRecords[%u]", count); for (int i = 0; i < count; i++) { char t[BT_OTS_OBJ_ID_STR_LEN]; (void)bt_ots_obj_id_to_str(metadata[i].id, t, sizeof(t)); - LOG_INF("Object ID: 0x%s", t); - LOG_INF("Object name: %s", metadata[i].name_c); - LOG_INF("Object Current Size: %u", metadata[i].size.cur); - LOG_INF("Object Allocate Size: %u", metadata[i].size.alloc); + LOG_INF("OtsCliObjId[%s]", t); + LOG_INF("OtsCliObjName[%s]", metadata[i].name_c); + LOG_INF("OtsCliObjCurSize[%u]", metadata[i].size.cur); + LOG_INF("OtsCliObjAllocSize[%u]", metadata[i].size.alloc); if (!bt_uuid_cmp(&metadata[i].type.uuid, BT_UUID_OTS_TYPE_MPL_ICON)) { - LOG_INF("Type: Icon Obj Type"); + LOG_INF("OtsCliObjTypeIcon"); } else if (!bt_uuid_cmp(&metadata[i].type.uuid, BT_UUID_OTS_TYPE_TRACK_SEGMENT)) { - LOG_INF("Type: Track Segment Obj Type"); + LOG_INF("OtsCliObjTypeTrackSegment"); } else if (!bt_uuid_cmp(&metadata[i].type.uuid, BT_UUID_OTS_TYPE_TRACK)) { - LOG_INF("Type: Track Obj Type"); + LOG_INF("OtsCliObjTypeTrack"); } else if (!bt_uuid_cmp(&metadata[i].type.uuid, BT_UUID_OTS_TYPE_GROUP)) { - LOG_INF("Type: Group Obj Type"); + LOG_INF("OtsCliObjTypeGroup"); } else if (!bt_uuid_cmp(&metadata[i].type.uuid, BT_UUID_OTS_DIRECTORY_LISTING)) { - LOG_INF("Type: Directory Listing"); + LOG_INF("OtsCliObjTypeDirListing"); } - LOG_INF("Properties:0x%x", metadata[i].props); + LOG_INF("OtsCliProps[%x]", metadata[i].props); if (BT_OTS_OBJ_GET_PROP_APPEND(metadata[i].props)) { - LOG_INF(" - append permitted"); + LOG_INF("OtsCliPropAppend"); } if (BT_OTS_OBJ_GET_PROP_DELETE(metadata[i].props)) { - LOG_INF(" - delete permitted"); + LOG_INF("OtsCliPropDelete"); } if (BT_OTS_OBJ_GET_PROP_EXECUTE(metadata[i].props)) { - LOG_INF(" - execute permitted"); + LOG_INF("OtsCliPropExecute"); } if (BT_OTS_OBJ_GET_PROP_MARKED(metadata[i].props)) { - LOG_INF(" - marked"); + LOG_INF("OtsCliPropMarked"); } if (BT_OTS_OBJ_GET_PROP_PATCH(metadata[i].props)) { - LOG_INF(" - patch permitted"); + LOG_INF("OtsCliPropPatch"); } if (BT_OTS_OBJ_GET_PROP_READ(metadata[i].props)) { - LOG_INF(" - read permitted"); + LOG_INF("OtsCliPropRd"); } if (BT_OTS_OBJ_GET_PROP_TRUNCATE(metadata[i].props)) { - LOG_INF(" - truncate permitted"); + LOG_INF("OtsCliPropTrunc"); } if (BT_OTS_OBJ_GET_PROP_WRITE(metadata[i].props)) { - LOG_INF(" - write permitted"); + LOG_INF("OtsCliPropWr"); } } } diff --git a/components/bt/esp_ble_audio/host/services/ots/ots_dir_list.c b/components/bt/esp_ble_audio/host/services/ots/ots_dir_list.c index c6fd36f93cf..7e38b3d29a6 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots_dir_list.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots_dir_list.c @@ -146,7 +146,7 @@ static int bt_ots_dir_list_search_forward(struct bt_ots_dir_list *dir_list, void size_t rec_len = dir_list_object_record_size(obj); bt_ots_obj_id_to_str(obj->id, id_str, sizeof(id_str)); - LOG_DBG("Searching forward for offset %ld starting at %ld with object ID %s", + LOG_DBG("OtsDirListSrchFwd[%ld][%ld][%s]", (long)offset, (long)dir_list->anchor_offset, id_str); while (dir_list->anchor_offset + rec_len <= offset) { @@ -173,7 +173,7 @@ static int bt_ots_dir_list_search_backward(struct bt_ots_dir_list *dir_list, voi struct bt_gatt_ots_object *obj = dir_list->anchor_object; bt_ots_obj_id_to_str(obj->id, id_str, sizeof(id_str)); - LOG_DBG("Searching backward for offset %ld starting at %ld with object ID %s", + LOG_DBG("OtsDirListSrchBwd[%ld][%ld][%s]", (long)offset, (long)dir_list->anchor_offset, id_str); while (dir_list->anchor_offset > offset) { @@ -208,7 +208,7 @@ static int bt_ots_dir_list_search(struct bt_ots_dir_list *dir_list, void *obj_ma } else { size_t rec_len; - LOG_DBG("Offset %ld is closer to %zu than %ld, start from end", + LOG_DBG("OtsDirListSrchFromEnd[%ld][%zu][%ld]", (long)offset, last, (long)dir_list->anchor_offset); err = bt_gatt_ots_obj_manager_last_obj_get(obj_manager, &dir_list->anchor_object); if (err) { @@ -222,7 +222,7 @@ static int bt_ots_dir_list_search(struct bt_ots_dir_list *dir_list, void *obj_ma const size_t mid = dir_list->anchor_offset / 2; if (offset < mid) { - LOG_DBG("Offset %ld is closer to 0 than %ld, start from beginning", + LOG_DBG("OtsDirListSrchFromStart[%ld][%ld]", (long)offset, (long)dir_list->anchor_offset); bt_ots_dir_list_reset_anchor(dir_list, obj_manager); err = bt_ots_dir_list_search_forward(dir_list, obj_manager, offset); @@ -236,7 +236,7 @@ static int bt_ots_dir_list_search(struct bt_ots_dir_list *dir_list, void *obj_ma } bt_ots_obj_id_to_str(dir_list->anchor_object->id, id_str, sizeof(id_str)); - LOG_DBG("Found offset %ld starting at %ld in object with ID %s", + LOG_DBG("OtsDirListFoundOft[%ld][%ld][%s]", (long)offset, (long)dir_list->anchor_offset, id_str); return 0; @@ -259,7 +259,7 @@ static void dir_list_update_size(struct bt_ots_dir_list *dir_list, void *obj_man err = bt_gatt_ots_obj_manager_next_obj_get(obj_manager, obj, &obj); } while (!err); - LOG_DBG("Update directory listing current size to 0x%zx", len); + LOG_DBG("OtsDirListUpdCurSize[%zx]", len); dir_list->dir_list_obj->metadata.size.cur = len; } diff --git a/components/bt/esp_ble_audio/host/services/ots/ots_l2cap.c b/components/bt/esp_ble_audio/host/services/ots/ots_l2cap.c index 8e4dde8fa71..da6d0be721b 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots_l2cap.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots_l2cap.c @@ -49,7 +49,7 @@ static int ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx) /* Prepare buffer for sending. */ buf = net_buf_alloc(&ot_chan_tx_pool, K_FOREVER); if (buf == NULL) { - LOG_ERR("OtsTxBufAllocFail"); + LOG_ERR("OtsL2capTxBufAllocFail"); return -ENOMEM; } @@ -58,7 +58,7 @@ static int ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx) ret = bt_l2cap_chan_send(&l2cap_ctx->ot_chan.chan, buf); if (ret < 0) { - LOG_ERR("Unable to send data over CoC: %d", ret); + LOG_WRN("OtsL2capChanSendFail[%d]", ret); net_buf_unref(buf); return -ENOEXEC; @@ -67,7 +67,7 @@ static int ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx) /* Mark that L2CAP TX was accepted. */ l2cap_ctx->tx.len_sent += len; - LOG_DBG("Sending TX chunk with %d bytes on L2CAP CoC", len); + LOG_DBG("OtsL2capTxChunk[%u]", len); return 0; } @@ -75,7 +75,7 @@ static int ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx) #if (CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU > BT_L2CAP_SDU_RX_MTU) static struct net_buf *l2cap_alloc_buf(struct bt_l2cap_chan *chan) { - LOG_DBG("Channel %p allocating buffer", chan); + LOG_DBG("OtsL2capAllocBuf"); return net_buf_alloc(&ot_chan_rx_pool, K_FOREVER); } @@ -86,7 +86,7 @@ static void l2cap_sent(struct bt_l2cap_chan *chan) struct bt_l2cap_le_chan *l2chan = CONTAINER_OF(chan, struct bt_l2cap_le_chan, chan); struct bt_gatt_ots_l2cap *l2cap_ctx; - LOG_DBG("Outgoing data channel %p transmitted", chan); + LOG_DBG("OtsL2capSent"); l2cap_ctx = CONTAINER_OF(l2chan, struct bt_gatt_ots_l2cap, ot_chan); @@ -94,7 +94,7 @@ static void l2cap_sent(struct bt_l2cap_chan *chan) if (l2cap_ctx->tx.len != l2cap_ctx->tx.len_sent) { if (ots_l2cap_send(l2cap_ctx)) { /* Send failed - clean up TX state to unblock channel. */ - LOG_ERR("Failed to send next chunk, aborting TX"); + LOG_WRN("OtsL2capTxAbort"); memset(&l2cap_ctx->tx, 0, sizeof(l2cap_ctx->tx)); if (l2cap_ctx->tx_done) { l2cap_ctx->tx_done(l2cap_ctx, chan->conn); @@ -107,7 +107,7 @@ static void l2cap_sent(struct bt_l2cap_chan *chan) /* TX completed - notify upper layers and clean up. */ memset(&l2cap_ctx->tx, 0, sizeof(l2cap_ctx->tx)); - LOG_DBG("Scheduled TX on L2CAP CoC is complete"); + LOG_DBG("OtsL2capTxComp"); if (l2cap_ctx->tx_done) { l2cap_ctx->tx_done(l2cap_ctx, chan->conn); @@ -119,7 +119,7 @@ static int l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) struct bt_l2cap_le_chan *l2chan = CONTAINER_OF(chan, struct bt_l2cap_le_chan, chan); struct bt_gatt_ots_l2cap *l2cap_ctx; - LOG_DBG("Incoming data channel %p received", chan); + LOG_DBG("OtsL2capRecv"); l2cap_ctx = CONTAINER_OF(l2chan, struct bt_gatt_ots_l2cap, ot_chan); @@ -132,12 +132,12 @@ static int l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf) static void l2cap_status(struct bt_l2cap_chan *chan, atomic_t *status) { - LOG_DBG("Channel %p status %lu", chan, atomic_get(status)); + LOG_DBG("OtsL2capStatus[%u]", atomic_get(status)); } static void l2cap_connected(struct bt_l2cap_chan *chan) { - LOG_DBG("Channel %p connected", chan); + LOG_DBG("OtsL2capConnected"); } static void l2cap_disconnected(struct bt_l2cap_chan *chan) @@ -145,7 +145,7 @@ static void l2cap_disconnected(struct bt_l2cap_chan *chan) struct bt_l2cap_le_chan *l2chan = CONTAINER_OF(chan, struct bt_l2cap_le_chan, chan); struct bt_gatt_ots_l2cap *l2cap_ctx; - LOG_DBG("Channel %p disconnected", chan); + LOG_DBG("OtsL2capDisconnected"); l2cap_ctx = CONTAINER_OF(l2chan, struct bt_gatt_ots_l2cap, ot_chan); @@ -173,7 +173,7 @@ static inline void l2cap_chan_init(struct bt_l2cap_le_chan *chan) chan->rx.mtu = CONFIG_BT_OTS_L2CAP_CHAN_RX_MTU; chan->chan.ops = &l2cap_ops; - LOG_DBG("RX MTU set to %u", chan->rx.mtu); + LOG_DBG("OtsL2capRxMtu[%u]", chan->rx.mtu); } static struct bt_gatt_ots_l2cap *find_free_l2cap_ctx(void) @@ -196,7 +196,7 @@ static int l2cap_accept(struct bt_conn *conn, struct bt_l2cap_server *server, { struct bt_gatt_ots_l2cap *l2cap_ctx; - LOG_DBG("Incoming conn %p", (void *)conn); + LOG_DBG("OtsL2capIncomingConn"); l2cap_ctx = find_free_l2cap_ctx(); if (l2cap_ctx) { @@ -224,11 +224,11 @@ static int bt_gatt_ots_l2cap_init(void) err = bt_l2cap_server_register(&l2cap_server); if (err) { - LOG_ERR("Unable to register OTS PSM"); + LOG_ERR("OtsL2capPsmRegFail"); return err; } - LOG_DBG("Initialized OTS L2CAP"); + LOG_DBG("OtsL2capInit"); return 0; } @@ -245,7 +245,7 @@ int bt_gatt_ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx, int err; if (l2cap_ctx->tx.len != 0) { - LOG_ERR("L2CAP TX in progress"); + LOG_WRN("OtsL2capTxInProgress"); return -EAGAIN; } @@ -253,11 +253,11 @@ int bt_gatt_ots_l2cap_send(struct bt_gatt_ots_l2cap *l2cap_ctx, l2cap_ctx->tx.data = data; l2cap_ctx->tx.len = len; - LOG_DBG("Starting TX on L2CAP CoC with %d byte packet", len); + LOG_DBG("OtsL2capTxStart[%u]", len); err = ots_l2cap_send(l2cap_ctx); if (err) { - LOG_ERR("Unable to send data over CoC: %d", err); + LOG_WRN("OtsL2capSendFail[%d]", err); memset(&l2cap_ctx->tx, 0, sizeof(l2cap_ctx->tx)); return err; @@ -288,12 +288,12 @@ int bt_gatt_ots_l2cap_connect(struct bt_conn *conn, struct bt_gatt_ots_l2cap *ctx; if (!conn) { - LOG_WRN("Invalid Connection"); + LOG_WRN("OtsL2capConnNull"); return -ENOTCONN; } if (!l2cap_ctx) { - LOG_WRN("Invalid context"); + LOG_WRN("OtsL2capCtxNull"); return -EINVAL; } @@ -307,12 +307,12 @@ int bt_gatt_ots_l2cap_connect(struct bt_conn *conn, l2cap_chan_init(&ctx->ot_chan); (void)memset(&ctx->tx, 0, sizeof(ctx->tx)); - LOG_DBG("Connecting L2CAP CoC"); + LOG_DBG("OtsL2capConnecting"); err = bt_l2cap_chan_connect(conn, &ctx->ot_chan.chan, BT_GATT_OTS_L2CAP_PSM); if (err) { - LOG_WRN("Unable to connect to psm %u (err %d)", BT_GATT_OTS_L2CAP_PSM, err); + LOG_WRN("OtsL2capConnFail[%u][%d]", BT_GATT_OTS_L2CAP_PSM, err); } else { - LOG_DBG("L2CAP connection pending"); + LOG_DBG("OtsL2capConnPending"); *l2cap_ctx = ctx; } diff --git a/components/bt/esp_ble_audio/host/services/ots/ots_oacp.c b/components/bt/esp_ble_audio/host/services/ots/ots_oacp.c index 162787a719d..4d4e00a6aba 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots_oacp.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots_oacp.c @@ -61,11 +61,10 @@ static enum bt_gatt_ots_oacp_res_code oacp_create_proc_validate( }; bt_uuid_to_str(¶m.type.uuid, str, BT_UUID_STR_LEN); - LOG_DBG("Validating Create procedure with size: 0x%08X and " - "type: %s", param.size, str); + LOG_DBG("OtsOacpValCreate[%08x][%s]", param.size, str); if (!BT_OTS_OACP_GET_FEAT_CREATE(ots->features.oacp)) { - LOG_DBG("Create Procedure is not supported."); + LOG_DBG("OtsOacpCreateNotSupp"); return BT_GATT_OTS_OACP_RES_OPCODE_NOT_SUP; } @@ -76,21 +75,21 @@ static enum bt_gatt_ots_oacp_res_code oacp_create_proc_validate( /* Verify Initialization Metadata */ if (strlen(obj->metadata.name) > 0) { - LOG_ERR("Object name shall be a zero length string after object creation."); + LOG_ERR("OtsOacpObjNameNotEmpty"); (void)bt_ots_obj_delete(ots, obj->id); err = -ECANCELED; goto exit; } if (obj->metadata.size.cur > 0) { - LOG_ERR("Object current size must be 0."); + LOG_ERR("OtsOacpObjCurSizeNotZero"); (void)bt_ots_obj_delete(ots, obj->id); err = -ECANCELED; goto exit; } if (!BT_OTS_OBJ_GET_PROP_WRITE(obj->metadata.props)) { - LOG_ERR("Created object must have write property."); + LOG_ERR("OtsOacpObjNoWrProp"); (void)bt_ots_obj_delete(ots, obj->id); err = -ECANCELED; goto exit; @@ -99,7 +98,7 @@ static enum bt_gatt_ots_oacp_res_code oacp_create_proc_validate( ots->cur_obj = obj; ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; - LOG_DBG("Create procedure is complete"); + LOG_DBG("OtsOacpCreateComp"); exit: switch (err) { @@ -127,27 +126,27 @@ static enum bt_gatt_ots_oacp_res_code oacp_delete_proc_validate( int err; if (!BT_OTS_OACP_GET_FEAT_DELETE(ots->features.oacp)) { - LOG_DBG("Delete Procedure is not supported."); + LOG_DBG("OtsOacpDeleteNotSupp"); return BT_GATT_OTS_OACP_RES_OPCODE_NOT_SUP; } if (!ots->cur_obj) { - LOG_DBG("No object is selected."); + LOG_DBG("OtsOacpNoObjSel"); return BT_GATT_OTS_OACP_RES_INV_OBJ; } if (!BT_OTS_OBJ_GET_PROP_DELETE(ots->cur_obj->metadata.props)) { - LOG_DBG("Object properties do not permit deletion."); + LOG_DBG("OtsOacpDeleteNotPermitted"); return BT_GATT_OTS_OACP_RES_NOT_PERMITTED; } err = bt_ots_obj_delete(ots, ots->cur_obj->id); if (err) { - LOG_ERR("Deleting object during Delete procedure failed: %d", err); + LOG_ERR("OtsOacpDeleteObjFail[%d]", err); goto exit; } - LOG_DBG("Delete procedure is complete"); + LOG_DBG("OtsOacpDeleteComp"); exit: switch (err) { @@ -173,8 +172,7 @@ static enum bt_gatt_ots_oacp_res_code oacp_checksum_proc_validate( int err; uint32_t checksum; - LOG_DBG("Validating Checksum procedure with offset: 0x%08X and " - "length: 0x%08X", params->offset, params->len); + LOG_DBG("OtsOacpValChecksum[%08x][%08x]", params->offset, params->len); if (!ots->cur_obj) { return BT_GATT_OTS_OACP_RES_INV_OBJ; @@ -201,8 +199,7 @@ static enum bt_gatt_ots_oacp_res_code oacp_checksum_proc_validate( checksum = bt_ots_client_calc_checksum((const uint8_t *)obj_data, params->len); net_buf_simple_add_le32(resp_param, checksum); - LOG_DBG("Calculate from offset %u len %u checksum 0x%08x", params->offset, - params->len, checksum); + LOG_DBG("OtsOacpChecksumCalc[%u][%u][%08x]", params->offset, params->len, checksum); return BT_GATT_OTS_OACP_RES_SUCCESS; } else { return BT_GATT_OTS_OACP_RES_OPER_FAILED; @@ -217,8 +214,7 @@ static enum bt_gatt_ots_oacp_res_code oacp_read_proc_validate( { const struct bt_gatt_ots_oacp_read_params *params = &proc->read_params; - LOG_DBG("Validating Read procedure with offset: 0x%08X and " - "length: 0x%08X", params->offset, params->len); + LOG_DBG("OtsOacpValRd[%08x][%08x]", params->offset, params->len); if (!ots->cur_obj) { return BT_GATT_OTS_OACP_RES_INV_OBJ; @@ -246,7 +242,7 @@ static enum bt_gatt_ots_oacp_res_code oacp_read_proc_validate( memcpy(&ots->cur_obj->state.read_op.oacp_params, &proc->read_params, sizeof(ots->cur_obj->state.read_op.oacp_params)); - LOG_DBG("Read procedure is accepted"); + LOG_DBG("OtsOacpRdAccepted"); return BT_GATT_OTS_OACP_RES_SUCCESS; } @@ -259,15 +255,14 @@ static enum bt_gatt_ots_oacp_res_code oacp_write_proc_validate( { struct bt_gatt_ots_oacp_write_params *params = &proc->write_params; - LOG_DBG("Validating Write procedure with offset: 0x%08X and " - "length: 0x%08X", params->offset, params->len); + LOG_DBG("OtsOacpValWr[%08x][%08x]", params->offset, params->len); if (!ots->cur_obj) { return BT_GATT_OTS_OACP_RES_INV_OBJ; } if (!BT_OTS_OACP_GET_FEAT_WRITE(ots->features.oacp)) { - LOG_DBG("Write Procedure is not supported."); + LOG_DBG("OtsOacpWrNotSupp"); return BT_GATT_OTS_OACP_RES_OPCODE_NOT_SUP; } @@ -318,7 +313,7 @@ static enum bt_gatt_ots_oacp_res_code oacp_write_proc_validate( memcpy(&ots->cur_obj->state.write_op.oacp_params, params, sizeof(ots->cur_obj->state.write_op.oacp_params)); - LOG_DBG("Write procedure is accepted"); + LOG_DBG("OtsOacpWrAccepted"); return BT_GATT_OTS_OACP_RES_SUCCESS; } @@ -463,14 +458,14 @@ static void oacp_read_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, ots = CONTAINER_OF(l2cap_ctx, struct bt_ots, l2cap); if (!ots->cur_obj) { - LOG_ERR("OTS Read operation failed: no current object"); + LOG_ERR("OtsOacpRdNoCurObj"); return; } if (ots->cb->obj_read == NULL && !(IS_ENABLED(CONFIG_BT_OTS_DIR_LIST_OBJ) && ots->cur_obj->id == OTS_OBJ_ID_DIR_LIST)) { ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; - LOG_ERR("OTS Read operation failed: there is no OTS Read callback"); + LOG_ERR("OtsOacpRdNoCb"); return; } @@ -479,10 +474,10 @@ static void oacp_read_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, offset = read_op->oacp_params.offset + read_op->sent_len; if (read_op->sent_len >= read_op->oacp_params.len) { - LOG_DBG("OACP Read Op over L2CAP is completed"); + LOG_DBG("OtsOacpRdL2capComp"); if (read_op->sent_len > read_op->oacp_params.len) { - LOG_WRN("More bytes sent that the client requested"); + LOG_WRN("OtsOacpSentMoreThanReq"); } ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; @@ -508,7 +503,7 @@ static void oacp_read_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, } if (len < 0) { - LOG_ERR("OCAP Read Op failed with error: %zd", len); + LOG_ERR("OtsOacpRdOpFail[%zd]", len); bt_gatt_ots_l2cap_disconnect(&ots->l2cap); ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; @@ -520,8 +515,7 @@ static void oacp_read_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, ots->l2cap.closed = oacp_l2cap_closed; err = bt_gatt_ots_l2cap_send(&ots->l2cap, obj_chunk, len); if (err) { - LOG_ERR("L2CAP CoC error: %d while trying to execute OACP " - "Read procedure", err); + LOG_WRN("OtsOacpL2capErr[%d]", err); ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; } else { read_op->sent_len += len; @@ -534,14 +528,13 @@ static void oacp_read_proc_execute(struct bt_ots *ots, struct bt_gatt_ots_oacp_read_params *params; if (!ots->cur_obj) { - LOG_ERR("Invalid Current Object on OACP Read procedure"); + LOG_ERR("OtsOacpRdInvCurObj"); return; } params = &ots->cur_obj->state.read_op.oacp_params; - LOG_DBG("Executing Read procedure with offset: 0x%08X and " - "length: 0x%08X", params->offset, params->len); + LOG_DBG("OtsOacpExecRd[%08x][%08x]", params->offset, params->len); oacp_read_proc_cb(&ots->l2cap, conn); } @@ -560,13 +553,12 @@ static ssize_t oacp_write_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, ots = CONTAINER_OF(l2cap_ctx, struct bt_ots, l2cap); if (!ots->cur_obj) { - LOG_ERR("Invalid Current Object on OACP Write procedure"); + LOG_ERR("OtsOacpWrInvCurObj"); return -ENODEV; } if (!ots->cb->obj_write) { - LOG_ERR("OTS Write operation failed: " - "there is no OTS Write callback"); + LOG_ERR("OtsOacpWrNoCb"); ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; return -ENODEV; } @@ -575,7 +567,7 @@ static ssize_t oacp_write_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, offset = write_op->oacp_params.offset + write_op->recv_len; len = buf->len; if (write_op->recv_len + len > write_op->oacp_params.len) { - LOG_WRN("More bytes received than the client indicated"); + LOG_WRN("OtsOacpRecvMoreThanInd"); len = write_op->oacp_params.len - write_op->recv_len; } rem = write_op->oacp_params.len - (write_op->recv_len + len); @@ -591,24 +583,24 @@ static ssize_t oacp_write_proc_cb(struct bt_gatt_ots_l2cap *l2cap_ctx, * released by the l2cap layer. This is an unsupported use case at the moment. */ if (rc == -EINPROGRESS) { - LOG_ERR("Unsupported error code %zd returned by object write callback", rc); + LOG_ERR("OtsOacpWrCbUnsuppRc[%zd]", rc); } - LOG_ERR("OTS Write operation failed with error: %zd", rc); + LOG_ERR("OtsOacpWrOpFail[%zd]", rc); ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; } else { /* Return -EIO as an error if all of data was not written */ if (rc != len) { len = 0; rc = -EIO; - LOG_ERR("OTS Write operation partially failed"); + LOG_ERR("OtsOacpWrPartialFail"); ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; } } write_op->recv_len += len; if (write_op->recv_len == write_op->oacp_params.len) { - LOG_DBG("OACP Write Op over L2CAP is completed"); + LOG_DBG("OtsOacpWrL2capComp"); ots->cur_obj->state.type = BT_GATT_OTS_OBJECT_IDLE_STATE; } @@ -626,10 +618,10 @@ static void oacp_ind_cb(struct bt_conn *conn, { struct bt_ots *ots = (struct bt_ots *) params->attr->user_data; - LOG_DBG("Received OACP Indication ACK with status: 0x%04X", err); + LOG_DBG("OtsOacpRecvIndAck[%04x]", err); if (!ots->cur_obj) { - LOG_DBG("There is no object associated with this ACK"); + LOG_DBG("OtsOacpNoObjForAck"); return; } @@ -644,7 +636,7 @@ static void oacp_ind_cb(struct bt_conn *conn, /* procedure is not in progress and was already completed */ break; default: - LOG_ERR("Unsupported OTS state: %d", ots->cur_obj->state.type); + LOG_ERR("OtsOacpUnsuppState[%d]", ots->cur_obj->state.type); break; } } @@ -664,7 +656,7 @@ static void oacp_ind_send(const struct bt_gatt_attr *oacp_attr, oacp_res[oacp_res_len++] = oacp_status; if (oacp_proc.type == BT_GATT_OTS_OACP_PROC_CHECKSUM_CALC && - oacp_status == BT_GATT_OTS_OACP_RES_SUCCESS) { + oacp_status == BT_GATT_OTS_OACP_RES_SUCCESS) { sys_put_le32(net_buf_simple_pull_le32(resp_param), (oacp_res + oacp_res_len)); oacp_res_len += sizeof(uint32_t); } @@ -677,7 +669,7 @@ static void oacp_ind_send(const struct bt_gatt_attr *oacp_attr, ots->oacp_ind.params.data = oacp_res; ots->oacp_ind.params.len = oacp_res_len; - LOG_DBG("Sending OACP indication"); + LOG_DBG("OtsOacpSendInd"); k_work_submit(&ots->oacp_ind.work); } @@ -693,20 +685,20 @@ ssize_t bt_gatt_ots_oacp_write(struct bt_conn *conn, struct bt_ots *ots = (struct bt_ots *) attr->user_data; NET_BUF_SIMPLE_DEFINE(resp_param, sizeof(uint32_t)); - LOG_DBG("Object Action Control Point GATT Write Operation"); + LOG_DBG("OtsOacpGattWr"); if (!ots->oacp_ind.is_enabled) { - LOG_WRN("OACP indications not enabled"); + LOG_WRN("OtsOacpIndNotEnabled"); return BT_GATT_ERR(BT_ATT_ERR_CCC_IMPROPER_CONF); } if (offset != 0) { - LOG_ERR("Invalid offset of OACP Write Request"); + LOG_WRN("OtsOacpWrReqInvOft"); return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); } if (k_work_is_pending(&ots->oacp_ind.work)) { - LOG_ERR("OACP Write received before indication sent"); + LOG_WRN("OtsOacpWrBeforeIndSent"); return BT_GATT_ERR(BT_ATT_ERR_PROCEDURE_IN_PROGRESS); } @@ -715,22 +707,21 @@ ssize_t bt_gatt_ots_oacp_write(struct bt_conn *conn, case 0: oacp_status = oacp_proc_validate(conn, ots, &oacp_proc, &resp_param); if (oacp_status != BT_GATT_OTS_OACP_RES_SUCCESS) { - LOG_WRN("OACP Write error status: 0x%02X", oacp_status); + LOG_WRN("OtsOacpWrErrStatus[%02x]", oacp_status); } break; case -ENOTSUP: oacp_status = BT_GATT_OTS_OACP_RES_OPCODE_NOT_SUP; - LOG_WRN("OACP unsupported procedure type: 0x%02X", oacp_proc.type); + LOG_WRN("OtsOacpUnsuppProcType[%02x]", oacp_proc.type); break; case -EBADMSG: - LOG_ERR("Invalid length of OACP Write Request for 0x%02X " - "Op Code", oacp_proc.type); + LOG_WRN("OtsOacpWrReqInvLen[%02x]", oacp_proc.type); return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); case -ENODATA: - LOG_ERR("Invalid length of OACP Write Request"); + LOG_WRN("OtsOacpWrReqNoData"); return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); default: - LOG_ERR("Invalid return code from oacp_command_decode: %d", decode_status); + LOG_ERR("OtsOacpDecodeInvRc[%d]", decode_status); return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); } @@ -745,7 +736,7 @@ void bt_gatt_ots_oacp_cfg_changed(const struct bt_gatt_attr *attr, CONTAINER_OF((struct bt_gatt_ccc_managed_user_data *) attr->user_data, struct bt_gatt_ots_indicate, ccc); - LOG_DBG("Object Action Control Point CCCD value: 0x%04X", value); + LOG_DBG("OtsOacpCccd[%04x]", value); oacp_ind->is_enabled = false; if (value == BT_GATT_CCC_INDICATE) { diff --git a/components/bt/esp_ble_audio/host/services/ots/ots_olcp.c b/components/bt/esp_ble_audio/host/services/ots/ots_olcp.c index f6e84d12732..c1982bde8bc 100644 --- a/components/bt/esp_ble_audio/host/services/ots/ots_olcp.c +++ b/components/bt/esp_ble_audio/host/services/ots/ots_olcp.c @@ -119,7 +119,7 @@ static enum bt_gatt_ots_olcp_res_code olcp_goto_proc_execute( struct bt_gatt_ots_object *id_obj; if (!BT_OTS_VALID_OBJ_ID(id)) { - LOG_DBG("Invalid object ID 0x%016llx", id); + LOG_WRN("OtsOlcpInvObjId[%016llx]", id); return BT_GATT_OTS_OLCP_RES_INVALID_PARAMETER; } @@ -139,7 +139,7 @@ static enum bt_gatt_ots_olcp_res_code olcp_goto_proc_execute( static enum bt_gatt_ots_olcp_res_code olcp_proc_execute( struct bt_ots *ots, struct bt_gatt_ots_olcp_proc *proc) { - LOG_DBG("Executing OLCP procedure with 0x%02X Op Code", proc->type); + LOG_DBG("OtsOlcpExecProc[%02x]", proc->type); switch (proc->type) { case BT_GATT_OTS_OLCP_PROC_FIRST: @@ -200,7 +200,7 @@ static void olcp_ind_cb(struct bt_conn *conn, struct bt_gatt_indicate_params *params, uint8_t err) { - LOG_DBG("Received OLCP Indication ACK with status: 0x%04X", err); + LOG_DBG("OtsOlcpRecvIndAck[%04x]", err); } static void olcp_ind_send(const struct bt_gatt_attr *olcp_attr, @@ -227,7 +227,7 @@ static void olcp_ind_send(const struct bt_gatt_attr *olcp_attr, ots->olcp_ind.params.chan_opt = BT_ATT_CHAN_OPT_NONE; #endif /* CONFIG_BT_EATT */ - LOG_DBG("Sending OLCP indication"); + LOG_DBG("OtsOlcpSendInd"); k_work_submit(&ots->olcp_ind.work); } @@ -243,20 +243,20 @@ ssize_t bt_gatt_ots_olcp_write(struct bt_conn *conn, struct bt_gatt_ots_olcp_proc olcp_proc; struct bt_ots *ots = (struct bt_ots *) attr->user_data; - LOG_DBG("Object List Control Point GATT Write Operation"); + LOG_DBG("OtsOlcpGattWr"); if (!ots->olcp_ind.is_enabled) { - LOG_WRN("OLCP indications not enabled"); + LOG_WRN("OtsOlcpIndNotEnabled"); return BT_GATT_ERR(BT_ATT_ERR_CCC_IMPROPER_CONF); } if (offset != 0) { - LOG_ERR("Invalid offset of OLCP Write Request"); + LOG_WRN("OtsOlcpWrReqInvOft"); return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); } if (k_work_is_pending(&ots->olcp_ind.work)) { - LOG_ERR("OLCP Write received before indication sent"); + LOG_WRN("OtsOlcpWrBeforeIndSent"); return BT_GATT_ERR(BT_ATT_ERR_PROCEDURE_IN_PROGRESS); } @@ -267,14 +267,13 @@ ssize_t bt_gatt_ots_olcp_write(struct bt_conn *conn, case 0: olcp_status = olcp_proc_execute(ots, &olcp_proc); if (olcp_status != BT_GATT_OTS_OLCP_RES_SUCCESS) { - LOG_WRN("OLCP Write error status: 0x%02X", olcp_status); + LOG_WRN("OtsOlcpWrErrStatus[%02x]", olcp_status); } else if (old_obj != ots->cur_obj) { char id[BT_OTS_OBJ_ID_STR_LEN]; bt_ots_obj_id_to_str(ots->cur_obj->id, id, sizeof(id)); - LOG_DBG("Selecting a new Current Object with id: %s", - id); + LOG_DBG("OtsOlcpSelNewCurObj[%s]", id); if (IS_ENABLED(CONFIG_BT_OTS_DIR_LIST_OBJ)) { bt_ots_dir_list_selected(ots->dir_list, ots->obj_manager, @@ -288,17 +287,16 @@ ssize_t bt_gatt_ots_olcp_write(struct bt_conn *conn, break; case -ENOTSUP: olcp_status = BT_GATT_OTS_OLCP_RES_PROC_NOT_SUP; - LOG_WRN("OLCP unsupported procedure type: 0x%02X", olcp_proc.type); + LOG_WRN("OtsOlcpUnsuppProcType[%02x]", olcp_proc.type); break; case -EBADMSG: - LOG_ERR("Invalid length of OLCP Write Request for 0x%02X " - "Op Code", olcp_proc.type); + LOG_WRN("OtsOlcpWrReqInvLen[%02x]", olcp_proc.type); return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); case -ENODATA: - LOG_ERR("Invalid size of OLCP Write Request"); + LOG_WRN("OtsOlcpWrReqNoData"); return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); default: - LOG_ERR("Invalid return code from olcp_command_decode: %d", decode_status); + LOG_ERR("OtsOlcpDecodeInvRc[%d]", decode_status); return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY); } @@ -313,7 +311,7 @@ void bt_gatt_ots_olcp_cfg_changed(const struct bt_gatt_attr *attr, CONTAINER_OF((struct bt_gatt_ccc_managed_user_data *) attr->user_data, struct bt_gatt_ots_indicate, ccc); - LOG_DBG("Object List Control Point CCCD value: 0x%04X", value); + LOG_DBG("OtsOlcpCccd[%04x]", value); olcp_ind->is_enabled = false; if (value == BT_GATT_CCC_INDICATE) { diff --git a/components/bt/esp_ble_audio/lib/lib b/components/bt/esp_ble_audio/lib/lib index b69d90c8604..9704d56f63e 160000 --- a/components/bt/esp_ble_audio/lib/lib +++ b/components/bt/esp_ble_audio/lib/lib @@ -1 +1 @@ -Subproject commit b69d90c86049f7d49bcc5ca7961c91e2691bc253 +Subproject commit 9704d56f63e0eef19b52bbef1958df575abde5dc diff --git a/components/bt/esp_ble_iso/Kconfig.in b/components/bt/esp_ble_iso/Kconfig.in index 5238b01bd47..186af695748 100644 --- a/components/bt/esp_ble_iso/Kconfig.in +++ b/components/bt/esp_ble_iso/Kconfig.in @@ -189,6 +189,8 @@ if BT_ISO choice BT_ISO_LOG_LEVEL prompt "BLE_ISO_LOG_LEVEL" + default BT_ISO_LOG_LEVEL_INFO if BT_LOG_CRITICAL_ONLY_ISO + default BT_ISO_LOG_LEVEL_DEBUG if BLE_COMPRESSED_LOG_ENABLE default BT_ISO_LOG_LEVEL_WARNING depends on !BT_ISO_NO_LOG help diff --git a/components/bt/esp_ble_iso/host/adapter/bluedroid/gatt/gatt.c b/components/bt/esp_ble_iso/host/adapter/bluedroid/gatt/gatt.c index e61431e1e48..d1ede2c903f 100644 --- a/components/bt/esp_ble_iso/host/adapter/bluedroid/gatt/gatt.c +++ b/components/bt/esp_ble_iso/host/adapter/bluedroid/gatt/gatt.c @@ -1983,7 +1983,7 @@ static void handle_gatts_read_event(struct bt_le_gatts_read_event *event) * values larger than one PDU (e.g. a BASS Broadcast Receive State). */ ret = attr->read(conn, attr, (void *)rsp, GATT_MAX_ATTR_LEN, event->offset); if (ret < 0) { - LOG_DBG("[B]GattsRdEvtErr[%u][%d]", event->attr_handle, ret); + LOG_WRN("[B]GattsRdEvtErr[%u][%d]", event->attr_handle, ret); status = BT_GATT_ERR(ret); } @@ -2178,7 +2178,7 @@ static void handle_gatts_write_event(struct bt_le_gatts_write_event *event) } else { ret = attr->write(conn, attr, event->value, event->len, 0, 0); if (ret < 0) { - LOG_DBG("[B]GattsWrEvtErr[%u][%d]", event->attr_handle, ret); + LOG_WRN("[B]GattsWrEvtErr[%u][%d]", event->attr_handle, ret); status = BT_GATT_ERR(ret); } @@ -2239,7 +2239,7 @@ static void handle_gatts_exec_write_event(struct bt_le_gatts_exec_write_event *e } else { ret = attr->write(conn, attr, gatt_conn->prep_buf, gatt_conn->prep_len, 0, 0); if (ret < 0) { - LOG_DBG("[B]GattsExecWrErr[%u][%d]", gatt_conn->prep_attr_handle, (int)ret); + LOG_WRN("[B]GattsExecWrErr[%u][%d]", gatt_conn->prep_attr_handle, (int)ret); status = BT_GATT_ERR(ret); } } diff --git a/components/bt/esp_ble_iso/host/common/gatt.c b/components/bt/esp_ble_iso/host/common/gatt.c index 76b68669195..24e53f50e4c 100644 --- a/components/bt/esp_ble_iso/host/common/gatt.c +++ b/components/bt/esp_ble_iso/host/common/gatt.c @@ -307,7 +307,7 @@ static uint8_t gatt_foreach_iter(const struct bt_gatt_attr *attr, /* Match attribute user_data if set */ if (attr_data && attr_data != attr->user_data) { - LOG_DBG("GattForeachIterMismatchData"); + LOG_DBG("GattForeachIterSkipData"); return BT_GATT_ITER_CONTINUE; } diff --git a/components/bt/esp_ble_iso/host/utils/timer.c b/components/bt/esp_ble_iso/host/utils/timer.c index 781de09f890..9de91400c8d 100644 --- a/components/bt/esp_ble_iso/host/utils/timer.c +++ b/components/bt/esp_ble_iso/host/utils/timer.c @@ -34,18 +34,16 @@ static void iso_timer_cb(void *arg) err = bt_le_iso_task_post(ISO_QUEUE_ITEM_TYPE_TIMER_EVENT, work, 0); if (err) { - LOG_ERR("IsoTimerPostFail[%d]", err); + LOG_ERR("TimerCbPostFail[%d]", err); } } int k_work_submit(struct k_work *work) { - LOG_DBG("WorkSubmit[%p]", work); - assert(work); if (work->handler == NULL) { - LOG_WRN("WorkHdlrNull"); + LOG_WRN("TimerSubmitHdlrNull"); return -EINVAL; } @@ -67,62 +65,52 @@ bool k_work_is_pending(struct k_work *work) { bool is_pending; - LOG_DBG("WorkIsPending[%p]", work); - assert(work); if (work->handler == NULL) { - LOG_WRN("WorkHdlrNull"); + LOG_WRN("TimerIsPendingHdlrNull"); return false; } is_pending = (work->timer ? esp_timer_is_active(work->timer) : false); - LOG_DBG("%sPending", is_pending ? "Is" : "Not"); + LOG_DBG("TimerIsPendingRet[%s]", is_pending ? "Is" : "Not"); return is_pending; } void k_work_init(struct k_work *work, k_work_handler_t handler) { - LOG_DBG("WorkInit[%p]", work); - assert(work); - work->handler = handler; } struct k_work_delayable *k_work_delayable_from_work(struct k_work *work) { - LOG_DBG("DworkFromWork[%p]", work); - assert(work); - return (struct k_work_delayable *)work; } void k_work_init_delayable(struct k_work_delayable *dwork, k_work_handler_t handler) { - LOG_DBG("DworkInit[%p]", dwork); - assert(dwork); const esp_timer_create_args_t timer_args = { .callback = &iso_timer_cb, .arg = &dwork->work, - .name = "iso_timer", + .name = "IsoTimer", }; int err; if (dwork->work.timer) { - LOG_WRN("TimerCreated"); + LOG_WRN("TimerInitAlreadyCreated"); return; } err = esp_timer_create(&timer_args, (esp_timer_handle_t *)&dwork->work.timer); if (err) { - LOG_ERR("CreateTimerFail[%d]", err); + LOG_ERR("TimerInitCreateFail[%d]", err); /* Reset handler so the object remains in a clean uninitialized state */ dwork->work.handler = NULL; return; @@ -135,18 +123,16 @@ void k_work_deinit_delayable(struct k_work_delayable *dwork) { int err; - LOG_DBG("DworkDeinit[%p]", dwork); - assert(dwork); if (dwork->work.timer == NULL) { - LOG_INF("TimerNotCreated"); + LOG_INF("TimerDeinitNotCreated"); return; } err = esp_timer_delete(dwork->work.timer); if (err) { - LOG_ERR("DeleteTimerFail[%d]", err); + LOG_ERR("TimerDeinitDelFail[%d]", err); return; } @@ -155,12 +141,10 @@ void k_work_deinit_delayable(struct k_work_delayable *dwork) int k_work_cancel_delayable(struct k_work_delayable *dwork) { - LOG_DBG("DworkCancel[%p]", dwork); - assert(dwork); if (dwork->work.timer == NULL) { - LOG_INF("TimerNotCreated"); + LOG_INF("TimerCancelNotCreated"); return -EINVAL; } @@ -172,14 +156,12 @@ int k_work_cancel_delayable(struct k_work_delayable *dwork) bool k_work_cancel_delayable_sync(struct k_work_delayable *dwork, struct k_work_sync *sync) { - LOG_DBG("DworkCancelSync[%p]", dwork); - assert(dwork); ARG_UNUSED(sync); if (dwork->work.timer == NULL) { - LOG_INF("TimerNotCreated"); + LOG_INF("TimerCancelSyncNotCreated"); return false; } @@ -193,12 +175,10 @@ int k_work_schedule(struct k_work_delayable *dwork, k_timeout_t ms) { int err; - LOG_DBG("WorkSchedule[%p][%u]", dwork, ms); - assert(dwork); if (dwork->work.timer == NULL) { - LOG_WRN("TimerNotCreated"); + LOG_WRN("TimerSchNotCreated"); return -EINVAL; } @@ -213,7 +193,7 @@ int k_work_schedule(struct k_work_delayable *dwork, k_timeout_t ms) err = esp_timer_start_once(dwork->work.timer, ms * 1000); if (err) { - LOG_ERR("StartTimerFail[%d]", err); + LOG_ERR("TimerSchStartFail[%d]", err); return -EIO; } @@ -224,12 +204,10 @@ int k_work_reschedule(struct k_work_delayable *dwork, k_timeout_t ms) { int err; - LOG_DBG("WorkReschedule[%p][%u]", dwork, ms); - assert(dwork); if (dwork->work.timer == NULL) { - LOG_WRN("TimerNotCreated"); + LOG_WRN("TimerReschNotCreated"); return -EINVAL; } @@ -244,7 +222,7 @@ int k_work_reschedule(struct k_work_delayable *dwork, k_timeout_t ms) err = esp_timer_start_once(dwork->work.timer, ms * 1000); if (err) { - LOG_ERR("RestartTimerFail[%d]", err); + LOG_ERR("TimerReschStartFail[%d]", err); return -EIO; } @@ -255,13 +233,11 @@ int k_work_schedule_periodic_us(struct k_work_delayable *dwork, uint64_t period_ { int err; - LOG_DBG("WorkSchedulePeriodicUs[%p][%llu]", dwork, (unsigned long long)period_us); - assert(dwork); assert(period_us > 0); if (dwork->work.timer == NULL) { - LOG_WRN("TimerNotCreated"); + LOG_WRN("TimerPeriodicNotCreated"); return -EINVAL; } @@ -269,7 +245,7 @@ int k_work_schedule_periodic_us(struct k_work_delayable *dwork, uint64_t period_ err = esp_timer_start_periodic(dwork->work.timer, period_us); if (err) { - LOG_ERR("StartPeriodicTimerFail[%d]", err); + LOG_ERR("TimerPeriodicStartFail[%d]", err); return -EIO; } @@ -289,17 +265,15 @@ k_timeout_t k_work_delayable_remaining_get(struct k_work_delayable *dwork) k_timeout_t timeout; int64_t delta_us; - LOG_DBG("DworkRemainingGet[%p]", dwork); - assert(dwork); if (dwork->work.timer == NULL) { - LOG_WRN("TimerNotCreated"); + LOG_WRN("TimerRemainingNotCreated"); return 0; } if (dwork->work.timeout_us == 0) { - LOG_DBG("WorkTimeoutZero"); + LOG_DBG("TimerRemainingTimeoutZero"); return 0; } @@ -307,7 +281,7 @@ k_timeout_t k_work_delayable_remaining_get(struct k_work_delayable *dwork) timeout = (delta_us > 0 ? (k_timeout_t)(delta_us / 1000) : 0); - LOG_DBG("Timeout[%u]", timeout); + LOG_DBG("TimerRemaining[%u]", timeout); return timeout; } diff --git a/examples/bluetooth/esp_ble_audio/bap/broadcast_sink/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/bap/broadcast_sink/sdkconfig.defaults index e694c177637..d18f16f3ce6 100644 --- a/examples/bluetooth/esp_ble_audio/bap/broadcast_sink/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/bap/broadcast_sink/sdkconfig.defaults @@ -38,3 +38,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/bap/broadcast_source/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/bap/broadcast_source/sdkconfig.defaults index 2b99b23e1f6..e714f62b10a 100644 --- a/examples/bluetooth/esp_ble_audio/bap/broadcast_source/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/bap/broadcast_source/sdkconfig.defaults @@ -28,3 +28,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/bap/unicast_client/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/bap/unicast_client/sdkconfig.defaults index 8b50eed32c4..0e4c686f510 100644 --- a/examples/bluetooth/esp_ble_audio/bap/unicast_client/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/bap/unicast_client/sdkconfig.defaults @@ -30,3 +30,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/bap/unicast_server/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/bap/unicast_server/sdkconfig.defaults index fc2a7709d10..6dc9be9c29c 100644 --- a/examples/bluetooth/esp_ble_audio/bap/unicast_server/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/bap/unicast_server/sdkconfig.defaults @@ -37,3 +37,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/cap/acceptor/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/cap/acceptor/sdkconfig.defaults index 34e1e3fa68e..68847a5cfbe 100644 --- a/examples/bluetooth/esp_ble_audio/cap/acceptor/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/cap/acceptor/sdkconfig.defaults @@ -44,3 +44,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/cap/initiator/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/cap/initiator/sdkconfig.defaults index 22330e5305d..637ef694277 100644 --- a/examples/bluetooth/esp_ble_audio/cap/initiator/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/cap/initiator/sdkconfig.defaults @@ -35,3 +35,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/tmap/bmr/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/tmap/bmr/sdkconfig.defaults index 7323c7888a9..fd69ac63aa4 100644 --- a/examples/bluetooth/esp_ble_audio/tmap/bmr/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/tmap/bmr/sdkconfig.defaults @@ -35,3 +35,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/tmap/bms/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/tmap/bms/sdkconfig.defaults index 9d7da1839e5..cfab3744e76 100644 --- a/examples/bluetooth/esp_ble_audio/tmap/bms/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/tmap/bms/sdkconfig.defaults @@ -30,3 +30,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_audio/tmap/central/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/tmap/central/sdkconfig.defaults index 8ca94a85a33..959bab772bf 100644 --- a/examples/bluetooth/esp_ble_audio/tmap/central/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/tmap/central/sdkconfig.defaults @@ -40,6 +40,18 @@ CONFIG_BT_TBS_SUPPORTED_FEATURES=3 # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 + CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y CONFIG_FREERTOS_HZ=1000 diff --git a/examples/bluetooth/esp_ble_audio/tmap/peripheral/sdkconfig.defaults b/examples/bluetooth/esp_ble_audio/tmap/peripheral/sdkconfig.defaults index f573f8b6e7d..f37e7cf5b7b 100644 --- a/examples/bluetooth/esp_ble_audio/tmap/peripheral/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_audio/tmap/peripheral/sdkconfig.defaults @@ -54,3 +54,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_AUDIO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_iso/big_broadcaster/sdkconfig.defaults b/examples/bluetooth/esp_ble_iso/big_broadcaster/sdkconfig.defaults index fda2934b82e..0b754ed2a1c 100644 --- a/examples/bluetooth/esp_ble_iso/big_broadcaster/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_iso/big_broadcaster/sdkconfig.defaults @@ -24,3 +24,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_iso/big_receiver/sdkconfig.defaults b/examples/bluetooth/esp_ble_iso/big_receiver/sdkconfig.defaults index 068acc465b5..adf1860d501 100644 --- a/examples/bluetooth/esp_ble_iso/big_receiver/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_iso/big_receiver/sdkconfig.defaults @@ -24,3 +24,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_iso/cis_central/sdkconfig.defaults b/examples/bluetooth/esp_ble_iso/cis_central/sdkconfig.defaults index 43e53ecc242..f46ae665e96 100644 --- a/examples/bluetooth/esp_ble_iso/cis_central/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_iso/cis_central/sdkconfig.defaults @@ -23,3 +23,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58 diff --git a/examples/bluetooth/esp_ble_iso/cis_peripheral/sdkconfig.defaults b/examples/bluetooth/esp_ble_iso/cis_peripheral/sdkconfig.defaults index 888a87fa0a4..d121d2fbbc7 100644 --- a/examples/bluetooth/esp_ble_iso/cis_peripheral/sdkconfig.defaults +++ b/examples/bluetooth/esp_ble_iso/cis_peripheral/sdkconfig.defaults @@ -23,3 +23,15 @@ CONFIG_FREERTOS_HZ=1000 # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_BSS_SEG_EXTERNAL_MEMORY=y # CONFIG_BT_ISO_HEAP_EXTERNAL_MEMORY=y + +# Bandwidth-optimized (critical-only) compressed BLE Audio/ISO logging over +# UART DMA. Pins shown are for esp32s31 (UART0 TX = GPIO58, 3000000 baud); set +# CONFIG_BLE_LOG_PRPH_UART_DMA_* values to the port/pin your capture reads. +# CONFIG_BLE_LOG_ENABLED=y +# CONFIG_BT_LOG_CRITICAL_ONLY=y +# CONFIG_BLE_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_ISO_COMPRESSED_LOG_ENABLE=y +# CONFIG_BLE_LOG_PRPH_UART_DMA=y +# CONFIG_BLE_LOG_PRPH_UART_DMA_PORT=0 +# CONFIG_BLE_LOG_PRPH_UART_DMA_BAUD_RATE=3000000 +# CONFIG_BLE_LOG_PRPH_UART_DMA_TX_IO_NUM=58