Loading system/main/shim/btm_api.cc +0 −7 Original line number Diff line number Diff line Loading @@ -914,13 +914,6 @@ void bluetooth::shim::BTM_BleReadPhy( LOG_INFO("UNIMPLEMENTED %s", __func__); } tBTM_STATUS bluetooth::shim::BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys) { LOG_INFO("UNIMPLEMENTED %s", __func__); return BTM_NO_RESOURCES; } void bluetooth::shim::BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys, uint16_t phy_options) { LOG_INFO("UNIMPLEMENTED %s", __func__); Loading system/main/shim/btm_api.h +0 −101 Original line number Diff line number Diff line Loading @@ -787,19 +787,6 @@ void BTM_BleReadPhy( const RawAddress& bd_addr, base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb); /******************************************************************************* * * Function BTM_BleSetDefaultPhy * * Description To set preferred PHY for ensuing LE connections * * * Returns BTM_SUCCESS if success; otherwise failed. * ******************************************************************************/ tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys); /******************************************************************************* * * Function BTM_BleSetPhy Loading Loading @@ -2103,18 +2090,6 @@ tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void); * * BLE API */ /******************************************************************************* * * Function BTM_BleObtainVendorCapabilities * * Description This function is called to obatin vendor capabilties * * Parameters p_cmn_vsc_cb - Returns the vednor capabilities * * Returns void * ******************************************************************************/ void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb); /** * This function is called to set scan parameters. |cb| is called with operation Loading Loading @@ -2177,20 +2152,6 @@ void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback, tBTM_BLE_REF_VALUE ref_value); /******************************************************************************* * * Function BTM_BleWriteScanRsp * * Description This function is called to write LE scan response. * * Parameters: p_scan_rsp: scan response. * * Returns status * ******************************************************************************/ void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback); /****************************************************************************** * * Function BTM_BleReadControllerFeatures Loading Loading @@ -2255,68 +2216,6 @@ bool BTM_BleConfigPrivacy(bool enable); ******************************************************************************/ bool BTM_BleLocalPrivacyEnabled(void); /******************************************************************************* * * Function BTM_BleEnableMixedPrivacyMode * * Description This function is called to enabled Mixed mode if privacy 1.2 * is applicable in controller. * * Parameters mixed_on: mixed mode to be used or not. * * Returns void * ******************************************************************************/ void BTM_BleEnableMixedPrivacyMode(bool mixed_on); /******************************************************************************* * * Function BTM_BleSetConnectableMode * * Description This function is called to set BLE connectable mode for a * peripheral device. * * Parameters connectable_mode: directed connectable mode, or * non-directed. It can be * BTM_BLE_CONNECT_EVT, * BTM_BLE_CONNECT_DIR_EVT or * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT * * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. * BTM_SUCCESS is status set successfully; otherwise failure. * ******************************************************************************/ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode); /******************************************************************************* * * Function BTM_BleTurnOnPrivacyOnRemote * * Description This function is called to enable or disable the privacy on * the remote device. * * Parameters bd_addr: remote device address. * privacy_on: true to enable it; false to disable it. * * Returns void * ******************************************************************************/ void BTM_BleTurnOnPrivacyOnRemote(const RawAddress& bd_addr, bool privacy_on); /******************************************************************************* * * Function BTM_BleStackEnable * * Description Enable/Disable BLE functionality on stack regardless of * controller capability. * * Parameters: enable: true to enable, false to disable. * * Returns true if added OK, else false * ******************************************************************************/ tBTM_STATUS BTM_BleStackEnable(bool enable); /** * This functions are called to configure the adv data payload filter condition */ Loading system/stack/btm/btm_ble.cc +0 −174 Original line number Diff line number Diff line Loading @@ -938,45 +938,6 @@ void BTM_BleReadPhy( void doNothing(uint8_t* data, uint16_t len) {} /******************************************************************************* * * Function BTM_BleSetDefaultPhy * * Description To set preferred PHY for ensuing LE connections * * * Returns BTM_SUCCESS if command successfully sent to controller, * BTM_MODE_UNSUPPORTED if local controller doesn't support LE * 2M or LE Coded PHY * ******************************************************************************/ tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleSetDefaultPhy(all_phys, tx_phys, rx_phys); } BTM_TRACE_DEBUG("%s: all_phys = 0x%02x, tx_phys = 0x%02x, rx_phys = 0x%02x", __func__, all_phys, tx_phys, rx_phys); // checking if local controller supports it! if (!controller_get_interface()->supports_ble_2m_phy() && !controller_get_interface()->supports_ble_coded_phy()) { BTM_TRACE_ERROR("%s failed, request not supported in local controller!", __func__); return BTM_MODE_UNSUPPORTED; } const uint8_t len = HCIC_PARAM_SIZE_BLE_SET_DEFAULT_PHY; uint8_t data[len]; uint8_t* pp = data; UINT8_TO_STREAM(pp, all_phys); UINT8_TO_STREAM(pp, tx_phys); UINT8_TO_STREAM(pp, rx_phys); btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_SET_DEFAULT_PHY, data, len, base::Bind(doNothing)); return BTM_SUCCESS; } /******************************************************************************* * * Function BTM_BleSetPhy Loading Loading @@ -2218,141 +2179,6 @@ bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig, return verified; } /******************************************************************************* * * Function BTM_GetLeSecurityState * * Description This function is called to get security mode 1 flags and * encryption key size for LE peer. * * Returns bool true if LE device is found, false otherwise. * ******************************************************************************/ bool BTM_GetLeSecurityState(const RawAddress& bd_addr, uint8_t* p_le_dev_sec_flags, uint8_t* p_le_key_size) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_GetLeSecurityState(bd_addr, p_le_dev_sec_flags, p_le_key_size); } tBTM_SEC_DEV_REC* p_dev_rec; uint16_t dev_rec_sec_flags; *p_le_dev_sec_flags = 0; *p_le_key_size = 0; p_dev_rec = btm_find_dev(bd_addr); if (p_dev_rec == NULL) { BTM_TRACE_ERROR("%s fails", __func__); return (false); } if (p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE) { BTM_TRACE_ERROR("%s-this is not LE device", __func__); return (false); } dev_rec_sec_flags = p_dev_rec->sec_flags; if (dev_rec_sec_flags & BTM_SEC_LE_ENCRYPTED) { /* link is encrypted with LTK or STK */ *p_le_key_size = p_dev_rec->enc_key_size; *p_le_dev_sec_flags |= BTM_SEC_LE_LINK_ENCRYPTED; *p_le_dev_sec_flags |= (dev_rec_sec_flags & BTM_SEC_LE_AUTHENTICATED) ? BTM_SEC_LE_LINK_PAIRED_WITH_MITM /* set auth LTK flag */ : BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM; /* set unauth LTK flag */ } else if (p_dev_rec->ble.key_type & BTM_LE_KEY_PENC) { /* link is unencrypted, still LTK is available */ *p_le_key_size = p_dev_rec->ble.keys.key_size; *p_le_dev_sec_flags |= (dev_rec_sec_flags & BTM_SEC_LE_LINK_KEY_AUTHED) ? BTM_SEC_LE_LINK_PAIRED_WITH_MITM /* set auth LTK flag */ : BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM; /* set unauth LTK flag */ } BTM_TRACE_DEBUG("%s - le_dev_sec_flags: 0x%02x, le_key_size: %d", __func__, *p_le_dev_sec_flags, *p_le_key_size); return true; } /******************************************************************************* * * Function BTM_BleSecurityProcedureIsRunning * * Description This function indicates if LE security procedure is * currently running with the peer. * * Returns bool true if security procedure is running, false * otherwise. * ******************************************************************************/ bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleSecurityProcedureIsRunning(bd_addr); } tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr); if (p_dev_rec == NULL) { LOG(ERROR) << __func__ << " device with BDA: " << bd_addr << " is not found"; return false; } return (p_dev_rec->sec_state == BTM_SEC_STATE_ENCRYPTING || p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING); } /******************************************************************************* * * Function BTM_BleGetSupportedKeySize * * Description This function gets the maximum encryption key size in bytes * the local device can suport. * record. * * Returns the key size or 0 if the size can't be retrieved. * ******************************************************************************/ extern uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleGetSupportedKeySize(bd_addr); } #if (L2CAP_LE_COC_INCLUDED == TRUE) tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr); tBTM_LE_EVT_DATA btm_le_evt_data; uint8_t callback_rc; if (!p_dev_rec) { LOG(ERROR) << __func__ << " device with BDA: " << bd_addr << " is not found"; return 0; } if (btm_cb.api.p_le_callback == NULL) { BTM_TRACE_ERROR("%s can't access supported key size", __func__); return 0; } callback_rc = (*btm_cb.api.p_le_callback)( BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr, &btm_le_evt_data); if (callback_rc != BTM_SUCCESS) { BTM_TRACE_ERROR("%s can't access supported key size", __func__); return 0; } BTM_TRACE_DEBUG("%s device supports key size = %d", __func__, btm_le_evt_data.io_req.max_key_size); return (btm_le_evt_data.io_req.max_key_size); #else return 0; #endif } /******************************************************************************* * Utility functions for LE device IR/ER generation ******************************************************************************/ Loading system/stack/btm/btm_ble_gap.cc +0 −121 Original line number Diff line number Diff line Loading @@ -365,52 +365,6 @@ inline bool BTM_LE_STATES_SUPPORTED(const uint8_t* x, uint8_t bit_num) { return ((x)[offset] & mask); } /******************************************************************************* * * Function BTM_BleUpdateAdvFilterPolicy * * Description This function update the filter policy of advertiser. * * Parameter adv_policy: advertising filter policy * * Return void ******************************************************************************/ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleUpdateAdvFilterPolicy(adv_policy); } tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var; tBLE_ADDR_TYPE init_addr_type = BLE_ADDR_PUBLIC; RawAddress adv_address = RawAddress::kEmpty; uint8_t adv_mode = p_cb->adv_mode; BTM_TRACE_EVENT("BTM_BleUpdateAdvFilterPolicy"); if (!controller_get_interface()->supports_ble()) return; if (p_cb->afp != adv_policy) { p_cb->afp = adv_policy; /* if adv active, stop and restart */ btm_ble_stop_adv(); if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE) p_cb->evt_type = btm_set_conn_mode_adv_init_addr( p_cb, adv_address, &init_addr_type, &p_cb->adv_addr_type); btsnd_hcic_ble_write_adv_params( (uint16_t)(p_cb->adv_interval_min ? p_cb->adv_interval_min : BTM_BLE_GAP_ADV_SLOW_INT), (uint16_t)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_SLOW_INT), p_cb->evt_type, p_cb->adv_addr_type, init_addr_type, adv_address, p_cb->adv_chnl_map, p_cb->afp); if (adv_mode == BTM_BLE_ADV_ENABLE) btm_ble_start_adv(); } } /******************************************************************************* * * Function BTM_BleObserve Loading Loading @@ -622,26 +576,6 @@ extern void BTM_BleReadControllerFeatures( UNUSED_ATTR tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback) {} #endif /******************************************************************************* * * Function BTM_BleEnableMixedPrivacyMode * * Description This function is called to enabled Mixed mode if privacy 1.2 * is applicable in controller. * * Parameters mixed_on: mixed mode to be used or not. * * Returns void * ******************************************************************************/ void BTM_BleEnableMixedPrivacyMode(bool mixed_on) { #if (BLE_PRIVACY_SPT == TRUE) btm_cb.ble_ctr_cb.mixed_mode = mixed_on; /* TODO: send VSC to enabled mixed mode */ #endif } /******************************************************************************* * * Function BTM_BleConfigPrivacy Loading Loading @@ -734,32 +668,6 @@ bool BTM_BleLocalPrivacyEnabled(void) { #endif } /******************************************************************************* * * Function BTM_BleSetConnectableMode * * Description This function is called to set BLE connectable mode for a * peripheral device. * * Parameters conn_mode: directed connectable mode, or non-directed. It * can be BTM_BLE_CONNECT_EVT, * BTM_BLE_CONNECT_DIR_EVT or * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT * * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. * BTM_SUCCESS is status set successfully; otherwise failure. * ******************************************************************************/ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode) { tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var; BTM_TRACE_EVENT("%s connectable_mode = %d ", __func__, connectable_mode); if (!controller_get_interface()->supports_ble()) return BTM_ILLEGAL_VALUE; p_cb->directed_conn = connectable_mode; return btm_ble_set_connectability(p_cb->connectable_mode); } #if (BLE_PRIVACY_SPT == TRUE) static bool is_resolving_list_bit_set(void* data, void* context) { tBTM_SEC_DEV_REC* p_dev_rec = static_cast<tBTM_SEC_DEV_REC*>(data); Loading Loading @@ -905,35 +813,6 @@ void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window, } } /******************************************************************************* * * Function BTM_BleWriteScanRsp * * Description This function is called to write LE scan response. * * Parameters: p_scan_rsp: scan response information. * * Returns void * ******************************************************************************/ void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback) { BTM_TRACE_EVENT("%s: length: %d", __func__, length); if (!controller_get_interface()->supports_ble()) { p_adv_data_cback(BTM_ILLEGAL_VALUE); return; } btsnd_hcic_ble_set_scan_rsp_data(length, data); if (length != 0) btm_cb.ble_ctr_cb.inq_var.scan_rsp = true; else btm_cb.ble_ctr_cb.inq_var.scan_rsp = false; p_adv_data_cback(BTM_SUCCESS); } /******************************************************************************* * * Function BTM__BLEReadDiscoverability Loading system/stack/include/btm_ble_api.h +0 −155 Original line number Diff line number Diff line Loading @@ -75,19 +75,6 @@ extern bool BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key, tBTM_LE_KEY_TYPE key_type); /******************************************************************************* * * Function BTM_BleObtainVendorCapabilities * * Description This function is called to obatin vendor capabilties * * Parameters p_cmn_vsc_cb - Returns the vednor capabilities * * Returns void * ******************************************************************************/ extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb); /** * This function is called to set scan parameters. |cb| is called with operation * status Loading Loading @@ -150,20 +137,6 @@ extern void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, extern void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback, tBTM_BLE_REF_VALUE ref_value); /******************************************************************************* * * Function BTM_BleWriteScanRsp * * Description This function is called to write LE scan response. * * Parameters: p_scan_rsp: scan response. * * Returns status * ******************************************************************************/ extern void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback); /******************************************************************************* * * Function BTM_BleObserve Loading Loading @@ -499,20 +472,6 @@ extern bool BTM_BleConfigPrivacy(bool enable); ******************************************************************************/ extern bool BTM_BleLocalPrivacyEnabled(void); /******************************************************************************* * * Function BTM_BleEnableMixedPrivacyMode * * Description This function is called to enabled Mixed mode if privacy 1.2 * is applicable in controller. * * Parameters mixed_on: mixed mode to be used or not. * * Returns void * ******************************************************************************/ extern void BTM_BleEnableMixedPrivacyMode(bool mixed_on); /******************************************************************************* * * Function BTM_BleMaxMultiAdvInstanceCount Loading @@ -525,54 +484,6 @@ extern void BTM_BleEnableMixedPrivacyMode(bool mixed_on); ******************************************************************************/ extern uint8_t BTM_BleMaxMultiAdvInstanceCount(); /******************************************************************************* * * Function BTM_BleSetConnectableMode * * Description This function is called to set BLE connectable mode for a * peripheral device. * * Parameters connectable_mode: directed connectable mode, or * non-directed. It can be * BTM_BLE_CONNECT_EVT, * BTM_BLE_CONNECT_DIR_EVT or * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT * * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. * BTM_SUCCESS is status set successfully; otherwise failure. * ******************************************************************************/ extern tBTM_STATUS BTM_BleSetConnectableMode( tBTM_BLE_CONN_MODE connectable_mode); /******************************************************************************* * * Function BTM_BleTurnOnPrivacyOnRemote * * Description This function is called to enable or disable the privacy on * the remote device. * * Parameters bd_addr: remote device address. * privacy_on: true to enable it; false to disable it. * * Returns void * ******************************************************************************/ extern void BTM_BleTurnOnPrivacyOnRemote(const RawAddress& bd_addr, bool privacy_on); /******************************************************************************* * * Function BTM_BleUpdateAdvFilterPolicy * * Description This function update the filter policy of advertiser. * * Parameter adv_policy: advertising filter policy * * Return void ******************************************************************************/ extern void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy); /******************************************************************************* * * Function BTM_BleReceiverTest Loading Loading @@ -624,59 +535,6 @@ void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback); ******************************************************************************/ extern bool BTM_UseLeLink(const RawAddress& bd_addr); /******************************************************************************* * * Function BTM_BleStackEnable * * Description Enable/Disable BLE functionality on stack regardless of * controller capability. * * Parameters: enable: true to enable, false to disable. * * Returns true if added OK, else false * ******************************************************************************/ extern tBTM_STATUS BTM_BleStackEnable(bool enable); /******************************************************************************* * * Function BTM_GetLeSecurityState * * Description This function is called to get security mode 1 flags and * encryption key size for LE peer. * * Returns bool true if LE device is found, false otherwise. * ******************************************************************************/ extern bool BTM_GetLeSecurityState(const RawAddress& bd_addr, uint8_t* p_le_dev_sec_flags, uint8_t* p_le_key_size); /******************************************************************************* * * Function BTM_BleSecurityProcedureIsRunning * * Description This function indicates if LE security procedure is * currently running with the peer. * * Returns bool true if security procedure is running, false otherwise. * ******************************************************************************/ extern bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr); /******************************************************************************* * * Function BTM_BleGetSupportedKeySize * * Description This function gets the maximum encryption key size in bytes * the local device can suport. * record. * * Returns the key size or 0 if the size can't be retrieved. * ******************************************************************************/ extern uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr); /******************************************************************************* * * Function BTM_BleAdvFilterParamSetup Loading Loading @@ -751,19 +609,6 @@ extern void BTM_BleReadPhy( const RawAddress& bd_addr, base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb); /******************************************************************************* * * Function BTM_BleSetDefaultPhy * * Description To set preferred PHY for ensuing LE connections * * * Returns BTM_SUCCESS if success; otherwise failed. * ******************************************************************************/ extern tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys); /******************************************************************************* * * Function BTM_BleSetPhy Loading Loading
system/main/shim/btm_api.cc +0 −7 Original line number Diff line number Diff line Loading @@ -914,13 +914,6 @@ void bluetooth::shim::BTM_BleReadPhy( LOG_INFO("UNIMPLEMENTED %s", __func__); } tBTM_STATUS bluetooth::shim::BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys) { LOG_INFO("UNIMPLEMENTED %s", __func__); return BTM_NO_RESOURCES; } void bluetooth::shim::BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys, uint16_t phy_options) { LOG_INFO("UNIMPLEMENTED %s", __func__); Loading
system/main/shim/btm_api.h +0 −101 Original line number Diff line number Diff line Loading @@ -787,19 +787,6 @@ void BTM_BleReadPhy( const RawAddress& bd_addr, base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb); /******************************************************************************* * * Function BTM_BleSetDefaultPhy * * Description To set preferred PHY for ensuing LE connections * * * Returns BTM_SUCCESS if success; otherwise failed. * ******************************************************************************/ tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys); /******************************************************************************* * * Function BTM_BleSetPhy Loading Loading @@ -2103,18 +2090,6 @@ tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void); * * BLE API */ /******************************************************************************* * * Function BTM_BleObtainVendorCapabilities * * Description This function is called to obatin vendor capabilties * * Parameters p_cmn_vsc_cb - Returns the vednor capabilities * * Returns void * ******************************************************************************/ void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb); /** * This function is called to set scan parameters. |cb| is called with operation Loading Loading @@ -2177,20 +2152,6 @@ void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback, tBTM_BLE_REF_VALUE ref_value); /******************************************************************************* * * Function BTM_BleWriteScanRsp * * Description This function is called to write LE scan response. * * Parameters: p_scan_rsp: scan response. * * Returns status * ******************************************************************************/ void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback); /****************************************************************************** * * Function BTM_BleReadControllerFeatures Loading Loading @@ -2255,68 +2216,6 @@ bool BTM_BleConfigPrivacy(bool enable); ******************************************************************************/ bool BTM_BleLocalPrivacyEnabled(void); /******************************************************************************* * * Function BTM_BleEnableMixedPrivacyMode * * Description This function is called to enabled Mixed mode if privacy 1.2 * is applicable in controller. * * Parameters mixed_on: mixed mode to be used or not. * * Returns void * ******************************************************************************/ void BTM_BleEnableMixedPrivacyMode(bool mixed_on); /******************************************************************************* * * Function BTM_BleSetConnectableMode * * Description This function is called to set BLE connectable mode for a * peripheral device. * * Parameters connectable_mode: directed connectable mode, or * non-directed. It can be * BTM_BLE_CONNECT_EVT, * BTM_BLE_CONNECT_DIR_EVT or * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT * * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. * BTM_SUCCESS is status set successfully; otherwise failure. * ******************************************************************************/ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode); /******************************************************************************* * * Function BTM_BleTurnOnPrivacyOnRemote * * Description This function is called to enable or disable the privacy on * the remote device. * * Parameters bd_addr: remote device address. * privacy_on: true to enable it; false to disable it. * * Returns void * ******************************************************************************/ void BTM_BleTurnOnPrivacyOnRemote(const RawAddress& bd_addr, bool privacy_on); /******************************************************************************* * * Function BTM_BleStackEnable * * Description Enable/Disable BLE functionality on stack regardless of * controller capability. * * Parameters: enable: true to enable, false to disable. * * Returns true if added OK, else false * ******************************************************************************/ tBTM_STATUS BTM_BleStackEnable(bool enable); /** * This functions are called to configure the adv data payload filter condition */ Loading
system/stack/btm/btm_ble.cc +0 −174 Original line number Diff line number Diff line Loading @@ -938,45 +938,6 @@ void BTM_BleReadPhy( void doNothing(uint8_t* data, uint16_t len) {} /******************************************************************************* * * Function BTM_BleSetDefaultPhy * * Description To set preferred PHY for ensuing LE connections * * * Returns BTM_SUCCESS if command successfully sent to controller, * BTM_MODE_UNSUPPORTED if local controller doesn't support LE * 2M or LE Coded PHY * ******************************************************************************/ tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleSetDefaultPhy(all_phys, tx_phys, rx_phys); } BTM_TRACE_DEBUG("%s: all_phys = 0x%02x, tx_phys = 0x%02x, rx_phys = 0x%02x", __func__, all_phys, tx_phys, rx_phys); // checking if local controller supports it! if (!controller_get_interface()->supports_ble_2m_phy() && !controller_get_interface()->supports_ble_coded_phy()) { BTM_TRACE_ERROR("%s failed, request not supported in local controller!", __func__); return BTM_MODE_UNSUPPORTED; } const uint8_t len = HCIC_PARAM_SIZE_BLE_SET_DEFAULT_PHY; uint8_t data[len]; uint8_t* pp = data; UINT8_TO_STREAM(pp, all_phys); UINT8_TO_STREAM(pp, tx_phys); UINT8_TO_STREAM(pp, rx_phys); btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_SET_DEFAULT_PHY, data, len, base::Bind(doNothing)); return BTM_SUCCESS; } /******************************************************************************* * * Function BTM_BleSetPhy Loading Loading @@ -2218,141 +2179,6 @@ bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig, return verified; } /******************************************************************************* * * Function BTM_GetLeSecurityState * * Description This function is called to get security mode 1 flags and * encryption key size for LE peer. * * Returns bool true if LE device is found, false otherwise. * ******************************************************************************/ bool BTM_GetLeSecurityState(const RawAddress& bd_addr, uint8_t* p_le_dev_sec_flags, uint8_t* p_le_key_size) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_GetLeSecurityState(bd_addr, p_le_dev_sec_flags, p_le_key_size); } tBTM_SEC_DEV_REC* p_dev_rec; uint16_t dev_rec_sec_flags; *p_le_dev_sec_flags = 0; *p_le_key_size = 0; p_dev_rec = btm_find_dev(bd_addr); if (p_dev_rec == NULL) { BTM_TRACE_ERROR("%s fails", __func__); return (false); } if (p_dev_rec->ble_hci_handle == BTM_SEC_INVALID_HANDLE) { BTM_TRACE_ERROR("%s-this is not LE device", __func__); return (false); } dev_rec_sec_flags = p_dev_rec->sec_flags; if (dev_rec_sec_flags & BTM_SEC_LE_ENCRYPTED) { /* link is encrypted with LTK or STK */ *p_le_key_size = p_dev_rec->enc_key_size; *p_le_dev_sec_flags |= BTM_SEC_LE_LINK_ENCRYPTED; *p_le_dev_sec_flags |= (dev_rec_sec_flags & BTM_SEC_LE_AUTHENTICATED) ? BTM_SEC_LE_LINK_PAIRED_WITH_MITM /* set auth LTK flag */ : BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM; /* set unauth LTK flag */ } else if (p_dev_rec->ble.key_type & BTM_LE_KEY_PENC) { /* link is unencrypted, still LTK is available */ *p_le_key_size = p_dev_rec->ble.keys.key_size; *p_le_dev_sec_flags |= (dev_rec_sec_flags & BTM_SEC_LE_LINK_KEY_AUTHED) ? BTM_SEC_LE_LINK_PAIRED_WITH_MITM /* set auth LTK flag */ : BTM_SEC_LE_LINK_PAIRED_WITHOUT_MITM; /* set unauth LTK flag */ } BTM_TRACE_DEBUG("%s - le_dev_sec_flags: 0x%02x, le_key_size: %d", __func__, *p_le_dev_sec_flags, *p_le_key_size); return true; } /******************************************************************************* * * Function BTM_BleSecurityProcedureIsRunning * * Description This function indicates if LE security procedure is * currently running with the peer. * * Returns bool true if security procedure is running, false * otherwise. * ******************************************************************************/ bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleSecurityProcedureIsRunning(bd_addr); } tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr); if (p_dev_rec == NULL) { LOG(ERROR) << __func__ << " device with BDA: " << bd_addr << " is not found"; return false; } return (p_dev_rec->sec_state == BTM_SEC_STATE_ENCRYPTING || p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING); } /******************************************************************************* * * Function BTM_BleGetSupportedKeySize * * Description This function gets the maximum encryption key size in bytes * the local device can suport. * record. * * Returns the key size or 0 if the size can't be retrieved. * ******************************************************************************/ extern uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleGetSupportedKeySize(bd_addr); } #if (L2CAP_LE_COC_INCLUDED == TRUE) tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bd_addr); tBTM_LE_EVT_DATA btm_le_evt_data; uint8_t callback_rc; if (!p_dev_rec) { LOG(ERROR) << __func__ << " device with BDA: " << bd_addr << " is not found"; return 0; } if (btm_cb.api.p_le_callback == NULL) { BTM_TRACE_ERROR("%s can't access supported key size", __func__); return 0; } callback_rc = (*btm_cb.api.p_le_callback)( BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr, &btm_le_evt_data); if (callback_rc != BTM_SUCCESS) { BTM_TRACE_ERROR("%s can't access supported key size", __func__); return 0; } BTM_TRACE_DEBUG("%s device supports key size = %d", __func__, btm_le_evt_data.io_req.max_key_size); return (btm_le_evt_data.io_req.max_key_size); #else return 0; #endif } /******************************************************************************* * Utility functions for LE device IR/ER generation ******************************************************************************/ Loading
system/stack/btm/btm_ble_gap.cc +0 −121 Original line number Diff line number Diff line Loading @@ -365,52 +365,6 @@ inline bool BTM_LE_STATES_SUPPORTED(const uint8_t* x, uint8_t bit_num) { return ((x)[offset] & mask); } /******************************************************************************* * * Function BTM_BleUpdateAdvFilterPolicy * * Description This function update the filter policy of advertiser. * * Parameter adv_policy: advertising filter policy * * Return void ******************************************************************************/ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy) { if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleUpdateAdvFilterPolicy(adv_policy); } tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var; tBLE_ADDR_TYPE init_addr_type = BLE_ADDR_PUBLIC; RawAddress adv_address = RawAddress::kEmpty; uint8_t adv_mode = p_cb->adv_mode; BTM_TRACE_EVENT("BTM_BleUpdateAdvFilterPolicy"); if (!controller_get_interface()->supports_ble()) return; if (p_cb->afp != adv_policy) { p_cb->afp = adv_policy; /* if adv active, stop and restart */ btm_ble_stop_adv(); if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE) p_cb->evt_type = btm_set_conn_mode_adv_init_addr( p_cb, adv_address, &init_addr_type, &p_cb->adv_addr_type); btsnd_hcic_ble_write_adv_params( (uint16_t)(p_cb->adv_interval_min ? p_cb->adv_interval_min : BTM_BLE_GAP_ADV_SLOW_INT), (uint16_t)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_SLOW_INT), p_cb->evt_type, p_cb->adv_addr_type, init_addr_type, adv_address, p_cb->adv_chnl_map, p_cb->afp); if (adv_mode == BTM_BLE_ADV_ENABLE) btm_ble_start_adv(); } } /******************************************************************************* * * Function BTM_BleObserve Loading Loading @@ -622,26 +576,6 @@ extern void BTM_BleReadControllerFeatures( UNUSED_ATTR tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback) {} #endif /******************************************************************************* * * Function BTM_BleEnableMixedPrivacyMode * * Description This function is called to enabled Mixed mode if privacy 1.2 * is applicable in controller. * * Parameters mixed_on: mixed mode to be used or not. * * Returns void * ******************************************************************************/ void BTM_BleEnableMixedPrivacyMode(bool mixed_on) { #if (BLE_PRIVACY_SPT == TRUE) btm_cb.ble_ctr_cb.mixed_mode = mixed_on; /* TODO: send VSC to enabled mixed mode */ #endif } /******************************************************************************* * * Function BTM_BleConfigPrivacy Loading Loading @@ -734,32 +668,6 @@ bool BTM_BleLocalPrivacyEnabled(void) { #endif } /******************************************************************************* * * Function BTM_BleSetConnectableMode * * Description This function is called to set BLE connectable mode for a * peripheral device. * * Parameters conn_mode: directed connectable mode, or non-directed. It * can be BTM_BLE_CONNECT_EVT, * BTM_BLE_CONNECT_DIR_EVT or * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT * * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. * BTM_SUCCESS is status set successfully; otherwise failure. * ******************************************************************************/ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode) { tBTM_BLE_INQ_CB* p_cb = &btm_cb.ble_ctr_cb.inq_var; BTM_TRACE_EVENT("%s connectable_mode = %d ", __func__, connectable_mode); if (!controller_get_interface()->supports_ble()) return BTM_ILLEGAL_VALUE; p_cb->directed_conn = connectable_mode; return btm_ble_set_connectability(p_cb->connectable_mode); } #if (BLE_PRIVACY_SPT == TRUE) static bool is_resolving_list_bit_set(void* data, void* context) { tBTM_SEC_DEV_REC* p_dev_rec = static_cast<tBTM_SEC_DEV_REC*>(data); Loading Loading @@ -905,35 +813,6 @@ void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window, } } /******************************************************************************* * * Function BTM_BleWriteScanRsp * * Description This function is called to write LE scan response. * * Parameters: p_scan_rsp: scan response information. * * Returns void * ******************************************************************************/ void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback) { BTM_TRACE_EVENT("%s: length: %d", __func__, length); if (!controller_get_interface()->supports_ble()) { p_adv_data_cback(BTM_ILLEGAL_VALUE); return; } btsnd_hcic_ble_set_scan_rsp_data(length, data); if (length != 0) btm_cb.ble_ctr_cb.inq_var.scan_rsp = true; else btm_cb.ble_ctr_cb.inq_var.scan_rsp = false; p_adv_data_cback(BTM_SUCCESS); } /******************************************************************************* * * Function BTM__BLEReadDiscoverability Loading
system/stack/include/btm_ble_api.h +0 −155 Original line number Diff line number Diff line Loading @@ -75,19 +75,6 @@ extern bool BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key, tBTM_LE_KEY_TYPE key_type); /******************************************************************************* * * Function BTM_BleObtainVendorCapabilities * * Description This function is called to obatin vendor capabilties * * Parameters p_cmn_vsc_cb - Returns the vednor capabilities * * Returns void * ******************************************************************************/ extern void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb); /** * This function is called to set scan parameters. |cb| is called with operation * status Loading Loading @@ -150,20 +137,6 @@ extern void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode, extern void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback, tBTM_BLE_REF_VALUE ref_value); /******************************************************************************* * * Function BTM_BleWriteScanRsp * * Description This function is called to write LE scan response. * * Parameters: p_scan_rsp: scan response. * * Returns status * ******************************************************************************/ extern void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length, tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback); /******************************************************************************* * * Function BTM_BleObserve Loading Loading @@ -499,20 +472,6 @@ extern bool BTM_BleConfigPrivacy(bool enable); ******************************************************************************/ extern bool BTM_BleLocalPrivacyEnabled(void); /******************************************************************************* * * Function BTM_BleEnableMixedPrivacyMode * * Description This function is called to enabled Mixed mode if privacy 1.2 * is applicable in controller. * * Parameters mixed_on: mixed mode to be used or not. * * Returns void * ******************************************************************************/ extern void BTM_BleEnableMixedPrivacyMode(bool mixed_on); /******************************************************************************* * * Function BTM_BleMaxMultiAdvInstanceCount Loading @@ -525,54 +484,6 @@ extern void BTM_BleEnableMixedPrivacyMode(bool mixed_on); ******************************************************************************/ extern uint8_t BTM_BleMaxMultiAdvInstanceCount(); /******************************************************************************* * * Function BTM_BleSetConnectableMode * * Description This function is called to set BLE connectable mode for a * peripheral device. * * Parameters connectable_mode: directed connectable mode, or * non-directed. It can be * BTM_BLE_CONNECT_EVT, * BTM_BLE_CONNECT_DIR_EVT or * BTM_BLE_CONNECT_LO_DUTY_DIR_EVT * * Returns BTM_ILLEGAL_VALUE if controller does not support BLE. * BTM_SUCCESS is status set successfully; otherwise failure. * ******************************************************************************/ extern tBTM_STATUS BTM_BleSetConnectableMode( tBTM_BLE_CONN_MODE connectable_mode); /******************************************************************************* * * Function BTM_BleTurnOnPrivacyOnRemote * * Description This function is called to enable or disable the privacy on * the remote device. * * Parameters bd_addr: remote device address. * privacy_on: true to enable it; false to disable it. * * Returns void * ******************************************************************************/ extern void BTM_BleTurnOnPrivacyOnRemote(const RawAddress& bd_addr, bool privacy_on); /******************************************************************************* * * Function BTM_BleUpdateAdvFilterPolicy * * Description This function update the filter policy of advertiser. * * Parameter adv_policy: advertising filter policy * * Return void ******************************************************************************/ extern void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy); /******************************************************************************* * * Function BTM_BleReceiverTest Loading Loading @@ -624,59 +535,6 @@ void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback); ******************************************************************************/ extern bool BTM_UseLeLink(const RawAddress& bd_addr); /******************************************************************************* * * Function BTM_BleStackEnable * * Description Enable/Disable BLE functionality on stack regardless of * controller capability. * * Parameters: enable: true to enable, false to disable. * * Returns true if added OK, else false * ******************************************************************************/ extern tBTM_STATUS BTM_BleStackEnable(bool enable); /******************************************************************************* * * Function BTM_GetLeSecurityState * * Description This function is called to get security mode 1 flags and * encryption key size for LE peer. * * Returns bool true if LE device is found, false otherwise. * ******************************************************************************/ extern bool BTM_GetLeSecurityState(const RawAddress& bd_addr, uint8_t* p_le_dev_sec_flags, uint8_t* p_le_key_size); /******************************************************************************* * * Function BTM_BleSecurityProcedureIsRunning * * Description This function indicates if LE security procedure is * currently running with the peer. * * Returns bool true if security procedure is running, false otherwise. * ******************************************************************************/ extern bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr); /******************************************************************************* * * Function BTM_BleGetSupportedKeySize * * Description This function gets the maximum encryption key size in bytes * the local device can suport. * record. * * Returns the key size or 0 if the size can't be retrieved. * ******************************************************************************/ extern uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr); /******************************************************************************* * * Function BTM_BleAdvFilterParamSetup Loading Loading @@ -751,19 +609,6 @@ extern void BTM_BleReadPhy( const RawAddress& bd_addr, base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb); /******************************************************************************* * * Function BTM_BleSetDefaultPhy * * Description To set preferred PHY for ensuing LE connections * * * Returns BTM_SUCCESS if success; otherwise failed. * ******************************************************************************/ extern tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys); /******************************************************************************* * * Function BTM_BleSetPhy Loading