if (p_data) {
bta_av_conn_cback(handle, bd_addr, event, p_data);
} else {
- APPL_TRACE_ERROR("%s: p_data is null", __func__);
+ APPL_TRACE_EVENT("%s: p_data is null", __func__);
}
}
p_scb->rc_handle = p_data->rc_conn_chg.handle;
APPL_TRACE_DEBUG("bta_av_rc_opened shdl:%d, srch %d", i + 1, p_scb->rc_handle);
shdl = i + 1;
- LOG_INFO("%s allow incoming AVRCP connections:%d", __func__, p_scb->use_rc);
+ APPL_TRACE_EVENT("%s allow incoming AVRCP connections:%d", __func__, p_scb->use_rc);
bta_sys_stop_timer(&p_scb->timer);
disc = p_scb->hndl;
break;
p_cb->rcb[i].shdl = shdl;
rc_open.rc_handle = i;
- APPL_TRACE_ERROR("bta_av_rc_opened rcb[%d] shdl:%d lidx:%d/%d",
+ APPL_TRACE_EVENT("bta_av_rc_opened rcb[%d] shdl:%d lidx:%d/%d",
i, shdl, p_cb->rcb[i].lidx, p_cb->lcb[BTA_AV_NUM_LINKS].lidx);
p_cb->rcb[i].status |= BTA_AV_RC_CONN_MASK;
}
#endif
- APPL_TRACE_WARNING("bta_dm_check_av:%d", bta_dm_cb.cur_av_count);
+ APPL_TRACE_EVENT("bta_dm_check_av:%d", bta_dm_cb.cur_av_count);
if (bta_dm_cb.cur_av_count) {
for (i = 0; i < bta_dm_cb.device_list.count; i++) {
p_dev = &bta_dm_cb.device_list.peer_device[i];
#endif ///BTM_SSR_INCLUDED == TRUE
}
}
- APPL_TRACE_WARNING("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
+ APPL_TRACE_EVENT("bta_dm_rm_cback:%d, status:%d", bta_dm_cb.cur_av_count, status);
}
/* Don't adjust roles for each busy/idle state transition to avoid
btc_aa_src_cb.media_feeding.cfg.pcm.num_channel *
BTC_MEDIA_TIME_TICK_MS) / 1000;
- APPL_TRACE_WARNING("pcm bytes per tick %d",
+ APPL_TRACE_EVENT("pcm bytes per tick %d",
(int)btc_aa_src_cb.media_feeding_state.pcm.bytes_per_tick);
}
}
}
case BTA_DM_INQ_CMPL_EVT: {
param.scan_rst.num_resps = p_data->inq_cmpl.num_resps;
- LOG_ERROR("%s BLE observe complete. Num Resp %d\n", __FUNCTION__, p_data->inq_cmpl.num_resps);
+ LOG_DEBUG("%s BLE observe complete. Num Resp %d\n", __FUNCTION__, p_data->inq_cmpl.num_resps);
break;
}
case BTA_DM_DISC_RES_EVT:
- LOG_ERROR("BTA_DM_DISC_RES_EVT\n");
+ LOG_DEBUG("BTA_DM_DISC_RES_EVT\n");
break;
case BTA_DM_DISC_BLE_RES_EVT:
- LOG_ERROR("BTA_DM_DISC_BLE_RES_EVT\n");
+ LOG_DEBUG("BTA_DM_DISC_BLE_RES_EVT\n");
break;
case BTA_DM_DISC_CMPL_EVT:
- LOG_ERROR("BTA_DM_DISC_CMPL_EVT\n");
+ LOG_DEBUG("BTA_DM_DISC_CMPL_EVT\n");
break;
case BTA_DM_DI_DISC_CMPL_EVT:
- LOG_ERROR("BTA_DM_DI_DISC_CMPL_EVT\n");
+ LOG_DEBUG("BTA_DM_DI_DISC_CMPL_EVT\n");
break;
case BTA_DM_SEARCH_CANCEL_CMPL_EVT:
- LOG_ERROR("BTA_DM_SEARCH_CANCEL_CMPL_EVT\n");
+ LOG_DEBUG("BTA_DM_SEARCH_CANCEL_CMPL_EVT\n");
break;
default:
LOG_ERROR("%s : Unknown event 0x%x\n", __FUNCTION__, event);
esp_gattc_cb_t btc_gattc_cb = (esp_gattc_cb_t )btc_profile_cb_get(BTC_PID_GATTC);
if (btc_gattc_cb) {
btc_gattc_cb(event, gattc_if, param);
- }
+ }
}
void btc_gattc_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
// Allocate buffer for request data if necessary
switch (msg->act) {
case BTA_GATTC_READ_DESCR_EVT:
- case BTA_GATTC_READ_CHAR_EVT:
+ case BTA_GATTC_READ_CHAR_EVT:
case BTA_GATTC_READ_MUTIPLE_EVT: {
if (p_src_data->read.p_value && p_src_data->read.p_value->p_value) {
p_dest_data->read.p_value = (tBTA_GATT_UNFMT *)osi_malloc(sizeof(tBTA_GATT_UNFMT) + p_src_data->read.p_value->len);
}
}
break;
- }
+ }
default:
break;
}
tBTA_GATTC *arg = (tBTA_GATTC *)(msg->arg);
switch (msg->act) {
case BTA_GATTC_READ_DESCR_EVT:
- case BTA_GATTC_READ_CHAR_EVT:
+ case BTA_GATTC_READ_CHAR_EVT:
case BTA_GATTC_READ_MUTIPLE_EVT: {
if (arg->read.p_value) {
osi_free(arg->read.p_value);
}
}
-esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc_uuid,
+esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc_uuid,
esp_gattc_service_elem_t *result,
uint16_t *count, uint16_t offset)
{
bta_uuid = osi_malloc(sizeof(tBT_UUID));
btc_to_bta_uuid(bta_uuid, svc_uuid);
}
-
+
BTA_GATTC_GetServiceWithUUID(conn_id, bta_uuid, &db, &svc_num);
if ((status = btc_gattc_check_valid_param(svc_num, offset)) != ESP_GATT_OK) {
if (bta_uuid) {
osi_free(bta_uuid);
}
- return status;
+ return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
}
if (db) {
osi_free(db);
}
- return status;
+ return status;
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
}
uint16_t start_handle,
uint16_t end_handle,
esp_bt_uuid_t char_uuid,
- esp_gattc_char_elem_t *result,
+ esp_gattc_char_elem_t *result,
uint16_t *count)
{
esp_gatt_status_t status;
uint16_t end_handle,
esp_bt_uuid_t char_uuid,
esp_bt_uuid_t descr_uuid,
- esp_gattc_descr_elem_t *result,
+ esp_gattc_descr_elem_t *result,
uint16_t *count)
{
esp_gatt_status_t status;
tBT_UUID bta_descr_uuid = {0};
btc_to_bta_uuid(&bta_char_uuid, &char_uuid);
btc_to_bta_uuid(&bta_descr_uuid, &descr_uuid);
-
- BTA_GATTC_GetDescrByUUID(conn_id, start_handle, end_handle,
+
+ BTA_GATTC_GetDescrByUUID(conn_id, start_handle, end_handle,
bta_char_uuid, bta_descr_uuid, &db, &descr_num);
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
} else {
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
}
-
+
*count = descr_num;
//don't forget to free the db buffer after used.
if (db) {
int descr_num = 0;
tBT_UUID bta_descr_uuid = {0};
btc_to_bta_uuid(&bta_descr_uuid, &descr_uuid);
-
+
BTA_GATTC_GetDescrByCharHandle(conn_id, char_handle, bta_descr_uuid, &db, &descr_num);
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
osi_free(db);
}
return ESP_GATT_OK;
-
+
}
esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
static void btc_gattc_write_char(btc_ble_gattc_args_t *arg)
{
- BTA_GATTC_WriteCharValue(arg->write_char.conn_id,
+ BTA_GATTC_WriteCharValue(arg->write_char.conn_id,
arg->write_char.handle,
arg->write_char.write_type,
arg->write_char.value_len,
descr_val.len = arg->write_descr.value_len;
descr_val.p_value = arg->write_descr.value;
- BTA_GATTC_WriteCharDescr(arg->write_descr.conn_id,
+ BTA_GATTC_WriteCharDescr(arg->write_descr.conn_id,
arg->write_descr.handle,
arg->write_descr.write_type, &descr_val,
arg->write_descr.auth_req);
btc_ble_gattc_args_t *arg = (btc_ble_gattc_args_t *)(msg->arg);
switch (msg->act) {
case BTC_GATTC_ACT_APP_REGISTER:
- LOG_ERROR("%s()", __func__);
btc_gattc_app_register(arg);
break;
case BTC_GATTC_ACT_APP_UNREGISTER:
*******************************************************************************/
void avct_lcb_chk_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
{
- AVCT_TRACE_WARNING("avct_lcb_chk_disc");
+ AVCT_TRACE_EVENT("avct_lcb_chk_disc");
#if (AVCT_BROWSE_INCLUDED == TRUE)
avct_close_bcb(p_lcb, p_data);
#endif
if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb)) {
- AVCT_TRACE_WARNING("closing");
+ AVCT_TRACE_EVENT("closing");
p_data->p_ccb->ch_close = TRUE;
avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data);
} else {
- AVCT_TRACE_WARNING("dealloc ccb");
+ AVCT_TRACE_EVENT("dealloc ccb");
avct_lcb_unbind_disc(p_lcb, p_data);
}
}
void btm_sec_conn_req (UINT8 *bda, UINT8 *dc)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda);
- BTM_TRACE_ERROR ("%s\n", __func__);
/* Some device may request a connection before we are done with the HCI_Reset sequence */
if (!controller_get_interface()->get_is_ready()) {
BTM_TRACE_ERROR ("Security Manager: connect request when device not ready\n");
btm_acl_resubmit_page();
- BTM_TRACE_ERROR ("%s\n", __func__);
/* Commenting out trace due to obf/compilation problems.
*/
#if (BT_USE_TRACES == TRUE && SMP_INCLUDED == TRUE)
if (p_e->p_callback) {
(*p_e->p_callback) (p_dev_rec->bd_addr, transport, p_e->p_ref_data, res);
}
-
+
fixed_queue_try_remove_from_queue(btm_cb.sec_pending_q, (void *)p_e);
}
}
/*******************************************************************/
#if (SDP_RAW_DATA_INCLUDED == TRUE)
- SDP_TRACE_WARNING("process_service_search_attr_rsp\n");
+ SDP_TRACE_DEBUG("process_service_search_attr_rsp\n");
sdp_copy_raw_data (p_ccb, TRUE);
#endif
sample_rate = 48000;
}
i2s_set_clk(0, sample_rate, 16, 2);
-
+
ESP_LOGI(BT_AV_TAG, "Configure audio player %x-%x-%x-%x",
a2d->audio_cfg.mcc.cie.sbc[0],
a2d->audio_cfg.mcc.cie.sbc[1],
static void bt_app_av_sm_hdlr(uint16_t event, void *param)
{
- ESP_LOGE(BT_AV_TAG, "%s state %d, evt 0x%x", __func__, m_a2d_state, event);
+ ESP_LOGI(BT_AV_TAG, "%s state %d, evt 0x%x", __func__, m_a2d_state, event);
switch (m_a2d_state) {
case APP_AV_STATE_DISCOVERING:
case APP_AV_STATE_DISCOVERED:
switch (event) {
case ESP_GATTC_REG_EVT:
- ESP_LOGE(GATTC_TAG, "REG EVT, set scan params");
+ ESP_LOGI(GATTC_TAG, "REG EVT, set scan params");
esp_ble_gap_set_scan_params(&ble_scan_params);
break;
case ESP_GATTC_CONNECT_EVT:
static void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param)
{
- ESP_LOGE(GATTS_TABLE_TAG, "GAP_EVT, event %d\n", event);
+ ESP_LOGI(GATTS_TABLE_TAG, "GAP_EVT, event %d\n", event);
switch (event) {
case ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT:
esp_ble_gatts_cb_param_t *p_data = (esp_ble_gatts_cb_param_t *) param;
uint8_t res = 0xff;
- ESP_LOGE(GATTS_TABLE_TAG, "event = %x\n",event);
+ ESP_LOGI(GATTS_TABLE_TAG, "event = %x\n",event);
switch (event) {
case ESP_GATTS_REG_EVT:
ESP_LOGI(GATTS_TABLE_TAG, "%s %d\n", __func__, __LINE__);
return;
}
}
-
+
do {
int idx;
for (idx = 0; idx < SPP_PROFILE_NUM; idx++) {
break;
case ESP_GAP_BLE_PASSKEY_NOTIF_EVT: ///the app will receive this evt when the IO has Output capability and the peer device IO has Input capability.
///show the passkey number to the user to input it in the peer deivce.
- ESP_LOGE(GATTC_TAG, "The passkey Notify number:%d", param->ble_security.key_notif.passkey);
+ ESP_LOGI(GATTC_TAG, "The passkey Notify number:%d", param->ble_security.key_notif.passkey);
break;
case ESP_GAP_BLE_KEY_EVT:
//shows the ble key info share with peer device to the user.
esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t));
/* If your BLE device act as a Slave, the init_key means you hope which types of key of the master should distribut to you,
and the response key means which key you can distribut to the Master;
- If your BLE device act as a master, the response key means you hope which types of key of the slave should distribut to you,
+ If your BLE device act as a master, the response key means you hope which types of key of the slave should distribut to you,
and the init key means which key you can distribut to the slave. */
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));
uint16_t heart_rate_handle_table[HRS_IDX_NB];
-esp_attr_value_t gatts_demo_char1_val =
+esp_attr_value_t gatts_demo_char1_val =
{
.attr_max_len = GATTS_DEMO_CHAR_VAL_LEN_MAX,
.attr_len = sizeof(heart_str),
esp_bt_uuid_t descr_uuid;
};
-static void gatts_profile_event_handler(esp_gatts_cb_event_t event,
+static void gatts_profile_event_handler(esp_gatts_cb_event_t event,
esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param);
/* One gatt-based profile one app_id and one gatts_if, this array will store the gatts_if returned by ESP_GATTS_REG_EVT */
static const esp_gatts_attr_db_t heart_rate_gatt_db[HRS_IDX_NB] =
{
// Heart Rate Service Declaration
- [HRS_IDX_SVC] =
+ [HRS_IDX_SVC] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&primary_service_uuid, ESP_GATT_PERM_READ,
sizeof(uint16_t), sizeof(heart_rate_svc), (uint8_t *)&heart_rate_svc}},
// Heart Rate Measurement Characteristic Declaration
- [HRS_IDX_HR_MEAS_CHAR] =
+ [HRS_IDX_HR_MEAS_CHAR] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
CHAR_DECLARATION_SIZE,CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_notify}},
-
+
// Heart Rate Measurement Characteristic Value
- [HRS_IDX_HR_MEAS_VAL] =
+ [HRS_IDX_HR_MEAS_VAL] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&heart_rate_meas_uuid, ESP_GATT_PERM_READ,
HRPS_HT_MEAS_MAX_LEN,0, NULL}},
// Heart Rate Measurement Characteristic - Client Characteristic Configuration Descriptor
- [HRS_IDX_HR_MEAS_NTF_CFG] =
+ [HRS_IDX_HR_MEAS_NTF_CFG] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_client_config_uuid, ESP_GATT_PERM_READ|ESP_GATT_PERM_WRITE,
sizeof(uint16_t),sizeof(heart_measurement_ccc), (uint8_t *)heart_measurement_ccc}},
// Body Sensor Location Characteristic Declaration
- [HRS_IDX_BOBY_SENSOR_LOC_CHAR] =
+ [HRS_IDX_BOBY_SENSOR_LOC_CHAR] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
CHAR_DECLARATION_SIZE,CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_read}},
// Body Sensor Location Characteristic Value
- [HRS_IDX_BOBY_SENSOR_LOC_VAL] =
+ [HRS_IDX_BOBY_SENSOR_LOC_VAL] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&body_sensor_location_uuid, ESP_GATT_PERM_READ_ENCRYPTED,
sizeof(uint8_t), sizeof(body_sensor_loc_val), (uint8_t *)body_sensor_loc_val}},
// Heart Rate Control Point Characteristic Declaration
- [HRS_IDX_HR_CTNL_PT_CHAR] =
+ [HRS_IDX_HR_CTNL_PT_CHAR] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
CHAR_DECLARATION_SIZE,CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_read_write}},
-
+
// Heart Rate Control Point Characteristic Value
- [HRS_IDX_HR_CTNL_PT_VAL] =
+ [HRS_IDX_HR_CTNL_PT_VAL] =
{{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&heart_rate_ctrl_point, ESP_GATT_PERM_WRITE_ENCRYPTED|ESP_GATT_PERM_READ_ENCRYPTED,
- sizeof(uint8_t), sizeof(heart_ctrl_point), (uint8_t *)heart_ctrl_point}},
+ sizeof(uint8_t), sizeof(heart_ctrl_point), (uint8_t *)heart_ctrl_point}},
};
static char *esp_key_type_to_str(esp_ble_key_type_t key_type)
break;
case ESP_GAP_BLE_PASSKEY_NOTIF_EVT: ///the app will receive this evt when the IO has Output capability and the peer device IO has Input capability.
///show the passkey number to the user to input it in the peer deivce.
- ESP_LOGE(GATTS_TABLE_TAG, "The passkey Notify number:%d", param->ble_security.key_notif.passkey);
+ ESP_LOGI(GATTS_TABLE_TAG, "The passkey Notify number:%d", param->ble_security.key_notif.passkey);
break;
case ESP_GAP_BLE_KEY_EVT:
//shows the ble key info share with peer device to the user.
break;
case ESP_GATTS_READ_EVT:
break;
- case ESP_GATTS_WRITE_EVT:
+ case ESP_GATTS_WRITE_EVT:
ESP_LOGI(GATTS_TABLE_TAG, "ESP_GATTS_WRITE_EVT, write value:");
esp_log_buffer_hex(GATTS_TABLE_TAG, param->write.value, param->write.len);
break;
}
-static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
+static void gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if,
esp_ble_gatts_cb_param_t *param)
{
/* If event is register event, store the gatts_if for each profile */
heart_rate_profile_tab[HEART_PROFILE_APP_IDX].gatts_if = gatts_if;
} else {
ESP_LOGI(GATTS_TABLE_TAG, "Reg app failed, app_id %04x, status %d\n",
- param->reg.app_id,
+ param->reg.app_id,
param->reg.status);
return;
}
esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t));
/* If your BLE device act as a Slave, the init_key means you hope which types of key of the master should distribut to you,
and the response key means which key you can distribut to the Master;
- If your BLE device act as a master, the response key means you hope which types of key of the slave should distribut to you,
+ If your BLE device act as a master, the response key means you hope which types of key of the slave should distribut to you,
and the init key means which key you can distribut to the slave. */
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));
- /* Just show how to clear all the bonded devices
+ /* Just show how to clear all the bonded devices
* Delay 30s, clear all the bonded devices
- *
+ *
* vTaskDelay(30000 / portTICK_PERIOD_MS);
* remove_all_bonded_devices();
*/
case ESP_GAP_BLE_SCAN_START_COMPLETE_EVT:
//scan start complete event to indicate scan start successfully or failed
if (param->scan_start_cmpl.status == ESP_BT_STATUS_SUCCESS) {
- ESP_LOGE(GATTC_TAG, "Scan start success");
+ ESP_LOGI(GATTC_TAG, "Scan start success");
}else{
ESP_LOGE(GATTC_TAG, "Scan start failed");
}