Loading system/bta/dm/bta_dm_api.c +9 −4 Original line number Diff line number Diff line Loading @@ -2544,13 +2544,18 @@ void BTA_VendorInit (void) void BTA_VendorCleanup (void) { tBTM_BLE_VSC_CB cmn_ble_vsc_cb; BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb); #if (BLE_INCLUDED == TRUE && BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE) if (cmn_ble_vsc_cb.max_filter > 0) { btm_ble_adv_filter_cleanup(); btm_ble_vendor_cleanup(); #endif } BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb); if (cmn_ble_vsc_cb.tot_scan_results_strg > 0) btm_ble_batchscan_cleanup(); #endif if(cmn_ble_vsc_cb.adv_inst_max > 0) btm_ble_multi_adv_cleanup(); Loading system/btif/src/btif_gatt_client.c +4 −1 Original line number Diff line number Diff line Loading @@ -732,7 +732,7 @@ static void btif_gattc_upstreams_evt(uint16_t event, char* p_param) btgatt_batch_track_cb_t *p_data = (btgatt_batch_track_cb_t*) p_param; uint8_t *p_rep_data = NULL; if (p_data->read_reports.data_len > 0) if (p_data->read_reports.data_len > 0 && NULL != p_data->read_reports.p_rep_data) { p_rep_data = GKI_getbuf(p_data->read_reports.data_len); memcpy(p_rep_data, p_data->read_reports.p_rep_data, p_data->read_reports.data_len); Loading @@ -741,6 +741,8 @@ static void btif_gattc_upstreams_evt(uint16_t event, char* p_param) HAL_CBACK(bt_gatt_callbacks, client->batchscan_reports_cb , p_data->client_if, p_data->status, p_data->read_reports.report_format , p_data->read_reports.num_records, p_data->read_reports.data_len, p_rep_data); if (NULL != p_rep_data) GKI_freebuf(p_rep_data); break; } Loading Loading @@ -926,6 +928,7 @@ static void bta_batch_scan_reports_cb(tBTA_DM_BLE_REF_VALUE ref_value, UINT8 rep UINT8* p_rep_data, tBTA_STATUS status) { btgatt_batch_track_cb_t btif_scan_track_cb; memset(&btif_scan_track_cb, 0, sizeof(btgatt_batch_track_cb_t)); BTIF_TRACE_DEBUG("%s - client_if:%d, %d, %d, %d",__FUNCTION__, ref_value, status, num_records, data_len); Loading system/stack/btm/btm_ble_batchscan.c +35 −27 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ tBTM_BLE_ADV_TRACK_CB ble_advtrack_cb; ** Local functions *******************************************************************************/ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params); void btm_ble_batchscan_cleanup(void); /******************************************************************************* ** Loading Loading @@ -172,7 +172,6 @@ void btm_ble_batchscan_enq_rep_data(UINT8 report_format, UINT8 num_records, UINT { len = ble_batchscan_cb.main_rep_q.data_len[index]; p_orig_data = ble_batchscan_cb.main_rep_q.p_data[index]; if (NULL != p_orig_data) { p_app_data = GKI_getbuf(len + data_len); Loading @@ -180,16 +179,17 @@ void btm_ble_batchscan_enq_rep_data(UINT8 report_format, UINT8 num_records, UINT memcpy(p_app_data+len, p_data, data_len); GKI_freebuf(p_orig_data); ble_batchscan_cb.main_rep_q.p_data[index] = p_app_data; ble_batchscan_cb.main_rep_q.num_records[index] += num_records; ble_batchscan_cb.main_rep_q.data_len[index] += data_len; } else { p_app_data = GKI_getbuf(data_len); memcpy(p_app_data, p_data, data_len); ble_batchscan_cb.main_rep_q.p_data[index] = p_app_data; ble_batchscan_cb.main_rep_q.num_records[index] = num_records; ble_batchscan_cb.main_rep_q.data_len[index] = data_len; } ble_batchscan_cb.main_rep_q.num_records[index] += num_records; ble_batchscan_cb.main_rep_q.data_len[index] += data_len; } } Loading Loading @@ -373,26 +373,7 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params) status, ble_batchscan_cb.cur_state, cb_evt); /* Clear the queues here */ if(BTM_SUCCESS == status && BTM_BLE_SCAN_DISABLE_CALLED == cur_state) { for (index = 0; index < BTM_BLE_BATCH_REP_MAIN_Q_SIZE; index++) { ble_batchscan_cb.main_rep_q.rep_mode[index] = 0; if (NULL != ble_batchscan_cb.main_rep_q.p_data[index]) GKI_freebuf(ble_batchscan_cb.main_rep_q.p_data[index]); ble_batchscan_cb.main_rep_q.p_data[index] = NULL; ble_batchscan_cb.main_rep_q.ref_value[index] = 0; ble_batchscan_cb.main_rep_q.num_records[index] = 0; } for (index = 0; index < BTM_BLE_BATCH_SCAN_MAX; index++) { ble_batchscan_cb.op_q.sub_code[index] = 0; ble_batchscan_cb.op_q.ref_value[index] = 0; ble_batchscan_cb.op_q.cur_state[index] = 0; } ble_batchscan_cb.op_q.pending_idx = 0; ble_batchscan_cb.op_q.next_idx = 0; } btm_ble_batchscan_cleanup(); if (cb_evt != 0 && NULL != ble_batchscan_cb.p_setup_cback) ble_batchscan_cb.p_setup_cback(cb_evt, ref_value, status); Loading Loading @@ -899,4 +880,31 @@ void btm_ble_batchscan_init(void) BTM_RegisterForVSEvents(btm_ble_batchscan_filter_track_adv_vse_cback, TRUE); } /******************************************************************************* ** ** Function btm_ble_batchscan_cleanup ** ** Description This function cleans the batch scan control block. ** ** Parameters None ** ** Returns void ** *******************************************************************************/ void btm_ble_batchscan_cleanup(void) { int index = 0; BTM_TRACE_EVENT (" btm_ble_batchscan_cleanup"); for (index = 0; index < BTM_BLE_BATCH_REP_MAIN_Q_SIZE; index++) { if (NULL != ble_batchscan_cb.main_rep_q.p_data[index]) GKI_freebuf(ble_batchscan_cb.main_rep_q.p_data[index]); ble_batchscan_cb.main_rep_q.p_data[index] = NULL; } memset(&ble_batchscan_cb, 0, sizeof(tBTM_BLE_BATCH_SCAN_CB)); memset(&ble_advtrack_cb, 0, sizeof(tBTM_BLE_ADV_TRACK_CB)); } #endif system/stack/btm/btm_ble_int.h +1 −0 Original line number Diff line number Diff line Loading @@ -400,6 +400,7 @@ extern void btm_ble_multi_adv_reenable(UINT8 inst_id); extern void btm_ble_multi_adv_enb_privacy(BOOLEAN enable); extern char btm_ble_map_adv_tx_power(int tx_power_index); extern void btm_ble_batchscan_init(void); extern void btm_ble_batchscan_cleanup(void); extern void btm_ble_adv_filter_init(void); extern void btm_ble_adv_filter_cleanup(void); extern BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request); Loading Loading
system/bta/dm/bta_dm_api.c +9 −4 Original line number Diff line number Diff line Loading @@ -2544,13 +2544,18 @@ void BTA_VendorInit (void) void BTA_VendorCleanup (void) { tBTM_BLE_VSC_CB cmn_ble_vsc_cb; BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb); #if (BLE_INCLUDED == TRUE && BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE) if (cmn_ble_vsc_cb.max_filter > 0) { btm_ble_adv_filter_cleanup(); btm_ble_vendor_cleanup(); #endif } BTM_BleGetVendorCapabilities(&cmn_ble_vsc_cb); if (cmn_ble_vsc_cb.tot_scan_results_strg > 0) btm_ble_batchscan_cleanup(); #endif if(cmn_ble_vsc_cb.adv_inst_max > 0) btm_ble_multi_adv_cleanup(); Loading
system/btif/src/btif_gatt_client.c +4 −1 Original line number Diff line number Diff line Loading @@ -732,7 +732,7 @@ static void btif_gattc_upstreams_evt(uint16_t event, char* p_param) btgatt_batch_track_cb_t *p_data = (btgatt_batch_track_cb_t*) p_param; uint8_t *p_rep_data = NULL; if (p_data->read_reports.data_len > 0) if (p_data->read_reports.data_len > 0 && NULL != p_data->read_reports.p_rep_data) { p_rep_data = GKI_getbuf(p_data->read_reports.data_len); memcpy(p_rep_data, p_data->read_reports.p_rep_data, p_data->read_reports.data_len); Loading @@ -741,6 +741,8 @@ static void btif_gattc_upstreams_evt(uint16_t event, char* p_param) HAL_CBACK(bt_gatt_callbacks, client->batchscan_reports_cb , p_data->client_if, p_data->status, p_data->read_reports.report_format , p_data->read_reports.num_records, p_data->read_reports.data_len, p_rep_data); if (NULL != p_rep_data) GKI_freebuf(p_rep_data); break; } Loading Loading @@ -926,6 +928,7 @@ static void bta_batch_scan_reports_cb(tBTA_DM_BLE_REF_VALUE ref_value, UINT8 rep UINT8* p_rep_data, tBTA_STATUS status) { btgatt_batch_track_cb_t btif_scan_track_cb; memset(&btif_scan_track_cb, 0, sizeof(btgatt_batch_track_cb_t)); BTIF_TRACE_DEBUG("%s - client_if:%d, %d, %d, %d",__FUNCTION__, ref_value, status, num_records, data_len); Loading
system/stack/btm/btm_ble_batchscan.c +35 −27 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ tBTM_BLE_ADV_TRACK_CB ble_advtrack_cb; ** Local functions *******************************************************************************/ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params); void btm_ble_batchscan_cleanup(void); /******************************************************************************* ** Loading Loading @@ -172,7 +172,6 @@ void btm_ble_batchscan_enq_rep_data(UINT8 report_format, UINT8 num_records, UINT { len = ble_batchscan_cb.main_rep_q.data_len[index]; p_orig_data = ble_batchscan_cb.main_rep_q.p_data[index]; if (NULL != p_orig_data) { p_app_data = GKI_getbuf(len + data_len); Loading @@ -180,16 +179,17 @@ void btm_ble_batchscan_enq_rep_data(UINT8 report_format, UINT8 num_records, UINT memcpy(p_app_data+len, p_data, data_len); GKI_freebuf(p_orig_data); ble_batchscan_cb.main_rep_q.p_data[index] = p_app_data; ble_batchscan_cb.main_rep_q.num_records[index] += num_records; ble_batchscan_cb.main_rep_q.data_len[index] += data_len; } else { p_app_data = GKI_getbuf(data_len); memcpy(p_app_data, p_data, data_len); ble_batchscan_cb.main_rep_q.p_data[index] = p_app_data; ble_batchscan_cb.main_rep_q.num_records[index] = num_records; ble_batchscan_cb.main_rep_q.data_len[index] = data_len; } ble_batchscan_cb.main_rep_q.num_records[index] += num_records; ble_batchscan_cb.main_rep_q.data_len[index] += data_len; } } Loading Loading @@ -373,26 +373,7 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params) status, ble_batchscan_cb.cur_state, cb_evt); /* Clear the queues here */ if(BTM_SUCCESS == status && BTM_BLE_SCAN_DISABLE_CALLED == cur_state) { for (index = 0; index < BTM_BLE_BATCH_REP_MAIN_Q_SIZE; index++) { ble_batchscan_cb.main_rep_q.rep_mode[index] = 0; if (NULL != ble_batchscan_cb.main_rep_q.p_data[index]) GKI_freebuf(ble_batchscan_cb.main_rep_q.p_data[index]); ble_batchscan_cb.main_rep_q.p_data[index] = NULL; ble_batchscan_cb.main_rep_q.ref_value[index] = 0; ble_batchscan_cb.main_rep_q.num_records[index] = 0; } for (index = 0; index < BTM_BLE_BATCH_SCAN_MAX; index++) { ble_batchscan_cb.op_q.sub_code[index] = 0; ble_batchscan_cb.op_q.ref_value[index] = 0; ble_batchscan_cb.op_q.cur_state[index] = 0; } ble_batchscan_cb.op_q.pending_idx = 0; ble_batchscan_cb.op_q.next_idx = 0; } btm_ble_batchscan_cleanup(); if (cb_evt != 0 && NULL != ble_batchscan_cb.p_setup_cback) ble_batchscan_cb.p_setup_cback(cb_evt, ref_value, status); Loading Loading @@ -899,4 +880,31 @@ void btm_ble_batchscan_init(void) BTM_RegisterForVSEvents(btm_ble_batchscan_filter_track_adv_vse_cback, TRUE); } /******************************************************************************* ** ** Function btm_ble_batchscan_cleanup ** ** Description This function cleans the batch scan control block. ** ** Parameters None ** ** Returns void ** *******************************************************************************/ void btm_ble_batchscan_cleanup(void) { int index = 0; BTM_TRACE_EVENT (" btm_ble_batchscan_cleanup"); for (index = 0; index < BTM_BLE_BATCH_REP_MAIN_Q_SIZE; index++) { if (NULL != ble_batchscan_cb.main_rep_q.p_data[index]) GKI_freebuf(ble_batchscan_cb.main_rep_q.p_data[index]); ble_batchscan_cb.main_rep_q.p_data[index] = NULL; } memset(&ble_batchscan_cb, 0, sizeof(tBTM_BLE_BATCH_SCAN_CB)); memset(&ble_advtrack_cb, 0, sizeof(tBTM_BLE_ADV_TRACK_CB)); } #endif
system/stack/btm/btm_ble_int.h +1 −0 Original line number Diff line number Diff line Loading @@ -400,6 +400,7 @@ extern void btm_ble_multi_adv_reenable(UINT8 inst_id); extern void btm_ble_multi_adv_enb_privacy(BOOLEAN enable); extern char btm_ble_map_adv_tx_power(int tx_power_index); extern void btm_ble_batchscan_init(void); extern void btm_ble_batchscan_cleanup(void); extern void btm_ble_adv_filter_init(void); extern void btm_ble_adv_filter_cleanup(void); extern BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request); Loading