component/bt : use LOG_XXX instead of print
This commit is contained in:
parent
20d33d636b
commit
45638b3f98
14 changed files with 46 additions and 47 deletions
|
@ -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]);
|
remaining_ticks = bta_dm_pm_get_remaining_ticks(&bta_dm_cb.pm_timer[i].timer[timer_idx]);
|
||||||
if (remaining_ticks < timeout)
|
if (remaining_ticks < timeout)
|
||||||
{
|
{
|
||||||
ets_printf("remain 00\n");
|
LOG_DEBUG("%s remain 0\n", __func__);
|
||||||
/* Cancel and restart the timer */
|
/* Cancel and restart the timer */
|
||||||
/*
|
/*
|
||||||
* TODO: The value of pm_action[timer_idx] is
|
* TODO: The value of pm_action[timer_idx] is
|
||||||
|
|
|
@ -179,7 +179,7 @@ void hci_hal_h4_task_post(void)
|
||||||
evt->par = 0;
|
evt->par = 0;
|
||||||
|
|
||||||
if (xQueueSend(xHciH4Queue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
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;
|
evt->par = 0;
|
||||||
|
|
||||||
if (xQueueSend(xHciHostQueue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
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
|
// Move it to the list of commands awaiting response
|
||||||
pthread_mutex_lock(&cmd_wait_q->commands_pending_response_lock);
|
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);
|
list_append(cmd_wait_q->commands_pending_response, wait_entry);
|
||||||
pthread_mutex_unlock(&cmd_wait_q->commands_pending_response_lock);
|
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_end(cmd_wait_q->commands_pending_response);
|
||||||
node = list_next(node)) {
|
node = list_next(node)) {
|
||||||
waiting_command_t *wait_entry = list_node(node);
|
waiting_command_t *wait_entry = list_node(node);
|
||||||
//ets_printf("wait_entry %08x\n", wait_entry);
|
|
||||||
if (!wait_entry || wait_entry->opcode != opcode)
|
if (!wait_entry || wait_entry->opcode != opcode)
|
||||||
continue;
|
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_DEBUG 4
|
||||||
#define LOG_LEVEL_VERBOSE 5
|
#define LOG_LEVEL_VERBOSE 5
|
||||||
#ifndef LOG_LEVEL
|
#ifndef LOG_LEVEL
|
||||||
#define LOG_LEVEL LOG_LEVEL_DEBUG
|
#define LOG_LEVEL LOG_LEVEL_ERROR
|
||||||
#endif
|
#endif
|
||||||
#define LOG_ERROR(fmt, args...) do {if (LOG_LEVEL >= LOG_LEVEL_ERROR) ets_printf(fmt,## args);} while(0)
|
#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)
|
#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++) {
|
for (i = 0; i < ALARM_CBS_NUM; i++) {
|
||||||
if (alarm_cbs[i].alarm_hdl == NULL) { //available
|
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];
|
return &alarm_cbs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,14 +61,13 @@ static void alarm_cb_handler(TimerHandle_t xTimer)
|
||||||
{
|
{
|
||||||
struct alarm_t *alarm;
|
struct alarm_t *alarm;
|
||||||
|
|
||||||
ets_printf("*********************************************************\n");
|
|
||||||
if (!xTimer) {
|
if (!xTimer) {
|
||||||
ets_printf("TimerName: NULL\n");
|
LOG_DEBUG("TimerName: NULL\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alarm = pvTimerGetTimerID(xTimer);
|
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) {
|
if (alarm->cb) {
|
||||||
alarm->cb(alarm->cb_data);
|
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 */
|
/* TODO mutex lock */
|
||||||
timer_id = alarm_cbs_lookfor_available();
|
timer_id = alarm_cbs_lookfor_available();
|
||||||
if (!timer_id) {
|
if (!timer_id) {
|
||||||
ets_printf("%s full\n", __func__);
|
LOG_ERROR("%s full\n", __func__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = xTimerCreate(alarm_name, timer_expire / portTICK_PERIOD_MS, pdFALSE, timer_id, alarm_cb_handler);
|
t = xTimerCreate(alarm_name, timer_expire / portTICK_PERIOD_MS, pdFALSE, timer_id, alarm_cb_handler);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
ets_printf("%s error\n", __func__);
|
LOG_ERROR("%s error\n", __func__);
|
||||||
return NULL;
|
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)
|
int osi_alarm_free(osi_alarm_t *alarm)
|
||||||
{
|
{
|
||||||
if (!alarm) {
|
if (!alarm) {
|
||||||
ets_printf("%s null\n", __func__);
|
LOG_ERROR("%s null\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xTimerDelete(alarm->alarm_hdl, BT_ALARM_FREE_WAIT_TICKS) != pdPASS) {
|
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;
|
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) {
|
int osi_alarm_set(osi_alarm_t *alarm, period_ms_t timeout) {
|
||||||
if (!alarm) {
|
if (!alarm) {
|
||||||
ets_printf("%s null\n", __func__);
|
LOG_ERROR("%s null\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xTimerChangePeriod(alarm->alarm_hdl, timeout / portTICK_PERIOD_MS, BT_ALARM_CHG_PERIOD_WAIT_TICKS) != pdPASS) {
|
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;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xTimerStart(alarm->alarm_hdl, BT_ALARM_START_WAIT_TICKS) != pdPASS) {
|
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;
|
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) {
|
int osi_alarm_cancel(osi_alarm_t *alarm) {
|
||||||
if (!alarm) {
|
if (!alarm) {
|
||||||
ets_printf("%s null\n", __func__);
|
LOG_ERROR("%s null\n", __func__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xTimerStop(alarm->alarm_hdl, BT_ALARM_STOP_WAIT_TICKS) != pdPASS) {
|
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;
|
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));
|
node = (list_node_t *)list->allocator->alloc(sizeof(list_node_t));
|
||||||
if (!node) {
|
if (!node) {
|
||||||
//ets_printf("list_append failed\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
node->next = NULL;
|
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) {
|
void *list_node(const list_node_t *node) {
|
||||||
assert(node != NULL);
|
assert(node != NULL);
|
||||||
//ets_printf("node %08x\n", node);
|
|
||||||
return node->data;
|
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;
|
UINT8 *p_rec_data = NULL;
|
||||||
tBTA_GATT_STATUS status;
|
tBTA_GATT_STATUS status;
|
||||||
|
|
||||||
LOG_ERROR("blufi profile cb event = %x\n",event);
|
LOG_DEBUG("blufi profile cb event = %x\n",event);
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case BTA_GATTS_REG_EVT:
|
case BTA_GATTS_REG_EVT:
|
||||||
status = p_data->reg_oper.status;
|
status = p_data->reg_oper.status;
|
||||||
|
|
||||||
LOG_ERROR("p_data->reg_oper.status = %x\n",p_data->reg_oper.status);
|
LOG_DEBUG("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.uuid.uu.uuid16=%x\n",p_data->reg_oper.uuid.uu.uuid16);
|
||||||
if(p_data->reg_oper.status != BTA_GATT_OK) {
|
if(p_data->reg_oper.status != BTA_GATT_OK) {
|
||||||
LOG_ERROR("blufi profile register failed\n");
|
LOG_ERROR("blufi profile register failed\n");
|
||||||
return;
|
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.gatt_if = p_data->reg_oper.server_if;
|
||||||
blufi_cb_env.enabled = true;
|
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);
|
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
|
//set the advertising data to the btm layer
|
||||||
BlufiBleConfigadvData(&esp32_adv_data[BLE_ADV_DATA_IDX], NULL);
|
BlufiBleConfigadvData(&esp32_adv_data[BLE_ADV_DATA_IDX], NULL);
|
||||||
//set the adversting data to the btm layer
|
//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));
|
memset(&rsp, 0, sizeof(tBTA_GATTS_API_RSP));
|
||||||
rsp.attr_value.handle = p_data->req_data.p_data->read_req.handle;
|
rsp.attr_value.handle = p_data->req_data.p_data->read_req.handle;
|
||||||
rsp.attr_value.len = 2;
|
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,
|
BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id,
|
||||||
p_data->req_data.status,&rsp);
|
p_data->req_data.status,&rsp);
|
||||||
break;
|
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,
|
BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id,
|
||||||
p_data->req_data.status,NULL);
|
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++){
|
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) {
|
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:
|
case BTA_GATTS_CONNECT_EVT:
|
||||||
//set the connection flag to true
|
//set the connection flag to true
|
||||||
blufi_env_clcb_alloc(p_data->conn.conn_id, p_data->conn.remote_bda);
|
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,
|
BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if,
|
||||||
p_data->conn.reason, p_data->conn.conn_id);
|
p_data->conn.reason, p_data->conn.conn_id);
|
||||||
/*return whether the remote device is currently connected*/
|
/*return whether the remote device is currently connected*/
|
||||||
int is_connected = BTA_DmGetConnectionState(p_data->conn.remote_bda);
|
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
|
BTA_DmBleBroadcast(0); //stop adv
|
||||||
break;
|
break;
|
||||||
case BTA_GATTS_DISCONNECT_EVT:
|
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);
|
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++)
|
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++ = cp_len + 1;
|
||||||
*p++ = BTM_BLE_AD_TYPE_MANU;
|
*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));
|
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];
|
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->callback = btu_hcif_command_complete_evt_on_task;
|
||||||
hack->response = response;
|
hack->response = response;
|
||||||
|
|
|
@ -340,7 +340,7 @@ void btu_task_post(uint32_t sig)
|
||||||
evt->par = 0;
|
evt->par = 0;
|
||||||
|
|
||||||
if (xQueueSend(xBtuQueue, &evt, 10/portTICK_RATE_MS) != pdTRUE) {
|
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++)
|
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)
|
if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1)) == NULL)
|
||||||
|
|
|
@ -47,7 +47,7 @@ static char tmp_passwd[33];
|
||||||
static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data)
|
static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
LOG_ERROR("the data is:%s\n", p_data);
|
LOG_DEBUG("the data is:%s\n", p_data);
|
||||||
#if 0
|
#if 0
|
||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
|
@ -63,17 +63,17 @@ static void BlufiDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_dat
|
||||||
#endif
|
#endif
|
||||||
p = strstr(p_data, HEADER_SSID);
|
p = strstr(p_data, HEADER_SSID);
|
||||||
if (p) {
|
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);
|
strcpy(tmp_ssid, p+strlen(HEADER_SSID)+1);
|
||||||
}
|
}
|
||||||
p = strstr(p_data, HEADER_PASSWD);
|
p = strstr(p_data, HEADER_PASSWD);
|
||||||
if (p) {
|
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);
|
strcpy(tmp_passwd, p+strlen(HEADER_PASSWD)+1);
|
||||||
}
|
}
|
||||||
p = strstr(p_data, HEADER_CONFIRM);
|
p = strstr(p_data, HEADER_CONFIRM);
|
||||||
if (p) {
|
if (p) {
|
||||||
ets_printf("CONFIRM\n");
|
LOG_ERROR("CONFIRM\n");
|
||||||
wifi_set_blue_config(tmp_ssid, tmp_passwd);
|
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();
|
const controller_t *controller = controller_get_interface();
|
||||||
char bdstr[18];
|
char bdstr[18];
|
||||||
bdaddr_to_string(controller->get_address(), bdstr, sizeof(bdstr));
|
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);
|
} while (0);
|
||||||
#endif
|
#endif
|
||||||
blufi_profile_init(BlufiDataCallBack);
|
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;
|
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));
|
evt = (struct dm_evt *)GKI_getbuf(sizeof(struct dm_evt));
|
||||||
if (evt == NULL)
|
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)
|
BtStatus_t blufi_enable(void *arg)
|
||||||
{
|
{
|
||||||
BTM_SetTraceLevel(BT_TRACE_LEVEL_DEBUG);
|
BTM_SetTraceLevel(BT_TRACE_LEVEL_ERROR);
|
||||||
|
|
||||||
BTA_EnableBluetooth(blufi_bte_dm_evt);
|
BTA_EnableBluetooth(blufi_bte_dm_evt);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
|
|
@ -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)
|
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);
|
return blufi_task_post(BLUFI_SIG_SWITCH_CONTEXT, 0, cb, arg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void wifi_set_blue_config(char *ssid, char *passwd)
|
||||||
strcpy(tmp_ssid, ssid);
|
strcpy(tmp_ssid, ssid);
|
||||||
strcpy(tmp_passwd, passwd);
|
strcpy(tmp_passwd, passwd);
|
||||||
confirm = true;
|
confirm = true;
|
||||||
printf("confirm true\n");
|
LOG_DEBUG("confirm true\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void blufi_config_failed(void);
|
extern void blufi_config_failed(void);
|
||||||
|
@ -100,12 +100,12 @@ void wifiTestTask(void *pvParameters)
|
||||||
sta_config.sta.bssid_set = 0;
|
sta_config.sta.bssid_set = 0;
|
||||||
|
|
||||||
ret = esp_wifi_disconnect();
|
ret = esp_wifi_disconnect();
|
||||||
printf("esp_wifi config\n");
|
LOG_INFO("esp_wifi config\n");
|
||||||
esp_wifi_set_config(WIFI_IF_STA, &sta_config);
|
esp_wifi_set_config(WIFI_IF_STA, &sta_config);
|
||||||
printf("esp_wifi connect\n");
|
LOG_INFO("esp_wifi connect\n");
|
||||||
ret = esp_wifi_connect();
|
ret = esp_wifi_connect();
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
printf("esp_wifi connect failed\n");
|
LOG_ERROR("esp_wifi connect failed\n");
|
||||||
blufi_config_failed();
|
blufi_config_failed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue