feat(ble/bluedroid): reduce bluedrois host bin size and disable BLE_HOST_BG_CONNECT_EN

This commit is contained in:
zhiweijian 2025-01-24 15:15:25 +08:00
parent d2d4d1518d
commit 69acda1785
32 changed files with 314 additions and 108 deletions

View File

@ -1640,13 +1640,15 @@ typedef struct {
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE) #endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE) #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT
#define BTA_DM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT #define BTA_DM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT

View File

@ -334,6 +334,7 @@ static void btc_dm_link_up_evt(tBTA_DM_LINK_UP *p_link_up)
} }
} }
#if (SMP_INCLUDED == TRUE)
static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) static void btc_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
{ {
/* Save link key, if not temporary */ /* Save link key, if not temporary */
@ -493,6 +494,7 @@ static void btc_dm_pin_req_evt(tBTA_DM_PIN_REQ *p_pin_req)
} }
#endif /// BTC_GAP_BT_INCLUDED == TRUE #endif /// BTC_GAP_BT_INCLUDED == TRUE
} }
#endif // #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED == TRUE)
static void btc_dm_sp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_cfm_req) static void btc_dm_sp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_cfm_req)
@ -814,6 +816,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
btc_disable_bluetooth_evt(); btc_disable_bluetooth_evt();
break; break;
} }
#if (SMP_INCLUDED == TRUE)
case BTA_DM_PIN_REQ_EVT: case BTA_DM_PIN_REQ_EVT:
BTC_TRACE_DEBUG("BTA_DM_PIN_REQ_EVT"); BTC_TRACE_DEBUG("BTA_DM_PIN_REQ_EVT");
btc_dm_pin_req_evt(&p_data->pin_req); btc_dm_pin_req_evt(&p_data->pin_req);
@ -827,6 +830,7 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
case BTA_DM_BOND_CANCEL_CMPL_EVT: case BTA_DM_BOND_CANCEL_CMPL_EVT:
BTC_TRACE_DEBUG("BTA_DM_BOND_CANCEL_CMPL_EVT"); BTC_TRACE_DEBUG("BTA_DM_BOND_CANCEL_CMPL_EVT");
break; break;
#endif // #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED == TRUE)
case BTA_DM_SP_CFM_REQ_EVT: case BTA_DM_SP_CFM_REQ_EVT:
btc_dm_sp_cfm_req_evt(&p_data->cfm_req); btc_dm_sp_cfm_req_evt(&p_data->cfm_req);

View File

@ -1042,6 +1042,8 @@ void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.period_adv_stop.instance = params->per_adv_stop.instance; param.period_adv_stop.instance = params->per_adv_stop.instance;
break; break;
} }
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT: { case BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT: {
msg.act = ESP_GAP_BLE_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT; msg.act = ESP_GAP_BLE_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT;
param.period_adv_create_sync.status = btc_btm_status_to_esp_status(params->per_adv_sync_create.status); param.period_adv_create_sync.status = btc_btm_status_to_esp_status(params->per_adv_sync_create.status);
@ -1072,7 +1074,7 @@ void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.period_adv_clear_dev.status = btc_btm_status_to_esp_status(params->per_adv_clear_dev.status); param.period_adv_clear_dev.status = btc_btm_status_to_esp_status(params->per_adv_clear_dev.status);
break; break;
} }
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE) #endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE) #if (BLE_50_EXTEND_SCAN_EN == TRUE)
case BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT: { case BTA_DM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT: {
@ -1889,6 +1891,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
break; break;
} }
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE) #endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
case BTC_GAP_BLE_EXT_ADV_START: { case BTC_GAP_BLE_EXT_ADV_START: {
esp_ble_gap_ext_adv_t *value = ((btc_ble_5_gap_args_t *)msg->arg)->ext_adv_start.ext_adv; esp_ble_gap_ext_adv_t *value = ((btc_ble_5_gap_args_t *)msg->arg)->ext_adv_start.ext_adv;
if (value) { if (value) {
@ -1903,6 +1906,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
} }
break; break;
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: { case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: {
uint8_t *p_param_buf = ((btc_ble_gap_args_t *)msg->arg)->vendor_cmd_send.p_param_buf; uint8_t *p_param_buf = ((btc_ble_gap_args_t *)msg->arg)->vendor_cmd_send.p_param_buf;

View File

@ -1403,6 +1403,10 @@
#define BLE_HOST_BATCH_SCAN_EN FALSE #define BLE_HOST_BATCH_SCAN_EN FALSE
#endif #endif
#ifndef BLE_HOST_BG_CONNECT_EN
#define BLE_HOST_BG_CONNECT_EN FALSE
#endif
#ifndef LOCAL_BLE_CONTROLLER_ID #ifndef LOCAL_BLE_CONTROLLER_ID
#define LOCAL_BLE_CONTROLLER_ID (1) #define LOCAL_BLE_CONTROLLER_ID (1)
#endif #endif

View File

@ -83,7 +83,9 @@ typedef struct {
bool simple_pairing_supported; bool simple_pairing_supported;
bool secure_connections_supported; bool secure_connections_supported;
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
uint16_t ble_ext_adv_data_max_len; uint16_t ble_ext_adv_data_max_len;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE) #endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
} controller_local_param_t; } controller_local_param_t;
@ -119,11 +121,13 @@ static void start_up(void)
response = AWAIT_COMMAND(controller_param.packet_factory->make_set_c2h_flow_control(HCI_HOST_FLOW_CTRL_ACL_ON)); response = AWAIT_COMMAND(controller_param.packet_factory->make_set_c2h_flow_control(HCI_HOST_FLOW_CTRL_ACL_ON));
controller_param.packet_parser->parse_generic_command_complete(response); controller_param.packet_parser->parse_generic_command_complete(response);
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE #endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
// Enable adv flow control // Enable adv flow control
response = AWAIT_COMMAND(controller_param.packet_factory->make_set_adv_report_flow_control(HCI_HOST_FLOW_CTRL_ADV_REPORT_ON, (uint16_t)BLE_ADV_REPORT_FLOW_CONTROL_NUM, (uint16_t)BLE_ADV_REPORT_DISCARD_THRSHOLD)); response = AWAIT_COMMAND(controller_param.packet_factory->make_set_adv_report_flow_control(HCI_HOST_FLOW_CTRL_ADV_REPORT_ON, (uint16_t)BLE_ADV_REPORT_FLOW_CONTROL_NUM, (uint16_t)BLE_ADV_REPORT_DISCARD_THRSHOLD));
controller_param.packet_parser->parse_generic_command_complete(response); controller_param.packet_parser->parse_generic_command_complete(response);
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
// Tell the controller about our buffer sizes and buffer counts next // Tell the controller about our buffer sizes and buffer counts next
// TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10? // TODO(zachoverflow): factor this out. eww l2cap contamination. And why just a hardcoded 10?
response = AWAIT_COMMAND( response = AWAIT_COMMAND(
@ -265,16 +269,20 @@ static void start_up(void)
&controller_param.ble_resolving_list_max_size); &controller_param.ble_resolving_list_max_size);
} }
#if BLE_50_FEATURE_SUPPORT == TRUE #if BLE_50_FEATURE_SUPPORT == TRUE
#if (BLE_50_EXTEND_ADV_EN == TRUE)
controller_param.ble_ext_adv_data_max_len = BLE_EXT_ADV_DATA_LEN_MAX; controller_param.ble_ext_adv_data_max_len = BLE_EXT_ADV_DATA_LEN_MAX;
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE) #endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE) #if (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
if (HCI_LE_EXT_ADV_SUPPORTED(controller_param.features_ble.as_array)) { if (HCI_LE_EXT_ADV_SUPPORTED(controller_param.features_ble.as_array)) {
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len()); response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
controller_param.packet_parser->parse_ble_read_adv_max_len_response( controller_param.packet_parser->parse_ble_read_adv_max_len_response(
response, response,
&controller_param.ble_ext_adv_data_max_len); &controller_param.ble_ext_adv_data_max_len);
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE) #endif // (BLE_50_FEATURE_SUPPORT == TRUE && BLE_42_FEATURE_SUPPORT == FALSE)
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(controller_param.features_ble.as_array)) { if (HCI_LE_DATA_LEN_EXT_SUPPORTED(controller_param.features_ble.as_array)) {
@ -508,6 +516,7 @@ static void set_ble_resolving_list_max_size(int resolving_list_max_size)
controller_param.ble_resolving_list_max_size = resolving_list_max_size; controller_param.ble_resolving_list_max_size = resolving_list_max_size;
} }
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static uint16_t ble_get_ext_adv_data_max_len(void) static uint16_t ble_get_ext_adv_data_max_len(void)
{ {
assert(controller_param.readable); assert(controller_param.readable);
@ -515,6 +524,7 @@ static uint16_t ble_get_ext_adv_data_max_len(void)
return controller_param.ble_ext_adv_data_max_len; return controller_param.ble_ext_adv_data_max_len;
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BTM_SCO_HCI_INCLUDED == TRUE) #if (BTM_SCO_HCI_INCLUDED == TRUE)
static uint8_t get_sco_data_size(void) static uint8_t get_sco_data_size(void)
@ -574,7 +584,9 @@ static const controller_t interface = {
get_ble_resolving_list_max_size, get_ble_resolving_list_max_size,
set_ble_resolving_list_max_size, set_ble_resolving_list_max_size,
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
ble_get_ext_adv_data_max_len, ble_get_ext_adv_data_max_len,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BTM_SCO_HCI_INCLUDED == TRUE) #if (BTM_SCO_HCI_INCLUDED == TRUE)
get_sco_data_size, get_sco_data_size,

View File

@ -81,7 +81,9 @@ typedef struct controller_t {
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size); void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
uint16_t (*ble_get_ext_adv_data_max_len)(void); uint16_t (*ble_get_ext_adv_data_max_len)(void);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // BLE_50_FEATURE_SUPPORT #endif // BLE_50_FEATURE_SUPPORT
#if (BTM_SCO_HCI_INCLUDED == TRUE) #if (BTM_SCO_HCI_INCLUDED == TRUE)

View File

@ -68,6 +68,7 @@ static const uint16_t outbound_event_types[] = {
typedef struct { typedef struct {
fixed_queue_t *rx_q; fixed_queue_t *rx_q;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_q; struct pkt_queue *adv_rpt_q;
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
osi_mutex_t adv_flow_lock; osi_mutex_t adv_flow_lock;
@ -77,6 +78,7 @@ typedef struct {
pkt_linked_item_t *adv_fc_cmd_buf; pkt_linked_item_t *adv_fc_cmd_buf;
bool cmd_buf_in_use; bool cmd_buf_in_use;
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_callbacks_t *callbacks; hci_hal_callbacks_t *callbacks;
osi_thread_t *hci_h4_thread; osi_thread_t *hci_h4_thread;
struct osi_event *upstream_data_ready; struct osi_event *upstream_data_ready;
@ -90,15 +92,18 @@ static const esp_bluedroid_hci_driver_callbacks_t hci_host_cb;
static void host_send_pkt_available_cb(void); static void host_send_pkt_available_cb(void);
static int host_recv_pkt_cb(uint8_t *data, uint16_t len); static int host_recv_pkt_cb(uint8_t *data, uint16_t len);
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet); static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet);
#if (BLE_42_SCAN_EN == TRUE)
static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt); static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt);
#endif // #if (BLE_42_SCAN_EN == TRUE)
static void hci_upstream_data_handler(void *arg); static void hci_upstream_data_handler(void *arg);
static bool hci_upstream_data_post(uint32_t timeout); static bool hci_upstream_data_post(uint32_t timeout);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
static void hci_adv_flow_monitor(void *context); static void hci_adv_flow_monitor(void *context);
static void hci_adv_flow_cmd_free_cb(pkt_linked_item_t *linked_pkt); static void hci_adv_flow_cmd_free_cb(pkt_linked_item_t *linked_pkt);
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thread_t *task_thread) static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thread_t *task_thread)
{ {
assert(upper_callbacks != NULL); assert(upper_callbacks != NULL);
@ -106,7 +111,7 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
hci_hal_env.hci_h4_thread = task_thread; hci_hal_env.hci_h4_thread = task_thread;
hci_hal_env.callbacks = (hci_hal_callbacks_t *)upper_callbacks; hci_hal_env.callbacks = (hci_hal_callbacks_t *)upper_callbacks;
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_hal_env.adv_fc_cmd_buf = osi_calloc(HCI_CMD_LINKED_BUF_SIZE(HCIC_PARAM_SIZE_BLE_UPDATE_ADV_FLOW_CONTROL)); hci_hal_env.adv_fc_cmd_buf = osi_calloc(HCI_CMD_LINKED_BUF_SIZE(HCIC_PARAM_SIZE_BLE_UPDATE_ADV_FLOW_CONTROL));
assert(hci_hal_env.adv_fc_cmd_buf != NULL); assert(hci_hal_env.adv_fc_cmd_buf != NULL);
@ -119,13 +124,13 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
hci_hal_env.adv_flow_monitor = osi_alarm_new("adv_fc_mon", hci_adv_flow_monitor, NULL, HCI_ADV_FLOW_MONITOR_PERIOD_MS); hci_hal_env.adv_flow_monitor = osi_alarm_new("adv_fc_mon", hci_adv_flow_monitor, NULL, HCI_ADV_FLOW_MONITOR_PERIOD_MS);
assert (hci_hal_env.adv_flow_monitor != NULL); assert (hci_hal_env.adv_flow_monitor != NULL);
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.rx_q = fixed_queue_new(QUEUE_SIZE_MAX); hci_hal_env.rx_q = fixed_queue_new(QUEUE_SIZE_MAX);
assert(hci_hal_env.rx_q != NULL); assert(hci_hal_env.rx_q != NULL);
#if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.adv_rpt_q = pkt_queue_create(); hci_hal_env.adv_rpt_q = pkt_queue_create();
assert(hci_hal_env.adv_rpt_q != NULL); assert(hci_hal_env.adv_rpt_q != NULL);
#endif // #if (BLE_42_SCAN_EN == TRUE)
struct osi_event *event = osi_event_create(hci_upstream_data_handler, NULL); struct osi_event *event = osi_event_create(hci_upstream_data_handler, NULL);
assert(event != NULL); assert(event != NULL);
hci_hal_env.upstream_data_ready = event; hci_hal_env.upstream_data_ready = event;
@ -137,19 +142,23 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
static void hci_hal_env_deinit(void) static void hci_hal_env_deinit(void)
{ {
fixed_queue_t *rx_q = hci_hal_env.rx_q; fixed_queue_t *rx_q = hci_hal_env.rx_q;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q; struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q;
#endif // #if (BLE_42_SCAN_EN == TRUE)
struct osi_event *upstream_data_ready = hci_hal_env.upstream_data_ready; struct osi_event *upstream_data_ready = hci_hal_env.upstream_data_ready;
hci_hal_env.rx_q = NULL; hci_hal_env.rx_q = NULL;
#if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.adv_rpt_q = NULL; hci_hal_env.adv_rpt_q = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.upstream_data_ready = NULL; hci_hal_env.upstream_data_ready = NULL;
fixed_queue_free(rx_q, osi_free_func); fixed_queue_free(rx_q, osi_free_func);
#if (BLE_42_SCAN_EN == TRUE)
pkt_queue_destroy(adv_rpt_q, NULL); pkt_queue_destroy(adv_rpt_q, NULL);
#endif // #if (BLE_42_SCAN_EN == TRUE)
osi_event_delete(upstream_data_ready); osi_event_delete(upstream_data_ready);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_hal_env.cmd_buf_in_use = true; hci_hal_env.cmd_buf_in_use = true;
osi_alarm_cancel(hci_hal_env.adv_flow_monitor); osi_alarm_cancel(hci_hal_env.adv_flow_monitor);
@ -159,7 +168,7 @@ static void hci_hal_env_deinit(void)
osi_free(hci_hal_env.adv_fc_cmd_buf); osi_free(hci_hal_env.adv_fc_cmd_buf);
hci_hal_env.adv_fc_cmd_buf = NULL; hci_hal_env.adv_fc_cmd_buf = NULL;
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.hci_h4_thread = NULL; hci_hal_env.hci_h4_thread = NULL;
memset(&hci_hal_env, 0, sizeof(hci_hal_env_t)); memset(&hci_hal_env, 0, sizeof(hci_hal_env_t));
@ -222,7 +231,9 @@ static uint16_t transmit_data(serial_data_type_t type,
static void hci_upstream_data_handler(void *arg) static void hci_upstream_data_handler(void *arg)
{ {
fixed_queue_t *rx_q = hci_hal_env.rx_q; fixed_queue_t *rx_q = hci_hal_env.rx_q;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q; struct pkt_queue *adv_rpt_q = hci_hal_env.adv_rpt_q;
#endif // #if (BLE_42_SCAN_EN == TRUE)
size_t pkts_to_process; size_t pkts_to_process;
do { do {
@ -234,7 +245,7 @@ static void hci_upstream_data_handler(void *arg)
} }
} }
} while (0); } while (0);
#if (BLE_42_SCAN_EN == TRUE)
do { do {
pkts_to_process = pkt_queue_length(adv_rpt_q); pkts_to_process = pkt_queue_length(adv_rpt_q);
for (size_t i = 0; i < pkts_to_process; i++) { for (size_t i = 0; i < pkts_to_process; i++) {
@ -244,8 +255,12 @@ static void hci_upstream_data_handler(void *arg)
} }
} }
} while (0); } while (0);
#endif // #if (BLE_42_SCAN_EN == TRUE)
if (!fixed_queue_is_empty(rx_q) || pkt_queue_length(adv_rpt_q) > 0) { if (!fixed_queue_is_empty(rx_q)
#if (BLE_42_SCAN_EN == TRUE)
|| pkt_queue_length(adv_rpt_q) > 0
#endif // #if (BLE_42_SCAN_EN == TRUE)
) {
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT); hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);
} }
} }
@ -286,6 +301,7 @@ bool host_recv_adv_packet(uint8_t *packet)
return false; return false;
} }
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
static void hci_adv_flow_monitor(void *context) static void hci_adv_flow_monitor(void *context)
{ {
@ -411,6 +427,7 @@ int hci_adv_credits_force_release(uint16_t num)
return credits_released; return credits_released;
} }
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet) static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
{ {
@ -472,7 +489,7 @@ static void hci_hal_h4_hdl_rx_packet(BT_HDR *packet)
packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)]; packet->event = outbound_event_types[PACKET_TYPE_TO_INDEX(type)];
hci_hal_env.callbacks->packet_ready(packet); hci_hal_env.callbacks->packet_ready(packet);
} }
#if (BLE_42_SCAN_EN == TRUE)
static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt) static void hci_hal_h4_hdl_rx_adv_rpt(pkt_linked_item_t *linked_pkt)
{ {
uint8_t type; uint8_t type;
@ -519,6 +536,7 @@ _discard_packet:
hci_adv_credits_prep_to_release(1); hci_adv_credits_prep_to_release(1);
#endif #endif
} }
#endif // #if (BLE_42_SCAN_EN == TRUE)
static void host_send_pkt_available_cb(void) static void host_send_pkt_available_cb(void)
{ {
@ -551,7 +569,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
{ {
//Target has packet to host, malloc new buffer for packet //Target has packet to host, malloc new buffer for packet
BT_HDR *pkt = NULL; BT_HDR *pkt = NULL;
#if (BLE_42_SCAN_EN == TRUE)
pkt_linked_item_t *linked_pkt = NULL; pkt_linked_item_t *linked_pkt = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
size_t pkt_size; size_t pkt_size;
if (hci_hal_env.rx_q == NULL) { if (hci_hal_env.rx_q == NULL) {
@ -576,6 +596,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
memcpy(pkt->data, data, len); memcpy(pkt->data, data, len);
fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT); fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT);
} else { } else {
#if (BLE_42_SCAN_EN == TRUE)
#if !BLE_ADV_REPORT_FLOW_CONTROL #if !BLE_ADV_REPORT_FLOW_CONTROL
// drop the packets if pkt_queue length goes beyond upper limit // drop the packets if pkt_queue length goes beyond upper limit
if (pkt_queue_length(hci_hal_env.adv_rpt_q) > HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX) { if (pkt_queue_length(hci_hal_env.adv_rpt_q) > HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX) {
@ -604,6 +625,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_adv_credits_consumed(1); hci_adv_credits_consumed(1);
#endif #endif
#else
assert(0);
#endif // #if (BLE_42_SCAN_EN == TRUE)
} }
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT); hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);

View File

@ -537,9 +537,11 @@ static void dispatch_adv_report(pkt_linked_item_t *linked_pkt)
//Tell Up-layer received packet. //Tell Up-layer received packet.
if (btu_task_post(SIG_BTU_HCI_ADV_RPT_MSG, linked_pkt, OSI_THREAD_MAX_TIMEOUT) == false) { if (btu_task_post(SIG_BTU_HCI_ADV_RPT_MSG, linked_pkt, OSI_THREAD_MAX_TIMEOUT) == false) {
osi_free(linked_pkt); osi_free(linked_pkt);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
hci_adv_credits_try_release(1); hci_adv_credits_try_release(1);
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
} }
} }
// Misc internal functions // Misc internal functions

View File

@ -52,6 +52,7 @@ static BT_HDR *make_set_c2h_flow_control(uint8_t enable)
return packet; return packet;
} }
#if (BLE_42_SCAN_EN == TRUE)
static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, uint16_t lost_threshold) static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, uint16_t lost_threshold)
{ {
uint8_t *stream; uint8_t *stream;
@ -63,7 +64,7 @@ static BT_HDR *make_set_adv_report_flow_control(uint8_t enable, uint16_t num, ui
UINT16_TO_STREAM(stream, lost_threshold); UINT16_TO_STREAM(stream, lost_threshold);
return packet; return packet;
} }
#endif // #if (BLE_42_SCAN_EN == TRUE)
static BT_HDR *make_host_buffer_size(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count) static BT_HDR *make_host_buffer_size(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count)
{ {
uint8_t *stream; uint8_t *stream;
@ -219,10 +220,12 @@ static BT_HDR *make_write_default_erroneous_data_report(uint8_t enable)
return packet; return packet;
} }
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static BT_HDR *make_read_max_adv_data_len(void) static BT_HDR *make_read_max_adv_data_len(void)
{ {
return make_command_no_params(HCI_BLE_RD_MAX_ADV_DATA_LEN); return make_command_no_params(HCI_BLE_RD_MAX_ADV_DATA_LEN);
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
// Internal functions // Internal functions
@ -252,7 +255,9 @@ static const hci_packet_factory_t interface = {
make_reset, make_reset,
make_read_buffer_size, make_read_buffer_size,
make_set_c2h_flow_control, make_set_c2h_flow_control,
#if (BLE_42_SCAN_EN == TRUE)
make_set_adv_report_flow_control, make_set_adv_report_flow_control,
#endif // #if (BLE_42_SCAN_EN == TRUE)
make_host_buffer_size, make_host_buffer_size,
make_read_local_version_info, make_read_local_version_info,
make_read_bd_addr, make_read_bd_addr,
@ -269,7 +274,9 @@ static const hci_packet_factory_t interface = {
make_ble_read_local_supported_features, make_ble_read_local_supported_features,
make_ble_read_resolving_list_size, make_ble_read_resolving_list_size,
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
make_read_max_adv_data_len, make_read_max_adv_data_len,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
make_ble_read_suggested_default_data_length, make_ble_read_suggested_default_data_length,
make_ble_write_suggested_default_data_length, make_ble_write_suggested_default_data_length,

View File

@ -209,6 +209,7 @@ static void parse_ble_read_suggested_default_data_length_response(
} }
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static void parse_ble_read_adv_max_len_response( static void parse_ble_read_adv_max_len_response(
BT_HDR *response, BT_HDR *response,
uint16_t *adv_max_len_ptr) uint16_t *adv_max_len_ptr)
@ -221,6 +222,7 @@ static void parse_ble_read_adv_max_len_response(
} }
osi_free(response); osi_free(response);
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
@ -282,7 +284,9 @@ static const hci_packet_parser_t interface = {
parse_ble_read_local_supported_features_response, parse_ble_read_local_supported_features_response,
parse_ble_read_resolving_list_size_response, parse_ble_read_resolving_list_size_response,
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
parse_ble_read_adv_max_len_response, parse_ble_read_adv_max_len_response,
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
parse_ble_read_suggested_default_data_length_response parse_ble_read_suggested_default_data_length_response
}; };

View File

@ -104,10 +104,11 @@ void hci_shut_down(void);
bool hci_downstream_data_post(uint32_t timeout); bool hci_downstream_data_post(uint32_t timeout);
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
int hci_adv_credits_prep_to_release(uint16_t num); int hci_adv_credits_prep_to_release(uint16_t num);
int hci_adv_credits_try_release(uint16_t num); int hci_adv_credits_try_release(uint16_t num);
int hci_adv_credits_force_release(uint16_t num); int hci_adv_credits_force_release(uint16_t num);
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif /* _HCI_LAYER_H_ */ #endif /* _HCI_LAYER_H_ */

View File

@ -26,7 +26,9 @@ typedef struct {
BT_HDR *(*make_reset)(void); BT_HDR *(*make_reset)(void);
BT_HDR *(*make_read_buffer_size)(void); BT_HDR *(*make_read_buffer_size)(void);
BT_HDR *(*make_set_c2h_flow_control)(uint8_t enable); BT_HDR *(*make_set_c2h_flow_control)(uint8_t enable);
#if (BLE_42_SCAN_EN == TRUE)
BT_HDR *(*make_set_adv_report_flow_control)(uint8_t enable, uint16_t num, uint16_t lost_threshold); BT_HDR *(*make_set_adv_report_flow_control)(uint8_t enable, uint16_t num, uint16_t lost_threshold);
#endif // #if (BLE_42_SCAN_EN == TRUE)
BT_HDR *(*make_host_buffer_size)(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count); BT_HDR *(*make_host_buffer_size)(uint16_t acl_size, uint8_t sco_size, uint16_t acl_count, uint16_t sco_count);
BT_HDR *(*make_read_local_version_info)(void); BT_HDR *(*make_read_local_version_info)(void);
BT_HDR *(*make_read_bd_addr)(void); BT_HDR *(*make_read_bd_addr)(void);
@ -43,7 +45,9 @@ typedef struct {
BT_HDR *(*make_ble_read_local_supported_features)(void); BT_HDR *(*make_ble_read_local_supported_features)(void);
BT_HDR *(*make_ble_read_resolving_list_size)(void); BT_HDR *(*make_ble_read_resolving_list_size)(void);
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
BT_HDR *(*make_read_max_adv_data_len)(void); BT_HDR *(*make_read_max_adv_data_len)(void);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
BT_HDR *(*make_ble_read_suggested_default_data_length)(void); BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
BT_HDR *(*make_ble_write_suggested_default_data_length)(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime); BT_HDR *(*make_ble_write_suggested_default_data_length)(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime);

View File

@ -95,10 +95,12 @@ typedef struct {
uint8_t *resolving_list_size_ptr uint8_t *resolving_list_size_ptr
); );
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void (*parse_ble_read_adv_max_len_response) ( void (*parse_ble_read_adv_max_len_response) (
BT_HDR *respone, BT_HDR *response,
uint16_t *ble_ext_adv_data_max_len_ptr uint16_t *ble_ext_adv_data_max_len_ptr
); );
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
void (*parse_ble_read_suggested_default_data_length_response)( void (*parse_ble_read_suggested_default_data_length_response)(
BT_HDR *response, BT_HDR *response,

View File

@ -583,10 +583,11 @@ void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window)
p_ble_cb->scan_win = scan_window; p_ble_cb->scan_win = scan_window;
new_param = TRUE; new_param = TRUE;
} }
#if (tGATT_BG_CONN_DEV == TRUE)
if (new_param && p_ble_cb->conn_state == BLE_BG_CONN) { if (new_param && p_ble_cb->conn_state == BLE_BG_CONN) {
btm_ble_suspend_bg_conn(); btm_ble_suspend_bg_conn();
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} else { } else {
BTM_TRACE_ERROR("Illegal Connection Scan Parameters"); BTM_TRACE_ERROR("Illegal Connection Scan Parameters");
} }

View File

@ -21,6 +21,7 @@ extern BOOLEAN BTM_GetLocalResolvablePrivateAddr(BD_ADDR bda);
extern void BTM_UpdateAddrInfor(uint8_t addr_type, BD_ADDR bda); extern void BTM_UpdateAddrInfor(uint8_t addr_type, BD_ADDR bda);
extern void BTM_BleSetStaticAddr(BD_ADDR rand_addr); extern void BTM_BleSetStaticAddr(BD_ADDR rand_addr);
extern uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb); extern uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb);
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static tBTM_STATUS btm_ble_ext_adv_params_validate(tBTM_BLE_GAP_EXT_ADV_PARAMS *params); static tBTM_STATUS btm_ble_ext_adv_params_validate(tBTM_BLE_GAP_EXT_ADV_PARAMS *params);
static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len, UINT8 *data); static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len, UINT8 *data);
@ -35,6 +36,8 @@ typedef struct {
} tBTM_EXT_ADV_RECORD; } tBTM_EXT_ADV_RECORD;
tBTM_EXT_ADV_RECORD adv_record[MAX_BLE_ADV_INSTANCE] = {0}; tBTM_EXT_ADV_RECORD adv_record[MAX_BLE_ADV_INSTANCE] = {0};
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
extern void btm_ble_inter_set(bool extble_inter); extern void btm_ble_inter_set(bool extble_inter);
#if !UC_BT_STACK_NO_LOG #if !UC_BT_STACK_NO_LOG
@ -193,11 +196,12 @@ void btm_ble_extendadvcb_init(void)
{ {
memset(&extend_adv_cb, 0, sizeof(tBTM_BLE_EXTENDED_CB)); memset(&extend_adv_cb, 0, sizeof(tBTM_BLE_EXTENDED_CB));
} }
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_advrecod_init(void) void btm_ble_advrecod_init(void)
{ {
memset(&adv_record[0], 0, sizeof(tBTM_EXT_ADV_RECORD)*MAX_BLE_ADV_INSTANCE); memset(&adv_record[0], 0, sizeof(tBTM_EXT_ADV_RECORD)*MAX_BLE_ADV_INSTANCE);
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
void BTM_BleGapRegisterCallback(tBTM_BLE_5_HCI_CBACK cb) void BTM_BleGapRegisterCallback(tBTM_BLE_5_HCI_CBACK cb)
{ {
@ -1127,6 +1131,7 @@ void btm_ble_extended_cleanup(void)
} }
#if (BLE_50_EXTEND_ADV_EN == TRUE)
static tBTM_STATUS btm_ble_ext_adv_params_validate(tBTM_BLE_GAP_EXT_ADV_PARAMS *params) static tBTM_STATUS btm_ble_ext_adv_params_validate(tBTM_BLE_GAP_EXT_ADV_PARAMS *params)
{ {
if (!params) { if (!params) {
@ -1203,6 +1208,7 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
return BTM_SUCCESS; return BTM_SUCCESS;
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_update_phy_evt(tBTM_BLE_UPDATE_PHY *params) void btm_ble_update_phy_evt(tBTM_BLE_UPDATE_PHY *params)
{ {
@ -1285,6 +1291,7 @@ void btm_ble_ext_adv_report_evt(tBTM_BLE_EXT_ADV_REPORT *params)
} }
#endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE) #endif // #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params) void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params)
{ {
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1301,7 +1308,7 @@ void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params)
return; return;
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params) void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params)
{ {
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
@ -1375,6 +1382,7 @@ void btm_ble_periodic_adv_sync_establish_evt(tBTM_BLE_PERIOD_ADV_SYNC_ESTAB *par
} }
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE) #endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
uint8_t btm_ble_ext_adv_active_count(void) uint8_t btm_ble_ext_adv_active_count(void)
{ {
uint8_t count = 0; uint8_t count = 0;
@ -1387,6 +1395,7 @@ uint8_t btm_ble_ext_adv_active_count(void)
return count; return count;
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)

View File

@ -648,6 +648,7 @@ void btm_ble_initiate_select_conn(BD_ADDR bda)
BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed"); BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed");
} }
} }
#if (tGATT_BG_CONN_DEV == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btm_ble_suspend_bg_conn ** Function btm_ble_suspend_bg_conn
@ -672,6 +673,8 @@ BOOLEAN btm_ble_suspend_bg_conn(void)
return FALSE; return FALSE;
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btm_suspend_wl_activity ** Function btm_suspend_wl_activity
@ -706,7 +709,9 @@ static void btm_suspend_wl_activity(tBTM_BLE_WL_STATE wl_state)
*******************************************************************************/ *******************************************************************************/
void btm_resume_wl_activity(tBTM_BLE_WL_STATE wl_state) void btm_resume_wl_activity(tBTM_BLE_WL_STATE wl_state)
{ {
#if (tGATT_BG_CONN_DEV == TRUE)
btm_ble_resume_bg_conn(); btm_ble_resume_bg_conn();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
if (wl_state & BTM_BLE_WL_ADV) { if (wl_state & BTM_BLE_WL_ADV) {
#if (BLE_42_ADV_EN == TRUE) #if (BLE_42_ADV_EN == TRUE)
btm_ble_start_adv(); btm_ble_start_adv();
@ -733,6 +738,7 @@ static void btm_wl_update_to_controller(void)
btm_execute_wl_dev_operation(); btm_execute_wl_dev_operation();
} }
#if (tGATT_BG_CONN_DEV == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btm_ble_resume_bg_conn ** Function btm_ble_resume_bg_conn
@ -762,6 +768,8 @@ BOOLEAN btm_ble_resume_bg_conn(void)
return ret; return ret;
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btm_ble_get_conn_st ** Function btm_ble_get_conn_st

View File

@ -86,7 +86,9 @@ static UINT8 btm_set_conn_mode_adv_init_addr(tBTM_BLE_INQ_CB *p_cb,
tBLE_ADDR_TYPE *p_own_addr_type); tBLE_ADDR_TYPE *p_own_addr_type);
static void btm_ble_stop_observe(void); static void btm_ble_stop_observe(void);
static void btm_ble_stop_discover(void); static void btm_ble_stop_discover(void);
#if (BLE_42_SCAN_EN == TRUE)
static void btm_adv_pkt_handler(void *arg); static void btm_adv_pkt_handler(void *arg);
#endif // #if (BLE_42_SCAN_EN == TRUE)
uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb); uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb);
#define BTM_BLE_INQ_RESULT 0x01 #define BTM_BLE_INQ_RESULT 0x01
@ -1332,7 +1334,9 @@ void BTM_BleClearBgConnDev(void)
{ {
btm_ble_start_auto_conn(FALSE); btm_ble_start_auto_conn(FALSE);
btm_ble_clear_white_list(NULL); btm_ble_clear_white_list(NULL);
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_reset_bgdev_list(); gatt_reset_bgdev_list();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} }
/******************************************************************************* /*******************************************************************************
@ -1355,7 +1359,7 @@ BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda)
BTM_TRACE_EVENT("%s() add=%d", __func__, add_remove); BTM_TRACE_EVENT("%s() add=%d", __func__, add_remove);
return btm_update_dev_to_white_list(add_remove, remote_bda, 0, NULL); return btm_update_dev_to_white_list(add_remove, remote_bda, 0, NULL);
} }
#if 0
/******************************************************************************* /*******************************************************************************
** **
** Function BTM_BleSetConnectableMode ** Function BTM_BleSetConnectableMode
@ -1383,7 +1387,7 @@ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode)
p_cb->directed_conn = connectable_mode; p_cb->directed_conn = connectable_mode;
return btm_ble_set_connectability( p_cb->connectable_mode); return btm_ble_set_connectability( p_cb->connectable_mode);
} }
#endif
/******************************************************************************* /*******************************************************************************
** **
** Function btm_set_conn_mode_adv_init_addr ** Function btm_set_conn_mode_adv_init_addr
@ -2029,6 +2033,7 @@ BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type)
return TRUE; return TRUE;
} }
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
/******************************************************************************* /*******************************************************************************
** **
** Function BTM_CheckAdvData ** Function BTM_CheckAdvData
@ -2074,7 +2079,7 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT16 adv_data_len, UINT8 type, UINT8 *p
*p_length = 0; *p_length = 0;
return NULL; return NULL;
} }
#endif // #if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
/******************************************************************************* /*******************************************************************************
** **
** Function BTM__BLEReadDiscoverability ** Function BTM__BLEReadDiscoverability
@ -2535,6 +2540,7 @@ void btm_ble_set_adv_flag(UINT16 connect_mode, UINT16 disc_mode)
btm_ble_update_adv_flag(flag); btm_ble_update_adv_flag(flag);
} }
} }
#if 0
/******************************************************************************* /*******************************************************************************
** **
** Function btm_ble_set_discoverability ** Function btm_ble_set_discoverability
@ -2637,7 +2643,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
} }
return status; return status;
} }
#endif
/******************************************************************************* /*******************************************************************************
** **
** Function btm_ble_set_connectability ** Function btm_ble_set_connectability
@ -3485,6 +3491,7 @@ void btm_send_sel_conn_callback(BD_ADDR remote_bda, UINT8 evt_type, UINT8 *p_dat
} }
} }
#if (BLE_42_SCAN_EN == TRUE)
static void btm_adv_pkt_handler(void *arg) static void btm_adv_pkt_handler(void *arg)
{ {
UINT8 hci_evt_code, hci_evt_len; UINT8 hci_evt_code, hci_evt_len;
@ -3527,6 +3534,7 @@ static void btm_adv_pkt_handler(void *arg)
UNUSED(hci_evt_code); UNUSED(hci_evt_code);
UNUSED(hci_evt_len); UNUSED(hci_evt_len);
} }
#endif // #if (BLE_42_SCAN_EN == TRUE)
/******************************************************************************* /*******************************************************************************
** **
@ -3813,6 +3821,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
void btm_ble_process_adv_discard_evt(UINT8 *p) void btm_ble_process_adv_discard_evt(UINT8 *p)
{ {
#if (BLE_42_SCAN_EN == TRUE)
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE) #if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
uint32_t num_dis = 0; uint32_t num_dis = 0;
STREAM_TO_UINT32 (num_dis, p); STREAM_TO_UINT32 (num_dis, p);
@ -3821,6 +3830,7 @@ void btm_ble_process_adv_discard_evt(UINT8 *p)
(p_obs_discard_cb)(num_dis); (p_obs_discard_cb)(num_dis);
} }
#endif #endif
#endif // #if (BLE_42_SCAN_EN == TRUE)
} }
void btm_ble_process_direct_adv_pkt(UINT8 *p) void btm_ble_process_direct_adv_pkt(UINT8 *p)
@ -4524,7 +4534,9 @@ BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 st
now in order */ now in order */
if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES && if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES &&
!btm_send_pending_direct_conn()) { !btm_send_pending_direct_conn()) {
#if (tGATT_BG_CONN_DEV == TRUE)
bg_con = btm_ble_resume_bg_conn(); bg_con = btm_ble_resume_bg_conn();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} }
return bg_con; return bg_con;
@ -4575,14 +4587,14 @@ void btm_ble_init (void)
p_cb->scan_int = p_cb->scan_win = BTM_BLE_SCAN_PARAM_UNDEF; p_cb->scan_int = p_cb->scan_win = BTM_BLE_SCAN_PARAM_UNDEF;
p_cb->inq_var.evt_type = BTM_BLE_NON_CONNECT_EVT; p_cb->inq_var.evt_type = BTM_BLE_NON_CONNECT_EVT;
#if (BLE_42_SCAN_EN == TRUE)
p_cb->adv_rpt_queue = pkt_queue_create(); p_cb->adv_rpt_queue = pkt_queue_create();
assert(p_cb->adv_rpt_queue != NULL); assert(p_cb->adv_rpt_queue != NULL);
p_cb->adv_rpt_ready = osi_event_create(btm_adv_pkt_handler, NULL); p_cb->adv_rpt_ready = osi_event_create(btm_adv_pkt_handler, NULL);
assert(p_cb->adv_rpt_ready != NULL); assert(p_cb->adv_rpt_ready != NULL);
osi_event_bind(p_cb->adv_rpt_ready, btu_get_current_thread(), 0); osi_event_bind(p_cb->adv_rpt_ready, btu_get_current_thread(), 0);
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if BLE_VND_INCLUDED == FALSE #if BLE_VND_INCLUDED == FALSE
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
btm_ble_adv_filter_init(); btm_ble_adv_filter_init();
@ -4606,13 +4618,13 @@ void btm_ble_free (void)
BTM_TRACE_DEBUG("%s", __func__); BTM_TRACE_DEBUG("%s", __func__);
fixed_queue_free(p_cb->conn_pending_q, osi_free_func); fixed_queue_free(p_cb->conn_pending_q, osi_free_func);
#if (BLE_42_SCAN_EN == TRUE)
pkt_queue_destroy(p_cb->adv_rpt_queue, NULL); pkt_queue_destroy(p_cb->adv_rpt_queue, NULL);
p_cb->adv_rpt_queue = NULL; p_cb->adv_rpt_queue = NULL;
osi_event_delete(p_cb->adv_rpt_ready); osi_event_delete(p_cb->adv_rpt_ready);
p_cb->adv_rpt_ready = NULL; p_cb->adv_rpt_ready = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#if BTM_DYNAMIC_MEMORY == TRUE #if BTM_DYNAMIC_MEMORY == TRUE
osi_free(cmn_ble_gap_vsc_cb_ptr); osi_free(cmn_ble_gap_vsc_cb_ptr);
cmn_ble_gap_vsc_cb_ptr = NULL; cmn_ble_gap_vsc_cb_ptr = NULL;
@ -4781,6 +4793,7 @@ BOOLEAN BTM_BleSetCsaSupport(UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *
return TRUE; return TRUE;
} }
#if (BLE_42_SCAN_EN == TRUE)
bool btm_ble_adv_pkt_ready(void) bool btm_ble_adv_pkt_ready(void)
{ {
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb; tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
@ -4799,4 +4812,6 @@ bool btm_ble_adv_pkt_post(pkt_linked_item_t *pkt)
pkt_queue_enqueue(p_cb->adv_rpt_queue, pkt); pkt_queue_enqueue(p_cb->adv_rpt_queue, pkt);
return true; return true;
} }
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif /* BLE_INCLUDED */ #endif /* BLE_INCLUDED */

View File

@ -694,11 +694,11 @@ BOOLEAN btm_ble_suspend_resolving_list_activity(void)
btm_ble_stop_scan(); btm_ble_stop_scan();
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_SCAN; p_ble_cb->suspended_rl_state |= BTM_BLE_RL_SCAN;
} }
#if (tGATT_BG_CONN_DEV == TRUE)
if (btm_ble_suspend_bg_conn()) { if (btm_ble_suspend_bg_conn()) {
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_INIT; p_ble_cb->suspended_rl_state |= BTM_BLE_RL_INIT;
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
return TRUE; return TRUE;
} }
@ -726,10 +726,11 @@ void btm_ble_resume_resolving_list_activity(void)
btm_ble_start_scan(); btm_ble_start_scan();
} }
#endif // #if (BLE_42_SCAN_EN == TRUE) #endif // #if (BLE_42_SCAN_EN == TRUE)
#if (tGATT_BG_CONN_DEV == TRUE)
if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_INIT) { if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_INIT) {
btm_ble_resume_bg_conn(); btm_ble_resume_bg_conn();
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE; p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE;
} }

View File

@ -82,7 +82,9 @@ void btm_dev_init (void)
/* Initialize nonzero defaults */ /* Initialize nonzero defaults */
#if (BTM_MAX_LOC_BD_NAME_LEN > 0) #if (BTM_MAX_LOC_BD_NAME_LEN > 0)
memset(btm_cb.cfg.ble_bd_name, 0, sizeof(tBTM_LOC_BD_NAME)); memset(btm_cb.cfg.ble_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
#if (CLASSIC_BT_INCLUDED == TRUE)
memset(btm_cb.cfg.bredr_bd_name, 0, sizeof(tBTM_LOC_BD_NAME)); memset(btm_cb.cfg.bredr_bd_name, 0, sizeof(tBTM_LOC_BD_NAME));
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif #endif
btm_cb.devcb.reset_timer.param = (TIMER_PARAM_TYPE)TT_DEV_RESET; btm_cb.devcb.reset_timer.param = (TIMER_PARAM_TYPE)TT_DEV_RESET;
@ -169,7 +171,9 @@ static void reset_complete(void)
btm_cb.ble_ctr_cb.conn_state = BLE_CONN_IDLE; btm_cb.ble_ctr_cb.conn_state = BLE_CONN_IDLE;
btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_NONE; btm_cb.ble_ctr_cb.bg_conn_type = BTM_BLE_CONN_NONE;
btm_cb.ble_ctr_cb.p_select_cback = NULL; btm_cb.ble_ctr_cb.p_select_cback = NULL;
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_reset_bgdev_list(); gatt_reset_bgdev_list();
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE) #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
btm_ble_multi_adv_init(); btm_ble_multi_adv_init();
#endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE) #endif // #if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
@ -473,7 +477,7 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
btm_cb.cfg.ble_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0'; btm_cb.cfg.ble_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
} }
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
if (name_type & BT_DEVICE_TYPE_BREDR) { if (name_type & BT_DEVICE_TYPE_BREDR) {
p = (UINT8 *)btm_cb.cfg.bredr_bd_name; p = (UINT8 *)btm_cb.cfg.bredr_bd_name;
if (p != (UINT8 *)p_name) { if (p != (UINT8 *)p_name) {
@ -481,6 +485,7 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name, tBT_DEVICE_TYPE name_type)
btm_cb.cfg.bredr_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0'; btm_cb.cfg.bredr_bd_name[BTM_MAX_LOC_BD_NAME_LEN] = '\0';
} }
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#else #else
p = (UINT8 *)p_name; p = (UINT8 *)p_name;
#endif #endif
@ -521,21 +526,22 @@ tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name, tBT_DEVICE_TYPE name_type)
*/ */
#if BTM_MAX_LOC_BD_NAME_LEN > 0 #if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
if ((name_type == BT_DEVICE_TYPE_DUMO) && if ((name_type == BT_DEVICE_TYPE_DUMO) &&
(BCM_STRNCMP_S(btm_cb.cfg.bredr_bd_name, btm_cb.cfg.ble_bd_name, BTM_MAX_LOC_BD_NAME_LEN) != 0)) { (BCM_STRNCMP_S(btm_cb.cfg.bredr_bd_name, btm_cb.cfg.ble_bd_name, BTM_MAX_LOC_BD_NAME_LEN) != 0)) {
*p_name = NULL; *p_name = NULL;
BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n"); BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n");
return (BTM_NO_RESOURCES); return (BTM_NO_RESOURCES);
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
if (name_type & BT_DEVICE_TYPE_BLE) { if (name_type & BT_DEVICE_TYPE_BLE) {
*p_name = btm_cb.cfg.ble_bd_name; *p_name = btm_cb.cfg.ble_bd_name;
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
if (name_type & BT_DEVICE_TYPE_BREDR) { if (name_type & BT_DEVICE_TYPE_BREDR) {
*p_name = btm_cb.cfg.bredr_bd_name; *p_name = btm_cb.cfg.bredr_bd_name;
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
return (BTM_SUCCESS); return (BTM_SUCCESS);
#else #else
*p_name = NULL; *p_name = NULL;

View File

@ -39,7 +39,9 @@ tBTM_CB *btm_cb_ptr;
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
extern void btm_ble_extendadvcb_init(void); extern void btm_ble_extendadvcb_init(void);
#if (BLE_50_EXTEND_ADV_EN == TRUE)
extern void btm_ble_advrecod_init(void); extern void btm_ble_advrecod_init(void);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif #endif
@ -89,7 +91,9 @@ void btm_init (void)
btm_sec_dev_init(); btm_sec_dev_init();
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
btm_ble_extendadvcb_init(); btm_ble_extendadvcb_init();
#if (BLE_50_EXTEND_ADV_EN == TRUE)
btm_ble_advrecod_init(); btm_ble_advrecod_init();
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif #endif
} }

View File

@ -1720,7 +1720,7 @@ void BTM_RemoteOobDataReply(tBTM_STATUS res, BD_ADDR bd_addr, BT_OCTET16 c, BT_O
btsnd_hcic_rem_oob_reply (bd_addr, c, r); btsnd_hcic_rem_oob_reply (bd_addr, c, r);
} }
} }
#if 0
/******************************************************************************* /*******************************************************************************
** **
** Function BTM_BuildOobData ** Function BTM_BuildOobData
@ -1745,8 +1745,10 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
UINT8 *p = p_data; UINT8 *p = p_data;
UINT16 len = 0; UINT16 len = 0;
#if BTM_MAX_LOC_BD_NAME_LEN > 0 #if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
UINT16 name_size; UINT16 name_size;
UINT8 name_type = BTM_EIR_SHORTENED_LOCAL_NAME_TYPE; UINT8 name_type = BTM_EIR_SHORTENED_LOCAL_NAME_TYPE;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif #endif
if (p_data && max_len >= BTM_OOB_MANDATORY_SIZE) { if (p_data && max_len >= BTM_OOB_MANDATORY_SIZE) {
@ -1789,6 +1791,7 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
max_len -= delta; max_len -= delta;
} }
#if BTM_MAX_LOC_BD_NAME_LEN > 0 #if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
name_size = name_len; name_size = name_len;
if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) { if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) {
name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE; name_type = BTM_EIR_COMPLETE_LOCAL_NAME_TYPE;
@ -1802,6 +1805,7 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
len += delta; len += delta;
max_len -= delta; max_len -= delta;
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif #endif
/* update len */ /* update len */
p = p_data; p = p_data;
@ -1871,6 +1875,7 @@ UINT8 *BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len)
return p_ret; return p_ret;
} }
#endif
#endif ///BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE #endif ///BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED == TRUE)

View File

@ -342,10 +342,10 @@ typedef struct {
tBTM_INQ_RESULTS_CB *p_scan_results_cb; tBTM_INQ_RESULTS_CB *p_scan_results_cb;
tBTM_CMPL_CB *p_scan_cmpl_cb; tBTM_CMPL_CB *p_scan_cmpl_cb;
TIMER_LIST_ENT scan_timer_ent; TIMER_LIST_ENT scan_timer_ent;
#if (BLE_42_SCAN_EN == TRUE)
struct pkt_queue *adv_rpt_queue; struct pkt_queue *adv_rpt_queue;
struct osi_event *adv_rpt_ready; struct osi_event *adv_rpt_ready;
#endif // #if (BLE_42_SCAN_EN == TRUE)
/* background connection procedure cb value */ /* background connection procedure cb value */
tBTM_BLE_CONN_TYPE bg_conn_type; tBTM_BLE_CONN_TYPE bg_conn_type;
UINT32 scan_int; UINT32 scan_int;
@ -388,12 +388,14 @@ extern "C" {
#endif #endif
void btm_ble_timeout(TIMER_LIST_ENT *p_tle); void btm_ble_timeout(TIMER_LIST_ENT *p_tle);
#if (BLE_42_SCAN_EN == TRUE)
void btm_ble_process_adv_pkt (UINT8 *p); void btm_ble_process_adv_pkt (UINT8 *p);
void btm_ble_process_adv_discard_evt(UINT8 *p); void btm_ble_process_adv_discard_evt(UINT8 *p);
void btm_ble_process_direct_adv_pkt (UINT8 *p); void btm_ble_process_direct_adv_pkt (UINT8 *p);
bool btm_ble_adv_pkt_ready(void); bool btm_ble_adv_pkt_ready(void);
bool btm_ble_adv_pkt_post(pkt_linked_item_t *pkt); bool btm_ble_adv_pkt_post(pkt_linked_item_t *pkt);
void btm_ble_proc_scan_rsp_rpt (UINT8 *p); void btm_ble_proc_scan_rsp_rpt (UINT8 *p);
#endif // #if (BLE_42_SCAN_EN == TRUE)
tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb); tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, tBTM_CMPL_CB *p_cb);
BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda); BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda);
@ -409,7 +411,11 @@ void btm_ble_init (void);
void btm_ble_free (void); void btm_ble_free (void);
void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched); void btm_ble_connected (UINT8 *bda, UINT16 handle, UINT8 enc_mode, UINT8 role, tBLE_ADDR_TYPE addr_type, BOOLEAN addr_matched);
void btm_ble_read_remote_features_complete(UINT8 *p); void btm_ble_read_remote_features_complete(UINT8 *p);
#if (BLE_42_ADV_EN == TRUE)
void btm_ble_write_adv_enable_complete(UINT8 *p); void btm_ble_write_adv_enable_complete(UINT8 *p);
#endif // #if (BLE_42_ADV_EN == TRUE)
void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced); void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced);
void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len); void btm_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len);
tBTM_BLE_CONN_ST btm_ble_get_conn_st(void); tBTM_BLE_CONN_ST btm_ble_get_conn_st(void);
@ -459,9 +465,12 @@ void btm_ble_remove_from_white_list_complete(UINT8 *p, UINT16 evt_len);
void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len); void btm_ble_clear_white_list_complete(UINT8 *p, UINT16 evt_len);
void btm_ble_white_list_init(UINT8 white_list_size); void btm_ble_white_list_init(UINT8 white_list_size);
#if (tGATT_BG_CONN_DEV == TRUE)
/* background connection function */ /* background connection function */
BOOLEAN btm_ble_suspend_bg_conn(void); BOOLEAN btm_ble_suspend_bg_conn(void);
BOOLEAN btm_ble_resume_bg_conn(void); BOOLEAN btm_ble_resume_bg_conn(void);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
void btm_ble_initiate_select_conn(BD_ADDR bda); void btm_ble_initiate_select_conn(BD_ADDR bda);
BOOLEAN btm_ble_start_auto_conn(BOOLEAN start); BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback); BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback);

View File

@ -726,14 +726,18 @@ struct tBTM_SEC_DEV_REC{
*/ */
typedef struct { typedef struct {
#if BTM_MAX_LOC_BD_NAME_LEN > 0 #if BTM_MAX_LOC_BD_NAME_LEN > 0
#if (CLASSIC_BT_INCLUDED == TRUE)
tBTM_LOC_BD_NAME bredr_bd_name; /* local BREDR device name */ tBTM_LOC_BD_NAME bredr_bd_name; /* local BREDR device name */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
tBTM_LOC_BD_NAME ble_bd_name; /* local BLE device name */ tBTM_LOC_BD_NAME ble_bd_name; /* local BLE device name */
#endif #endif
#if (CLASSIC_BT_INCLUDED == TRUE)
BOOLEAN pin_type; /* TRUE if PIN type is fixed */ BOOLEAN pin_type; /* TRUE if PIN type is fixed */
UINT8 pin_code_len; /* Bonding information */ UINT8 pin_code_len; /* Bonding information */
PIN_CODE pin_code; /* PIN CODE if pin type is fixed */ PIN_CODE pin_code; /* PIN CODE if pin type is fixed */
BOOLEAN connectable; /* If TRUE page scan should be enabled */ // BOOLEAN connectable; /* If TRUE page scan should be enabled */
UINT8 def_inq_scan_mode; /* ??? limited/general/none */ // UINT8 def_inq_scan_mode; /* ??? limited/general/none */
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
} tBTM_CFG; } tBTM_CFG;
enum { enum {
@ -954,7 +958,7 @@ typedef struct {
#endif // SMP_INCLUDED == TRUE || BT_CLASSIC_ENABLED == TRUE #endif // SMP_INCLUDED == TRUE || BT_CLASSIC_ENABLED == TRUE
list_t *p_sec_dev_rec_list; list_t *p_sec_dev_rec_list;
tBTM_SEC_SERV_REC *p_out_serv; tBTM_SEC_SERV_REC *p_out_serv;
tBTM_MKEY_CALLBACK *mkey_cback; // tBTM_MKEY_CALLBACK *mkey_cback;
BD_ADDR connecting_bda; BD_ADDR connecting_bda;
DEV_CLASS connecting_dc; DEV_CLASS connecting_dc;

View File

@ -55,6 +55,7 @@ extern void btm_ble_test_command_complete(UINT8 *p);
/********************************************************************************/ /********************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */ /* L O C A L F U N C T I O N P R O T O T Y P E S */
/********************************************************************************/ /********************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_inquiry_comp_evt (UINT8 *p); static void btu_hcif_inquiry_comp_evt (UINT8 *p);
static void btu_hcif_inquiry_result_evt (UINT8 *p); static void btu_hcif_inquiry_result_evt (UINT8 *p);
static void btu_hcif_inquiry_rssi_result_evt (UINT8 *p); static void btu_hcif_inquiry_rssi_result_evt (UINT8 *p);
@ -62,30 +63,46 @@ static void btu_hcif_extended_inquiry_result_evt (UINT8 *p);
static void btu_hcif_connection_comp_evt (UINT8 *p); static void btu_hcif_connection_comp_evt (UINT8 *p);
static void btu_hcif_connection_request_evt (UINT8 *p); static void btu_hcif_connection_request_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_disconnection_comp_evt (UINT8 *p); static void btu_hcif_disconnection_comp_evt (UINT8 *p);
#if (SMP_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE)
static void btu_hcif_authentication_comp_evt (UINT8 *p); static void btu_hcif_authentication_comp_evt (UINT8 *p);
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len); static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE)
static void btu_hcif_encryption_change_evt (UINT8 *p); static void btu_hcif_encryption_change_evt (UINT8 *p);
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_read_rmt_features_comp_evt (UINT8 *p); static void btu_hcif_read_rmt_features_comp_evt (UINT8 *p);
static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p); static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p); static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_qos_setup_comp_evt (UINT8 *p); static void btu_hcif_qos_setup_comp_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_command_complete_evt (BT_HDR *response, void *context); static void btu_hcif_command_complete_evt (BT_HDR *response, void *context);
static void btu_hcif_command_status_evt (uint8_t status, BT_HDR *command, void *context); static void btu_hcif_command_status_evt (uint8_t status, BT_HDR *command, void *context);
static void btu_hcif_hardware_error_evt (UINT8 *p); static void btu_hcif_hardware_error_evt (UINT8 *p);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_flush_occured_evt (void); static void btu_hcif_flush_occured_evt (void);
static void btu_hcif_role_change_evt (UINT8 *p); static void btu_hcif_role_change_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p); static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p);
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_mode_change_evt (UINT8 *p); static void btu_hcif_mode_change_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p); static void btu_hcif_pin_code_request_evt (UINT8 *p);
static void btu_hcif_link_key_request_evt (UINT8 *p); static void btu_hcif_link_key_request_evt (UINT8 *p);
static void btu_hcif_link_key_notification_evt (UINT8 *p); static void btu_hcif_link_key_notification_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_loopback_command_evt (void); static void btu_hcif_loopback_command_evt (void);
static void btu_hcif_data_buf_overflow_evt (void); static void btu_hcif_data_buf_overflow_evt (void);
static void btu_hcif_max_slots_changed_evt (void); static void btu_hcif_max_slots_changed_evt (void);
@ -98,6 +115,8 @@ static void btu_hcif_esco_connection_comp_evt(UINT8 *p);
static void btu_hcif_esco_connection_chg_evt(UINT8 *p); static void btu_hcif_esco_connection_chg_evt(UINT8 *p);
static void btu_hcif_host_support_evt (UINT8 *p); static void btu_hcif_host_support_evt (UINT8 *p);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/* Simple Pairing Events */ /* Simple Pairing Events */
#if (CLASSIC_BT_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p); static void btu_hcif_io_cap_request_evt (UINT8 *p);
@ -111,12 +130,14 @@ static void btu_hcif_keypress_notif_evt (UINT8 *p);
#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE #if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
static void btu_hcif_rem_oob_request_evt (UINT8 *p); static void btu_hcif_rem_oob_request_evt (UINT8 *p);
#endif #endif
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_link_supv_to_changed_evt (UINT8 *p); static void btu_hcif_link_supv_to_changed_evt (UINT8 *p);
#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE #if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
static void btu_hcif_enhanced_flush_complete_evt (void); static void btu_hcif_enhanced_flush_complete_evt (void);
#endif #endif
static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len); static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len);
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if BLE_INCLUDED == TRUE #if BLE_INCLUDED == TRUE
static void btu_ble_ll_conn_complete_evt (UINT8 *p, UINT16 evt_len); static void btu_ble_ll_conn_complete_evt (UINT8 *p, UINT16 evt_len);
@ -157,17 +178,20 @@ static void btu_ble_channel_select_alg_evt(UINT8 *p);
static void btu_ble_periodic_adv_sync_trans_recv(UINT8 *p); static void btu_ble_periodic_adv_sync_trans_recv(UINT8 *p);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE) #endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_42_ADV_EN == TRUE)
extern osi_sem_t adv_enable_sem; extern osi_sem_t adv_enable_sem;
extern osi_sem_t adv_data_sem; extern osi_sem_t adv_data_sem;
extern osi_sem_t adv_param_sem; extern osi_sem_t adv_param_sem;
extern osi_sem_t scan_enable_sem;
extern osi_sem_t scan_param_sem;
extern uint8_t adv_enable_status; extern uint8_t adv_enable_status;
extern uint8_t adv_data_status; extern uint8_t adv_data_status;
extern uint8_t adv_param_status; extern uint8_t adv_param_status;
#endif // #if (BLE_42_ADV_EN == TRUE)
#if (BLE_42_SCAN_EN == TRUE)
extern osi_sem_t scan_enable_sem;
extern osi_sem_t scan_param_sem;
extern uint8_t scan_enable_status; extern uint8_t scan_enable_status;
extern uint8_t scan_param_status; extern uint8_t scan_param_status;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#endif #endif
/******************************************************************************* /*******************************************************************************
@ -191,6 +215,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
STREAM_TO_UINT8 (hci_evt_len, p); STREAM_TO_UINT8 (hci_evt_len, p);
switch (hci_evt_code) { switch (hci_evt_code) {
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_INQUIRY_COMP_EVT: case HCI_INQUIRY_COMP_EVT:
btu_hcif_inquiry_comp_evt (p); btu_hcif_inquiry_comp_evt (p);
break; break;
@ -209,6 +234,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_CONNECTION_REQUEST_EVT: case HCI_CONNECTION_REQUEST_EVT:
btu_hcif_connection_request_evt (p); btu_hcif_connection_request_evt (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_DISCONNECTION_COMP_EVT: case HCI_DISCONNECTION_COMP_EVT:
btu_hcif_disconnection_comp_evt (p); btu_hcif_disconnection_comp_evt (p);
break; break;
@ -217,9 +243,11 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
btu_hcif_authentication_comp_evt (p); btu_hcif_authentication_comp_evt (p);
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_RMT_NAME_REQUEST_COMP_EVT: case HCI_RMT_NAME_REQUEST_COMP_EVT:
btu_hcif_rmt_name_request_comp_evt (p, hci_evt_len); btu_hcif_rmt_name_request_comp_evt (p, hci_evt_len);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_ENCRYPTION_CHANGE_EVT: case HCI_ENCRYPTION_CHANGE_EVT:
#if (SMP_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE)
btu_hcif_encryption_change_evt (p); btu_hcif_encryption_change_evt (p);
@ -232,18 +260,22 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
break; break;
#endif #endif
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_RMT_FEATURES_COMP_EVT: case HCI_READ_RMT_FEATURES_COMP_EVT:
btu_hcif_read_rmt_features_comp_evt (p); btu_hcif_read_rmt_features_comp_evt (p);
break; break;
case HCI_READ_RMT_EXT_FEATURES_COMP_EVT: case HCI_READ_RMT_EXT_FEATURES_COMP_EVT:
btu_hcif_read_rmt_ext_features_comp_evt (p); btu_hcif_read_rmt_ext_features_comp_evt (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_RMT_VERSION_COMP_EVT: case HCI_READ_RMT_VERSION_COMP_EVT:
btu_hcif_read_rmt_version_comp_evt (p); btu_hcif_read_rmt_version_comp_evt (p);
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_QOS_SETUP_COMP_EVT: case HCI_QOS_SETUP_COMP_EVT:
btu_hcif_qos_setup_comp_evt (p); btu_hcif_qos_setup_comp_evt (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_COMMAND_COMPLETE_EVT: case HCI_COMMAND_COMPLETE_EVT:
//HCI_TRACE_ERROR("%s should not have received a command complete event. " //HCI_TRACE_ERROR("%s should not have received a command complete event. "
// "Someone didn't go through the hci transmit_command function.", __func__); // "Someone didn't go through the hci transmit_command function.", __func__);
@ -255,19 +287,24 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_HARDWARE_ERROR_EVT: case HCI_HARDWARE_ERROR_EVT:
btu_hcif_hardware_error_evt (p); btu_hcif_hardware_error_evt (p);
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_FLUSH_OCCURED_EVT: case HCI_FLUSH_OCCURED_EVT:
btu_hcif_flush_occured_evt (); btu_hcif_flush_occured_evt ();
break; break;
case HCI_ROLE_CHANGE_EVT: case HCI_ROLE_CHANGE_EVT:
btu_hcif_role_change_evt (p); btu_hcif_role_change_evt (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_NUM_COMPL_DATA_PKTS_EVT: case HCI_NUM_COMPL_DATA_PKTS_EVT:
btu_hcif_num_compl_data_pkts_evt (p); btu_hcif_num_compl_data_pkts_evt (p);
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_MODE_CHANGE_EVT: case HCI_MODE_CHANGE_EVT:
btu_hcif_mode_change_evt (p); btu_hcif_mode_change_evt (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (SMP_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_PIN_CODE_REQUEST_EVT: case HCI_PIN_CODE_REQUEST_EVT:
btu_hcif_pin_code_request_evt (p); btu_hcif_pin_code_request_evt (p);
break; break;
@ -277,7 +314,9 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_LINK_KEY_NOTIFICATION_EVT: case HCI_LINK_KEY_NOTIFICATION_EVT:
btu_hcif_link_key_notification_evt (p); btu_hcif_link_key_notification_evt (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_LOOPBACK_COMMAND_EVT: case HCI_LOOPBACK_COMMAND_EVT:
btu_hcif_loopback_command_evt (); btu_hcif_loopback_command_evt ();
break; break;
@ -314,7 +353,6 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_RMT_HOST_SUP_FEAT_NOTIFY_EVT: case HCI_RMT_HOST_SUP_FEAT_NOTIFY_EVT:
btu_hcif_host_support_evt (p); btu_hcif_host_support_evt (p);
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_IO_CAPABILITY_REQUEST_EVT: case HCI_IO_CAPABILITY_REQUEST_EVT:
btu_hcif_io_cap_request_evt (p); btu_hcif_io_cap_request_evt (p);
break; break;
@ -343,7 +381,6 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
case HCI_KEYPRESS_NOTIFY_EVT: case HCI_KEYPRESS_NOTIFY_EVT:
btu_hcif_keypress_notif_evt (p); btu_hcif_keypress_notif_evt (p);
break; break;
#endif /* (CLASSIC_BT_INCLUDED == TRUE) */
case HCI_LINK_SUPER_TOUT_CHANGED_EVT: case HCI_LINK_SUPER_TOUT_CHANGED_EVT:
btu_hcif_link_supv_to_changed_evt (p); btu_hcif_link_supv_to_changed_evt (p);
break; break;
@ -352,6 +389,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
btu_hcif_enhanced_flush_complete_evt (); btu_hcif_enhanced_flush_complete_evt ();
break; break;
#endif #endif
#endif /* (CLASSIC_BT_INCLUDED == TRUE) */
#if (BLE_INCLUDED == TRUE) #if (BLE_INCLUDED == TRUE)
case HCI_BLE_EVENT: case HCI_BLE_EVENT:
@ -577,7 +615,7 @@ void btu_hcif_send_host_rdy_for_data(void)
btsnd_hcic_host_num_xmitted_pkts (num_ents, handles, num_pkts); btsnd_hcic_host_num_xmitted_pkts (num_ents, handles, num_pkts);
} }
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_inquiry_comp_evt ** Function btu_hcif_inquiry_comp_evt
@ -705,7 +743,7 @@ static void btu_hcif_connection_request_evt (UINT8 *p)
} }
#endif /* BTM_SCO_INCLUDED */ #endif /* BTM_SCO_INCLUDED */
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
@ -754,6 +792,7 @@ static void btu_hcif_authentication_comp_evt (UINT8 *p)
} }
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_rmt_name_request_comp_evt ** Function btu_hcif_rmt_name_request_comp_evt
@ -778,7 +817,7 @@ static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len)
btm_sec_rmt_name_request_complete (bd_addr, p, status); btm_sec_rmt_name_request_complete (bd_addr, p, status);
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
@ -804,7 +843,7 @@ static void btu_hcif_encryption_change_evt (UINT8 *p)
btm_sec_encrypt_change (handle, status, encr_enable); btm_sec_encrypt_change (handle, status, encr_enable);
} }
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_read_rmt_features_comp_evt ** Function btu_hcif_read_rmt_features_comp_evt
@ -843,6 +882,7 @@ static void btu_hcif_read_rmt_ext_features_comp_evt (UINT8 *p)
btm_read_remote_ext_features_failed(status, handle); btm_read_remote_ext_features_failed(status, handle);
} }
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
@ -858,7 +898,7 @@ static void btu_hcif_read_rmt_version_comp_evt (UINT8 *p)
btm_read_remote_version_complete (p); btm_read_remote_version_complete (p);
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_qos_setup_comp_evt ** Function btu_hcif_qos_setup_comp_evt
@ -952,6 +992,7 @@ static void btu_hcif_esco_connection_chg_evt (UINT8 *p)
rx_pkt_len, tx_pkt_len); rx_pkt_len, tx_pkt_len);
#endif #endif
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
@ -967,6 +1008,7 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
{ {
uint8_t status; uint8_t status;
switch (opcode) { switch (opcode) {
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_INQUIRY_CANCEL: case HCI_INQUIRY_CANCEL:
/* Tell inquiry processing that we are done */ /* Tell inquiry processing that we are done */
btm_process_cancel_complete(HCI_SUCCESS, BTM_BR_INQUIRY_MASK); btm_process_cancel_complete(HCI_SUCCESS, BTM_BR_INQUIRY_MASK);
@ -979,14 +1021,13 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_delete_stored_link_key_complete (p); btm_delete_stored_link_key_complete (p);
break; break;
case HCI_READ_LOCAL_NAME:
btm_read_local_name_complete (p, evt_len);
break;
case HCI_GET_LINK_QUALITY: case HCI_GET_LINK_QUALITY:
btm_read_link_quality_complete (p); btm_read_link_quality_complete (p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_LOCAL_NAME:
btm_read_local_name_complete (p, evt_len);
break;
case HCI_READ_RSSI: case HCI_READ_RSSI:
btm_read_rssi_complete (p); btm_read_rssi_complete (p);
break; break;
@ -996,22 +1037,21 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_read_tx_power_complete(p, FALSE); btm_read_tx_power_complete(p, FALSE);
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) #endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_CREATE_CONNECTION_CANCEL: case HCI_CREATE_CONNECTION_CANCEL:
btm_create_conn_cancel_complete(p); btm_create_conn_cancel_complete(p);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_LOCAL_OOB_DATA: case HCI_READ_LOCAL_OOB_DATA:
#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE #if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
btm_read_local_oob_complete(p); btm_read_local_oob_complete(p);
#endif #endif
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_READ_INQ_TX_POWER_LEVEL: case HCI_READ_INQ_TX_POWER_LEVEL:
btm_read_linq_tx_power_complete (p); btm_read_linq_tx_power_complete (p);
break; break;
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_SET_AFH_CHANNELS: case HCI_SET_AFH_CHANNELS:
btm_set_afh_channels_complete(p); btm_set_afh_channels_complete(p);
break; break;
@ -1079,11 +1119,11 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_read_tx_power_complete(p, TRUE); btm_read_tx_power_complete(p, TRUE);
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE) #endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
break; break;
#if (BLE_42_ADV_EN == TRUE)
case HCI_BLE_WRITE_ADV_ENABLE: case HCI_BLE_WRITE_ADV_ENABLE:
btm_ble_write_adv_enable_complete(p); btm_ble_write_adv_enable_complete(p);
break; break;
#endif // #if (BLE_42_ADV_EN == TRUE)
case HCI_BLE_CREATE_LL_CONN: case HCI_BLE_CREATE_LL_CONN:
btm_ble_create_ll_conn_complete(*p); btm_ble_create_ll_conn_complete(*p);
break; break;
@ -1298,6 +1338,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
#endif #endif
switch (opcode) { switch (opcode) {
#if (CLASSIC_BT_INCLUDED == TRUE)
case HCI_EXIT_SNIFF_MODE: case HCI_EXIT_SNIFF_MODE:
case HCI_EXIT_PARK_MODE: case HCI_EXIT_PARK_MODE:
#if BTM_SCO_WAKE_PARKED_LINK == TRUE #if BTM_SCO_WAKE_PARKED_LINK == TRUE
@ -1317,6 +1358,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
case HCI_PARK_MODE: case HCI_PARK_MODE:
btm_pm_proc_cmd_status(status); btm_pm_proc_cmd_status(status);
break; break;
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE) #if (BLE_50_EXTEND_SYNC_EN == TRUE)
case HCI_BLE_PERIOD_ADV_CREATE_SYNC: case HCI_BLE_PERIOD_ADV_CREATE_SYNC:
@ -1536,7 +1578,7 @@ static void btu_hcif_hardware_error_evt (UINT8 *p)
} }
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_flush_occured_evt ** Function btu_hcif_flush_occured_evt
@ -1573,7 +1615,7 @@ static void btu_hcif_role_change_evt (UINT8 *p)
l2c_link_role_changed (bda, role, status); l2c_link_role_changed (bda, role, status);
btm_acl_role_changed(status, bda, role); btm_acl_role_changed(status, bda, role);
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
@ -1594,7 +1636,7 @@ static void btu_hcif_num_compl_data_pkts_evt (UINT8 *p)
btm_sco_process_num_completed_pkts (p); btm_sco_process_num_completed_pkts (p);
#endif #endif
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_mode_change_evt ** Function btu_hcif_mode_change_evt
@ -1662,7 +1704,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
HCI_TRACE_WARNING("hcif ssr evt: st 0x%x, hdl 0x%x, tx_lat %d rx_lat %d", status, handle, max_tx_lat, max_rx_lat); HCI_TRACE_WARNING("hcif ssr evt: st 0x%x, hdl 0x%x, tx_lat %d rx_lat %d", status, handle, max_tx_lat, max_rx_lat);
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_pin_code_request_evt ** Function btu_hcif_pin_code_request_evt
@ -1673,6 +1715,7 @@ static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len)
** **
*******************************************************************************/ *******************************************************************************/
#if (SMP_INCLUDED == TRUE) #if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_pin_code_request_evt (UINT8 *p) static void btu_hcif_pin_code_request_evt (UINT8 *p)
{ {
#if (CLASSIC_BT_INCLUDED == TRUE) #if (CLASSIC_BT_INCLUDED == TRUE)
@ -1727,9 +1770,10 @@ static void btu_hcif_link_key_notification_evt (UINT8 *p)
btm_sec_link_key_notification (bda, key, key_type); btm_sec_link_key_notification (bda, key, key_type);
} }
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
#endif ///SMP_INCLUDED == TRUE #endif ///SMP_INCLUDED == TRUE
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_loopback_command_evt ** Function btu_hcif_loopback_command_evt
@ -1905,7 +1949,7 @@ static void btu_hcif_host_support_evt (UINT8 *p)
** Returns void ** Returns void
** **
*******************************************************************************/ *******************************************************************************/
#if (CLASSIC_BT_INCLUDED == TRUE)
static void btu_hcif_io_cap_request_evt (UINT8 *p) static void btu_hcif_io_cap_request_evt (UINT8 *p)
{ {
btm_io_capabilities_req(p); btm_io_capabilities_req(p);
@ -2014,6 +2058,7 @@ static void btu_hcif_rem_oob_request_evt (UINT8 *p)
} }
#endif #endif
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function btu_hcif_link_supv_to_changed_evt ** Function btu_hcif_link_supv_to_changed_evt
@ -2052,6 +2097,7 @@ static void btu_hcif_enhanced_flush_complete_evt (void)
/* This is empty until an upper layer cares about returning event */ /* This is empty until an upper layer cares about returning event */
} }
#endif #endif
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
/********************************************** /**********************************************
** End of Simple Pairing Events ** End of Simple Pairing Events
***********************************************/ ***********************************************/

View File

@ -229,11 +229,13 @@ bool btu_task_post(uint32_t sig, void *param, uint32_t timeout)
break; break;
case SIG_BTU_HCI_ADV_RPT_MSG: case SIG_BTU_HCI_ADV_RPT_MSG:
#if BLE_INCLUDED == TRUE #if BLE_INCLUDED == TRUE
#if (BLE_42_SCAN_EN == TRUE)
if (param != NULL) { if (param != NULL) {
btm_ble_adv_pkt_post(param); btm_ble_adv_pkt_post(param);
} }
btm_ble_adv_pkt_ready(); btm_ble_adv_pkt_ready();
status = true; status = true;
#endif // #if (BLE_42_SCAN_EN == TRUE)
#else #else
osi_free(param); osi_free(param);
status = false; status = false;

View File

@ -75,7 +75,7 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level)
** **
** Function GATTS_AddHandleRange ** Function GATTS_AddHandleRange
** **
** Description This function add the allocated handles range for the specifed ** Description This function add the allocated handles range for the specified
** application UUID, service UUID and service instance ** application UUID, service UUID and service instance
** **
** Parameter p_hndl_range: pointer to allocated handles information ** Parameter p_hndl_range: pointer to allocated handles information
@ -105,7 +105,7 @@ BOOLEAN GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range)
** NV save callback function. There can be one and only one ** NV save callback function. There can be one and only one
** NV save callback function. ** NV save callback function.
** **
** Parameter p_cb_info : callback informaiton ** Parameter p_cb_info : callback information
** **
** Returns TRUE if registered OK, else FALSE ** Returns TRUE if registered OK, else FALSE
** **
@ -151,7 +151,7 @@ static void gatt_update_for_database_change(void)
** num_handles : number of handles needed by the service. ** num_handles : number of handles needed by the service.
** is_pri : is a primary service or not. ** is_pri : is a primary service or not.
** **
** Returns service handle if sucessful, otherwise 0. ** Returns service handle if successful, otherwise 0.
** **
*******************************************************************************/ *******************************************************************************/
UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
@ -170,7 +170,7 @@ UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
GATT_TRACE_API ("GATTS_CreateService\n" ); GATT_TRACE_API ("GATTS_CreateService\n" );
if (p_reg == NULL) { if (p_reg == NULL) {
GATT_TRACE_ERROR ("Inavlid gatt_if=%d\n", gatt_if); GATT_TRACE_ERROR ("Invalid gatt_if=%d\n", gatt_if);
return (0); return (0);
} }
@ -491,7 +491,7 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
return GATT_SERVICE_STARTED; return GATT_SERVICE_STARTED;
} }
/*this is a new application servoce start */ /*this is a new application service start */
if ((i_sreg = gatt_sr_alloc_rcb(p_list)) == GATT_MAX_SR_PROFILES) { if ((i_sreg = gatt_sr_alloc_rcb(p_list)) == GATT_MAX_SR_PROFILES) {
GATT_TRACE_ERROR ("GATTS_StartService: no free server registration block"); GATT_TRACE_ERROR ("GATTS_StartService: no free server registration block");
return GATT_NO_RESOURCES; return GATT_NO_RESOURCES;
@ -1388,8 +1388,9 @@ void GATT_Deregister (tGATT_IF gatt_if)
} }
} }
} }
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_deregister_bgdev_list(gatt_if); gatt_deregister_bgdev_list(gatt_if);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/* update the listen mode */ /* update the listen mode */
#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE)) #if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
GATT_Listen(gatt_if, FALSE, NULL); GATT_Listen(gatt_if, FALSE, NULL);
@ -1468,9 +1469,12 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
if (is_direct) { if (is_direct) {
status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux); status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux);
} else { } else {
#if (tGATT_BG_CONN_DEV == TRUE)
if (transport == BT_TRANSPORT_LE) { if (transport == BT_TRANSPORT_LE) {
status = gatt_update_auto_connect_dev(gatt_if, TRUE, bd_addr, TRUE); status = gatt_update_auto_connect_dev(gatt_if, TRUE, bd_addr, TRUE);
} else { } else
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
{
GATT_TRACE_ERROR("Unsupported transport for background connection"); GATT_TRACE_ERROR("Unsupported transport for background connection");
} }
} }
@ -1483,7 +1487,7 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
** **
** Function GATT_CancelConnect ** Function GATT_CancelConnect
** **
** Description This function terminate the connection initaition to a remote ** Description This function terminate the connection initiation to a remote
** device on GATT channel. ** device on GATT channel.
** **
** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect, ** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect,
@ -1527,6 +1531,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct
status = gatt_cancel_open(gatt_if, bd_addr); status = gatt_cancel_open(gatt_if, bd_addr);
} }
} else { } else {
#if (tGATT_BG_CONN_DEV == TRUE)
if (!gatt_if) { if (!gatt_if) {
if (gatt_get_num_apps_for_bg_dev(bd_addr)) { if (gatt_get_num_apps_for_bg_dev(bd_addr)) {
while (gatt_find_app_for_bg_dev(bd_addr, &temp_gatt_if)) { while (gatt_find_app_for_bg_dev(bd_addr, &temp_gatt_if)) {
@ -1539,6 +1544,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct
} else { } else {
status = gatt_remove_bg_dev_for_app(gatt_if, bd_addr); status = gatt_remove_bg_dev_for_app(gatt_if, bd_addr);
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} }
return status; return status;
@ -1628,7 +1634,7 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
** **
** Function GATT_GetConnectionInfor ** Function GATT_GetConnectionInfor
** **
** Description This function use conn_id to find its associated BD address and applciation ** Description This function use conn_id to find its associated BD address and application
** interface ** interface
** **
** Parameters conn_id: connection id (input) ** Parameters conn_id: connection id (input)
@ -1665,7 +1671,7 @@ BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_
** Function GATT_GetConnIdIfConnected ** Function GATT_GetConnIdIfConnected
** **
** Description This function find the conn_id if the logical link for BD address ** Description This function find the conn_id if the logical link for BD address
** and applciation interface is connected ** and application interface is connected
** **
** Parameters gatt_if: application interface (input) ** Parameters gatt_if: application interface (input)
** bd_addr: peer device address. (input) ** bd_addr: peer device address. (input)
@ -1720,7 +1726,9 @@ BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
} }
if (bd_addr != NULL) { if (bd_addr != NULL) {
#if (tGATT_BG_CONN_DEV == TRUE)
gatt_update_auto_connect_dev(gatt_if, start, bd_addr, FALSE); gatt_update_auto_connect_dev(gatt_if, start, bd_addr, FALSE);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
} else { } else {
p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE; p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE;
} }

View File

@ -502,7 +502,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
#endif ///GATTS_INCLUDED == TRUE #endif ///GATTS_INCLUDED == TRUE
} }
} else { } else {
GATT_TRACE_ERROR("CCB max out, no rsources"); GATT_TRACE_ERROR("CCB max out, no resources");
} }
} }
} else { } else {
@ -929,18 +929,23 @@ static void gatt_send_conn_cback(tGATT_TCB *p_tcb)
{ {
UINT8 i; UINT8 i;
tGATT_REG *p_reg; tGATT_REG *p_reg;
#if (tGATT_BG_CONN_DEV == TRUE)
tGATT_BG_CONN_DEV *p_bg_dev = NULL; tGATT_BG_CONN_DEV *p_bg_dev = NULL;
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
UINT16 conn_id; UINT16 conn_id;
#if (tGATT_BG_CONN_DEV == TRUE)
p_bg_dev = gatt_find_bg_dev(p_tcb->peer_bda); p_bg_dev = gatt_find_bg_dev(p_tcb->peer_bda);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/* notifying all applications for the connection up event */ /* notifying all applications for the connection up event */
for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) { for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) {
if (p_reg->in_use) { if (p_reg->in_use) {
#if (tGATT_BG_CONN_DEV == TRUE)
if (p_bg_dev && gatt_is_bg_dev_for_app(p_bg_dev, p_reg->gatt_if)) { if (p_bg_dev && gatt_is_bg_dev_for_app(p_bg_dev, p_reg->gatt_if)) {
gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE); gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE);
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
if (p_reg->app_cb.p_conn_cb) { if (p_reg->app_cb.p_conn_cb) {
conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if); conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if);
(*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id, (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id,

View File

@ -108,7 +108,7 @@ void gatt_free_pending_ind(tGATT_TCB *p_tcb)
** **
** Function gatt_free_pending_enc_queue ** Function gatt_free_pending_enc_queue
** **
** Description Free all buffers in pending encyption queue ** Description Free all buffers in pending encryption queue
** **
** Returns None ** Returns None
** **
@ -222,7 +222,7 @@ void gatt_set_srv_chg(void)
** **
** Description Find the app id in on the new service changed list ** Description Find the app id in on the new service changed list
** **
** Returns Pointer to the found new service changed item othwerwise NULL ** Returns Pointer to the found new service changed item otherwise NULL
** **
*******************************************************************************/ *******************************************************************************/
tGATTS_PENDING_NEW_SRV_START *gatt_sr_is_new_srv_chg(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst) tGATTS_PENDING_NEW_SRV_START *gatt_sr_is_new_srv_chg(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst)
@ -299,7 +299,7 @@ tGATTS_PENDING_NEW_SRV_START *gatt_add_pending_new_srv_start(tGATTS_HNDL_RANGE *
** **
** Function gatt_add_srv_chg_clt ** Function gatt_add_srv_chg_clt
** **
** Description Add a service chnage client to the service change client queue ** Description Add a service change client to the service change client queue
** **
** Returns Pointer to the service change client buffer; Null no buffer available ** Returns Pointer to the service change client buffer; Null no buffer available
** **
@ -682,7 +682,7 @@ BOOLEAN gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_
** **
** Function gatt_add_an_item_to_list ** Function gatt_add_an_item_to_list
** **
** Description add an service handle range to the list in decending ** Description add an service handle range to the list in descending
** order of the start handle ** order of the start handle
** **
** Returns BOOLEAN TRUE-if add is successful ** Returns BOOLEAN TRUE-if add is successful
@ -808,7 +808,7 @@ BOOLEAN gatt_find_the_connected_bda(UINT8 start_idx, BD_ADDR bda, UINT8 *p_found
** **
** Function gatt_is_srv_chg_ind_pending ** Function gatt_is_srv_chg_ind_pending
** **
** Description Check whether a service chnaged is in the indication pending queue ** Description Check whether a service changed is in the indication pending queue
** or waiting for an Ack already ** or waiting for an Ack already
** **
** Returns BOOLEAN ** Returns BOOLEAN
@ -846,9 +846,9 @@ BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb)
** **
** Function gatt_is_bda_in_the_srv_chg_clt_list ** Function gatt_is_bda_in_the_srv_chg_clt_list
** **
** Description This function check the specified bda is in the srv chg clinet list or not ** Description This function check the specified bda is in the srv chg client list or not
** **
** Returns pointer to the found elemenet otherwise NULL ** Returns pointer to the found element otherwise NULL
** **
*******************************************************************************/ *******************************************************************************/
tGATTS_SRV_CHG *gatt_is_bda_in_the_srv_chg_clt_list (BD_ADDR bda) tGATTS_SRV_CHG *gatt_is_bda_in_the_srv_chg_clt_list (BD_ADDR bda)
@ -1205,7 +1205,7 @@ UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid)
if (uuid.len == LEN_UUID_16) { if (uuid.len == LEN_UUID_16) {
UINT16_TO_STREAM (p, uuid.uu.uuid16); UINT16_TO_STREAM (p, uuid.uu.uuid16);
len = LEN_UUID_16; len = LEN_UUID_16;
} else if (uuid.len == LEN_UUID_32) { /* always convert 32 bits into 128 bits as alwats */ } else if (uuid.len == LEN_UUID_32) { /* always convert 32 bits into 128 bits as always */
gatt_convert_uuid32_to_uuid128(p, uuid.uu.uuid32); gatt_convert_uuid32_to_uuid128(p, uuid.uu.uuid32);
p += LEN_UUID_128; p += LEN_UUID_128;
len = LEN_UUID_128; len = LEN_UUID_128;
@ -1465,7 +1465,7 @@ UINT8 gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list )
UINT8 ii = 0; UINT8 ii = 0;
tGATT_SR_REG *p_sreg = NULL; tGATT_SR_REG *p_sreg = NULL;
/*this is a new application servoce start */ /*this is a new application service start */
for (ii = 0, p_sreg = gatt_cb.sr_reg; ii < GATT_MAX_SR_PROFILES; ii++, p_sreg++) { for (ii = 0, p_sreg = gatt_cb.sr_reg; ii < GATT_MAX_SR_PROFILES; ii++, p_sreg++) {
if (!p_sreg->in_use) { if (!p_sreg->in_use) {
memset (p_sreg, 0, sizeof(tGATT_SR_REG)); memset (p_sreg, 0, sizeof(tGATT_SR_REG));
@ -1616,7 +1616,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
break; break;
default: default:
GATT_TRACE_ERROR("inavlid UUID len=%d", p_uuid->len); GATT_TRACE_ERROR("invalid UUID len=%d", p_uuid->len);
SDP_DeleteRecord(sdp_handle); SDP_DeleteRecord(sdp_handle);
return 0; return 0;
break; break;
@ -1633,7 +1633,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
SDP_AddProtocolList(sdp_handle, 2, proto_elem_list); SDP_AddProtocolList(sdp_handle, 2, proto_elem_list);
/* Make the service browseable */ /* Make the service browsable */
SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list); SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list);
return (sdp_handle); return (sdp_handle);
@ -1868,7 +1868,7 @@ UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb)
** **
** Function gatt_num_clcb_by_bd_addr ** Function gatt_num_clcb_by_bd_addr
** **
** Description The function searches all LCB with macthing bd address ** Description The function searches all LCB with matching bd address
** **
** Returns total number of clcb found. ** Returns total number of clcb found.
** **
@ -1892,7 +1892,7 @@ UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda)
** **
** Function gatt_sr_update_cback_cnt ** Function gatt_sr_update_cback_cnt
** **
** Description The function searches all LCB with macthing bd address ** Description The function searches all LCB with matching bd address
** **
** Returns total number of clcb found. ** Returns total number of clcb found.
** **
@ -1916,7 +1916,7 @@ void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
** **
** Function gatt_sr_is_cback_cnt_zero ** Function gatt_sr_is_cback_cnt_zero
** **
** Description The function searches all LCB with macthing bd address ** Description The function searches all LCB with matching bd address
** **
** Returns True if thetotal application callback count is zero ** Returns True if thetotal application callback count is zero
** **
@ -2015,7 +2015,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
** **
** Function gatt_sr_update_cback_cnt ** Function gatt_sr_update_cback_cnt
** **
** Description Update the teh application callback count ** Description Update the the application callback count
** **
** Returns None ** Returns None
** **
@ -2045,7 +2045,7 @@ void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc
** **
** Function gatt_sr_update_prep_cnt ** Function gatt_sr_update_prep_cnt
** **
** Description Update the teh prepare write request count ** Description Update the the prepare write request count
** **
** Returns None ** Returns None
** **
@ -2461,7 +2461,7 @@ void gatt_dbg_display_uuid(tBT_UUID bt_uuid)
} }
#if (tGATT_BG_CONN_DEV == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function gatt_is_bg_dev_for_app ** Function gatt_is_bg_dev_for_app
@ -2552,7 +2552,7 @@ BOOLEAN gatt_add_bg_dev_list(tGATT_REG *p_reg, BD_ADDR bd_addr, BOOLEAN is_init
for (i = 0; i < GATT_MAX_APPS; i ++) { for (i = 0; i < GATT_MAX_APPS; i ++) {
if (is_initator) { if (is_initator) {
if (p_dev->gatt_if[i] == gatt_if) { if (p_dev->gatt_if[i] == gatt_if) {
GATT_TRACE_ERROR("device already in iniator white list"); GATT_TRACE_ERROR("device already in initiator white list");
return TRUE; return TRUE;
} else if (p_dev->gatt_if[i] == 0) { } else if (p_dev->gatt_if[i] == 0) {
p_dev->gatt_if[i] = gatt_if; p_dev->gatt_if[i] = gatt_if;
@ -2618,9 +2618,9 @@ BOOLEAN gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr)
** **
** Function gatt_get_num_apps_for_bg_dev ** Function gatt_get_num_apps_for_bg_dev
** **
** Description Gte the number of applciations for the specified background device ** Description Gte the number of applications for the specified background device
** **
** Returns UINT8 total number fo applications ** Returns UINT8 total number for applications
** **
*******************************************************************************/ *******************************************************************************/
UINT8 gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr) UINT8 gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr)
@ -2842,7 +2842,7 @@ BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_
} }
return ret; return ret;
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/******************************************************************************* /*******************************************************************************

View File

@ -130,7 +130,7 @@ typedef union {
tGATT_EXEC_FLAG exec_write; /* execute write */ tGATT_EXEC_FLAG exec_write; /* execute write */
} tGATT_CL_MSG; } tGATT_CL_MSG;
/* error response strucutre */ /* error response structure */
typedef struct { typedef struct {
UINT16 handle; UINT16 handle;
UINT8 cmd_code; UINT8 cmd_code;
@ -480,12 +480,14 @@ typedef struct {
UINT32 service_change; UINT32 service_change;
} tGATT_SVC_CHG; } tGATT_SVC_CHG;
#if (tGATT_BG_CONN_DEV == TRUE)
typedef struct { typedef struct {
tGATT_IF gatt_if[GATT_MAX_APPS]; tGATT_IF gatt_if[GATT_MAX_APPS];
tGATT_IF listen_gif[GATT_MAX_APPS]; tGATT_IF listen_gif[GATT_MAX_APPS];
BD_ADDR remote_bda; BD_ADDR remote_bda;
BOOLEAN in_use; BOOLEAN in_use;
} tGATT_BG_CONN_DEV; } tGATT_BG_CONN_DEV;
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
#define GATT_SVC_CHANGED_CONNECTING 1 /* wait for connection */ #define GATT_SVC_CHANGED_CONNECTING 1 /* wait for connection */
#define GATT_SVC_CHANGED_SERVICE 2 /* GATT service discovery */ #define GATT_SVC_CHANGED_SERVICE 2 /* GATT service discovery */
@ -553,8 +555,9 @@ typedef struct {
tGATT_HDL_CFG hdl_cfg; tGATT_HDL_CFG hdl_cfg;
#if (tGATT_BG_CONN_DEV == TRUE)
tGATT_BG_CONN_DEV bgconn_dev[GATT_MAX_BG_CONN_DEV]; tGATT_BG_CONN_DEV bgconn_dev[GATT_MAX_BG_CONN_DEV];
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
BOOLEAN auto_disc; /* internal use: true for auto discovering after connected */ BOOLEAN auto_disc; /* internal use: true for auto discovering after connected */
UINT8 srv_chg_mode; /* internal use: service change mode */ UINT8 srv_chg_mode; /* internal use: service change mode */
tGATTS_RSP rsp; /* use to read internal service attribute */ tGATTS_RSP rsp; /* use to read internal service attribute */
@ -667,6 +670,7 @@ extern BOOLEAN gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_L
extern BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove); extern BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove);
extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg); extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg);
#if (tGATT_BG_CONN_DEV == TRUE)
/* for background connection */ /* for background connection */
extern BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initiator); extern BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initiator);
extern BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if); extern BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if);
@ -676,6 +680,7 @@ extern BOOLEAN gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if);
extern tGATT_BG_CONN_DEV *gatt_find_bg_dev(BD_ADDR remote_bda); extern tGATT_BG_CONN_DEV *gatt_find_bg_dev(BD_ADDR remote_bda);
extern void gatt_deregister_bgdev_list(tGATT_IF gatt_if); extern void gatt_deregister_bgdev_list(tGATT_IF gatt_if);
extern void gatt_reset_bgdev_list(void); extern void gatt_reset_bgdev_list(void);
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
/* server function */ /* server function */
extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle); extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle);

View File

@ -1033,13 +1033,15 @@ typedef void (tBTM_SET_CSA_SUPPORT_CMPL_CBACK) (tBTM_STATUS status);
#define BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT 13 #define BTM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT 13
#define BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT 14 #define BTM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT 14
#define BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT 15 #define BTM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT 15
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
#define BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT 16 #define BTM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT 16
#define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT 17 #define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_CANCEL_COMPLETE_EVT 17
#define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT 18 #define BTM_BLE_5_GAP_PERIODIC_ADV_SYNC_TERMINATE_COMPLETE_EVT 18
#define BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT 19 #define BTM_BLE_5_GAP_PERIODIC_ADV_ADD_DEV_COMPLETE_EVT 19
#define BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT 20 #define BTM_BLE_5_GAP_PERIODIC_ADV_REMOVE_DEV_COMPLETE_EVT 20
#define BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT 21 #define BTM_BLE_5_GAP_PERIODIC_ADV_CLEAR_DEV_COMPLETE_EVT 21
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE) #endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE) #if (BLE_50_EXTEND_SCAN_EN == TRUE)
#define BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT 22 #define BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT 22
#define BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT 23 #define BTM_BLE_5_GAP_EXT_SCAN_START_COMPLETE_EVT 23
@ -1343,13 +1345,15 @@ typedef union {
tBTM_BLE_PERIOD_ADV_DATA_SET_CMPL per_adv_data_set; tBTM_BLE_PERIOD_ADV_DATA_SET_CMPL per_adv_data_set;
tBTM_BLE_PERIOD_ADV_START_CMPL per_adv_start; tBTM_BLE_PERIOD_ADV_START_CMPL per_adv_start;
tBTM_BLE_PERIOD_ADV_STOP_CMPL per_adv_stop; tBTM_BLE_PERIOD_ADV_STOP_CMPL per_adv_stop;
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
tBTM_BLE_PERIOD_ADV_SYNC_CREATE_CMPL per_adv_sync_create; tBTM_BLE_PERIOD_ADV_SYNC_CREATE_CMPL per_adv_sync_create;
tBTM_BLE_PERIOD_ADV_SYNC_CANCEL_CMPL per_adv_sync_cancel; tBTM_BLE_PERIOD_ADV_SYNC_CANCEL_CMPL per_adv_sync_cancel;
tBTM_BLE_PERIOD_ADV_SYNC_TEMINAT_CMPL per_adv_sync_term; tBTM_BLE_PERIOD_ADV_SYNC_TEMINAT_CMPL per_adv_sync_term;
tBTM_BLE_PERIOD_ADV_ADD_DEV_CMPL per_adv_add_dev; tBTM_BLE_PERIOD_ADV_ADD_DEV_CMPL per_adv_add_dev;
tBTM_BLE_PERIOD_ADV_REMOVE_DEV_CMPL per_adv_remove_dev; tBTM_BLE_PERIOD_ADV_REMOVE_DEV_CMPL per_adv_remove_dev;
tBTM_BLE_PEROID_ADV_CLEAR_DEV_CMPL per_adv_clear_dev; tBTM_BLE_PEROID_ADV_CLEAR_DEV_CMPL per_adv_clear_dev;
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE) #endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
#if (BLE_50_EXTEND_SCAN_EN == TRUE) #if (BLE_50_EXTEND_SCAN_EN == TRUE)
tBTM_BLE_SET_EXT_SCAN_PARAMS_CMPL ext_scan; tBTM_BLE_SET_EXT_SCAN_PARAMS_CMPL ext_scan;
tBTM_BLE_EXT_SCAN_START_CMPL scan_start; tBTM_BLE_EXT_SCAN_START_CMPL scan_start;

View File

@ -1073,11 +1073,11 @@ BOOLEAN l2cble_create_conn (tL2C_LCB *p_lcb)
L2CAP_TRACE_WARNING ("L2CAP - LE - cannot start new connection at conn st: %d", conn_st); L2CAP_TRACE_WARNING ("L2CAP - LE - cannot start new connection at conn st: %d", conn_st);
btm_ble_enqueue_direct_conn_req(p_lcb); btm_ble_enqueue_direct_conn_req(p_lcb);
#if (tGATT_BG_CONN_DEV == TRUE)
if (conn_st == BLE_BG_CONN) { if (conn_st == BLE_BG_CONN) {
btm_ble_suspend_bg_conn(); btm_ble_suspend_bg_conn();
} }
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
rt = TRUE; rt = TRUE;
} }
return rt; return rt;

View File

@ -368,9 +368,11 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
BTM_Recovery_Pre_State(); BTM_Recovery_Pre_State();
} }
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
if(btm_ble_inter_get() && reason == HCI_ERR_CONN_FAILED_ESTABLISHMENT) { if(btm_ble_inter_get() && reason == HCI_ERR_CONN_FAILED_ESTABLISHMENT) {
BTM_BleStartExtAdvRestart(handle); BTM_BleStartExtAdvRestart(handle);
} }
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#endif ///BLE_INCLUDED == TRUE #endif ///BLE_INCLUDED == TRUE
status = FALSE; status = FALSE;