component/bt : use LOG_XXX instead of print

This commit is contained in:
Tian Hao 2016-10-26 15:57:40 +08:00
parent 20d33d636b
commit 45638b3f98
14 changed files with 46 additions and 47 deletions

View file

@ -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

View file

@ -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");
}
}

View file

@ -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;

View file

@ -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)

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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:

View file

@ -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;

View file

@ -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;

View file

@ -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");
}
}

View file

@ -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)

View file

@ -47,7 +47,7 @@ static char tmp_passwd[33];
static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data)
{
char *p = NULL;
LOG_ERROR("the data is:%s\n", p_data);
LOG_DEBUG("the data is:%s\n", p_data);
#if 0
switch(event)
{
@ -63,17 +63,17 @@ static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_dat
#endif
p = strstr(p_data, HEADER_SSID);
if (p) {
ets_printf("SSID: %s\n", p+strlen(HEADER_SSID)+1);
LOG_ERROR("SSID: %s\n", p+strlen(HEADER_SSID)+1);
strcpy(tmp_ssid, p+strlen(HEADER_SSID)+1);
}
p = strstr(p_data, HEADER_PASSWD);
if (p) {
ets_printf("PASSWORD: %s\n", p+strlen(HEADER_PASSWD)+1);
LOG_ERROR("PASSWORD: %s\n", p+strlen(HEADER_PASSWD)+1);
strcpy(tmp_passwd, p+strlen(HEADER_PASSWD)+1);
}
p = strstr(p_data, HEADER_CONFIRM);
if (p) {
ets_printf("CONFIRM\n");
LOG_ERROR("CONFIRM\n");
wifi_set_blue_config(tmp_ssid, tmp_passwd);
}
@ -98,7 +98,7 @@ static BtStatus_t blufi_dm_upstreams_evt(void *arg)
const controller_t *controller = controller_get_interface();
char bdstr[18];
bdaddr_to_string(controller->get_address(), bdstr, sizeof(bdstr));
LOG_ERROR("BDA is: %s\n", bdstr);
LOG_DEBUG("BDA is: %s\n", bdstr);
} while (0);
#endif
blufi_profile_init(BlufiDataCallBack);
@ -118,7 +118,7 @@ void blufi_bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data)
{
struct dm_evt *evt;
LOG_ERROR("%s: %d\n", __func__, (uint16_t)event);
LOG_DEBUG("%s: %d\n", __func__, (uint16_t)event);
evt = (struct dm_evt *)GKI_getbuf(sizeof(struct dm_evt));
if (evt == NULL)
@ -132,7 +132,7 @@ void blufi_bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data)
BtStatus_t blufi_enable(void *arg)
{
BTM_SetTraceLevel(BT_TRACE_LEVEL_DEBUG);
BTM_SetTraceLevel(BT_TRACE_LEVEL_ERROR);
BTA_EnableBluetooth(blufi_bte_dm_evt);
vTaskDelay(1000 / portTICK_PERIOD_MS);

View file

@ -69,7 +69,7 @@ static int blufi_task_post(uint32_t sig, void *par, void *cb, void *arg)
BtStatus_t blufi_transfer_context(BtTaskCb_t cb, void *arg)
{
LOG_ERROR("%s cb %08x, arg %u\n", __func__, cb, arg);
LOG_DEBUG("%s cb %08x, arg %u\n", __func__, cb, arg);
return blufi_task_post(BLUFI_SIG_SWITCH_CONTEXT, 0, cb, arg);
}

View file

@ -43,7 +43,7 @@ void wifi_set_blue_config(char *ssid, char *passwd)
strcpy(tmp_ssid, ssid);
strcpy(tmp_passwd, passwd);
confirm = true;
printf("confirm true\n");
LOG_DEBUG("confirm true\n");
}
extern void blufi_config_failed(void);
@ -100,12 +100,12 @@ void wifiTestTask(void *pvParameters)
sta_config.sta.bssid_set = 0;
ret = esp_wifi_disconnect();
printf("esp_wifi config\n");
LOG_INFO("esp_wifi config\n");
esp_wifi_set_config(WIFI_IF_STA, &sta_config);
printf("esp_wifi connect\n");
LOG_INFO("esp_wifi connect\n");
ret = esp_wifi_connect();
if (ret != ESP_OK) {
printf("esp_wifi connect failed\n");
LOG_ERROR("esp_wifi connect failed\n");
blufi_config_failed();
}
}