mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 09:09:10 -04:00
feat(ble/bluedroid): reduce bluedrois host bin size and disable BLE_HOST_BG_CONNECT_EN
This commit is contained in:
parent
d2d4d1518d
commit
69acda1785
@ -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_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
|
||||
#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_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_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_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)
|
||||
#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
|
||||
|
@ -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)
|
||||
{
|
||||
/* 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 // #if (SMP_INCLUDED == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
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();
|
||||
break;
|
||||
}
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
case BTA_DM_PIN_REQ_EVT:
|
||||
BTC_TRACE_DEBUG("BTA_DM_PIN_REQ_EVT");
|
||||
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:
|
||||
BTC_TRACE_DEBUG("BTA_DM_BOND_CANCEL_CMPL_EVT");
|
||||
break;
|
||||
#endif // #if (SMP_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case BTA_DM_SP_CFM_REQ_EVT:
|
||||
btc_dm_sp_cfm_req_evt(&p_data->cfm_req);
|
||||
|
@ -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;
|
||||
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: {
|
||||
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);
|
||||
@ -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);
|
||||
break;
|
||||
}
|
||||
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
|
||||
#if (BLE_50_EXTEND_SCAN_EN == TRUE)
|
||||
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;
|
||||
}
|
||||
#endif // #if (BLE_50_PERIODIC_ADV_EN == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
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;
|
||||
if (value) {
|
||||
@ -1903,6 +1906,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
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;
|
||||
|
@ -1403,6 +1403,10 @@
|
||||
#define BLE_HOST_BATCH_SCAN_EN FALSE
|
||||
#endif
|
||||
|
||||
#ifndef BLE_HOST_BG_CONNECT_EN
|
||||
#define BLE_HOST_BG_CONNECT_EN FALSE
|
||||
#endif
|
||||
|
||||
#ifndef LOCAL_BLE_CONTROLLER_ID
|
||||
#define LOCAL_BLE_CONTROLLER_ID (1)
|
||||
#endif
|
||||
|
@ -83,7 +83,9 @@ typedef struct {
|
||||
bool simple_pairing_supported;
|
||||
bool secure_connections_supported;
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
uint16_t ble_ext_adv_data_max_len;
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
} 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));
|
||||
controller_param.packet_parser->parse_generic_command_complete(response);
|
||||
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
// 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));
|
||||
controller_param.packet_parser->parse_generic_command_complete(response);
|
||||
#endif
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
// 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?
|
||||
response = AWAIT_COMMAND(
|
||||
@ -265,16 +269,20 @@ static void start_up(void)
|
||||
&controller_param.ble_resolving_list_max_size);
|
||||
}
|
||||
#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;
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#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)) {
|
||||
response = AWAIT_COMMAND(controller_param.packet_factory->make_read_max_adv_data_len());
|
||||
controller_param.packet_parser->parse_ble_read_adv_max_len_response(
|
||||
response,
|
||||
&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)
|
||||
|
||||
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;
|
||||
}
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
static uint16_t ble_get_ext_adv_data_max_len(void)
|
||||
{
|
||||
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;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
static uint8_t get_sco_data_size(void)
|
||||
@ -574,7 +584,9 @@ static const controller_t interface = {
|
||||
get_ble_resolving_list_max_size,
|
||||
set_ble_resolving_list_max_size,
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
ble_get_ext_adv_data_max_len,
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
get_sco_data_size,
|
||||
|
@ -81,7 +81,9 @@ typedef struct controller_t {
|
||||
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
uint16_t (*ble_get_ext_adv_data_max_len)(void);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // BLE_50_FEATURE_SUPPORT
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
|
@ -68,6 +68,7 @@ static const uint16_t outbound_event_types[] = {
|
||||
|
||||
typedef struct {
|
||||
fixed_queue_t *rx_q;
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
struct pkt_queue *adv_rpt_q;
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
osi_mutex_t adv_flow_lock;
|
||||
@ -77,6 +78,7 @@ typedef struct {
|
||||
pkt_linked_item_t *adv_fc_cmd_buf;
|
||||
bool cmd_buf_in_use;
|
||||
#endif
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
hci_hal_callbacks_t *callbacks;
|
||||
osi_thread_t *hci_h4_thread;
|
||||
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 int host_recv_pkt_cb(uint8_t *data, uint16_t len);
|
||||
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);
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
static void hci_upstream_data_handler(void *arg);
|
||||
static bool hci_upstream_data_post(uint32_t timeout);
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
static void hci_adv_flow_monitor(void *context);
|
||||
static void hci_adv_flow_cmd_free_cb(pkt_linked_item_t *linked_pkt);
|
||||
#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)
|
||||
{
|
||||
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.callbacks = (hci_hal_callbacks_t *)upper_callbacks;
|
||||
|
||||
#if (BLE_42_SCAN_EN == 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));
|
||||
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);
|
||||
assert (hci_hal_env.adv_flow_monitor != NULL);
|
||||
#endif
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
hci_hal_env.rx_q = fixed_queue_new(QUEUE_SIZE_MAX);
|
||||
assert(hci_hal_env.rx_q != NULL);
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
hci_hal_env.adv_rpt_q = pkt_queue_create();
|
||||
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);
|
||||
assert(event != NULL);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
struct osi_event *upstream_data_ready = hci_hal_env.upstream_data_ready;
|
||||
|
||||
hci_hal_env.rx_q = NULL;
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
hci_hal_env.adv_rpt_q = NULL;
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
hci_hal_env.upstream_data_ready = NULL;
|
||||
|
||||
fixed_queue_free(rx_q, osi_free_func);
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
pkt_queue_destroy(adv_rpt_q, NULL);
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
osi_event_delete(upstream_data_ready);
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
hci_hal_env.cmd_buf_in_use = true;
|
||||
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);
|
||||
hci_hal_env.adv_fc_cmd_buf = NULL;
|
||||
#endif
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
hci_hal_env.hci_h4_thread = NULL;
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
size_t pkts_to_process;
|
||||
|
||||
do {
|
||||
@ -234,7 +245,7 @@ static void hci_upstream_data_handler(void *arg)
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
do {
|
||||
pkts_to_process = pkt_queue_length(adv_rpt_q);
|
||||
for (size_t i = 0; i < pkts_to_process; i++) {
|
||||
@ -244,8 +255,12 @@ static void hci_upstream_data_handler(void *arg)
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
|
||||
if (!fixed_queue_is_empty(rx_q) || pkt_queue_length(adv_rpt_q) > 0) {
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -286,6 +301,7 @@ bool host_recv_adv_packet(uint8_t *packet)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
static void hci_adv_flow_monitor(void *context)
|
||||
{
|
||||
@ -411,6 +427,7 @@ int hci_adv_credits_force_release(uint16_t num)
|
||||
return credits_released;
|
||||
}
|
||||
#endif
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
|
||||
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)];
|
||||
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)
|
||||
{
|
||||
uint8_t type;
|
||||
@ -519,6 +536,7 @@ _discard_packet:
|
||||
hci_adv_credits_prep_to_release(1);
|
||||
#endif
|
||||
}
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
|
||||
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
|
||||
BT_HDR *pkt = NULL;
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
pkt_linked_item_t *linked_pkt = NULL;
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
size_t pkt_size;
|
||||
|
||||
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);
|
||||
fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT);
|
||||
} else {
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if !BLE_ADV_REPORT_FLOW_CONTROL
|
||||
// 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) {
|
||||
@ -604,6 +625,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
hci_adv_credits_consumed(1);
|
||||
#endif
|
||||
#else
|
||||
assert(0);
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
}
|
||||
|
||||
hci_upstream_data_post(OSI_THREAD_MAX_TIMEOUT);
|
||||
|
@ -537,9 +537,11 @@ static void dispatch_adv_report(pkt_linked_item_t *linked_pkt)
|
||||
//Tell Up-layer received packet.
|
||||
if (btu_task_post(SIG_BTU_HCI_ADV_RPT_MSG, linked_pkt, OSI_THREAD_MAX_TIMEOUT) == false) {
|
||||
osi_free(linked_pkt);
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
hci_adv_credits_try_release(1);
|
||||
#endif
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
}
|
||||
}
|
||||
// Misc internal functions
|
||||
|
@ -52,6 +52,7 @@ static BT_HDR *make_set_c2h_flow_control(uint8_t enable)
|
||||
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)
|
||||
{
|
||||
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);
|
||||
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)
|
||||
{
|
||||
uint8_t *stream;
|
||||
@ -219,10 +220,12 @@ static BT_HDR *make_write_default_erroneous_data_report(uint8_t enable)
|
||||
return packet;
|
||||
}
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
static BT_HDR *make_read_max_adv_data_len(void)
|
||||
{
|
||||
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)
|
||||
// Internal functions
|
||||
|
||||
@ -252,7 +255,9 @@ static const hci_packet_factory_t interface = {
|
||||
make_reset,
|
||||
make_read_buffer_size,
|
||||
make_set_c2h_flow_control,
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
make_set_adv_report_flow_control,
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
make_host_buffer_size,
|
||||
make_read_local_version_info,
|
||||
make_read_bd_addr,
|
||||
@ -269,7 +274,9 @@ static const hci_packet_factory_t interface = {
|
||||
make_ble_read_local_supported_features,
|
||||
make_ble_read_resolving_list_size,
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
make_read_max_adv_data_len,
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
make_ble_read_suggested_default_data_length,
|
||||
make_ble_write_suggested_default_data_length,
|
||||
|
@ -209,6 +209,7 @@ static void parse_ble_read_suggested_default_data_length_response(
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
static void parse_ble_read_adv_max_len_response(
|
||||
BT_HDR *response,
|
||||
uint16_t *adv_max_len_ptr)
|
||||
@ -221,6 +222,7 @@ static void parse_ble_read_adv_max_len_response(
|
||||
}
|
||||
osi_free(response);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == 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_resolving_list_size_response,
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
parse_ble_read_adv_max_len_response,
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
parse_ble_read_suggested_default_data_length_response
|
||||
};
|
||||
|
@ -104,10 +104,11 @@ void hci_shut_down(void);
|
||||
|
||||
bool hci_downstream_data_post(uint32_t timeout);
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
int hci_adv_credits_prep_to_release(uint16_t num);
|
||||
int hci_adv_credits_try_release(uint16_t num);
|
||||
int hci_adv_credits_force_release(uint16_t num);
|
||||
#endif
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#endif /* _HCI_LAYER_H_ */
|
||||
|
@ -26,7 +26,9 @@ typedef struct {
|
||||
BT_HDR *(*make_reset)(void);
|
||||
BT_HDR *(*make_read_buffer_size)(void);
|
||||
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);
|
||||
#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_read_local_version_info)(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_resolving_list_size)(void);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
BT_HDR *(*make_read_max_adv_data_len)(void);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
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);
|
||||
|
@ -95,10 +95,12 @@ typedef struct {
|
||||
uint8_t *resolving_list_size_ptr
|
||||
);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
void (*parse_ble_read_adv_max_len_response) (
|
||||
BT_HDR *respone,
|
||||
BT_HDR *response,
|
||||
uint16_t *ble_ext_adv_data_max_len_ptr
|
||||
);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void (*parse_ble_read_suggested_default_data_length_response)(
|
||||
BT_HDR *response,
|
||||
|
@ -583,10 +583,11 @@ void BTM_BleSetConnScanParams (UINT32 scan_interval, UINT32 scan_window)
|
||||
p_ble_cb->scan_win = scan_window;
|
||||
new_param = TRUE;
|
||||
}
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (new_param && p_ble_cb->conn_state == BLE_BG_CONN) {
|
||||
btm_ble_suspend_bg_conn();
|
||||
}
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
} else {
|
||||
BTM_TRACE_ERROR("Illegal Connection Scan Parameters");
|
||||
}
|
||||
|
@ -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_BleSetStaticAddr(BD_ADDR rand_addr);
|
||||
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_set_data_validate(UINT8 instance, UINT16 len, UINT8 *data);
|
||||
|
||||
@ -35,6 +36,8 @@ typedef struct {
|
||||
} tBTM_EXT_ADV_RECORD;
|
||||
|
||||
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);
|
||||
|
||||
#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));
|
||||
}
|
||||
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
void btm_ble_advrecod_init(void)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -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)
|
||||
{
|
||||
if (!params) {
|
||||
@ -1203,6 +1208,7 @@ static tBTM_STATUS btm_ble_ext_adv_set_data_validate(UINT8 instance, UINT16 len,
|
||||
|
||||
return BTM_SUCCESS;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
|
||||
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)
|
||||
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
void btm_ble_channel_select_algorithm_evt(tBTM_BLE_CHANNEL_SEL_ALG *params)
|
||||
{
|
||||
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)
|
||||
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
uint8_t btm_ble_ext_adv_active_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
@ -1387,6 +1395,7 @@ uint8_t btm_ble_ext_adv_active_count(void)
|
||||
|
||||
return count;
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
|
@ -648,6 +648,7 @@ void btm_ble_initiate_select_conn(BD_ADDR bda)
|
||||
BTM_TRACE_ERROR("btm_ble_initiate_select_conn failed");
|
||||
}
|
||||
}
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_suspend_bg_conn
|
||||
@ -672,6 +673,8 @@ BOOLEAN btm_ble_suspend_bg_conn(void)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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)
|
||||
{
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
btm_ble_resume_bg_conn();
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (wl_state & BTM_BLE_WL_ADV) {
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
btm_ble_start_adv();
|
||||
@ -733,6 +738,7 @@ static void btm_wl_update_to_controller(void)
|
||||
btm_execute_wl_dev_operation();
|
||||
|
||||
}
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_resume_bg_conn
|
||||
@ -762,6 +768,8 @@ BOOLEAN btm_ble_resume_bg_conn(void)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_get_conn_st
|
||||
|
@ -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);
|
||||
static void btm_ble_stop_observe(void);
|
||||
static void btm_ble_stop_discover(void);
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
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);
|
||||
|
||||
#define BTM_BLE_INQ_RESULT 0x01
|
||||
@ -1332,7 +1334,9 @@ void BTM_BleClearBgConnDev(void)
|
||||
{
|
||||
btm_ble_start_auto_conn(FALSE);
|
||||
btm_ble_clear_white_list(NULL);
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
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);
|
||||
return btm_update_dev_to_white_list(add_remove, remote_bda, 0, NULL);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleSetConnectableMode
|
||||
@ -1383,7 +1387,7 @@ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode)
|
||||
p_cb->directed_conn = connectable_mode;
|
||||
return btm_ble_set_connectability( p_cb->connectable_mode);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_set_conn_mode_adv_init_addr
|
||||
@ -2029,6 +2033,7 @@ BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_CheckAdvData
|
||||
@ -2074,7 +2079,7 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT16 adv_data_len, UINT8 type, UINT8 *p
|
||||
*p_length = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // #if ((BLE_42_SCAN_EN == TRUE) || (BLE_50_EXTEND_SCAN_EN == TRUE))
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_discoverability
|
||||
@ -2637,7 +2643,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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)
|
||||
{
|
||||
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_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)
|
||||
{
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
uint32_t num_dis = 0;
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
}
|
||||
|
||||
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 */
|
||||
if (btm_ble_get_conn_st() == BLE_CONN_IDLE && status != HCI_ERR_HOST_REJECT_RESOURCES &&
|
||||
!btm_send_pending_direct_conn()) {
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
bg_con = btm_ble_resume_bg_conn();
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
}
|
||||
|
||||
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->inq_var.evt_type = BTM_BLE_NON_CONNECT_EVT;
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
p_cb->adv_rpt_queue = pkt_queue_create();
|
||||
assert(p_cb->adv_rpt_queue != NULL);
|
||||
|
||||
p_cb->adv_rpt_ready = osi_event_create(btm_adv_pkt_handler, NULL);
|
||||
assert(p_cb->adv_rpt_ready != NULL);
|
||||
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_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
btm_ble_adv_filter_init();
|
||||
@ -4606,13 +4618,13 @@ void btm_ble_free (void)
|
||||
BTM_TRACE_DEBUG("%s", __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);
|
||||
p_cb->adv_rpt_queue = NULL;
|
||||
|
||||
osi_event_delete(p_cb->adv_rpt_ready);
|
||||
p_cb->adv_rpt_ready = NULL;
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#if BTM_DYNAMIC_MEMORY == TRUE
|
||||
osi_free(cmn_ble_gap_vsc_cb_ptr);
|
||||
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;
|
||||
}
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
bool btm_ble_adv_pkt_ready(void)
|
||||
{
|
||||
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);
|
||||
return true;
|
||||
}
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
@ -694,11 +694,11 @@ BOOLEAN btm_ble_suspend_resolving_list_activity(void)
|
||||
btm_ble_stop_scan();
|
||||
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_SCAN;
|
||||
}
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (btm_ble_suspend_bg_conn()) {
|
||||
p_ble_cb->suspended_rl_state |= BTM_BLE_RL_INIT;
|
||||
}
|
||||
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -726,10 +726,11 @@ void btm_ble_resume_resolving_list_activity(void)
|
||||
btm_ble_start_scan();
|
||||
}
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (p_ble_cb->suspended_rl_state & BTM_BLE_RL_INIT) {
|
||||
btm_ble_resume_bg_conn();
|
||||
}
|
||||
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
p_ble_cb->suspended_rl_state = BTM_BLE_RL_IDLE;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,9 @@ void btm_dev_init (void)
|
||||
/* Initialize nonzero defaults */
|
||||
#if (BTM_MAX_LOC_BD_NAME_LEN > 0)
|
||||
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));
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif
|
||||
|
||||
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.bg_conn_type = BTM_BLE_CONN_NONE;
|
||||
btm_cb.ble_ctr_cb.p_select_cback = NULL;
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
gatt_reset_bgdev_list();
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
#if (BLE_HOST_BLE_MULTI_ADV_EN == TRUE)
|
||||
btm_ble_multi_adv_init();
|
||||
#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';
|
||||
}
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
p = (UINT8 *)btm_cb.cfg.bredr_bd_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';
|
||||
}
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#else
|
||||
p = (UINT8 *)p_name;
|
||||
#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 (CLASSIC_BT_INCLUDED == TRUE)
|
||||
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)) {
|
||||
*p_name = NULL;
|
||||
BTM_TRACE_ERROR("Error, BLE and BREDR have different names, return NULL\n");
|
||||
return (BTM_NO_RESOURCES);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (name_type & BT_DEVICE_TYPE_BLE) {
|
||||
*p_name = btm_cb.cfg.ble_bd_name;
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
if (name_type & BT_DEVICE_TYPE_BREDR) {
|
||||
*p_name = btm_cb.cfg.bredr_bd_name;
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
return (BTM_SUCCESS);
|
||||
#else
|
||||
*p_name = NULL;
|
||||
|
@ -39,7 +39,9 @@ tBTM_CB *btm_cb_ptr;
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void btm_ble_extendadvcb_init(void);
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
extern void btm_ble_advrecod_init(void);
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif
|
||||
|
||||
|
||||
@ -89,7 +91,9 @@ void btm_init (void)
|
||||
btm_sec_dev_init();
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
btm_ble_extendadvcb_init();
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
btm_ble_advrecod_init();
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BuildOobData
|
||||
@ -1745,8 +1745,10 @@ UINT16 BTM_BuildOobData(UINT8 *p_data, UINT16 max_len, BT_OCTET16 c,
|
||||
UINT8 *p = p_data;
|
||||
UINT16 len = 0;
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
UINT16 name_size;
|
||||
UINT8 name_type = BTM_EIR_SHORTENED_LOCAL_NAME_TYPE;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif
|
||||
|
||||
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;
|
||||
}
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
name_size = name_len;
|
||||
if (name_size > strlen(btm_cb.cfg.bredr_bd_name)) {
|
||||
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;
|
||||
max_len -= delta;
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif
|
||||
/* update len */
|
||||
p = p_data;
|
||||
@ -1871,6 +1875,7 @@ UINT8 *BTM_ReadOobData(UINT8 *p_data, UINT8 eir_tag, UINT8 *p_len)
|
||||
|
||||
return p_ret;
|
||||
}
|
||||
#endif
|
||||
#endif ///BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
@ -342,10 +342,10 @@ typedef struct {
|
||||
tBTM_INQ_RESULTS_CB *p_scan_results_cb;
|
||||
tBTM_CMPL_CB *p_scan_cmpl_cb;
|
||||
TIMER_LIST_ENT scan_timer_ent;
|
||||
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
struct pkt_queue *adv_rpt_queue;
|
||||
struct osi_event *adv_rpt_ready;
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
/* background connection procedure cb value */
|
||||
tBTM_BLE_CONN_TYPE bg_conn_type;
|
||||
UINT32 scan_int;
|
||||
@ -388,12 +388,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
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_discard_evt(UINT8 *p);
|
||||
void btm_ble_process_direct_adv_pkt (UINT8 *p);
|
||||
bool btm_ble_adv_pkt_ready(void);
|
||||
bool btm_ble_adv_pkt_post(pkt_linked_item_t *pkt);
|
||||
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);
|
||||
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_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);
|
||||
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
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_read_ble_local_supported_states_complete(UINT8 *p, UINT16 evt_len);
|
||||
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_white_list_init(UINT8 white_list_size);
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
/* background connection function */
|
||||
BOOLEAN btm_ble_suspend_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);
|
||||
BOOLEAN btm_ble_start_auto_conn(BOOLEAN start);
|
||||
BOOLEAN btm_ble_start_select_conn(BOOLEAN start, tBTM_BLE_SEL_CBACK *p_select_cback);
|
||||
|
@ -726,14 +726,18 @@ struct tBTM_SEC_DEV_REC{
|
||||
*/
|
||||
typedef struct {
|
||||
#if BTM_MAX_LOC_BD_NAME_LEN > 0
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
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 */
|
||||
#endif
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BOOLEAN pin_type; /* TRUE if PIN type is fixed */
|
||||
UINT8 pin_code_len; /* Bonding information */
|
||||
PIN_CODE pin_code; /* PIN CODE if pin type is fixed */
|
||||
BOOLEAN connectable; /* If TRUE page scan should be enabled */
|
||||
UINT8 def_inq_scan_mode; /* ??? limited/general/none */
|
||||
// BOOLEAN connectable; /* If TRUE page scan should be enabled */
|
||||
// UINT8 def_inq_scan_mode; /* ??? limited/general/none */
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
} tBTM_CFG;
|
||||
|
||||
enum {
|
||||
@ -954,7 +958,7 @@ typedef struct {
|
||||
#endif // SMP_INCLUDED == TRUE || BT_CLASSIC_ENABLED == TRUE
|
||||
list_t *p_sec_dev_rec_list;
|
||||
tBTM_SEC_SERV_REC *p_out_serv;
|
||||
tBTM_MKEY_CALLBACK *mkey_cback;
|
||||
// tBTM_MKEY_CALLBACK *mkey_cback;
|
||||
|
||||
BD_ADDR connecting_bda;
|
||||
DEV_CLASS connecting_dc;
|
||||
|
@ -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 */
|
||||
/********************************************************************************/
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_inquiry_comp_evt (UINT8 *p);
|
||||
static void btu_hcif_inquiry_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_request_evt (UINT8 *p);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_disconnection_comp_evt (UINT8 *p);
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
static void btu_hcif_authentication_comp_evt (UINT8 *p);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_rmt_name_request_comp_evt (UINT8 *p, UINT16 evt_len);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
static void btu_hcif_encryption_change_evt (UINT8 *p);
|
||||
#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_ext_features_comp_evt (UINT8 *p);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
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);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
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_hardware_error_evt (UINT8 *p);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_flush_occured_evt (void);
|
||||
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);
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_mode_change_evt (UINT8 *p);
|
||||
#endif // #if (CLASSIC_BT_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_link_key_request_evt (UINT8 *p);
|
||||
static void btu_hcif_link_key_notification_evt (UINT8 *p);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_loopback_command_evt (void);
|
||||
static void btu_hcif_data_buf_overflow_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_host_support_evt (UINT8 *p);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
/* Simple Pairing Events */
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
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
|
||||
static void btu_hcif_rem_oob_request_evt (UINT8 *p);
|
||||
#endif
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_link_supv_to_changed_evt (UINT8 *p);
|
||||
#if L2CAP_NON_FLUSHABLE_PB_INCLUDED == TRUE
|
||||
static void btu_hcif_enhanced_flush_complete_evt (void);
|
||||
#endif
|
||||
|
||||
static void btu_hcif_ssr_evt (UINT8 *p, UINT16 evt_len);
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
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);
|
||||
#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_data_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_data_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_param_status;
|
||||
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#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);
|
||||
|
||||
switch (hci_evt_code) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_INQUIRY_COMP_EVT:
|
||||
btu_hcif_inquiry_comp_evt (p);
|
||||
break;
|
||||
@ -209,6 +234,7 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
||||
case HCI_CONNECTION_REQUEST_EVT:
|
||||
btu_hcif_connection_request_evt (p);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_DISCONNECTION_COMP_EVT:
|
||||
btu_hcif_disconnection_comp_evt (p);
|
||||
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);
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
break;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_RMT_NAME_REQUEST_COMP_EVT:
|
||||
btu_hcif_rmt_name_request_comp_evt (p, hci_evt_len);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_ENCRYPTION_CHANGE_EVT:
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
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
|
||||
break;
|
||||
#endif
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_READ_RMT_FEATURES_COMP_EVT:
|
||||
btu_hcif_read_rmt_features_comp_evt (p);
|
||||
break;
|
||||
case HCI_READ_RMT_EXT_FEATURES_COMP_EVT:
|
||||
btu_hcif_read_rmt_ext_features_comp_evt (p);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_READ_RMT_VERSION_COMP_EVT:
|
||||
btu_hcif_read_rmt_version_comp_evt (p);
|
||||
break;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_QOS_SETUP_COMP_EVT:
|
||||
btu_hcif_qos_setup_comp_evt (p);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_COMMAND_COMPLETE_EVT:
|
||||
//HCI_TRACE_ERROR("%s should not have received a command complete event. "
|
||||
// "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:
|
||||
btu_hcif_hardware_error_evt (p);
|
||||
break;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_FLUSH_OCCURED_EVT:
|
||||
btu_hcif_flush_occured_evt ();
|
||||
break;
|
||||
case HCI_ROLE_CHANGE_EVT:
|
||||
btu_hcif_role_change_evt (p);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_NUM_COMPL_DATA_PKTS_EVT:
|
||||
btu_hcif_num_compl_data_pkts_evt (p);
|
||||
break;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_MODE_CHANGE_EVT:
|
||||
btu_hcif_mode_change_evt (p);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_PIN_CODE_REQUEST_EVT:
|
||||
btu_hcif_pin_code_request_evt (p);
|
||||
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:
|
||||
btu_hcif_link_key_notification_evt (p);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_LOOPBACK_COMMAND_EVT:
|
||||
btu_hcif_loopback_command_evt ();
|
||||
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:
|
||||
btu_hcif_host_support_evt (p);
|
||||
break;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_IO_CAPABILITY_REQUEST_EVT:
|
||||
btu_hcif_io_cap_request_evt (p);
|
||||
break;
|
||||
@ -343,7 +381,6 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
|
||||
case HCI_KEYPRESS_NOTIFY_EVT:
|
||||
btu_hcif_keypress_notif_evt (p);
|
||||
break;
|
||||
#endif /* (CLASSIC_BT_INCLUDED == TRUE) */
|
||||
case HCI_LINK_SUPER_TOUT_CHANGED_EVT:
|
||||
btu_hcif_link_supv_to_changed_evt (p);
|
||||
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 ();
|
||||
break;
|
||||
#endif
|
||||
#endif /* (CLASSIC_BT_INCLUDED == TRUE) */
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btu_hcif_inquiry_comp_evt
|
||||
@ -705,7 +743,7 @@ static void btu_hcif_connection_request_evt (UINT8 *p)
|
||||
}
|
||||
#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
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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);
|
||||
#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);
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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);
|
||||
}
|
||||
}
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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);
|
||||
#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;
|
||||
switch (opcode) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_INQUIRY_CANCEL:
|
||||
/* Tell inquiry processing that we are done */
|
||||
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);
|
||||
break;
|
||||
|
||||
case HCI_READ_LOCAL_NAME:
|
||||
btm_read_local_name_complete (p, evt_len);
|
||||
break;
|
||||
|
||||
case HCI_GET_LINK_QUALITY:
|
||||
btm_read_link_quality_complete (p);
|
||||
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:
|
||||
btm_read_rssi_complete (p);
|
||||
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);
|
||||
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
break;
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_CREATE_CONNECTION_CANCEL:
|
||||
btm_create_conn_cancel_complete(p);
|
||||
break;
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_READ_LOCAL_OOB_DATA:
|
||||
#if BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE
|
||||
btm_read_local_oob_complete(p);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_READ_INQ_TX_POWER_LEVEL:
|
||||
btm_read_linq_tx_power_complete (p);
|
||||
break;
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_SET_AFH_CHANNELS:
|
||||
btm_set_afh_channels_complete(p);
|
||||
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);
|
||||
#endif // #if (BLE_HOST_READ_TX_POWER_EN == TRUE)
|
||||
break;
|
||||
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
case HCI_BLE_WRITE_ADV_ENABLE:
|
||||
btm_ble_write_adv_enable_complete(p);
|
||||
break;
|
||||
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
case HCI_BLE_CREATE_LL_CONN:
|
||||
btm_ble_create_ll_conn_complete(*p);
|
||||
break;
|
||||
@ -1298,6 +1338,7 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
|
||||
#endif
|
||||
|
||||
switch (opcode) {
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
case HCI_EXIT_SNIFF_MODE:
|
||||
case HCI_EXIT_PARK_MODE:
|
||||
#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:
|
||||
btm_pm_proc_cmd_status(status);
|
||||
break;
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
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
|
||||
@ -1573,7 +1615,7 @@ static void btu_hcif_role_change_evt (UINT8 *p)
|
||||
l2c_link_role_changed (bda, role, status);
|
||||
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);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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);
|
||||
}
|
||||
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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 (CLASSIC_BT_INCLUDED == TRUE)
|
||||
static void btu_hcif_pin_code_request_evt (UINT8 *p)
|
||||
{
|
||||
#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);
|
||||
}
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btu_hcif_loopback_command_evt
|
||||
@ -1905,7 +1949,7 @@ static void btu_hcif_host_support_evt (UINT8 *p)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
static void btu_hcif_io_cap_request_evt (UINT8 *p)
|
||||
{
|
||||
btm_io_capabilities_req(p);
|
||||
@ -2014,6 +2058,7 @@ static void btu_hcif_rem_oob_request_evt (UINT8 *p)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** 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 */
|
||||
}
|
||||
#endif
|
||||
#endif // #if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
/**********************************************
|
||||
** End of Simple Pairing Events
|
||||
***********************************************/
|
||||
|
@ -229,11 +229,13 @@ bool btu_task_post(uint32_t sig, void *param, uint32_t timeout)
|
||||
break;
|
||||
case SIG_BTU_HCI_ADV_RPT_MSG:
|
||||
#if BLE_INCLUDED == TRUE
|
||||
#if (BLE_42_SCAN_EN == TRUE)
|
||||
if (param != NULL) {
|
||||
btm_ble_adv_pkt_post(param);
|
||||
}
|
||||
btm_ble_adv_pkt_ready();
|
||||
status = true;
|
||||
#endif // #if (BLE_42_SCAN_EN == TRUE)
|
||||
#else
|
||||
osi_free(param);
|
||||
status = false;
|
||||
|
@ -75,7 +75,7 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level)
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** Parameter p_cb_info : callback informaiton
|
||||
** Parameter p_cb_info : callback information
|
||||
**
|
||||
** 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.
|
||||
** 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,
|
||||
@ -170,7 +170,7 @@ UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
|
||||
GATT_TRACE_API ("GATTS_CreateService\n" );
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
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) {
|
||||
GATT_TRACE_ERROR ("GATTS_StartService: no free server registration block");
|
||||
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);
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
/* update the listen mode */
|
||||
#if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE))
|
||||
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) {
|
||||
status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux);
|
||||
} else {
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
@ -1483,7 +1487,7 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
** 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);
|
||||
}
|
||||
} else {
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (!gatt_if) {
|
||||
if (gatt_get_num_apps_for_bg_dev(bd_addr)) {
|
||||
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 {
|
||||
status = gatt_remove_bg_dev_for_app(gatt_if, bd_addr);
|
||||
}
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
}
|
||||
|
||||
return status;
|
||||
@ -1628,7 +1634,7 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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)
|
||||
** 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 (tGATT_BG_CONN_DEV == TRUE)
|
||||
gatt_update_auto_connect_dev(gatt_if, start, bd_addr, FALSE);
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
} else {
|
||||
p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
|
||||
#endif ///GATTS_INCLUDED == TRUE
|
||||
}
|
||||
} else {
|
||||
GATT_TRACE_ERROR("CCB max out, no rsources");
|
||||
GATT_TRACE_ERROR("CCB max out, no resources");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -929,18 +929,23 @@ static void gatt_send_conn_cback(tGATT_TCB *p_tcb)
|
||||
{
|
||||
UINT8 i;
|
||||
tGATT_REG *p_reg;
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
tGATT_BG_CONN_DEV *p_bg_dev = NULL;
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
UINT16 conn_id;
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
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 */
|
||||
for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) {
|
||||
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)) {
|
||||
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) {
|
||||
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,
|
||||
|
@ -108,7 +108,7 @@ void gatt_free_pending_ind(tGATT_TCB *p_tcb)
|
||||
**
|
||||
** Function gatt_free_pending_enc_queue
|
||||
**
|
||||
** Description Free all buffers in pending encyption queue
|
||||
** Description Free all buffers in pending encryption queue
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
@ -222,7 +222,7 @@ void gatt_set_srv_chg(void)
|
||||
**
|
||||
** 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)
|
||||
@ -299,7 +299,7 @@ tGATTS_PENDING_NEW_SRV_START *gatt_add_pending_new_srv_start(tGATTS_HNDL_RANGE *
|
||||
**
|
||||
** 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
|
||||
**
|
||||
@ -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
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** 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)
|
||||
@ -1205,7 +1205,7 @@ UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid)
|
||||
if (uuid.len == LEN_UUID_16) {
|
||||
UINT16_TO_STREAM (p, uuid.uu.uuid16);
|
||||
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);
|
||||
p += 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;
|
||||
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++) {
|
||||
if (!p_sreg->in_use) {
|
||||
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;
|
||||
|
||||
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);
|
||||
return 0;
|
||||
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);
|
||||
|
||||
/* Make the service browseable */
|
||||
/* Make the service browsable */
|
||||
SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list);
|
||||
|
||||
return (sdp_handle);
|
||||
@ -1868,7 +1868,7 @@ UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb)
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
@ -1892,7 +1892,7 @@ UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda)
|
||||
**
|
||||
** 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.
|
||||
**
|
||||
@ -1916,7 +1916,7 @@ void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb )
|
||||
**
|
||||
** 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
|
||||
**
|
||||
@ -2015,7 +2015,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
|
||||
**
|
||||
** Function gatt_sr_update_cback_cnt
|
||||
**
|
||||
** Description Update the teh application callback count
|
||||
** Description Update the the application callback count
|
||||
**
|
||||
** 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
|
||||
**
|
||||
** Description Update the teh prepare write request count
|
||||
** Description Update the the prepare write request count
|
||||
**
|
||||
** 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
|
||||
@ -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 ++) {
|
||||
if (is_initator) {
|
||||
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;
|
||||
} else if (p_dev->gatt_if[i] == 0) {
|
||||
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
|
||||
**
|
||||
** 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)
|
||||
@ -2842,7 +2842,7 @@ BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -130,7 +130,7 @@ typedef union {
|
||||
tGATT_EXEC_FLAG exec_write; /* execute write */
|
||||
} tGATT_CL_MSG;
|
||||
|
||||
/* error response strucutre */
|
||||
/* error response structure */
|
||||
typedef struct {
|
||||
UINT16 handle;
|
||||
UINT8 cmd_code;
|
||||
@ -480,12 +480,14 @@ typedef struct {
|
||||
UINT32 service_change;
|
||||
} tGATT_SVC_CHG;
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
typedef struct {
|
||||
tGATT_IF gatt_if[GATT_MAX_APPS];
|
||||
tGATT_IF listen_gif[GATT_MAX_APPS];
|
||||
BD_ADDR remote_bda;
|
||||
BOOLEAN in_use;
|
||||
} tGATT_BG_CONN_DEV;
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
|
||||
#define GATT_SVC_CHANGED_CONNECTING 1 /* wait for connection */
|
||||
#define GATT_SVC_CHANGED_SERVICE 2 /* GATT service discovery */
|
||||
@ -553,8 +555,9 @@ typedef struct {
|
||||
|
||||
|
||||
tGATT_HDL_CFG hdl_cfg;
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
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 */
|
||||
UINT8 srv_chg_mode; /* internal use: service change mode */
|
||||
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 tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg);
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
/* 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_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 void gatt_deregister_bgdev_list(tGATT_IF gatt_if);
|
||||
extern void gatt_reset_bgdev_list(void);
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
|
||||
/* server function */
|
||||
extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle);
|
||||
|
@ -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_START_COMPLETE_EVT 14
|
||||
#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_SYNC_CANCEL_COMPLETE_EVT 17
|
||||
#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_REMOVE_DEV_COMPLETE_EVT 20
|
||||
#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)
|
||||
#define BTM_BLE_5_GAP_SET_EXT_SCAN_PARAMS_COMPLETE_EVT 22
|
||||
#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_START_CMPL per_adv_start;
|
||||
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_CANCEL_CMPL per_adv_sync_cancel;
|
||||
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_REMOVE_DEV_CMPL per_adv_remove_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)
|
||||
tBTM_BLE_SET_EXT_SCAN_PARAMS_CMPL ext_scan;
|
||||
tBTM_BLE_EXT_SCAN_START_CMPL scan_start;
|
||||
|
@ -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);
|
||||
|
||||
btm_ble_enqueue_direct_conn_req(p_lcb);
|
||||
|
||||
#if (tGATT_BG_CONN_DEV == TRUE)
|
||||
if (conn_st == BLE_BG_CONN) {
|
||||
btm_ble_suspend_bg_conn();
|
||||
}
|
||||
|
||||
#endif // #if (tGATT_BG_CONN_DEV == TRUE)
|
||||
rt = TRUE;
|
||||
}
|
||||
return rt;
|
||||
|
@ -368,9 +368,11 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
|
||||
BTM_Recovery_Pre_State();
|
||||
}
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
if(btm_ble_inter_get() && reason == HCI_ERR_CONN_FAILED_ESTABLISHMENT) {
|
||||
BTM_BleStartExtAdvRestart(handle);
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
status = FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user