mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-11 21:10:05 +01:00
component/bt : use LOG_XXX instead of print
This commit is contained in:
@@ -636,7 +636,7 @@ static void bta_dm_pm_set_mode(BD_ADDR peer_addr, tBTA_DM_PM_ACTION pm_request,
|
||||
remaining_ticks = bta_dm_pm_get_remaining_ticks(&bta_dm_cb.pm_timer[i].timer[timer_idx]);
|
||||
if (remaining_ticks < timeout)
|
||||
{
|
||||
ets_printf("remain 00\n");
|
||||
LOG_DEBUG("%s remain 0\n", __func__);
|
||||
/* Cancel and restart the timer */
|
||||
/*
|
||||
* TODO: The value of pm_action[timer_idx] is
|
||||
|
||||
@@ -179,7 +179,7 @@ void hci_hal_h4_task_post(void)
|
||||
evt->par = 0;
|
||||
|
||||
if (xQueueSend(xHciH4Queue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
||||
ets_printf("xHciH4Queue failed\n");
|
||||
LOG_ERROR("xHciH4Queue failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ void hci_host_task_post(void)
|
||||
evt->par = 0;
|
||||
|
||||
if (xQueueSend(xHciHostQueue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
||||
ets_printf("xHciHostQueue failed\n");
|
||||
LOG_ERROR("xHciHostQueue failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,6 @@ static void event_command_ready(fixed_queue_t *queue) {
|
||||
|
||||
// Move it to the list of commands awaiting response
|
||||
pthread_mutex_lock(&cmd_wait_q->commands_pending_response_lock);
|
||||
//ets_printf("%s\n", __func__);
|
||||
list_append(cmd_wait_q->commands_pending_response, wait_entry);
|
||||
pthread_mutex_unlock(&cmd_wait_q->commands_pending_response_lock);
|
||||
|
||||
@@ -548,7 +547,6 @@ static waiting_command_t *get_waiting_command(command_opcode_t opcode) {
|
||||
node != list_end(cmd_wait_q->commands_pending_response);
|
||||
node = list_next(node)) {
|
||||
waiting_command_t *wait_entry = list_node(node);
|
||||
//ets_printf("wait_entry %08x\n", wait_entry);
|
||||
if (!wait_entry || wait_entry->opcode != opcode)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ inline void trc_dump_buffer(uint8_t *prefix, uint8_t *data, uint16_t len)
|
||||
#define LOG_LEVEL_DEBUG 4
|
||||
#define LOG_LEVEL_VERBOSE 5
|
||||
#ifndef LOG_LEVEL
|
||||
#define LOG_LEVEL LOG_LEVEL_DEBUG
|
||||
#define LOG_LEVEL LOG_LEVEL_ERROR
|
||||
#endif
|
||||
#define LOG_ERROR(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_ERROR) ets_printf(fmt,## args);} while(0)
|
||||
#define LOG_WARN(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_WARN) ets_printf(fmt,## args);} while(0)
|
||||
|
||||
@@ -49,7 +49,7 @@ static struct alarm_t *alarm_cbs_lookfor_available(void)
|
||||
|
||||
for (i = 0; i < ALARM_CBS_NUM; i++) {
|
||||
if (alarm_cbs[i].alarm_hdl == NULL) { //available
|
||||
ets_printf(">>>> %d %08x<<<<\n", i, &alarm_cbs[i]);
|
||||
LOG_DEBUG(">>>> %d %08x<<<<\n", i, &alarm_cbs[i]);
|
||||
return &alarm_cbs[i];
|
||||
}
|
||||
}
|
||||
@@ -61,14 +61,13 @@ static void alarm_cb_handler(TimerHandle_t xTimer)
|
||||
{
|
||||
struct alarm_t *alarm;
|
||||
|
||||
ets_printf("*********************************************************\n");
|
||||
if (!xTimer) {
|
||||
ets_printf("TimerName: NULL\n");
|
||||
LOG_DEBUG("TimerName: NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
alarm = pvTimerGetTimerID(xTimer);
|
||||
ets_printf("TimerID %08x, Name %s\n", alarm, pcTimerGetTimerName(xTimer));
|
||||
LOG_DEBUG("TimerID %08x, Name %s\n", alarm, pcTimerGetTimerName(xTimer));
|
||||
if (alarm->cb) {
|
||||
alarm->cb(alarm->cb_data);
|
||||
}
|
||||
@@ -85,13 +84,13 @@ osi_alarm_t *osi_alarm_new(char *alarm_name, osi_alarm_callback_t callback, void
|
||||
/* TODO mutex lock */
|
||||
timer_id = alarm_cbs_lookfor_available();
|
||||
if (!timer_id) {
|
||||
ets_printf("%s full\n", __func__);
|
||||
LOG_ERROR("%s full\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
t = xTimerCreate(alarm_name, timer_expire / portTICK_PERIOD_MS, pdFALSE, timer_id, alarm_cb_handler);
|
||||
if (!t) {
|
||||
ets_printf("%s error\n", __func__);
|
||||
LOG_ERROR("%s error\n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -106,12 +105,12 @@ osi_alarm_t *osi_alarm_new(char *alarm_name, osi_alarm_callback_t callback, void
|
||||
int osi_alarm_free(osi_alarm_t *alarm)
|
||||
{
|
||||
if (!alarm) {
|
||||
ets_printf("%s null\n", __func__);
|
||||
LOG_ERROR("%s null\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (xTimerDelete(alarm->alarm_hdl, BT_ALARM_FREE_WAIT_TICKS) != pdPASS) {
|
||||
ets_printf("%s error\n", __func__);
|
||||
LOG_ERROR("%s error\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -125,17 +124,17 @@ int osi_alarm_free(osi_alarm_t *alarm)
|
||||
|
||||
int osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout) {
|
||||
if (!alarm) {
|
||||
ets_printf("%s null\n", __func__);
|
||||
LOG_ERROR("%s null\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (xTimerChangePeriod(alarm->alarm_hdl, timeout / portTICK_PERIOD_MS, BT_ALARM_CHG_PERIOD_WAIT_TICKS) != pdPASS) {
|
||||
ets_printf("%s chg period error\n", __func__);
|
||||
LOG_ERROR("%s chg period error\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (xTimerStart(alarm->alarm_hdl, BT_ALARM_START_WAIT_TICKS) != pdPASS) {
|
||||
ets_printf("%s start error\n", __func__);
|
||||
LOG_ERROR("%s start error\n", __func__);
|
||||
return -3;
|
||||
}
|
||||
|
||||
@@ -145,12 +144,12 @@ int osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout) {
|
||||
|
||||
int osi_alarm_cancel(osi_alarm_t *alarm) {
|
||||
if (!alarm) {
|
||||
ets_printf("%s null\n", __func__);
|
||||
LOG_ERROR("%s null\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (xTimerStop(alarm->alarm_hdl, BT_ALARM_STOP_WAIT_TICKS) != pdPASS) {
|
||||
ets_printf("%s error\n", __func__);
|
||||
LOG_ERROR("%s error\n", __func__);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ bool list_append(list_t *list, void *data) {
|
||||
|
||||
node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
|
||||
if (!node) {
|
||||
//ets_printf("list_append failed\n");
|
||||
return false;
|
||||
}
|
||||
node->next = NULL;
|
||||
@@ -209,7 +208,6 @@ list_node_t *list_next(const list_node_t *node) {
|
||||
|
||||
void *list_node(const list_node_t *node) {
|
||||
assert(node != NULL);
|
||||
//ets_printf("node %08x\n", node);
|
||||
return node->data;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,13 +118,13 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
UINT8 *p_rec_data = NULL;
|
||||
tBTA_GATT_STATUS status;
|
||||
|
||||
LOG_ERROR("blufi profile cb event = %x\n",event);
|
||||
LOG_DEBUG("blufi profile cb event = %x\n",event);
|
||||
switch(event) {
|
||||
case BTA_GATTS_REG_EVT:
|
||||
status = p_data->reg_oper.status;
|
||||
|
||||
LOG_ERROR("p_data->reg_oper.status = %x\n",p_data->reg_oper.status);
|
||||
LOG_ERROR("(p_data->reg_oper.uuid.uu.uuid16=%x\n",p_data->reg_oper.uuid.uu.uuid16);
|
||||
LOG_DEBUG("p_data->reg_oper.status = %x\n",p_data->reg_oper.status);
|
||||
LOG_DEBUG("(p_data->reg_oper.uuid.uu.uuid16=%x\n",p_data->reg_oper.uuid.uu.uuid16);
|
||||
if(p_data->reg_oper.status != BTA_GATT_OK) {
|
||||
LOG_ERROR("blufi profile register failed\n");
|
||||
return;
|
||||
@@ -132,10 +132,10 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
|
||||
blufi_cb_env.gatt_if = p_data->reg_oper.server_if;
|
||||
blufi_cb_env.enabled = true;
|
||||
LOG_ERROR("register complete: event=%d, status=%d, server_if=%d\n",
|
||||
LOG_DEBUG("register complete: event=%d, status=%d, server_if=%d\n",
|
||||
event, status, blufi_cb_env.gatt_if);
|
||||
|
||||
LOG_ERROR("set advertising parameters\n");
|
||||
LOG_DEBUG("set advertising parameters\n");
|
||||
//set the advertising data to the btm layer
|
||||
BlufiBleConfigadvData(&esp32_adv_data[BLE_ADV_DATA_IDX], NULL);
|
||||
//set the adversting data to the btm layer
|
||||
@@ -151,6 +151,10 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
memset(&rsp, 0, sizeof(tBTA_GATTS_API_RSP));
|
||||
rsp.attr_value.handle = p_data->req_data.p_data->read_req.handle;
|
||||
rsp.attr_value.len = 2;
|
||||
//rsp.attr_value.value[0] = 0xde;
|
||||
//rsp.attr_value.value[1] = 0xed;
|
||||
//rsp.attr_value.value[2] = 0xbe;
|
||||
//rsp.attr_value.value[3] = 0xef;
|
||||
BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id,
|
||||
p_data->req_data.status,&rsp);
|
||||
break;
|
||||
@@ -158,11 +162,11 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id,
|
||||
p_data->req_data.status,NULL);
|
||||
|
||||
LOG_ERROR("Received blufi data:");
|
||||
LOG_DEBUG("Received blufi data:");
|
||||
for(int i = 0; i < p_data->req_data.p_data->write_req.len; i++){
|
||||
LOG_ERROR("%x",p_data->req_data.p_data->write_req.value[i]);
|
||||
LOG_DEBUG("%x",p_data->req_data.p_data->write_req.value[i]);
|
||||
}
|
||||
LOG_ERROR("\n");
|
||||
LOG_DEBUG("\n");
|
||||
|
||||
if (p_data->req_data.p_data->write_req.handle == blufi_cb_env.blufi_inst.blufi_hdl) {
|
||||
|
||||
@@ -203,12 +207,12 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
case BTA_GATTS_CONNECT_EVT:
|
||||
//set the connection flag to true
|
||||
blufi_env_clcb_alloc(p_data->conn.conn_id, p_data->conn.remote_bda);
|
||||
LOG_ERROR("\ndevice is connected "BT_BD_ADDR_STR", server_if=%d,reason=0x%x,connect_id=%d\n",
|
||||
LOG_DEBUG("\ndevice is connected "BT_BD_ADDR_STR", server_if=%d,reason=0x%x,connect_id=%d\n",
|
||||
BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if,
|
||||
p_data->conn.reason, p_data->conn.conn_id);
|
||||
/*return whether the remote device is currently connected*/
|
||||
int is_connected = BTA_DmGetConnectionState(p_data->conn.remote_bda);
|
||||
LOG_ERROR("is_connected=%d\n",is_connected);
|
||||
LOG_DEBUG("is_connected=%d\n",is_connected);
|
||||
BTA_DmBleBroadcast(0); //stop adv
|
||||
break;
|
||||
case BTA_GATTS_DISCONNECT_EVT:
|
||||
|
||||
@@ -1434,7 +1434,7 @@ UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst,
|
||||
LOG_ERROR("cp_len = %d\n,p_data->p_manu->len=%d\n",cp_len,p_data->p_manu->len);
|
||||
for(int i = 0; i < p_data->p_manu->len; i++)
|
||||
{
|
||||
LOG_ERROR("p_data->p_manu->p_val[%d] = %x\n",i,p_data->p_manu->p_val[i]);
|
||||
LOG_DEBUG("p_data->p_manu->p_val[%d] = %x\n",i,p_data->p_manu->p_val[i]);
|
||||
}
|
||||
*p++ = cp_len + 1;
|
||||
*p++ = BTM_BLE_AD_TYPE_MANU;
|
||||
|
||||
@@ -971,7 +971,7 @@ static void btu_hcif_command_complete_evt(BT_HDR *response, void *context)
|
||||
BT_HDR *event = osi_calloc(sizeof(BT_HDR) + sizeof(command_complete_hack_t));
|
||||
command_complete_hack_t *hack = (command_complete_hack_t *)&event->data[0];
|
||||
|
||||
LOG_ERROR("btu_hcif_command_complete_evt\n");
|
||||
LOG_DEBUG("btu_hcif_command_complete_evt\n");
|
||||
|
||||
hack->callback = btu_hcif_command_complete_evt_on_task;
|
||||
hack->response = response;
|
||||
|
||||
@@ -340,7 +340,7 @@ void btu_task_post(uint32_t sig)
|
||||
evt->par = 0;
|
||||
|
||||
if (xQueueSend(xBtuQueue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
||||
ets_printf("xBtuQueue failed\n");
|
||||
LOG_ERROR("xBtuQueue failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data)
|
||||
|
||||
for (int i = 0; i < data_len; i++)
|
||||
{
|
||||
LOG_ERROR("p_data[%d] = %x\n", i,p_data[i]);
|
||||
LOG_DEBUG("p_data[%d] = %x\n", i,p_data[i]);
|
||||
}
|
||||
|
||||
if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1)) == NULL)
|
||||
|
||||
Reference in New Issue
Block a user