component/bt : support adv & scan simultaneously

1. Occupy conn[9] for adv. The max connection number of bluetooth controller decrease to 9. (Previously, it is 10)
2. modify the enum of setting BLE TX power corresponding to connection's.
3. fix libbtdm_app.a cwitch jump table
This commit is contained in:
Tian Hao 2017-09-04 21:58:33 +08:00
parent d7fb4a71a0
commit 00a7cdbb0b
4 changed files with 30 additions and 32 deletions

View file

@ -2988,21 +2988,18 @@ tBTM_STATUS btm_ble_start_scan(void)
tBTM_BLE_INQ_CB *p_inq = &btm_cb.ble_ctr_cb.inq_var;
tBTM_STATUS status = BTM_CMD_STARTED;
if (p_inq->adv_mode != BTM_BLE_ADV_DISABLE) {
/* start scan, disable duplicate filtering */
if (!btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, p_inq->scan_duplicate_filter)) {
status = BTM_NO_RESOURCES;
} else {
/* start scan, disable duplicate filtering */
if (!btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, p_inq->scan_duplicate_filter)) {
status = BTM_NO_RESOURCES;
btm_cb.ble_ctr_cb.inq_var.state = BTM_BLE_SCANNING;
if (p_inq->scan_type == BTM_BLE_SCAN_MODE_ACTI) {
btm_ble_set_topology_mask(BTM_BLE_STATE_ACTIVE_SCAN_BIT);
} else {
btm_cb.ble_ctr_cb.inq_var.state = BTM_BLE_SCANNING;
if (p_inq->scan_type == BTM_BLE_SCAN_MODE_ACTI) {
btm_ble_set_topology_mask(BTM_BLE_STATE_ACTIVE_SCAN_BIT);
} else {
btm_ble_set_topology_mask(BTM_BLE_STATE_PASSIVE_SCAN_BIT);
}
btm_ble_set_topology_mask(BTM_BLE_STATE_PASSIVE_SCAN_BIT);
}
}
return status;
}
@ -3019,18 +3016,17 @@ void btm_ble_stop_scan(void)
{
BTM_TRACE_EVENT ("btm_ble_stop_scan ");
if (btm_cb.ble_ctr_cb.inq_var.adv_mode == BTM_BLE_ADV_DISABLE) {
/* Clear the inquiry callback if set */
btm_cb.ble_ctr_cb.inq_var.scan_type = BTM_BLE_SCAN_MODE_NONE;
btm_cb.ble_ctr_cb.inq_var.state = BTM_BLE_STOP_SCAN;
/* stop discovery now */
btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE);
/* Clear the inquiry callback if set */
btm_cb.ble_ctr_cb.inq_var.scan_type = BTM_BLE_SCAN_MODE_NONE;
btm_cb.ble_ctr_cb.inq_var.state = BTM_BLE_STOP_SCAN;
/* stop discovery now */
btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE);
btm_update_scanner_filter_policy(SP_ADV_ALL);
btm_update_scanner_filter_policy(SP_ADV_ALL);
btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_SCAN;
}
btm_cb.ble_ctr_cb.wl_state &= ~BTM_BLE_WL_SCAN;
}
/*******************************************************************************
**
** Function btm_ble_stop_inquiry
@ -3149,14 +3145,10 @@ static BOOLEAN btm_ble_adv_states_operation(BTM_TOPOLOGY_FUNC_PTR *p_handler, UI
*******************************************************************************/
tBTM_STATUS btm_ble_start_adv(void)
{
tBTM_BLE_CB *p_ble_cb = & btm_cb.ble_ctr_cb;
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
tBTM_STATUS rt = BTM_NO_RESOURCES;
BTM_TRACE_EVENT ("btm_ble_start_adv\n");
if (BTM_BLE_IS_OBS_ACTIVE(p_ble_cb->scan_activity)) {
return BTM_NO_RESOURCES;
}
if (!btm_ble_adv_states_operation (btm_ble_topology_check, p_cb->evt_type)) {
return BTM_WRONG_MODE;
@ -3200,12 +3192,10 @@ tBTM_STATUS btm_ble_start_adv(void)
*******************************************************************************/
tBTM_STATUS btm_ble_stop_adv(void)
{
tBTM_BLE_CB *p_ble_cb = & btm_cb.ble_ctr_cb;
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
tBTM_STATUS rt = BTM_SUCCESS;
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE
&& !BTM_BLE_IS_OBS_ACTIVE(p_ble_cb->scan_activity)) {
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
if (btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE)) {
p_cb->fast_adv_on = FALSE;
p_cb->adv_mode = BTM_BLE_ADV_DISABLE;

View file

@ -102,11 +102,10 @@ typedef enum {
ESP_BLE_PWR_TYPE_CONN_HDL6 = 6, /*!< For connection handle 6 */
ESP_BLE_PWR_TYPE_CONN_HDL7 = 7, /*!< For connection handle 7 */
ESP_BLE_PWR_TYPE_CONN_HDL8 = 8, /*!< For connection handle 8 */
ESP_BLE_PWR_TYPE_CONN_HDL9 = 9, /*!< For connection handle 9 */
ESP_BLE_PWR_TYPE_ADV = 10, /*!< For advertising */
ESP_BLE_PWR_TYPE_SCAN = 11, /*!< For scan */
ESP_BLE_PWR_TYPE_DEFAULT = 12, /*!< For default, if not set other, it will use default value */
ESP_BLE_PWR_TYPE_NUM = 13, /*!< TYPE numbers */
ESP_BLE_PWR_TYPE_ADV = 9, /*!< For advertising */
ESP_BLE_PWR_TYPE_SCAN = 10, /*!< For scan */
ESP_BLE_PWR_TYPE_DEFAULT = 11, /*!< For default, if not set other, it will use default value */
ESP_BLE_PWR_TYPE_NUM = 12, /*!< TYPE numbers */
} esp_ble_power_type_t;
/**

@ -1 +1 @@
Subproject commit 2651a662d8ccda03c06a2b775fdaf938270855bd
Subproject commit d41e3512971612a4903e1ea1189968408811a1ae

View file

@ -215,9 +215,17 @@ PROVIDE ( llc_state = 0x3ffb96f8 );
PROVIDE ( lldesc_build_chain = 0x4000a850 );
PROVIDE ( lldesc_num2link = 0x4000a948 );
PROVIDE ( lldesc_set_owner = 0x4000a974 );
PROVIDE ( lld_evt_deferred_elt_push = 0x400466b4 );
PROVIDE ( lld_evt_deferred_elt_pop = 0x400466dc );
PROVIDE ( lld_evt_winsize_change = 0x40046730 );
PROVIDE ( lld_evt_rxwin_compute = 0x400467c8 );
PROVIDE ( lld_evt_slave_time_compute = 0x40046818 );
PROVIDE ( lld_evt_env = 0x3ffb9704 );
PROVIDE ( lld_evt_elt_wait_get = 0x400468e4 );
PROVIDE ( lld_evt_get_next_free_slot = 0x4004692c );
PROVIDE ( lld_pdu_adv_pk_desc_tab = 0x3ff98c70 );
PROVIDE ( lld_pdu_llcp_pk_desc_tab = 0x3ff98b68 );
PROVIDE ( lld_pdu_pack = 0x4004ab14 );
PROVIDE ( LLM_AA_CT1 = 0x3ff98d8a );
PROVIDE ( LLM_AA_CT2 = 0x3ff98d88 );
PROVIDE ( llm_default_handler = 0x3ff98d80 );
@ -1713,5 +1721,6 @@ PROVIDE ( LM_SniffSubRate = 0x3ffb8214 );
PROVIDE ( prbs_64bytes = 0x3ff98992 );
PROVIDE ( nvds_env = 0x3ffb8364 );
PROVIDE ( nvds_magic_number = 0x3ff9912a );
PROVIDE ( TASK_DESC_LLD = 0x3ff98b58 );
/* Above are static data, but can be used, not generated by script >>>>> btdm data */