Loading system/bta/dm/bta_dm_act.c +137 −1 Original line number Diff line number Diff line Loading @@ -5042,7 +5042,6 @@ void bta_dm_ble_passkey_reply (tBTA_DM_MSG *p_data) { if (p_data->pin_reply.accept) { BTM_BlePasskeyReply(p_data->ble_passkey_reply.bd_addr, BTM_SUCCESS, p_data->ble_passkey_reply.passkey); } else Loading Loading @@ -5327,6 +5326,142 @@ void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data) #endif } /******************************************************************************* ** ** Function bta_dm_ble_setup_storage ** ** Description This function configures up the storage parameters for ADV batch scanning ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data) { #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleSetStorageConfig(p_data->ble_set_storage.batch_scan_full_max, p_data->ble_set_storage.batch_scan_trunc_max, p_data->ble_set_storage.batch_scan_notify_threshold, p_data->ble_set_storage.p_setup_cback, p_data->ble_set_storage.p_thres_cback, p_data->ble_set_storage.p_read_rep_cback, p_data->ble_set_storage.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_CFG_STRG_EVT, p_data->ble_set_storage.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_dm_ble_enable_batch_scan ** ** Description This function sets up the parameters and enables batch scan ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_enable_batch_scan (tBTA_DM_MSG *p_data) { #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleEnableBatchScan(p_data->ble_enable_scan.scan_mode, p_data->ble_enable_scan.scan_int,p_data->ble_enable_scan.scan_window, p_data->ble_enable_scan.discard_rule, p_data->ble_enable_scan.addr_type, p_data->ble_enable_scan.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_ENABLE_EVT, p_data->ble_enable_scan.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_dm_ble_disable_batch_scan ** ** Description This function disables the batch scan ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data) { UNUSED(p_data); #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleDisableBatchScan(p_data->ble_disable_scan.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_DISABLE_EVT, p_data->ble_enable_scan.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_dm_ble_read_scan_reports ** ** Description This function reads the batch scan reports ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data) { #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleReadScanReports(p_data->ble_read_reports.scan_type, p_data->ble_read_reports.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_READ_REPTS_EVT, p_data->ble_enable_scan.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_ble_scan_setup_cb ** ** Description Handle the setup callback from BTM layer and forward it to app layer ** ** Parameters: ** *******************************************************************************/ void bta_ble_scan_setup_cb(tBTM_BLE_BATCH_SCAN_EVT evt, tBTM_BLE_REF_VALUE ref_value, tBTM_STATUS status) { tBTA_BLE_BATCH_SCAN_EVT bta_evt = 0; switch(evt) { case BTM_BLE_BATCH_SCAN_ENABLE_EVT: bta_evt = BTA_BLE_BATCH_SCAN_ENB_EVT; break; case BTM_BLE_BATCH_SCAN_CFG_STRG_EVT: bta_evt = BTA_BLE_BATCH_SCAN_CFG_STRG_EVT; break; case BTM_BLE_BATCH_SCAN_DISABLE_EVT: bta_evt = BTA_BLE_BATCH_SCAN_DIS_EVT; break; case BTM_BLE_BATCH_SCAN_PARAM_EVT: bta_evt = BTA_BLE_BATCH_SCAN_PARAM_EVT; break; default: break; } if(NULL != bta_dm_cb.p_setup_cback) bta_dm_cb.p_setup_cback(bta_evt, ref_value, status); } #if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)) #ifndef BTA_DM_GATT_CLOSE_DELAY_TOUT #define BTA_DM_GATT_CLOSE_DELAY_TOUT 1000 Loading Loading @@ -5661,6 +5796,7 @@ static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data) break; } } #endif /* BTA_GATT_INCLUDED */ #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE Loading system/bta/dm/bta_dm_api.c +129 −1 Original line number Diff line number Diff line /****************************************************************************** * * Copyright (C) 2003-2012 Broadcom Corporation * Copyright (C) 2003-2014 Broadcom Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -1575,6 +1575,134 @@ BTA_API extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_AD } } /******************************************************************************* ** ** Function BTA_DmBleSetStorageParams ** ** Description This function is called to override the BTA scan response. ** ** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning ** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning ** batch_scan_notify_threshold -Setup notification level based on total space ** p_setup_cback - Setup callback pointer ** p_thres_cback - Threshold callback pointer ** p_rep_cback - Reports callback pointer ** ref_value - Ref value ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max, UINT8 batch_scan_trunc_max, UINT8 batch_scan_notify_threshold, tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback, tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, tBTA_BLE_SCAN_REP_CBACK* p_rep_cback, tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_SET_STORAGE_CONFIG *p_msg; bta_dm_cb.p_setup_cback = p_setup_cback; if ((p_msg = (tBTA_DM_API_SET_STORAGE_CONFIG *) GKI_getbuf(sizeof(tBTA_DM_API_SET_STORAGE_CONFIG))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_SETUP_STORAGE_EVT; p_msg->p_setup_cback=bta_ble_scan_setup_cb; p_msg->p_thres_cback=p_thres_cback; p_msg->p_read_rep_cback=p_rep_cback; p_msg->ref_value = ref_value; p_msg->batch_scan_full_max = batch_scan_full_max; p_msg->batch_scan_trunc_max = batch_scan_trunc_max; p_msg->batch_scan_notify_threshold = batch_scan_notify_threshold; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleEnableBatchScan ** ** Description This function is called to enable the batch scan ** ** Parameters scan_mode -Batch scan mode ** scan_interval - Scan interval ** scan_window - Scan window ** discard_rule -Discard rules ** addr_type - Address type ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode, UINT32 scan_interval, UINT32 scan_window, tBTA_BLE_DISCARD_RULE discard_rule, tBLE_ADDR_TYPE addr_type, tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_ENABLE_SCAN *p_msg; if ((p_msg = (tBTA_DM_API_ENABLE_SCAN *) GKI_getbuf(sizeof(tBTA_DM_API_ENABLE_SCAN))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT; p_msg->scan_mode = scan_mode; p_msg->scan_int = scan_interval; p_msg->scan_window = scan_window; p_msg->discard_rule = discard_rule; p_msg->addr_type = addr_type; p_msg->ref_value = ref_value; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleDisableBatchScan ** ** Description This function is called to disable the batch scan ** ** Parameters ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_DISABLE_SCAN *p_msg; if ((p_msg = (tBTA_DM_API_DISABLE_SCAN *) GKI_getbuf(sizeof(tBTA_DM_API_DISABLE_SCAN))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT; p_msg->ref_value = ref_value; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleReadScanReports ** ** Description This function is called to read scan reports ** ** Parameters scan_type -Batch scan mode ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleReadScanReports(tBTA_BLE_SCAN_MODE scan_type, tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_READ_SCAN_REPORTS *p_msg; if ((p_msg = (tBTA_DM_API_READ_SCAN_REPORTS *) GKI_getbuf(sizeof(tBTA_DM_API_READ_SCAN_REPORTS))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT; p_msg->scan_type = scan_type; p_msg->ref_value = ref_value; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleBroadcast Loading system/bta/dm/bta_dm_int.h +62 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,11 @@ enum BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT, BTA_DM_API_BLE_MULTI_ADV_DATA_EVT, BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT, BTA_DM_API_BLE_SETUP_STORAGE_EVT, BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT, BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT, BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT, BTA_DM_API_BLE_TRACK_ADVERTISER_EVT, #endif #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) Loading Loading @@ -584,7 +589,6 @@ typedef struct UINT8 inst_id; }tBTA_DM_API_BLE_MULTI_ADV_DISABLE; typedef struct { BT_HDR hdr; Loading @@ -593,6 +597,51 @@ typedef struct tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback; }tBTA_DM_API_SET_ADV_CONFIG; typedef struct { BT_HDR hdr; UINT8 batch_scan_full_max; UINT8 batch_scan_trunc_max; UINT8 batch_scan_notify_threshold; tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback; tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback; tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_SET_STORAGE_CONFIG; typedef struct { BT_HDR hdr; tBTA_BLE_SCAN_MODE scan_mode; UINT32 scan_int; UINT32 scan_window; tBTA_BLE_DISCARD_RULE discard_rule; tBLE_ADDR_TYPE addr_type; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_ENABLE_SCAN; typedef struct { BT_HDR hdr; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_DISABLE_SCAN; typedef struct { BT_HDR hdr; tBTA_BLE_SCAN_MODE scan_type; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_READ_SCAN_REPORTS; typedef struct { BT_HDR hdr; UINT8 track_adv_action; tBLE_ADDR_TYPE addr_type; tBLE_BD_ADDR *p_bda; UINT8 onlost_timeout; } tBTA_DM_API_TRACK_ADVERTISER; #endif /* BLE_INCLUDED */ typedef struct Loading Loading @@ -742,6 +791,12 @@ typedef union tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param; tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data; tBTA_DM_API_BLE_MULTI_ADV_DISABLE ble_multi_adv_disable; tBTA_DM_API_SET_STORAGE_CONFIG ble_set_storage; tBTA_DM_API_ENABLE_SCAN ble_enable_scan; tBTA_DM_API_READ_SCAN_REPORTS ble_read_reports; tBTA_DM_API_DISABLE_SCAN ble_disable_scan; tBTA_DM_API_TRACK_ADVERTISER ble_track_advert; #endif tBTA_DM_API_SET_AFH_CHANNEL_ASSESSMENT set_afh_channel_assessment; Loading Loading @@ -844,6 +899,8 @@ typedef struct BOOLEAN is_bta_dm_active; tBTA_DM_ACTIVE_LINK device_list; tBTA_DM_SEC_CBACK *p_sec_cback; tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback; void *p_ref; TIMER_LIST_ENT signal_strength_timer; tBTA_SIG_STRENGTH_MASK signal_strength_mask; UINT16 state; Loading Loading @@ -1118,6 +1175,10 @@ extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data); extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data); extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data); extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data); extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG * p_data); extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG * p_data); extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG * p_data); #endif extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data); extern void bta_dm_confirm(tBTA_DM_MSG *p_data); Loading system/bta/dm/bta_dm_main.c +4 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,10 @@ const tBTA_DM_ACTION bta_dm_action[] = bta_dm_ble_multi_adv_upd_param, /* BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT */ bta_dm_ble_multi_adv_data, /* BTA_DM_API_BLE_MULTI_ADV_DATA_EVT */ btm_dm_ble_multi_adv_disable, /* BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT */ bta_dm_ble_setup_storage, /* BTA_DM_API_BLE_SETUP_STORAGE_EVT */ bta_dm_ble_enable_batch_scan, /* BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT */ bta_dm_ble_disable_batch_scan, /* BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT */ bta_dm_ble_read_scan_reports, /* BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT */ #endif #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) Loading system/bta/include/bta_api.h +122 −3 Original line number Diff line number Diff line /****************************************************************************** * * Copyright (C) 2003-2012 Broadcom Corporation * Copyright (C) 2003-2014 Broadcom Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -454,6 +454,41 @@ typedef struct UINT8 *p_remote_name; tBTA_BLE_SERVICE service; } tBTA_BLE_INQ_DATA; enum { BTA_BLE_SCAN_MODE_PASS=1, BTA_BLE_SCAN_MODE_ACTI=2, BTA_BLE_SCAN_MODE_PASS_ACTI=3 }; typedef UINT8 tBTA_BLE_SCAN_MODE; enum { BTA_BLE_DISCARD_OLD_ITEMS=0, BTA_BLE_DISCARD_LOWER_RSSI_ITEMS=1 }; typedef UINT8 tBTA_BLE_DISCARD_RULE; enum { BTA_BLE_ADV_SEEN_FIRST_TIME=0, BTA_BLE_ADV_TRACKING_TIMEOUT=1 }; typedef UINT8 tBTA_BLE_ADV_CHANGE_REASON; enum { BTA_BLE_BATCH_SCAN_ENB_EVT = 1, BTA_BLE_BATCH_SCAN_CFG_STRG_EVT = 2, BTA_BLE_BATCH_SCAN_DATA_EVT = 3, BTA_BLE_BATCH_SCAN_THRES_EVT = 4, BTA_BLE_BATCH_SCAN_PARAM_EVT = 5, BTA_BLE_BATCH_SCAN_DIS_EVT = 6 }; typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT; typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION; #endif /* BLE customer specific feature function type definitions */ Loading Loading @@ -531,8 +566,8 @@ typedef struct UINT8 data_len; /* <= 20 bytes */ UINT8 *p_pattern; UINT16 company_id_mask; /* UUID value mask */ UINT8 *p_pattern_mask; /* Manufactuer data matching mask, same length as data pattern, set to all 0xff, match exact data */ UINT8 *p_pattern_mask; /* Manufacturer data matching mask, same length as data pattern, set to all 0xff, match exact data */ }tBTA_DM_BLE_PF_MANU_COND; typedef struct Loading Loading @@ -912,6 +947,7 @@ typedef UINT8 tBTA_BLE_MULTI_ADV_EVT; /* multi adv callback */ typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event, UINT8 inst_id, void *p_ref, tBTA_STATUS status); typedef UINT8 tBTA_DM_BLE_REF_VALUE; /* Vendor Specific Command Callback */ typedef tBTM_VSC_CMPL_CB tBTA_VENDOR_CMPL_CBACK; Loading Loading @@ -1014,6 +1050,14 @@ typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, #define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM #define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT; typedef void (tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value); typedef void (tBTA_BLE_SCAN_REP_CBACK) (tBTA_DM_BLE_REF_VALUE ref_value, UINT8 report_format, UINT8 num_records, UINT16 data_len, UINT8* p_rep_data, tBTA_STATUS status); typedef void (tBTA_BLE_SCAN_SETUP_CBACK) (tBTA_BLE_BATCH_SCAN_EVT evt, tBTA_DM_BLE_REF_VALUE ref_value, tBTA_STATUS status); #else typedef UINT8 tBTA_DM_BLE_SEC_ACT; #endif Loading Loading @@ -2278,6 +2322,81 @@ BTA_API extern tBTA_STATUS BTA_BleDisableAdvInstance(UINT8 inst_id); *******************************************************************************/ BTA_API extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout); /******************************************************************************* ** ** Function BTA_DmBleSetStorageParams ** ** Description This function is called to set the storage parameters ** ** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning ** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning ** batch_scan_notify_threshold - Setup notification level based on total space ** consumed by both pools. Setting it to 0 will disable threshold notification ** p_setup_cback - Setup callback ** p_thres_cback - Threshold callback ** p_rep_cback - Reports callback ** p_ref - Ref pointer ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max, UINT8 batch_scan_trunc_max, UINT8 batch_scan_notify_threshold, tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback, tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, tBTA_BLE_SCAN_REP_CBACK* p_rep_cback, tBTA_DM_BLE_REF_VALUE ref_value); /******************************************************************************* ** ** Function BTA_DmBleEnableBatchScan ** ** Description This function is called to enable the batch scan ** ** Parameters scan_mode -Batch scan mode ** scan_interval - Scan interval ** scan_window - Scan window ** discard_rule -Discard rules ** addr_type - Address type ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode, UINT32 scan_interval, UINT32 scan_window, tBTA_BLE_DISCARD_RULE discard_rule, tBLE_ADDR_TYPE addr_type, tBTA_DM_BLE_REF_VALUE ref_value); /******************************************************************************* ** ** Function BTA_DmBleReadScanReports ** ** Description This function is called to read the batch scan reports ** ** Parameters scan_mode -Batch scan mode ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleReadScanReports(tBTA_BLE_SCAN_MODE scan_type, tBTA_DM_BLE_REF_VALUE ref_value); /******************************************************************************* ** ** Function BTA_DmBleDisableBatchScan ** ** Description This function is called to disable the batch scanning ** ** Parameters None ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value); #endif #ifdef __cplusplus Loading Loading
system/bta/dm/bta_dm_act.c +137 −1 Original line number Diff line number Diff line Loading @@ -5042,7 +5042,6 @@ void bta_dm_ble_passkey_reply (tBTA_DM_MSG *p_data) { if (p_data->pin_reply.accept) { BTM_BlePasskeyReply(p_data->ble_passkey_reply.bd_addr, BTM_SUCCESS, p_data->ble_passkey_reply.passkey); } else Loading Loading @@ -5327,6 +5326,142 @@ void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data) #endif } /******************************************************************************* ** ** Function bta_dm_ble_setup_storage ** ** Description This function configures up the storage parameters for ADV batch scanning ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data) { #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleSetStorageConfig(p_data->ble_set_storage.batch_scan_full_max, p_data->ble_set_storage.batch_scan_trunc_max, p_data->ble_set_storage.batch_scan_notify_threshold, p_data->ble_set_storage.p_setup_cback, p_data->ble_set_storage.p_thres_cback, p_data->ble_set_storage.p_read_rep_cback, p_data->ble_set_storage.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_CFG_STRG_EVT, p_data->ble_set_storage.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_dm_ble_enable_batch_scan ** ** Description This function sets up the parameters and enables batch scan ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_enable_batch_scan (tBTA_DM_MSG *p_data) { #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleEnableBatchScan(p_data->ble_enable_scan.scan_mode, p_data->ble_enable_scan.scan_int,p_data->ble_enable_scan.scan_window, p_data->ble_enable_scan.discard_rule, p_data->ble_enable_scan.addr_type, p_data->ble_enable_scan.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_ENABLE_EVT, p_data->ble_enable_scan.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_dm_ble_disable_batch_scan ** ** Description This function disables the batch scan ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data) { UNUSED(p_data); #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleDisableBatchScan(p_data->ble_disable_scan.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_DISABLE_EVT, p_data->ble_enable_scan.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_dm_ble_read_scan_reports ** ** Description This function reads the batch scan reports ** ** Parameters: ** *******************************************************************************/ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data) { #if BLE_BATCH_SCAN_INCLUDED == TRUE tBTM_STATUS btm_status = 0; btm_status = BTM_BleReadScanReports(p_data->ble_read_reports.scan_type, p_data->ble_read_reports.ref_value); if(BTM_CMD_STARTED != btm_status) bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_READ_REPTS_EVT, p_data->ble_enable_scan.ref_value, btm_status); #endif } /******************************************************************************* ** ** Function bta_ble_scan_setup_cb ** ** Description Handle the setup callback from BTM layer and forward it to app layer ** ** Parameters: ** *******************************************************************************/ void bta_ble_scan_setup_cb(tBTM_BLE_BATCH_SCAN_EVT evt, tBTM_BLE_REF_VALUE ref_value, tBTM_STATUS status) { tBTA_BLE_BATCH_SCAN_EVT bta_evt = 0; switch(evt) { case BTM_BLE_BATCH_SCAN_ENABLE_EVT: bta_evt = BTA_BLE_BATCH_SCAN_ENB_EVT; break; case BTM_BLE_BATCH_SCAN_CFG_STRG_EVT: bta_evt = BTA_BLE_BATCH_SCAN_CFG_STRG_EVT; break; case BTM_BLE_BATCH_SCAN_DISABLE_EVT: bta_evt = BTA_BLE_BATCH_SCAN_DIS_EVT; break; case BTM_BLE_BATCH_SCAN_PARAM_EVT: bta_evt = BTA_BLE_BATCH_SCAN_PARAM_EVT; break; default: break; } if(NULL != bta_dm_cb.p_setup_cback) bta_dm_cb.p_setup_cback(bta_evt, ref_value, status); } #if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE)) #ifndef BTA_DM_GATT_CLOSE_DELAY_TOUT #define BTA_DM_GATT_CLOSE_DELAY_TOUT 1000 Loading Loading @@ -5661,6 +5796,7 @@ static void bta_dm_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data) break; } } #endif /* BTA_GATT_INCLUDED */ #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE Loading
system/bta/dm/bta_dm_api.c +129 −1 Original line number Diff line number Diff line /****************************************************************************** * * Copyright (C) 2003-2012 Broadcom Corporation * Copyright (C) 2003-2014 Broadcom Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -1575,6 +1575,134 @@ BTA_API extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_AD } } /******************************************************************************* ** ** Function BTA_DmBleSetStorageParams ** ** Description This function is called to override the BTA scan response. ** ** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning ** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning ** batch_scan_notify_threshold -Setup notification level based on total space ** p_setup_cback - Setup callback pointer ** p_thres_cback - Threshold callback pointer ** p_rep_cback - Reports callback pointer ** ref_value - Ref value ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max, UINT8 batch_scan_trunc_max, UINT8 batch_scan_notify_threshold, tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback, tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, tBTA_BLE_SCAN_REP_CBACK* p_rep_cback, tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_SET_STORAGE_CONFIG *p_msg; bta_dm_cb.p_setup_cback = p_setup_cback; if ((p_msg = (tBTA_DM_API_SET_STORAGE_CONFIG *) GKI_getbuf(sizeof(tBTA_DM_API_SET_STORAGE_CONFIG))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_SETUP_STORAGE_EVT; p_msg->p_setup_cback=bta_ble_scan_setup_cb; p_msg->p_thres_cback=p_thres_cback; p_msg->p_read_rep_cback=p_rep_cback; p_msg->ref_value = ref_value; p_msg->batch_scan_full_max = batch_scan_full_max; p_msg->batch_scan_trunc_max = batch_scan_trunc_max; p_msg->batch_scan_notify_threshold = batch_scan_notify_threshold; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleEnableBatchScan ** ** Description This function is called to enable the batch scan ** ** Parameters scan_mode -Batch scan mode ** scan_interval - Scan interval ** scan_window - Scan window ** discard_rule -Discard rules ** addr_type - Address type ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode, UINT32 scan_interval, UINT32 scan_window, tBTA_BLE_DISCARD_RULE discard_rule, tBLE_ADDR_TYPE addr_type, tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_ENABLE_SCAN *p_msg; if ((p_msg = (tBTA_DM_API_ENABLE_SCAN *) GKI_getbuf(sizeof(tBTA_DM_API_ENABLE_SCAN))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT; p_msg->scan_mode = scan_mode; p_msg->scan_int = scan_interval; p_msg->scan_window = scan_window; p_msg->discard_rule = discard_rule; p_msg->addr_type = addr_type; p_msg->ref_value = ref_value; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleDisableBatchScan ** ** Description This function is called to disable the batch scan ** ** Parameters ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_DISABLE_SCAN *p_msg; if ((p_msg = (tBTA_DM_API_DISABLE_SCAN *) GKI_getbuf(sizeof(tBTA_DM_API_DISABLE_SCAN))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT; p_msg->ref_value = ref_value; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleReadScanReports ** ** Description This function is called to read scan reports ** ** Parameters scan_type -Batch scan mode ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleReadScanReports(tBTA_BLE_SCAN_MODE scan_type, tBTA_DM_BLE_REF_VALUE ref_value) { tBTA_DM_API_READ_SCAN_REPORTS *p_msg; if ((p_msg = (tBTA_DM_API_READ_SCAN_REPORTS *) GKI_getbuf(sizeof(tBTA_DM_API_READ_SCAN_REPORTS))) != NULL) { p_msg->hdr.event = BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT; p_msg->scan_type = scan_type; p_msg->ref_value = ref_value; bta_sys_sendmsg(p_msg); } } /******************************************************************************* ** ** Function BTA_DmBleBroadcast Loading
system/bta/dm/bta_dm_int.h +62 −1 Original line number Diff line number Diff line Loading @@ -118,6 +118,11 @@ enum BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT, BTA_DM_API_BLE_MULTI_ADV_DATA_EVT, BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT, BTA_DM_API_BLE_SETUP_STORAGE_EVT, BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT, BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT, BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT, BTA_DM_API_BLE_TRACK_ADVERTISER_EVT, #endif #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) Loading Loading @@ -584,7 +589,6 @@ typedef struct UINT8 inst_id; }tBTA_DM_API_BLE_MULTI_ADV_DISABLE; typedef struct { BT_HDR hdr; Loading @@ -593,6 +597,51 @@ typedef struct tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback; }tBTA_DM_API_SET_ADV_CONFIG; typedef struct { BT_HDR hdr; UINT8 batch_scan_full_max; UINT8 batch_scan_trunc_max; UINT8 batch_scan_notify_threshold; tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback; tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback; tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_SET_STORAGE_CONFIG; typedef struct { BT_HDR hdr; tBTA_BLE_SCAN_MODE scan_mode; UINT32 scan_int; UINT32 scan_window; tBTA_BLE_DISCARD_RULE discard_rule; tBLE_ADDR_TYPE addr_type; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_ENABLE_SCAN; typedef struct { BT_HDR hdr; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_DISABLE_SCAN; typedef struct { BT_HDR hdr; tBTA_BLE_SCAN_MODE scan_type; tBTA_DM_BLE_REF_VALUE ref_value; } tBTA_DM_API_READ_SCAN_REPORTS; typedef struct { BT_HDR hdr; UINT8 track_adv_action; tBLE_ADDR_TYPE addr_type; tBLE_BD_ADDR *p_bda; UINT8 onlost_timeout; } tBTA_DM_API_TRACK_ADVERTISER; #endif /* BLE_INCLUDED */ typedef struct Loading Loading @@ -742,6 +791,12 @@ typedef union tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param; tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data; tBTA_DM_API_BLE_MULTI_ADV_DISABLE ble_multi_adv_disable; tBTA_DM_API_SET_STORAGE_CONFIG ble_set_storage; tBTA_DM_API_ENABLE_SCAN ble_enable_scan; tBTA_DM_API_READ_SCAN_REPORTS ble_read_reports; tBTA_DM_API_DISABLE_SCAN ble_disable_scan; tBTA_DM_API_TRACK_ADVERTISER ble_track_advert; #endif tBTA_DM_API_SET_AFH_CHANNEL_ASSESSMENT set_afh_channel_assessment; Loading Loading @@ -844,6 +899,8 @@ typedef struct BOOLEAN is_bta_dm_active; tBTA_DM_ACTIVE_LINK device_list; tBTA_DM_SEC_CBACK *p_sec_cback; tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback; void *p_ref; TIMER_LIST_ENT signal_strength_timer; tBTA_SIG_STRENGTH_MASK signal_strength_mask; UINT16 state; Loading Loading @@ -1118,6 +1175,10 @@ extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data); extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data); extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data); extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data); extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG * p_data); extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG * p_data); extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG * p_data); #endif extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data); extern void bta_dm_confirm(tBTA_DM_MSG *p_data); Loading
system/bta/dm/bta_dm_main.c +4 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,10 @@ const tBTA_DM_ACTION bta_dm_action[] = bta_dm_ble_multi_adv_upd_param, /* BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT */ bta_dm_ble_multi_adv_data, /* BTA_DM_API_BLE_MULTI_ADV_DATA_EVT */ btm_dm_ble_multi_adv_disable, /* BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT */ bta_dm_ble_setup_storage, /* BTA_DM_API_BLE_SETUP_STORAGE_EVT */ bta_dm_ble_enable_batch_scan, /* BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT */ bta_dm_ble_disable_batch_scan, /* BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT */ bta_dm_ble_read_scan_reports, /* BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT */ #endif #if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&( BTA_EIR_CANNED_UUID_LIST != TRUE )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) Loading
system/bta/include/bta_api.h +122 −3 Original line number Diff line number Diff line /****************************************************************************** * * Copyright (C) 2003-2012 Broadcom Corporation * Copyright (C) 2003-2014 Broadcom Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. Loading Loading @@ -454,6 +454,41 @@ typedef struct UINT8 *p_remote_name; tBTA_BLE_SERVICE service; } tBTA_BLE_INQ_DATA; enum { BTA_BLE_SCAN_MODE_PASS=1, BTA_BLE_SCAN_MODE_ACTI=2, BTA_BLE_SCAN_MODE_PASS_ACTI=3 }; typedef UINT8 tBTA_BLE_SCAN_MODE; enum { BTA_BLE_DISCARD_OLD_ITEMS=0, BTA_BLE_DISCARD_LOWER_RSSI_ITEMS=1 }; typedef UINT8 tBTA_BLE_DISCARD_RULE; enum { BTA_BLE_ADV_SEEN_FIRST_TIME=0, BTA_BLE_ADV_TRACKING_TIMEOUT=1 }; typedef UINT8 tBTA_BLE_ADV_CHANGE_REASON; enum { BTA_BLE_BATCH_SCAN_ENB_EVT = 1, BTA_BLE_BATCH_SCAN_CFG_STRG_EVT = 2, BTA_BLE_BATCH_SCAN_DATA_EVT = 3, BTA_BLE_BATCH_SCAN_THRES_EVT = 4, BTA_BLE_BATCH_SCAN_PARAM_EVT = 5, BTA_BLE_BATCH_SCAN_DIS_EVT = 6 }; typedef tBTM_BLE_BATCH_SCAN_EVT tBTA_BLE_BATCH_SCAN_EVT; typedef tBTM_BLE_TRACK_ADV_ACTION tBTA_BLE_TRACK_ADV_ACTION; #endif /* BLE customer specific feature function type definitions */ Loading Loading @@ -531,8 +566,8 @@ typedef struct UINT8 data_len; /* <= 20 bytes */ UINT8 *p_pattern; UINT16 company_id_mask; /* UUID value mask */ UINT8 *p_pattern_mask; /* Manufactuer data matching mask, same length as data pattern, set to all 0xff, match exact data */ UINT8 *p_pattern_mask; /* Manufacturer data matching mask, same length as data pattern, set to all 0xff, match exact data */ }tBTA_DM_BLE_PF_MANU_COND; typedef struct Loading Loading @@ -912,6 +947,7 @@ typedef UINT8 tBTA_BLE_MULTI_ADV_EVT; /* multi adv callback */ typedef void (tBTA_BLE_MULTI_ADV_CBACK)(tBTA_BLE_MULTI_ADV_EVT event, UINT8 inst_id, void *p_ref, tBTA_STATUS status); typedef UINT8 tBTA_DM_BLE_REF_VALUE; /* Vendor Specific Command Callback */ typedef tBTM_VSC_CMPL_CB tBTA_VENDOR_CMPL_CBACK; Loading Loading @@ -1014,6 +1050,14 @@ typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, #define BTA_DM_BLE_SEC_NO_MITM BTM_BLE_SEC_ENCRYPT_NO_MITM #define BTA_DM_BLE_SEC_MITM BTM_BLE_SEC_ENCRYPT_MITM typedef tBTM_BLE_SEC_ACT tBTA_DM_BLE_SEC_ACT; typedef void (tBTA_BLE_SCAN_THRESHOLD_CBACK)(tBTA_DM_BLE_REF_VALUE ref_value); typedef void (tBTA_BLE_SCAN_REP_CBACK) (tBTA_DM_BLE_REF_VALUE ref_value, UINT8 report_format, UINT8 num_records, UINT16 data_len, UINT8* p_rep_data, tBTA_STATUS status); typedef void (tBTA_BLE_SCAN_SETUP_CBACK) (tBTA_BLE_BATCH_SCAN_EVT evt, tBTA_DM_BLE_REF_VALUE ref_value, tBTA_STATUS status); #else typedef UINT8 tBTA_DM_BLE_SEC_ACT; #endif Loading Loading @@ -2278,6 +2322,81 @@ BTA_API extern tBTA_STATUS BTA_BleDisableAdvInstance(UINT8 inst_id); *******************************************************************************/ BTA_API extern void BTA_DmBleUpdateConnectionParams(BD_ADDR bd_addr, UINT16 min_int, UINT16 max_int, UINT16 latency, UINT16 timeout); /******************************************************************************* ** ** Function BTA_DmBleSetStorageParams ** ** Description This function is called to set the storage parameters ** ** Parameters batch_scan_full_max -Max storage space (in %) allocated to full scanning ** batch_scan_trunc_max -Max storage space (in %) allocated to truncated scanning ** batch_scan_notify_threshold - Setup notification level based on total space ** consumed by both pools. Setting it to 0 will disable threshold notification ** p_setup_cback - Setup callback ** p_thres_cback - Threshold callback ** p_rep_cback - Reports callback ** p_ref - Ref pointer ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleSetStorageParams(UINT8 batch_scan_full_max, UINT8 batch_scan_trunc_max, UINT8 batch_scan_notify_threshold, tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback, tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback, tBTA_BLE_SCAN_REP_CBACK* p_rep_cback, tBTA_DM_BLE_REF_VALUE ref_value); /******************************************************************************* ** ** Function BTA_DmBleEnableBatchScan ** ** Description This function is called to enable the batch scan ** ** Parameters scan_mode -Batch scan mode ** scan_interval - Scan interval ** scan_window - Scan window ** discard_rule -Discard rules ** addr_type - Address type ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleEnableBatchScan(tBTA_BLE_SCAN_MODE scan_mode, UINT32 scan_interval, UINT32 scan_window, tBTA_BLE_DISCARD_RULE discard_rule, tBLE_ADDR_TYPE addr_type, tBTA_DM_BLE_REF_VALUE ref_value); /******************************************************************************* ** ** Function BTA_DmBleReadScanReports ** ** Description This function is called to read the batch scan reports ** ** Parameters scan_mode -Batch scan mode ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleReadScanReports(tBTA_BLE_SCAN_MODE scan_type, tBTA_DM_BLE_REF_VALUE ref_value); /******************************************************************************* ** ** Function BTA_DmBleDisableBatchScan ** ** Description This function is called to disable the batch scanning ** ** Parameters None ** ** Returns None ** *******************************************************************************/ BTA_API extern void BTA_DmBleDisableBatchScan(tBTA_DM_BLE_REF_VALUE ref_value); #endif #ifdef __cplusplus Loading