Merge branch 'feature/btdm_add_get_local_used_addr_API' into 'master'

Component/bt: add esp_ble_gap_get_local_used_addr() API

See merge request idf/esp-idf!2137
This commit is contained in:
Jiang Jiang Jian
2018-04-02 22:28:00 +08:00
4 changed files with 68 additions and 1 deletions

View File

@@ -1604,6 +1604,37 @@ tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
}
}
/*******************************************************************************
**
** Function BTM_BleGetCurrentAddress
**
** Description This function is called to get local used BLE address.
**
** Parameters: None.
**
** Returns success or fail
**
*******************************************************************************/
BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type)
{
if(addr == NULL || addr_type == NULL) {
BTM_TRACE_ERROR("%s addr or addr_type is NULL\n", __func__);
return FALSE;
}
if(btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type == BLE_ADDR_RANDOM) {
*addr_type = BLE_ADDR_RANDOM;
memcpy(addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, BD_ADDR_LEN);
} else if(btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type == BLE_ADDR_PUBLIC) {
*addr_type = BLE_ADDR_PUBLIC;
memcpy(addr, &controller_get_interface()->get_address()->address, BD_ADDR_LEN);
} else {
BTM_TRACE_ERROR("%s\n", __func__);
memset(addr, 0, BD_ADDR_LEN);
return FALSE;
}
return TRUE;
}
/*******************************************************************************
**
** Function BTM_CheckAdvData

View File

@@ -1541,6 +1541,19 @@ void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK *p_vsc_cback);
//extern
UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length);
/*******************************************************************************
**
** Function BTM_BleGetCurrentAddress
**
** Description This function is called to get local used BLE address.
**
** Parameters: None.
**
** Returns success or fail
**
*******************************************************************************/
BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type);
/*******************************************************************************
**
** Function BTM__BLEReadDiscoverability