components/bt: Fix warning when disable debug logs or in release mode and improve the code structure
This commit is contained in:
parent
bbdb236ab7
commit
5ede49ca4a
43 changed files with 423 additions and 238 deletions
|
@ -1293,9 +1293,10 @@ void bta_av_setconfig_rsp (tBTA_AV_SCB *p_scb, tBTA_AV_DATA *p_data)
|
||||||
/* if SBC is used by the SNK as INT, discover req is not sent in bta_av_config_ind.
|
/* if SBC is used by the SNK as INT, discover req is not sent in bta_av_config_ind.
|
||||||
* call disc_res now */
|
* call disc_res now */
|
||||||
/* this is called in A2DP SRC path only, In case of SINK we don't need it */
|
/* this is called in A2DP SRC path only, In case of SINK we don't need it */
|
||||||
if (local_sep == AVDT_TSEP_SRC)
|
if (local_sep == AVDT_TSEP_SRC) {
|
||||||
p_scb->p_cos->disc_res(p_scb->hndl, num, num, 0, p_scb->peer_addr,
|
p_scb->p_cos->disc_res(p_scb->hndl, num, num, 0, p_scb->peer_addr,
|
||||||
UUID_SERVCLASS_AUDIO_SOURCE);
|
UUID_SERVCLASS_AUDIO_SOURCE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* we do not know the peer device and it is using non-SBC codec
|
/* we do not know the peer device and it is using non-SBC codec
|
||||||
* we need to know all the SEPs on SNK */
|
* we need to know all the SEPs on SNK */
|
||||||
|
|
|
@ -829,10 +829,11 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
|
||||||
if (p_data->rc_msg.msg.pass.op_id == AVRC_ID_VENDOR) {
|
if (p_data->rc_msg.msg.pass.op_id == AVRC_ID_VENDOR) {
|
||||||
p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
|
p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
|
||||||
#if (AVRC_METADATA_INCLUDED == TRUE)
|
#if (AVRC_METADATA_INCLUDED == TRUE)
|
||||||
if (p_cb->features & BTA_AV_FEAT_METADATA)
|
if (p_cb->features & BTA_AV_FEAT_METADATA) {
|
||||||
p_data->rc_msg.msg.hdr.ctype =
|
p_data->rc_msg.msg.hdr.ctype =
|
||||||
bta_av_group_navi_supported(p_data->rc_msg.msg.pass.pass_len,
|
bta_av_group_navi_supported(p_data->rc_msg.msg.pass.pass_len,
|
||||||
p_data->rc_msg.msg.pass.p_pass_data, is_inquiry);
|
p_data->rc_msg.msg.pass.p_pass_data, is_inquiry);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
p_data->rc_msg.msg.hdr.ctype = bta_av_op_supported(p_data->rc_msg.msg.pass.op_id, is_inquiry);
|
p_data->rc_msg.msg.hdr.ctype = bta_av_op_supported(p_data->rc_msg.msg.pass.op_id, is_inquiry);
|
||||||
|
@ -890,8 +891,10 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
|
||||||
evt = bta_av_proc_meta_cmd (&rc_rsp, &p_data->rc_msg, &ctype);
|
evt = bta_av_proc_meta_cmd (&rc_rsp, &p_data->rc_msg, &ctype);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
evt = BTA_AV_VENDOR_CMD_EVT;
|
evt = BTA_AV_VENDOR_CMD_EVT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* else if configured to support vendor specific and it's a response */
|
/* else if configured to support vendor specific and it's a response */
|
||||||
else if ((p_cb->features & BTA_AV_FEAT_VENDOR) &&
|
else if ((p_cb->features & BTA_AV_FEAT_VENDOR) &&
|
||||||
p_data->rc_msg.msg.hdr.ctype >= AVRC_RSP_ACCEPT) {
|
p_data->rc_msg.msg.hdr.ctype >= AVRC_RSP_ACCEPT) {
|
||||||
|
@ -902,7 +905,9 @@ void bta_av_rc_msg(tBTA_AV_CB *p_cb, tBTA_AV_DATA *p_data)
|
||||||
evt = BTA_AV_META_MSG_EVT;
|
evt = BTA_AV_META_MSG_EVT;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
evt = BTA_AV_VENDOR_RSP_EVT;
|
evt = BTA_AV_VENDOR_RSP_EVT;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* else if not configured to support vendor specific and it's a command */
|
/* else if not configured to support vendor specific and it's a command */
|
||||||
|
|
|
@ -636,13 +636,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
|
||||||
|
|
||||||
/* set modes for Discoverability and connectability if not ignore */
|
/* set modes for Discoverability and connectability if not ignore */
|
||||||
if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
||||||
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
|
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
|
||||||
p_data->set_visibility.disc_mode =
|
p_data->set_visibility.disc_mode =
|
||||||
((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);
|
((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);
|
||||||
|
}
|
||||||
|
|
||||||
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
|
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
|
||||||
p_data->set_visibility.disc_mode =
|
p_data->set_visibility.disc_mode =
|
||||||
((p_data->set_visibility.disc_mode & ~BTA_DM_IGNORE) | disc_mode);
|
((p_data->set_visibility.disc_mode & ~BTA_DM_IGNORE) | disc_mode);
|
||||||
|
}
|
||||||
|
|
||||||
BTM_SetDiscoverability(p_data->set_visibility.disc_mode,
|
BTM_SetDiscoverability(p_data->set_visibility.disc_mode,
|
||||||
bta_dm_cb.inquiry_scan_window,
|
bta_dm_cb.inquiry_scan_window,
|
||||||
|
@ -650,13 +652,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE)) {
|
||||||
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
|
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE) {
|
||||||
p_data->set_visibility.conn_mode =
|
p_data->set_visibility.conn_mode =
|
||||||
((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);
|
((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);
|
||||||
|
}
|
||||||
|
|
||||||
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
|
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE) {
|
||||||
p_data->set_visibility.conn_mode =
|
p_data->set_visibility.conn_mode =
|
||||||
((p_data->set_visibility.conn_mode & ~BTA_DM_IGNORE) | conn_mode);
|
((p_data->set_visibility.conn_mode & ~BTA_DM_IGNORE) | conn_mode);
|
||||||
|
}
|
||||||
|
|
||||||
BTM_SetConnectability(p_data->set_visibility.conn_mode,
|
BTM_SetConnectability(p_data->set_visibility.conn_mode,
|
||||||
bta_dm_cb.page_scan_window,
|
bta_dm_cb.page_scan_window,
|
||||||
|
@ -1886,10 +1890,12 @@ void bta_dm_disc_result (tBTA_DM_MSG *p_data)
|
||||||
|
|
||||||
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
|
#if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
|
||||||
/* if any BR/EDR service discovery has been done, report the event */
|
/* if any BR/EDR service discovery has been done, report the event */
|
||||||
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK)))
|
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK))) {
|
||||||
#endif
|
|
||||||
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
|
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
bta_dm_search_cb.p_search_cback(BTA_DM_DISC_RES_EVT, &p_data->disc_result.result);
|
||||||
|
#endif
|
||||||
tBTA_DM_MSG *p_msg = (tBTA_DM_MSG *) osi_malloc(sizeof(tBTA_DM_MSG));
|
tBTA_DM_MSG *p_msg = (tBTA_DM_MSG *) osi_malloc(sizeof(tBTA_DM_MSG));
|
||||||
|
|
||||||
/* send a message to change state */
|
/* send a message to change state */
|
||||||
|
@ -2155,9 +2161,10 @@ static void bta_dm_find_services ( BD_ADDR bd_addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* last one? clear the BLE service bit if all discovery has been done */
|
/* last one? clear the BLE service bit if all discovery has been done */
|
||||||
if (bta_dm_search_cb.uuid_to_search == 0)
|
if (bta_dm_search_cb.uuid_to_search == 0) {
|
||||||
bta_dm_search_cb.services_to_search &=
|
bta_dm_search_cb.services_to_search &=
|
||||||
(tBTA_SERVICE_MASK)(~(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index)));
|
(tBTA_SERVICE_MASK)(~(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index)));
|
||||||
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
@ -3640,11 +3647,11 @@ static char *bta_dm_get_remname(void)
|
||||||
char *p_temp;
|
char *p_temp;
|
||||||
|
|
||||||
/* If the name isn't already stored, try retrieving from BTM */
|
/* If the name isn't already stored, try retrieving from BTM */
|
||||||
if (*p_name == '\0')
|
if (*p_name == '\0') {
|
||||||
if ((p_temp = BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr)) != NULL) {
|
if ((p_temp = BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr)) != NULL) {
|
||||||
p_name = p_temp;
|
p_name = p_temp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return p_name;
|
return p_name;
|
||||||
}
|
}
|
||||||
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
|
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
|
||||||
|
@ -5181,10 +5188,11 @@ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data)
|
||||||
p_data->ble_set_storage.ref_value);
|
p_data->ble_set_storage.ref_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BTM_CMD_STARTED != btm_status)
|
if (BTM_CMD_STARTED != btm_status) {
|
||||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_CFG_STRG_EVT, p_data->ble_set_storage.ref_value,
|
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_CFG_STRG_EVT, p_data->ble_set_storage.ref_value,
|
||||||
btm_status);
|
btm_status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -5211,10 +5219,11 @@ void bta_dm_ble_enable_batch_scan (tBTA_DM_MSG *p_data)
|
||||||
p_data->ble_enable_scan.ref_value);
|
p_data->ble_enable_scan.ref_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BTM_CMD_STARTED != btm_status)
|
if (BTM_CMD_STARTED != btm_status) {
|
||||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_ENABLE_EVT, p_data->ble_enable_scan.ref_value,
|
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_ENABLE_EVT, p_data->ble_enable_scan.ref_value,
|
||||||
btm_status);
|
btm_status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -5237,10 +5246,11 @@ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data)
|
||||||
btm_status = BTM_BleDisableBatchScan(p_data->ble_disable_scan.ref_value);
|
btm_status = BTM_BleDisableBatchScan(p_data->ble_disable_scan.ref_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BTM_CMD_STARTED != btm_status)
|
if (BTM_CMD_STARTED != btm_status) {
|
||||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_DISABLE_EVT, p_data->ble_enable_scan.ref_value,
|
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_DISABLE_EVT, p_data->ble_enable_scan.ref_value,
|
||||||
btm_status);
|
btm_status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -5263,10 +5273,11 @@ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data)
|
||||||
p_data->ble_read_reports.ref_value);
|
p_data->ble_read_reports.ref_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BTM_CMD_STARTED != btm_status)
|
if (BTM_CMD_STARTED != btm_status) {
|
||||||
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_READ_REPTS_EVT, p_data->ble_enable_scan.ref_value,
|
bta_ble_scan_setup_cb(BTM_BLE_BATCH_SCAN_READ_REPTS_EVT, p_data->ble_enable_scan.ref_value,
|
||||||
btm_status);
|
btm_status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -5395,10 +5406,11 @@ void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_data->ble_cfg_filter_cond.p_filt_cfg_cback)
|
if (p_data->ble_cfg_filter_cond.p_filt_cfg_cback) {
|
||||||
p_data->ble_cfg_filter_cond.p_filt_cfg_cback(BTA_DM_BLE_PF_CONFIG_EVT,
|
p_data->ble_cfg_filter_cond.p_filt_cfg_cback(BTA_DM_BLE_PF_CONFIG_EVT,
|
||||||
p_data->ble_cfg_filter_cond.cond_type, 0, status,
|
p_data->ble_cfg_filter_cond.cond_type, 0, status,
|
||||||
p_data->ble_cfg_filter_cond.ref_value);
|
p_data->ble_cfg_filter_cond.ref_value);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5429,9 +5441,10 @@ void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_data->ble_enable_scan_filt.p_filt_status_cback)
|
if (p_data->ble_enable_scan_filt.p_filt_status_cback) {
|
||||||
p_data->ble_enable_scan_filt.p_filt_status_cback (BTA_DM_BLE_PF_ENABLE_EVT,
|
p_data->ble_enable_scan_filt.p_filt_status_cback (BTA_DM_BLE_PF_ENABLE_EVT,
|
||||||
p_data->ble_enable_scan_filt.ref_value, status);
|
p_data->ble_enable_scan_filt.ref_value, status);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5465,9 +5478,10 @@ void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_data->ble_scan_filt_param_setup.p_filt_param_cback)
|
if (p_data->ble_scan_filt_param_setup.p_filt_param_cback) {
|
||||||
p_data->ble_scan_filt_param_setup.p_filt_param_cback (BTA_DM_BLE_PF_ENABLE_EVT, 0,
|
p_data->ble_scan_filt_param_setup.p_filt_param_cback (BTA_DM_BLE_PF_ENABLE_EVT, 0,
|
||||||
p_data->ble_scan_filt_param_setup.ref_value, status);
|
p_data->ble_scan_filt_param_setup.ref_value, status);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1038,11 +1038,12 @@ static void bta_dm_pm_hid_check(BOOLEAN bScoActive)
|
||||||
bta_dm_pm_set_sniff_policy( bta_dm_find_peer_device(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr), bScoActive);
|
bta_dm_pm_set_sniff_policy( bta_dm_find_peer_device(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr), bScoActive);
|
||||||
|
|
||||||
/* if we had disabled link policy, seems like the hid device stop retrying SNIFF after a few tries. force sniff if needed */
|
/* if we had disabled link policy, seems like the hid device stop retrying SNIFF after a few tries. force sniff if needed */
|
||||||
if (!bScoActive)
|
if (!bScoActive) {
|
||||||
bta_dm_pm_set_mode(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr, BTA_DM_PM_NO_ACTION,
|
bta_dm_pm_set_mode(bta_dm_conn_srvcs.conn_srvc[j].peer_bdaddr, BTA_DM_PM_NO_ACTION,
|
||||||
BTA_DM_PM_RESTART);
|
BTA_DM_PM_RESTART);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1071,8 +1071,9 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
void bta_gattc_read(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||||
{
|
{
|
||||||
if (!bta_gattc_enqueue(p_clcb, p_data))
|
if (!bta_gattc_enqueue(p_clcb, p_data)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tGATT_READ_PARAM read_param;
|
tGATT_READ_PARAM read_param;
|
||||||
memset (&read_param, 0 ,sizeof(tGATT_READ_PARAM));
|
memset (&read_param, 0 ,sizeof(tGATT_READ_PARAM));
|
||||||
|
@ -1140,8 +1141,9 @@ void bta_gattc_read_multi(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
void bta_gattc_write(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||||
{
|
{
|
||||||
if (!bta_gattc_enqueue(p_clcb, p_data))
|
if (!bta_gattc_enqueue(p_clcb, p_data)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
tBTA_GATT_STATUS status = BTA_GATT_OK;
|
tBTA_GATT_STATUS status = BTA_GATT_OK;
|
||||||
tGATT_VALUE attr;
|
tGATT_VALUE attr;
|
||||||
|
|
|
@ -314,8 +314,9 @@ static tBTA_GATT_STATUS bta_gattc_add_char_to_cache(tBTA_GATTC_SERV *p_srvc_cb,
|
||||||
/* TODO(jpawlowski): We should use attribute handle, not value handle to refer to characteristic.
|
/* TODO(jpawlowski): We should use attribute handle, not value handle to refer to characteristic.
|
||||||
This is just a temporary workaround.
|
This is just a temporary workaround.
|
||||||
*/
|
*/
|
||||||
if (service->e_handle < value_handle)
|
if (service->e_handle < value_handle) {
|
||||||
service->e_handle = value_handle;
|
service->e_handle = value_handle;
|
||||||
|
}
|
||||||
|
|
||||||
tBTA_GATTC_CHARACTERISTIC *characteristic = osi_malloc(sizeof(tBTA_GATTC_CHARACTERISTIC));
|
tBTA_GATTC_CHARACTERISTIC *characteristic = osi_malloc(sizeof(tBTA_GATTC_CHARACTERISTIC));
|
||||||
if (!characteristic) {
|
if (!characteristic) {
|
||||||
|
@ -980,12 +981,13 @@ void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_
|
||||||
p_data->value.incl_service.e_handle,
|
p_data->value.incl_service.e_handle,
|
||||||
p_data->value.incl_service.service_type);
|
p_data->value.incl_service.service_type);
|
||||||
|
|
||||||
if (!pri_srvc)
|
if (!pri_srvc) {
|
||||||
bta_gattc_add_srvc_to_list(p_srvc_cb,
|
bta_gattc_add_srvc_to_list(p_srvc_cb,
|
||||||
p_data->value.incl_service.s_handle,
|
p_data->value.incl_service.s_handle,
|
||||||
p_data->value.incl_service.e_handle,
|
p_data->value.incl_service.e_handle,
|
||||||
p_data->value.incl_service.service_type,
|
p_data->value.incl_service.service_type,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
}
|
||||||
/* add into database */
|
/* add into database */
|
||||||
bta_gattc_add_attr_to_cache(p_srvc_cb,
|
bta_gattc_add_attr_to_cache(p_srvc_cb,
|
||||||
p_data->handle,
|
p_data->handle,
|
||||||
|
@ -1023,8 +1025,9 @@ void bta_gattc_disc_cmpl_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT
|
||||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||||
|
|
||||||
if ( p_clcb && (status != GATT_SUCCESS || p_clcb->status != GATT_SUCCESS) ) {
|
if ( p_clcb && (status != GATT_SUCCESS || p_clcb->status != GATT_SUCCESS) ) {
|
||||||
if (status == GATT_SUCCESS)
|
if (status == GATT_SUCCESS) {
|
||||||
p_clcb->status = status;
|
p_clcb->status = status;
|
||||||
|
}
|
||||||
bta_gattc_sm_execute(p_clcb, BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
|
bta_gattc_sm_execute(p_clcb, BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1071,15 +1074,17 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
|
||||||
{
|
{
|
||||||
tBTA_GATTC cb_data;
|
tBTA_GATTC cb_data;
|
||||||
|
|
||||||
if (!p_clcb->p_srcb->p_srvc_cache || list_is_empty(p_clcb->p_srcb->p_srvc_cache))
|
if (!p_clcb->p_srcb->p_srvc_cache || list_is_empty(p_clcb->p_srcb->p_srvc_cache)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *sn = list_begin(p_clcb->p_srcb->p_srvc_cache);
|
for (list_node_t *sn = list_begin(p_clcb->p_srcb->p_srvc_cache);
|
||||||
sn != list_end(p_clcb->p_srcb->p_srvc_cache); sn = list_next(sn)) {
|
sn != list_end(p_clcb->p_srcb->p_srvc_cache); sn = list_next(sn)) {
|
||||||
tBTA_GATTC_SERVICE *p_cache = list_node(sn);
|
tBTA_GATTC_SERVICE *p_cache = list_node(sn);
|
||||||
|
|
||||||
if (!bta_gattc_uuid_compare(p_uuid, &p_cache->uuid, FALSE))
|
if (!bta_gattc_uuid_compare(p_uuid, &p_cache->uuid, FALSE)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
#if (defined BTA_GATT_DEBUG && BTA_GATT_DEBUG == TRUE)
|
#if (defined BTA_GATT_DEBUG && BTA_GATT_DEBUG == TRUE)
|
||||||
APPL_TRACE_DEBUG("found service [0x%04x], inst[%d] handle [%d]",
|
APPL_TRACE_DEBUG("found service [0x%04x], inst[%d] handle [%d]",
|
||||||
|
@ -1087,8 +1092,9 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
|
||||||
p_cache->handle,
|
p_cache->handle,
|
||||||
p_cache->s_handle);
|
p_cache->s_handle);
|
||||||
#endif
|
#endif
|
||||||
if (!p_clcb->p_rcb->p_cback)
|
if (!p_clcb->p_rcb->p_cback) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&cb_data, 0, sizeof(tBTA_GATTC));
|
memset(&cb_data, 0, sizeof(tBTA_GATTC));
|
||||||
|
|
||||||
|
@ -1103,8 +1109,9 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
|
list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
|
||||||
if (!p_srcb || !p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache))
|
if (!p_srcb || !p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return p_srcb->p_srvc_cache;
|
return p_srcb->p_srvc_cache;
|
||||||
}
|
}
|
||||||
|
@ -1112,8 +1119,9 @@ list_t* bta_gattc_get_services_srcb(tBTA_GATTC_SERV *p_srcb) {
|
||||||
const list_t* bta_gattc_get_services(UINT16 conn_id) {
|
const list_t* bta_gattc_get_services(UINT16 conn_id) {
|
||||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||||
|
|
||||||
if (p_clcb == NULL )
|
if (p_clcb == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||||
|
|
||||||
|
@ -1121,16 +1129,18 @@ const list_t* bta_gattc_get_services(UINT16 conn_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
tBTA_GATTC_SERVICE* bta_gattc_find_matching_service(const list_t *services, UINT16 handle) {
|
tBTA_GATTC_SERVICE* bta_gattc_find_matching_service(const list_t *services, UINT16 handle) {
|
||||||
if (!services || list_is_empty(services))
|
if (!services || list_is_empty(services)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *sn = list_begin(services);
|
for (list_node_t *sn = list_begin(services);
|
||||||
sn != list_end(services); sn = list_next(sn)) {
|
sn != list_end(services); sn = list_next(sn)) {
|
||||||
tBTA_GATTC_SERVICE *service = list_node(sn);
|
tBTA_GATTC_SERVICE *service = list_node(sn);
|
||||||
|
|
||||||
if (handle >= service->s_handle && handle <= service->e_handle)
|
if (handle >= service->s_handle && handle <= service->e_handle) {
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1153,15 +1163,17 @@ tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p
|
||||||
{
|
{
|
||||||
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
|
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
|
||||||
|
|
||||||
if (!service)
|
if (!service) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *cn = list_begin(service->characteristics);
|
for (list_node_t *cn = list_begin(service->characteristics);
|
||||||
cn != list_end(service->characteristics); cn = list_next(cn)) {
|
cn != list_end(service->characteristics); cn = list_next(cn)) {
|
||||||
tBTA_GATTC_CHARACTERISTIC *p_char = list_node(cn);
|
tBTA_GATTC_CHARACTERISTIC *p_char = list_node(cn);
|
||||||
if (handle == p_char->handle)
|
if (handle == p_char->handle) {
|
||||||
return p_char;
|
return p_char;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1170,8 +1182,9 @@ tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16
|
||||||
{
|
{
|
||||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||||
|
|
||||||
if (p_clcb == NULL )
|
if (p_clcb == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||||
return bta_gattc_get_characteristic_srcb(p_srcb, handle);
|
return bta_gattc_get_characteristic_srcb(p_srcb, handle);
|
||||||
|
@ -1191,10 +1204,11 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, U
|
||||||
for (list_node_t *dn = list_begin(p_char->descriptors);
|
for (list_node_t *dn = list_begin(p_char->descriptors);
|
||||||
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
||||||
tBTA_GATTC_DESCRIPTOR *p_desc = list_node(dn);
|
tBTA_GATTC_DESCRIPTOR *p_desc = list_node(dn);
|
||||||
if (handle == p_desc->handle)
|
if (handle == p_desc->handle) {
|
||||||
return p_desc;
|
return p_desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1203,8 +1217,9 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
|
||||||
{
|
{
|
||||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||||
|
|
||||||
if (p_clcb == NULL )
|
if (p_clcb == NULL ) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
|
||||||
return bta_gattc_get_descriptor_srcb(p_srcb, handle);
|
return bta_gattc_get_descriptor_srcb(p_srcb, handle);
|
||||||
|
@ -1574,8 +1589,9 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
|
||||||
static size_t bta_gattc_get_db_size(list_t *services,
|
static size_t bta_gattc_get_db_size(list_t *services,
|
||||||
UINT16 start_handle, UINT16 end_handle)
|
UINT16 start_handle, UINT16 end_handle)
|
||||||
{
|
{
|
||||||
if (!services || list_is_empty(services))
|
if (!services || list_is_empty(services)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
size_t db_size = 0;
|
size_t db_size = 0;
|
||||||
UINT16 svc_length = list_length(services) - 1;
|
UINT16 svc_length = list_length(services) - 1;
|
||||||
|
@ -1599,8 +1615,9 @@ static size_t bta_gattc_get_db_size(list_t *services,
|
||||||
db_size++;
|
db_size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics))
|
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
|
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
|
||||||
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
|
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
|
||||||
|
@ -1786,8 +1803,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||||
p_char->properties);
|
p_char->properties);
|
||||||
curr_db_attr++;
|
curr_db_attr++;
|
||||||
|
|
||||||
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
|
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *dn = list_begin(p_char->descriptors);
|
for (list_node_t *dn = list_begin(p_char->descriptors);
|
||||||
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
||||||
|
@ -1815,8 +1833,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc))
|
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *isn = list_begin(p_cur_srvc->included_svc);
|
for (list_node_t *isn = list_begin(p_cur_srvc->included_svc);
|
||||||
isn != list_end(p_cur_srvc->included_svc); isn = list_next(isn)) {
|
isn != list_end(p_cur_srvc->included_svc); isn = list_next(isn)) {
|
||||||
|
@ -1983,8 +2002,9 @@ void bta_gattc_fill_nv_attr(tBTA_GATTC_NV_ATTR *p_attr, UINT8 type, UINT16 s_han
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
||||||
{
|
{
|
||||||
if (!p_srvc_cb->p_srvc_cache || list_is_empty(p_srvc_cb->p_srvc_cache))
|
if (!p_srvc_cb->p_srvc_cache || list_is_empty(p_srvc_cb->p_srvc_cache)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
size_t db_size = bta_gattc_get_db_size(p_srvc_cb->p_srvc_cache, 0x0000, 0xFFFF);
|
size_t db_size = bta_gattc_get_db_size(p_srvc_cb->p_srvc_cache, 0x0000, 0xFFFF);
|
||||||
|
@ -2017,8 +2037,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
||||||
sn != list_end(p_srvc_cb->p_srvc_cache); sn = list_next(sn)) {
|
sn != list_end(p_srvc_cb->p_srvc_cache); sn = list_next(sn)) {
|
||||||
tBTA_GATTC_SERVICE *p_cur_srvc = list_node(sn);
|
tBTA_GATTC_SERVICE *p_cur_srvc = list_node(sn);
|
||||||
|
|
||||||
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics))
|
if (!p_cur_srvc->characteristics || list_is_empty(p_cur_srvc->characteristics)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
|
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
|
||||||
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
|
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
|
||||||
|
@ -2034,8 +2055,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
||||||
0 /* incl_srvc_e_handle */,
|
0 /* incl_srvc_e_handle */,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
|
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *dn = list_begin(p_char->descriptors);
|
for (list_node_t *dn = list_begin(p_char->descriptors);
|
||||||
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
|
||||||
|
@ -2053,8 +2075,9 @@ void bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc))
|
if (!p_cur_srvc->included_svc || list_is_empty(p_cur_srvc->included_svc)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (list_node_t *an = list_begin(p_cur_srvc->included_svc);
|
for (list_node_t *an = list_begin(p_cur_srvc->included_svc);
|
||||||
an != list_end(p_cur_srvc->included_svc); an = list_next(an)) {
|
an != list_end(p_cur_srvc->included_svc); an = list_next(an)) {
|
||||||
|
|
|
@ -416,8 +416,9 @@ tBTA_GATTC_SERV *bta_gattc_srcb_alloc(BD_ADDR bda)
|
||||||
|
|
||||||
if (p_tcb != NULL)
|
if (p_tcb != NULL)
|
||||||
{
|
{
|
||||||
if (p_tcb->p_srvc_cache != NULL)
|
if (p_tcb->p_srvc_cache != NULL) {
|
||||||
list_free(p_tcb->p_srvc_cache);
|
list_free(p_tcb->p_srvc_cache);
|
||||||
|
}
|
||||||
osi_free(p_tcb->p_srvc_list);
|
osi_free(p_tcb->p_srvc_list);
|
||||||
p_tcb->p_srvc_list = NULL;
|
p_tcb->p_srvc_list = NULL;
|
||||||
//osi_free_and_reset((void **)&p_tcb->p_srvc_list);
|
//osi_free_and_reset((void **)&p_tcb->p_srvc_list);
|
||||||
|
@ -583,11 +584,12 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
|
||||||
* clear boundaries are always around service.
|
* clear boundaries are always around service.
|
||||||
*/
|
*/
|
||||||
handle = p_clrcb->notif_reg[i].handle;
|
handle = p_clrcb->notif_reg[i].handle;
|
||||||
if (handle >= start_handle && handle <= end_handle)
|
if (handle >= start_handle && handle <= end_handle) {
|
||||||
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
|
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
APPL_TRACE_ERROR("can not clear indication/notif registration for unknown app");
|
APPL_TRACE_ERROR("can not clear indication/notif registration for unknown app");
|
||||||
}
|
}
|
||||||
|
@ -936,9 +938,10 @@ void bta_to_btif_uuid(bt_uuid_t *p_dest, tBT_UUID *p_src)
|
||||||
|
|
||||||
if (p_src->len == LEN_UUID_16 || p_src->len == LEN_UUID_32)
|
if (p_src->len == LEN_UUID_16 || p_src->len == LEN_UUID_32)
|
||||||
{
|
{
|
||||||
for(i=0; i != 16; ++i)
|
for(i=0; i != 16; ++i) {
|
||||||
p_dest->uu[i] = base_uuid[i];
|
p_dest->uu[i] = base_uuid[i];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (p_src->len)
|
switch (p_src->len)
|
||||||
{
|
{
|
||||||
|
|
|
@ -665,17 +665,18 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||||
&gatt_if, remote_bda, &transport)) {
|
&gatt_if, remote_bda, &transport)) {
|
||||||
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
p_rcb = bta_gatts_find_app_rcb_by_app_if(gatt_if);
|
||||||
|
|
||||||
if (p_msg->api_indicate.need_confirm)
|
if (p_msg->api_indicate.need_confirm) {
|
||||||
|
|
||||||
status = GATTS_HandleValueIndication (p_msg->api_indicate.hdr.layer_specific,
|
status = GATTS_HandleValueIndication (p_msg->api_indicate.hdr.layer_specific,
|
||||||
p_msg->api_indicate.attr_id,
|
p_msg->api_indicate.attr_id,
|
||||||
p_msg->api_indicate.len,
|
p_msg->api_indicate.len,
|
||||||
p_msg->api_indicate.value);
|
p_msg->api_indicate.value);
|
||||||
else
|
} else {
|
||||||
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
|
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
|
||||||
p_msg->api_indicate.attr_id,
|
p_msg->api_indicate.attr_id,
|
||||||
p_msg->api_indicate.len,
|
p_msg->api_indicate.len,
|
||||||
p_msg->api_indicate.value);
|
p_msg->api_indicate.value);
|
||||||
|
}
|
||||||
|
|
||||||
/* if over BR_EDR, inform PM for mode change */
|
/* if over BR_EDR, inform PM for mode change */
|
||||||
if (transport == BTA_TRANSPORT_BR_EDR) {
|
if (transport == BTA_TRANSPORT_BR_EDR) {
|
||||||
|
|
|
@ -101,9 +101,11 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
|
||||||
bta_hh_le_enable();
|
bta_hh_le_enable();
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* signal BTA call back event */
|
/* signal BTA call back event */
|
||||||
(* bta_hh_cb.p_cback)(BTA_HH_ENABLE_EVT, (tBTA_HH *)&status);
|
(* bta_hh_cb.p_cback)(BTA_HH_ENABLE_EVT, (tBTA_HH *)&status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function bta_hh_api_disable
|
** Function bta_hh_api_disable
|
||||||
|
@ -901,8 +903,10 @@ void bta_hh_get_dscp_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||||
bta_hh_le_get_dscp_act(p_cb);
|
bta_hh_le_get_dscp_act(p_cb);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
(*bta_hh_cb.p_cback)(BTA_HH_GET_DSCP_EVT, (tBTA_HH *)&p_cb->dscp_info);
|
(*bta_hh_cb.p_cback)(BTA_HH_GET_DSCP_EVT, (tBTA_HH *)&p_cb->dscp_info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -934,11 +938,10 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||||
dev_info.status = BTA_HH_OK;
|
dev_info.status = BTA_HH_OK;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, &dev_handle)\
|
if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, &dev_handle)\
|
||||||
== HID_SUCCESS) {
|
== HID_SUCCESS) {
|
||||||
dev_info.handle = dev_handle;
|
dev_info.handle = dev_handle;
|
||||||
dev_info.status = BTA_HH_OK;
|
|
||||||
|
|
||||||
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
|
||||||
/* update DI information */
|
/* update DI information */
|
||||||
|
@ -966,6 +969,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
|
||||||
/* update cb_index[] map */
|
/* update cb_index[] map */
|
||||||
bta_hh_cb.cb_index[dev_handle] = p_cb->index;
|
bta_hh_cb.cb_index[dev_handle] = p_cb->index;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else { /* device already been added */
|
} else { /* device already been added */
|
||||||
dev_info.handle = p_cb->hid_handle;
|
dev_info.handle = p_cb->hid_handle;
|
||||||
dev_info.status = BTA_HH_OK;
|
dev_info.status = BTA_HH_OK;
|
||||||
|
|
|
@ -2183,9 +2183,10 @@ void bta_hh_le_write_char_descr_cmpl(tBTA_HH_DEV_CB *p_dev_cb, tBTA_HH_DATA *p_b
|
||||||
case GATT_UUID_HID_BT_KB_INPUT:
|
case GATT_UUID_HID_BT_KB_INPUT:
|
||||||
case GATT_UUID_HID_BT_MOUSE_INPUT:
|
case GATT_UUID_HID_BT_MOUSE_INPUT:
|
||||||
case GATT_UUID_HID_REPORT:
|
case GATT_UUID_HID_REPORT:
|
||||||
if (p_data->status == BTA_GATT_OK)
|
if (p_data->status == BTA_GATT_OK) {
|
||||||
p_dev_cb->hid_srvc[hid_inst_id].report[p_dev_cb->clt_cfg_idx].client_cfg_value =
|
p_dev_cb->hid_srvc[hid_inst_id].report[p_dev_cb->clt_cfg_idx].client_cfg_value =
|
||||||
BTA_GATT_CLT_CONFIG_NOTIFICATION;
|
BTA_GATT_CLT_CONFIG_NOTIFICATION;
|
||||||
|
}
|
||||||
p_dev_cb->clt_cfg_idx ++;
|
p_dev_cb->clt_cfg_idx ++;
|
||||||
bta_hh_le_write_rpt_clt_cfg(p_dev_cb, hid_inst_id);
|
bta_hh_le_write_rpt_clt_cfg(p_dev_cb, hid_inst_id);
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,12 @@ UINT8 bta_hh_find_cb(BD_ADDR bda)
|
||||||
return xx;
|
return xx;
|
||||||
}
|
}
|
||||||
#if BTA_HH_DEBUG
|
#if BTA_HH_DEBUG
|
||||||
else
|
else {
|
||||||
APPL_TRACE_DEBUG("in_use ? [%d] kdev[%d].hid_handle = %d state = [%d]",
|
APPL_TRACE_DEBUG("in_use ? [%d] kdev[%d].hid_handle = %d state = [%d]",
|
||||||
bta_hh_cb.kdev[xx].in_use, xx,
|
bta_hh_cb.kdev[xx].in_use, xx,
|
||||||
bta_hh_cb.kdev[xx].hid_handle,
|
bta_hh_cb.kdev[xx].hid_handle,
|
||||||
bta_hh_cb.kdev[xx].state);
|
bta_hh_cb.kdev[xx].state);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +124,10 @@ void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB *p_cb)
|
||||||
bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = BTA_HH_IDX_INVALID;
|
bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = BTA_HH_IDX_INVALID;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
bta_hh_cb.cb_index[p_cb->hid_handle] = BTA_HH_IDX_INVALID;
|
bta_hh_cb.cb_index[p_cb->hid_handle] = BTA_HH_IDX_INVALID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* reset device control block */
|
/* reset device control block */
|
||||||
index = p_cb->index; /* Preserve index for this control block */
|
index = p_cb->index; /* Preserve index for this control block */
|
||||||
|
@ -486,11 +489,12 @@ UINT8 bta_hh_dev_handle_to_cb_idx(UINT8 dev_handle)
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* regular HID device checking */
|
/* regular HID device checking */
|
||||||
if (dev_handle < BTA_HH_MAX_KNOWN ) {
|
if (dev_handle < BTA_HH_MAX_KNOWN ) {
|
||||||
index = bta_hh_cb.cb_index[dev_handle];
|
index = bta_hh_cb.cb_index[dev_handle];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return index;
|
return index;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -747,9 +747,10 @@ void bta_jv_get_channel_id(tBTA_JV_MSG *p_data)
|
||||||
bta_jv_cb.scn[channel - 1] = TRUE;
|
bta_jv_cb.scn[channel - 1] = TRUE;
|
||||||
scn = (UINT8) channel;
|
scn = (UINT8) channel;
|
||||||
}
|
}
|
||||||
if (bta_jv_cb.p_dm_cback)
|
if (bta_jv_cb.p_dm_cback) {
|
||||||
bta_jv_cb.p_dm_cback(BTA_JV_GET_SCN_EVT, (tBTA_JV *)&scn,
|
bta_jv_cb.p_dm_cback(BTA_JV_GET_SCN_EVT, (tBTA_JV *)&scn,
|
||||||
p_data->alloc_channel.user_data);
|
p_data->alloc_channel.user_data);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case BTA_JV_CONN_TYPE_L2CAP:
|
case BTA_JV_CONN_TYPE_L2CAP:
|
||||||
|
|
|
@ -195,8 +195,9 @@ bt_status_t btc_hf_client_init(void)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static bt_status_t connect_int( bt_bdaddr_t *bd_addr, uint16_t uuid )
|
static bt_status_t connect_int( bt_bdaddr_t *bd_addr, uint16_t uuid )
|
||||||
{
|
{
|
||||||
if (is_connected(bd_addr))
|
if (is_connected(bd_addr)) {
|
||||||
return BT_STATUS_BUSY;
|
return BT_STATUS_BUSY;
|
||||||
|
}
|
||||||
|
|
||||||
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING;
|
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING;
|
||||||
bdcpy(btc_hf_client_cb.connected_bda.address, bd_addr->address);
|
bdcpy(btc_hf_client_cb.connected_bda.address, bd_addr->address);
|
||||||
|
@ -803,11 +804,13 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
|
||||||
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, ¶m);
|
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, ¶m);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED)
|
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED) {
|
||||||
bdsetany(btc_hf_client_cb.connected_bda.address);
|
bdsetany(btc_hf_client_cb.connected_bda.address);
|
||||||
|
}
|
||||||
|
|
||||||
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS)
|
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS) {
|
||||||
btc_queue_advance();
|
btc_queue_advance();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -145,9 +145,10 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
|
||||||
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
|
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
|
||||||
if (*(ps16GenBufPtr) < s32BitSlice + 2) {
|
if (*(ps16GenBufPtr) < s32BitSlice + 2) {
|
||||||
*(ps16GenArrPtr) = 0;
|
*(ps16GenArrPtr) = 0;
|
||||||
} else
|
} else {
|
||||||
*(ps16GenArrPtr) = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
|
*(ps16GenArrPtr) = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
|
||||||
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
|
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
|
||||||
|
}
|
||||||
|
|
||||||
ps16GenBufPtr++;
|
ps16GenBufPtr++;
|
||||||
ps16GenArrPtr++;
|
ps16GenArrPtr++;
|
||||||
|
|
|
@ -132,9 +132,10 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
|
||||||
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
|
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
|
||||||
if (*ps16GenBufPtr < s32BitSlice + 2) {
|
if (*ps16GenBufPtr < s32BitSlice + 2) {
|
||||||
*ps16GenArrPtr = 0;
|
*ps16GenArrPtr = 0;
|
||||||
} else
|
} else {
|
||||||
*ps16GenArrPtr = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
|
*ps16GenArrPtr = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
|
||||||
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
|
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
|
||||||
|
}
|
||||||
ps16GenBufPtr++;
|
ps16GenBufPtr++;
|
||||||
ps16GenArrPtr++;
|
ps16GenArrPtr++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,10 @@ bool list_contains(const list_t *list, const void *data)
|
||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
|
|
||||||
for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) {
|
for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) {
|
||||||
if (list_node(node) == data)
|
if (list_node(node) == data) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -201,8 +202,9 @@ list_node_t *list_foreach(const list_t *list, list_iter_cb callback, void *conte
|
||||||
|
|
||||||
for (list_node_t *node = list->head; node; ) {
|
for (list_node_t *node = list->head; node; ) {
|
||||||
list_node_t *next = node->next;
|
list_node_t *next = node->next;
|
||||||
if (!callback(node->data, context))
|
if (!callback(node->data, context)) {
|
||||||
return node;
|
return node;
|
||||||
|
}
|
||||||
node = next;
|
node = next;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -605,8 +605,9 @@ void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
|
||||||
{
|
{
|
||||||
UNUSED(p_lcb);
|
UNUSED(p_lcb);
|
||||||
|
|
||||||
if (p_data == NULL)
|
if (p_data == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
osi_free(p_data->p_buf);
|
osi_free(p_data->p_buf);
|
||||||
p_data->p_buf = NULL;
|
p_data->p_buf = NULL;
|
||||||
|
|
|
@ -629,6 +629,7 @@ void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||||
avdt_scb_hdl_pkt_frag(p_scb, p_data);
|
avdt_scb_hdl_pkt_frag(p_scb, p_data);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
#if AVDT_REPORTING == TRUE
|
#if AVDT_REPORTING == TRUE
|
||||||
if (p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT) {
|
if (p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT) {
|
||||||
p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
|
p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
|
||||||
|
@ -637,8 +638,11 @@ void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||||
p_data->p_pkt = NULL;
|
p_data->p_pkt = NULL;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
avdt_scb_hdl_pkt_no_frag(p_scb, p_data);
|
avdt_scb_hdl_pkt_no_frag(p_scb, p_data);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -1305,7 +1309,9 @@ void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
|
||||||
#if AVDT_MULTIPLEXING == TRUE
|
#if AVDT_MULTIPLEXING == TRUE
|
||||||
if (fixed_queue_is_empty(p_scb->frag_q))
|
if (fixed_queue_is_empty(p_scb->frag_q))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
avdt_scb_hdl_write_req_no_frag(p_scb, p_data);
|
avdt_scb_hdl_write_req_no_frag(p_scb, p_data);
|
||||||
|
}
|
||||||
#if AVDT_MULTIPLEXING == TRUE
|
#if AVDT_MULTIPLEXING == TRUE
|
||||||
else {
|
else {
|
||||||
avdt_scb_hdl_write_req_frag(p_scb, p_data);
|
avdt_scb_hdl_write_req_frag(p_scb, p_data);
|
||||||
|
|
|
@ -261,9 +261,10 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
|
||||||
#if BLE_INCLUDED == TRUE
|
#if BLE_INCLUDED == TRUE
|
||||||
p->transport = transport;
|
p->transport = transport;
|
||||||
#if BLE_PRIVACY_SPT == TRUE
|
#if BLE_PRIVACY_SPT == TRUE
|
||||||
if (transport == BT_TRANSPORT_LE)
|
if (transport == BT_TRANSPORT_LE) {
|
||||||
btm_ble_refresh_local_resolvable_private_addr(bda,
|
btm_ble_refresh_local_resolvable_private_addr(bda,
|
||||||
btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr);
|
btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
p->conn_addr_type = BLE_ADDR_PUBLIC;
|
p->conn_addr_type = BLE_ADDR_PUBLIC;
|
||||||
memcpy(p->conn_addr, &controller_get_interface()->get_address()->address, BD_ADDR_LEN);
|
memcpy(p->conn_addr, &controller_get_interface()->get_address()->address, BD_ADDR_LEN);
|
||||||
|
@ -2495,15 +2496,17 @@ void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 and 3 MPS support? */
|
/* 2 and 3 MPS support? */
|
||||||
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0]))
|
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])) {
|
||||||
/* Not supported. Add 'not_supported' mask for all 2MPS packet types */
|
/* Not supported. Add 'not_supported' mask for all 2MPS packet types */
|
||||||
*p_pkt_type |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH1 + BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 +
|
*p_pkt_type |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH1 + BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_NO_2_DH5);
|
BTM_ACL_PKT_TYPES_MASK_NO_2_DH5);
|
||||||
|
}
|
||||||
|
|
||||||
if (!HCI_EDR_ACL_3MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0]))
|
if (!HCI_EDR_ACL_3MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])) {
|
||||||
/* Not supported. Add 'not_supported' mask for all 3MPS packet types */
|
/* Not supported. Add 'not_supported' mask for all 3MPS packet types */
|
||||||
*p_pkt_type |= (BTM_ACL_PKT_TYPES_MASK_NO_3_DH1 + BTM_ACL_PKT_TYPES_MASK_NO_3_DH3 +
|
*p_pkt_type |= (BTM_ACL_PKT_TYPES_MASK_NO_3_DH1 + BTM_ACL_PKT_TYPES_MASK_NO_3_DH3 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5);
|
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5);
|
||||||
|
}
|
||||||
|
|
||||||
/* EDR 3 and 5 slot support? */
|
/* EDR 3 and 5 slot support? */
|
||||||
if (HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])
|
if (HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])
|
||||||
|
|
|
@ -887,9 +887,10 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
||||||
return BTM_SEC_OK;
|
return BTM_SEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (security_required & BTM_SEC_OUT_MITM)
|
if (security_required & BTM_SEC_OUT_MITM) {
|
||||||
auth_req |= BTM_LE_AUTH_REQ_MITM;
|
auth_req |= BTM_LE_AUTH_REQ_MITM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((security_required & BTM_SEC_IN_FLAGS) == 0&& (security_required & BTM_SEC_IN_MITM) == 0)
|
if ((security_required & BTM_SEC_IN_FLAGS) == 0&& (security_required & BTM_SEC_IN_MITM) == 0)
|
||||||
|
@ -898,20 +899,23 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
||||||
return BTM_SEC_OK;
|
return BTM_SEC_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (security_required & BTM_SEC_IN_MITM)
|
if (security_required & BTM_SEC_IN_MITM) {
|
||||||
auth_req |= BTM_LE_AUTH_REQ_MITM;
|
auth_req |= BTM_LE_AUTH_REQ_MITM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tBTM_BLE_SEC_REQ_ACT ble_sec_act = BTM_BLE_SEC_REQ_ACT_NONE;
|
tBTM_BLE_SEC_REQ_ACT ble_sec_act = BTM_BLE_SEC_REQ_ACT_NONE;
|
||||||
btm_ble_link_sec_check(bdaddr, auth_req, &ble_sec_act);
|
btm_ble_link_sec_check(bdaddr, auth_req, &ble_sec_act);
|
||||||
|
|
||||||
BTM_TRACE_DEBUG ("%s ble_sec_act %d", __func__ , ble_sec_act);
|
BTM_TRACE_DEBUG ("%s ble_sec_act %d", __func__ , ble_sec_act);
|
||||||
|
|
||||||
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_DISCARD)
|
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_DISCARD) {
|
||||||
return BTM_SEC_ENC_PENDING;
|
return BTM_SEC_ENC_PENDING;
|
||||||
|
}
|
||||||
|
|
||||||
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE)
|
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE) {
|
||||||
return BTM_SEC_OK;
|
return BTM_SEC_OK;
|
||||||
|
}
|
||||||
|
|
||||||
UINT8 sec_flag = 0;
|
UINT8 sec_flag = 0;
|
||||||
BTM_GetSecurityFlagsByTransport(bdaddr, &sec_flag, BT_TRANSPORT_LE);
|
BTM_GetSecurityFlagsByTransport(bdaddr, &sec_flag, BT_TRANSPORT_LE);
|
||||||
|
@ -920,12 +924,14 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
||||||
BOOLEAN is_key_mitm = FALSE;
|
BOOLEAN is_key_mitm = FALSE;
|
||||||
if (sec_flag & (BTM_SEC_FLAG_ENCRYPTED| BTM_SEC_FLAG_LKEY_KNOWN))
|
if (sec_flag & (BTM_SEC_FLAG_ENCRYPTED| BTM_SEC_FLAG_LKEY_KNOWN))
|
||||||
{
|
{
|
||||||
if (sec_flag & BTM_SEC_FLAG_ENCRYPTED)
|
if (sec_flag & BTM_SEC_FLAG_ENCRYPTED) {
|
||||||
is_link_encrypted = TRUE;
|
is_link_encrypted = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
|
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED) {
|
||||||
is_key_mitm = TRUE;
|
is_key_mitm = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (auth_req & BTM_LE_AUTH_REQ_MITM)
|
if (auth_req & BTM_LE_AUTH_REQ_MITM)
|
||||||
{
|
{
|
||||||
|
@ -933,17 +939,19 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
|
||||||
{
|
{
|
||||||
return BTM_SEC_ENCRYPT_MITM;
|
return BTM_SEC_ENCRYPT_MITM;
|
||||||
} else {
|
} else {
|
||||||
if (is_link_encrypted)
|
if (is_link_encrypted) {
|
||||||
return BTM_SEC_OK;
|
return BTM_SEC_OK;
|
||||||
else
|
} else {
|
||||||
return BTM_SEC_ENCRYPT;
|
return BTM_SEC_ENCRYPT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_link_encrypted)
|
if (is_link_encrypted) {
|
||||||
return BTM_SEC_OK;
|
return BTM_SEC_OK;
|
||||||
else
|
} else {
|
||||||
return BTM_SEC_ENCRYPT_NO_MITM;
|
return BTM_SEC_ENCRYPT_NO_MITM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return BTM_SEC_OK;
|
return BTM_SEC_OK;
|
||||||
}
|
}
|
||||||
|
@ -1012,8 +1020,9 @@ BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originat
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ble_sec_act == BTM_BLE_SEC_NONE)
|
if (ble_sec_act == BTM_BLE_SEC_NONE) {
|
||||||
return status;
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_LE);
|
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_LE);
|
||||||
p_lcb->sec_act = sec_act;
|
p_lcb->sec_act = sec_act;
|
||||||
|
|
|
@ -312,10 +312,11 @@ void btm_ble_scan_pf_cmpl_cback(tBTM_VSC_CMPL *p_params)
|
||||||
if (HCI_SUCCESS == status) {
|
if (HCI_SUCCESS == status) {
|
||||||
if (memcmp(&btm_ble_adv_filt_cb.cur_filter_target.bda, &na_bda, BD_ADDR_LEN) == 0) {
|
if (memcmp(&btm_ble_adv_filt_cb.cur_filter_target.bda, &na_bda, BD_ADDR_LEN) == 0) {
|
||||||
btm_ble_cs_update_pf_counter(action, cond_type, NULL, num_avail);
|
btm_ble_cs_update_pf_counter(action, cond_type, NULL, num_avail);
|
||||||
} else
|
} else {
|
||||||
btm_ble_cs_update_pf_counter(action, cond_type,
|
btm_ble_cs_update_pf_counter(action, cond_type,
|
||||||
&btm_ble_adv_filt_cb.cur_filter_target, num_avail);
|
&btm_ble_adv_filt_cb.cur_filter_target, num_avail);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* send ADV PF operation complete */
|
/* send ADV PF operation complete */
|
||||||
btm_ble_adv_filt_cb.op_type = 0;
|
btm_ble_adv_filt_cb.op_type = 0;
|
||||||
|
@ -855,9 +856,10 @@ tBTM_STATUS btm_ble_update_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
|
||||||
len,
|
len,
|
||||||
param,
|
param,
|
||||||
btm_ble_scan_pf_cmpl_cback)) != BTM_NO_RESOURCES) {
|
btm_ble_scan_pf_cmpl_cback)) != BTM_NO_RESOURCES) {
|
||||||
if (p_uuid_cond && p_uuid_cond->p_target_addr)
|
if (p_uuid_cond && p_uuid_cond->p_target_addr) {
|
||||||
memcpy(&btm_ble_adv_filt_cb.cur_filter_target, p_uuid_cond->p_target_addr,
|
memcpy(&btm_ble_adv_filt_cb.cur_filter_target, p_uuid_cond->p_target_addr,
|
||||||
sizeof(tBLE_BD_ADDR));
|
sizeof(tBLE_BD_ADDR));
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
|
memset(&btm_ble_adv_filt_cb.cur_filter_target, 0, sizeof(tBLE_BD_ADDR));
|
||||||
}
|
}
|
||||||
|
@ -914,15 +916,17 @@ tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
|
||||||
/* clear manufactuer data filter */
|
/* clear manufactuer data filter */
|
||||||
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
||||||
BTM_BLE_PF_MANU_DATA, cb_evt, ref_value);
|
BTM_BLE_PF_MANU_DATA, cb_evt, ref_value);
|
||||||
if (BTM_CMD_STARTED == st)
|
if (BTM_CMD_STARTED == st) {
|
||||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_MANU_DATA, cb_evt,
|
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_MANU_DATA, cb_evt,
|
||||||
ref_value, NULL, NULL);
|
ref_value, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* clear local name filter */
|
/* clear local name filter */
|
||||||
st = btm_ble_update_pf_local_name(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
|
st = btm_ble_update_pf_local_name(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
|
||||||
if (BTM_CMD_STARTED == st)
|
if (BTM_CMD_STARTED == st) {
|
||||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_LOCAL_NAME, cb_evt,
|
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_LOCAL_NAME, cb_evt,
|
||||||
ref_value, NULL, NULL);
|
ref_value, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* update the counter for service data */
|
/* update the counter for service data */
|
||||||
st = btm_ble_update_srvc_data_change(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
|
st = btm_ble_update_srvc_data_change(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
|
||||||
|
@ -936,17 +940,19 @@ tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
|
||||||
|
|
||||||
st = btm_ble_update_uuid_filter(BTM_BLE_SCAN_COND_CLEAR, filt_index,
|
st = btm_ble_update_uuid_filter(BTM_BLE_SCAN_COND_CLEAR, filt_index,
|
||||||
BTM_BLE_PF_SRVC_SOL_UUID, NULL, cb_evt, ref_value);
|
BTM_BLE_PF_SRVC_SOL_UUID, NULL, cb_evt, ref_value);
|
||||||
if (BTM_CMD_STARTED == st)
|
if (BTM_CMD_STARTED == st) {
|
||||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_SOL_UUID, cb_evt,
|
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_SOL_UUID, cb_evt,
|
||||||
ref_value, NULL, NULL);
|
ref_value, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* clear service data filter */
|
/* clear service data filter */
|
||||||
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
||||||
BTM_BLE_PF_SRVC_DATA_PATTERN, cb_evt, ref_value);
|
BTM_BLE_PF_SRVC_DATA_PATTERN, cb_evt, ref_value);
|
||||||
if (BTM_CMD_STARTED == st)
|
if (BTM_CMD_STARTED == st) {
|
||||||
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_SRVC_DATA, cb_evt,
|
btm_ble_advfilt_enq_op_q(action, BTM_BLE_META_PF_SRVC_DATA, cb_evt,
|
||||||
ref_value, NULL, NULL);
|
ref_value, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* select feature based on control block settings */
|
/* select feature based on control block settings */
|
||||||
UINT8_TO_STREAM(p, BTM_BLE_META_PF_FEAT_SEL);
|
UINT8_TO_STREAM(p, BTM_BLE_META_PF_FEAT_SEL);
|
||||||
|
@ -1053,9 +1059,10 @@ tBTM_STATUS BTM_BleAdvFilterParamSetup(int action, tBTM_BLE_PF_FILT_INDEX filt_i
|
||||||
|
|
||||||
if (cmn_ble_vsc_cb.version_supported == BTM_VSC_CHIP_CAPABILITY_L_VERSION) {
|
if (cmn_ble_vsc_cb.version_supported == BTM_VSC_CHIP_CAPABILITY_L_VERSION) {
|
||||||
len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN;
|
len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN;
|
||||||
} else
|
} else {
|
||||||
len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN +
|
len = BTM_BLE_ADV_FILT_META_HDR_LENGTH + BTM_BLE_ADV_FILT_FEAT_SELN_LEN +
|
||||||
BTM_BLE_ADV_FILT_TRACK_NUM;
|
BTM_BLE_ADV_FILT_TRACK_NUM;
|
||||||
|
}
|
||||||
|
|
||||||
if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
|
if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
|
||||||
(UINT8)len,
|
(UINT8)len,
|
||||||
|
|
|
@ -427,9 +427,10 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
|
||||||
if (0 == num_records) {
|
if (0 == num_records) {
|
||||||
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
|
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
|
||||||
&p_data, &data_len);
|
&p_data, &data_len);
|
||||||
if (NULL != ble_batchscan_cb.p_scan_rep_cback)
|
if (NULL != ble_batchscan_cb.p_scan_rep_cback) {
|
||||||
ble_batchscan_cb.p_scan_rep_cback(ref_value, report_format, num_records,
|
ble_batchscan_cb.p_scan_rep_cback(ref_value, report_format, num_records,
|
||||||
data_len, p_data, status);
|
data_len, p_data, status);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((len - 4) > 0) {
|
if ((len - 4) > 0) {
|
||||||
btm_ble_batchscan_enq_rep_data(report_format, num_records, p, len - 4);
|
btm_ble_batchscan_enq_rep_data(report_format, num_records, p, len - 4);
|
||||||
|
@ -439,13 +440,14 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
|
||||||
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
|
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
|
||||||
&p_data, &data_len);
|
&p_data, &data_len);
|
||||||
/* Send whatever is available, in case of a command failure */
|
/* Send whatever is available, in case of a command failure */
|
||||||
if (NULL != ble_batchscan_cb.p_scan_rep_cback && NULL != p_data)
|
if (NULL != ble_batchscan_cb.p_scan_rep_cback && NULL != p_data) {
|
||||||
ble_batchscan_cb.p_scan_rep_cback(ref_value, report_format,
|
ble_batchscan_cb.p_scan_rep_cback(ref_value, report_format,
|
||||||
num_records, data_len, p_data, status);
|
num_records, data_len, p_data, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,10 @@ void btm_ble_cont_energy_cmpl_cback (tBTM_VSC_CMPL *p_params)
|
||||||
BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%u, rx_t=%u, ener_used=%u, idle_t=%u",
|
BTM_TRACE_DEBUG("energy_info status=%d,tx_t=%u, rx_t=%u, ener_used=%u, idle_t=%u",
|
||||||
status, total_tx_time, total_rx_time, total_energy_used, total_idle_time);
|
status, total_tx_time, total_rx_time, total_energy_used, total_idle_time);
|
||||||
|
|
||||||
if (NULL != ble_energy_info_cb.p_ener_cback)
|
if (NULL != ble_energy_info_cb.p_ener_cback) {
|
||||||
ble_energy_info_cb.p_ener_cback(total_tx_time, total_rx_time, total_idle_time,
|
ble_energy_info_cb.p_ener_cback(total_tx_time, total_rx_time, total_idle_time,
|
||||||
total_energy_used, status);
|
total_energy_used, status);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,9 +280,10 @@ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy)
|
||||||
/* if adv active, stop and restart */
|
/* if adv active, stop and restart */
|
||||||
btm_ble_stop_adv ();
|
btm_ble_stop_adv ();
|
||||||
|
|
||||||
if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE)
|
if (p_cb->connectable_mode & BTM_BLE_CONNECTABLE) {
|
||||||
p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
|
p_cb->evt_type = btm_set_conn_mode_adv_init_addr(p_cb, p_addr_ptr, &init_addr_type,
|
||||||
&p_cb->adv_addr_type);
|
&p_cb->adv_addr_type);
|
||||||
|
}
|
||||||
|
|
||||||
btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
|
btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
|
||||||
BTM_BLE_GAP_ADV_SLOW_INT),
|
BTM_BLE_GAP_ADV_SLOW_INT),
|
||||||
|
@ -1370,7 +1371,6 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
|
||||||
p_dir_bda->bda,
|
p_dir_bda->bda,
|
||||||
chnl_map,
|
chnl_map,
|
||||||
p_cb->afp);
|
p_cb->afp);
|
||||||
|
|
||||||
return btm_ble_start_adv();
|
return btm_ble_start_adv();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1774,8 +1774,9 @@ tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
|
tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
|
||||||
{
|
{
|
||||||
if (rand_addr == NULL)
|
if (rand_addr == NULL) {
|
||||||
return BTM_SET_STATIC_RAND_ADDR_FAIL;
|
return BTM_SET_STATIC_RAND_ADDR_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_STOP_SCAN || btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_STOP_ADV || btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_IDLE)) {
|
if (!(btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_STOP_SCAN || btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_STOP_ADV || btm_cb.ble_ctr_cb.inq_var.state == BTM_BLE_IDLE)) {
|
||||||
BTM_TRACE_ERROR("Advertising or scaning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
BTM_TRACE_ERROR("Advertising or scaning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
||||||
|
|
|
@ -521,9 +521,10 @@ tBTM_STATUS btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC *p_dev_rec)
|
||||||
btm_ble_resolving_list_vsc_op_cmpl);
|
btm_ble_resolving_list_vsc_op_cmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st == BTM_CMD_STARTED)
|
if (st == BTM_CMD_STARTED) {
|
||||||
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
|
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
|
||||||
BTM_BLE_META_READ_IRK_ENTRY);
|
BTM_BLE_META_READ_IRK_ENTRY);
|
||||||
|
}
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
@ -799,9 +800,10 @@ BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rt)
|
if (rt) {
|
||||||
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
|
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
|
||||||
BTM_BLE_META_ADD_IRK_ENTRY);
|
BTM_BLE_META_ADD_IRK_ENTRY);
|
||||||
|
}
|
||||||
|
|
||||||
/* if resolving list has been turned on, re-enable it */
|
/* if resolving list has been turned on, re-enable it */
|
||||||
if (rl_mask) {
|
if (rl_mask) {
|
||||||
|
|
|
@ -207,8 +207,9 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr, tBT_TRANSPORT transport)
|
||||||
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr)
|
extern void BTM_SecClearSecurityFlags (BD_ADDR bd_addr)
|
||||||
{
|
{
|
||||||
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
|
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev(bd_addr);
|
||||||
if (p_dev_rec == NULL)
|
if (p_dev_rec == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
p_dev_rec->sec_flags = 0;
|
p_dev_rec->sec_flags = 0;
|
||||||
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
|
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
|
||||||
|
|
|
@ -273,13 +273,15 @@ static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_feat
|
||||||
btm_cb.btm_acl_pkt_types_supported = (BTM_ACL_PKT_TYPES_MASK_DH1 +
|
btm_cb.btm_acl_pkt_types_supported = (BTM_ACL_PKT_TYPES_MASK_DH1 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_DM1);
|
BTM_ACL_PKT_TYPES_MASK_DM1);
|
||||||
|
|
||||||
if (HCI_3_SLOT_PACKETS_SUPPORTED(p_features))
|
if (HCI_3_SLOT_PACKETS_SUPPORTED(p_features)) {
|
||||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH3 +
|
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH3 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_DM3);
|
BTM_ACL_PKT_TYPES_MASK_DM3);
|
||||||
|
}
|
||||||
|
|
||||||
if (HCI_5_SLOT_PACKETS_SUPPORTED(p_features))
|
if (HCI_5_SLOT_PACKETS_SUPPORTED(p_features)) {
|
||||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH5 +
|
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH5 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_DM5);
|
BTM_ACL_PKT_TYPES_MASK_DM5);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add in EDR related ACL types */
|
/* Add in EDR related ACL types */
|
||||||
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p_features)) {
|
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p_features)) {
|
||||||
|
@ -297,14 +299,16 @@ static void btm_decode_ext_features_page (UINT8 page_number, const UINT8 *p_feat
|
||||||
/* Check to see if 3 and 5 slot packets are available */
|
/* Check to see if 3 and 5 slot packets are available */
|
||||||
if (HCI_EDR_ACL_2MPS_SUPPORTED(p_features) ||
|
if (HCI_EDR_ACL_2MPS_SUPPORTED(p_features) ||
|
||||||
HCI_EDR_ACL_3MPS_SUPPORTED(p_features)) {
|
HCI_EDR_ACL_3MPS_SUPPORTED(p_features)) {
|
||||||
if (!HCI_3_SLOT_EDR_ACL_SUPPORTED(p_features))
|
if (!HCI_3_SLOT_EDR_ACL_SUPPORTED(p_features)) {
|
||||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 +
|
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH3 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_NO_3_DH3);
|
BTM_ACL_PKT_TYPES_MASK_NO_3_DH3);
|
||||||
|
}
|
||||||
|
|
||||||
if (!HCI_5_SLOT_EDR_ACL_SUPPORTED(p_features))
|
if (!HCI_5_SLOT_EDR_ACL_SUPPORTED(p_features)) {
|
||||||
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH5 +
|
btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_NO_2_DH5 +
|
||||||
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5);
|
BTM_ACL_PKT_TYPES_MASK_NO_3_DH5);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BTM_TRACE_DEBUG("Local supported ACL packet types: 0x%04x",
|
BTM_TRACE_DEBUG("Local supported ACL packet types: 0x%04x",
|
||||||
btm_cb.btm_acl_pkt_types_supported);
|
btm_cb.btm_acl_pkt_types_supported);
|
||||||
|
|
|
@ -1042,10 +1042,11 @@ tBTM_STATUS BTM_ReadRemoteDeviceName (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb
|
||||||
return btm_ble_read_remote_name(remote_bda, p_cur, p_cb);
|
return btm_ble_read_remote_name(remote_bda, p_cur, p_cb);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
return (btm_initiate_rem_name (remote_bda, p_cur, BTM_RMT_NAME_EXT,
|
return (btm_initiate_rem_name (remote_bda, p_cur, BTM_RMT_NAME_EXT,
|
||||||
BTM_EXT_RMT_NAME_TIMEOUT, p_cb));
|
BTM_EXT_RMT_NAME_TIMEOUT, p_cb));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
|
@ -1080,11 +1081,13 @@ tBTM_STATUS BTM_CancelRemoteDeviceName (void)
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
if (btsnd_hcic_rmt_name_req_cancel (p_inq->remname_bda)) {
|
if (btsnd_hcic_rmt_name_req_cancel (p_inq->remname_bda)) {
|
||||||
return (BTM_CMD_STARTED);
|
return (BTM_CMD_STARTED);
|
||||||
} else {
|
} else {
|
||||||
return (BTM_NO_RESOURCES);
|
return (BTM_NO_RESOURCES);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return (BTM_WRONG_MODE);
|
return (BTM_WRONG_MODE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -887,7 +887,9 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
|
||||||
#ifdef APPL_AUTH_WRITE_EXCEPTION
|
#ifdef APPL_AUTH_WRITE_EXCEPTION
|
||||||
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
|
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
btsnd_hcic_write_auth_enable (TRUE);
|
btsnd_hcic_write_auth_enable (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
btm_cb.acl_disc_reason = 0xff ;
|
btm_cb.acl_disc_reason = 0xff ;
|
||||||
|
|
||||||
|
@ -907,10 +909,11 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
|
||||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||||
p_dev_rec->sec_flags &= ~BTM_SEC_LINK_KEY_AUTHED;
|
p_dev_rec->sec_flags &= ~BTM_SEC_LINK_KEY_AUTHED;
|
||||||
|
|
||||||
if (btm_cb.api.p_auth_complete_callback)
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_ERR_AUTH_FAILURE);
|
p_dev_rec->sec_bd_name, HCI_ERR_AUTH_FAILURE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1396,7 +1399,9 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
rc = btm_sec_execute_procedure (p_dev_rec);
|
rc = btm_sec_execute_procedure (p_dev_rec);
|
||||||
|
}
|
||||||
|
|
||||||
if (rc != BTM_CMD_STARTED && rc != BTM_BUSY) {
|
if (rc != BTM_CMD_STARTED && rc != BTM_BUSY) {
|
||||||
if (p_callback) {
|
if (p_callback) {
|
||||||
|
@ -2163,9 +2168,10 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
|
||||||
"rmt_support_for_sc : %d -> fail pairing\n", __FUNCTION__,
|
"rmt_support_for_sc : %d -> fail pairing\n", __FUNCTION__,
|
||||||
local_supports_sc,
|
local_supports_sc,
|
||||||
p_dev_rec->remote_supports_secure_connections);
|
p_dev_rec->remote_supports_secure_connections);
|
||||||
if (p_callback)
|
if (p_callback) {
|
||||||
(*p_callback) (bd_addr, transport, (void *)p_ref_data,
|
(*p_callback) (bd_addr, transport, (void *)p_ref_data,
|
||||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||||
}
|
}
|
||||||
|
@ -2525,9 +2531,10 @@ tBTM_STATUS btm_sec_mx_access_request (BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_o
|
||||||
"remote_support_for_sc %d: fail pairing\n", __FUNCTION__,
|
"remote_support_for_sc %d: fail pairing\n", __FUNCTION__,
|
||||||
local_supports_sc, p_dev_rec->remote_supports_secure_connections);
|
local_supports_sc, p_dev_rec->remote_supports_secure_connections);
|
||||||
|
|
||||||
if (p_callback)
|
if (p_callback) {
|
||||||
(*p_callback) (bd_addr, transport, (void *)p_ref_data,
|
(*p_callback) (bd_addr, transport, (void *)p_ref_data,
|
||||||
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
|
||||||
}
|
}
|
||||||
|
@ -3013,10 +3020,11 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
||||||
|
|
||||||
/* Notify all clients waiting for name to be resolved */
|
/* Notify all clients waiting for name to be resolved */
|
||||||
for (i = 0; i < BTM_SEC_MAX_RMT_NAME_CALLBACKS; i++) {
|
for (i = 0; i < BTM_SEC_MAX_RMT_NAME_CALLBACKS; i++) {
|
||||||
if (btm_cb.p_rmt_name_callback[i] && p_bd_addr)
|
if (btm_cb.p_rmt_name_callback[i] && p_bd_addr) {
|
||||||
(*btm_cb.p_rmt_name_callback[i])(p_bd_addr, p_dev_rec->dev_class,
|
(*btm_cb.p_rmt_name_callback[i])(p_bd_addr, p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name);
|
p_dev_rec->sec_bd_name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dev_class[0] = 0;
|
dev_class[0] = 0;
|
||||||
dev_class[1] = 0;
|
dev_class[1] = 0;
|
||||||
|
@ -3100,11 +3108,12 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
||||||
|
|
||||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||||
|
|
||||||
if (btm_cb.api.p_auth_complete_callback)
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
|
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
BTM_TRACE_WARNING ("btm_sec_rmt_name_request_complete: wrong BDA, retry with pairing BDA\n");
|
BTM_TRACE_WARNING ("btm_sec_rmt_name_request_complete: wrong BDA, retry with pairing BDA\n");
|
||||||
|
@ -3128,10 +3137,11 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
|
||||||
/* that some authentication has been completed */
|
/* that some authentication has been completed */
|
||||||
/* This is required when different entities receive link notification and auth complete */
|
/* This is required when different entities receive link notification and auth complete */
|
||||||
if (!(p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)) {
|
if (!(p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)) {
|
||||||
if (btm_cb.api.p_auth_complete_callback)
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||||
p_dev_rec->dev_class,
|
p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3907,11 +3917,12 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
|
||||||
/* User probably Disabled the keyboard while it was asleap. Let her try */
|
/* User probably Disabled the keyboard while it was asleap. Let her try */
|
||||||
if (btm_cb.api.p_auth_complete_callback) {
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
/* report the suthentication status */
|
/* report the suthentication status */
|
||||||
if (old_state != BTM_PAIR_STATE_IDLE)
|
if (old_state != BTM_PAIR_STATE_IDLE) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||||
p_dev_rec->dev_class,
|
p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, status);
|
p_dev_rec->sec_bd_name, status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
|
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
|
||||||
|
|
||||||
|
@ -4181,11 +4192,12 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
|
||||||
|
|
||||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||||
|
|
||||||
if (btm_cb.api.p_auth_complete_callback)
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
|
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif ///SMP_INCLUDED == TRUE
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -4408,10 +4420,11 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btm_cb.api.p_auth_complete_callback)
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||||
p_dev_rec->dev_class,
|
p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
|
||||||
|
|
||||||
|
@ -4717,10 +4730,11 @@ void btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_t
|
||||||
if (!(p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)
|
if (!(p_dev_rec->security_required & BTM_SEC_OUT_AUTHENTICATE)
|
||||||
/* for derived key, always send authentication callback for BR channel */
|
/* for derived key, always send authentication callback for BR channel */
|
||||||
|| ltk_derived_lk) {
|
|| ltk_derived_lk) {
|
||||||
if (btm_cb.api.p_auth_complete_callback)
|
if (btm_cb.api.p_auth_complete_callback) {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
p_dev_rec->sec_bd_name, HCI_SUCCESS);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* We will save link key only if the user authorized it - BTE report link key in all cases */
|
/* We will save link key only if the user authorized it - BTE report link key in all cases */
|
||||||
#ifdef BRCM_NONE_BTE
|
#ifdef BRCM_NONE_BTE
|
||||||
|
@ -4829,11 +4843,12 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
|
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
|
||||||
NULL,
|
NULL,
|
||||||
name, HCI_ERR_CONNECTION_TOUT);
|
name, HCI_ERR_CONNECTION_TOUT);
|
||||||
} else
|
} else {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||||
p_dev_rec->dev_class,
|
p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_ERR_CONNECTION_TOUT);
|
p_dev_rec->sec_bd_name, HCI_ERR_CONNECTION_TOUT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTM_PAIR_STATE_WAIT_NUMERIC_CONFIRM:
|
case BTM_PAIR_STATE_WAIT_NUMERIC_CONFIRM:
|
||||||
|
@ -4888,11 +4903,12 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
|
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
|
||||||
NULL,
|
NULL,
|
||||||
name, HCI_ERR_CONNECTION_TOUT);
|
name, HCI_ERR_CONNECTION_TOUT);
|
||||||
} else
|
} else {
|
||||||
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
(*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
|
||||||
p_dev_rec->dev_class,
|
p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, HCI_ERR_CONNECTION_TOUT);
|
p_dev_rec->sec_bd_name, HCI_ERR_CONNECTION_TOUT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -5520,11 +5536,12 @@ static void btm_sec_collision_timeout (TIMER_LIST_ENT *p_tle)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
static void btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec)
|
static void btm_send_link_key_notif (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||||
{
|
{
|
||||||
if (btm_cb.api.p_link_key_callback)
|
if (btm_cb.api.p_link_key_callback) {
|
||||||
(*btm_cb.api.p_link_key_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
(*btm_cb.api.p_link_key_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
|
||||||
p_dev_rec->sec_bd_name, p_dev_rec->link_key,
|
p_dev_rec->sec_bd_name, p_dev_rec->link_key,
|
||||||
p_dev_rec->link_key_type);
|
p_dev_rec->link_key_type);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif ///SMP_INCLUDED == TRUE
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -5703,8 +5720,10 @@ void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEA
|
||||||
(*p_callback) (p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE, p_dev_rec->p_ref_data, res);
|
(*p_callback) (p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE, p_dev_rec->p_ref_data, res);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
(*p_callback) (p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, p_dev_rec->p_ref_data, res);
|
(*p_callback) (p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, p_dev_rec->p_ref_data, res);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#if (SMP_INCLUDED == TRUE)
|
#if (SMP_INCLUDED == TRUE)
|
||||||
btm_sec_check_pending_reqs();
|
btm_sec_check_pending_reqs();
|
||||||
#endif ///SMP_INCLUDED == TRUE
|
#endif ///SMP_INCLUDED == TRUE
|
||||||
|
@ -5761,8 +5780,10 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
|
||||||
#ifdef APPL_AUTH_WRITE_EXCEPTION
|
#ifdef APPL_AUTH_WRITE_EXCEPTION
|
||||||
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
|
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
btsnd_hcic_write_auth_enable (TRUE);
|
btsnd_hcic_write_auth_enable (TRUE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_LOCAL_PIN);
|
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_LOCAL_PIN);
|
||||||
|
|
||||||
|
@ -5913,8 +5934,9 @@ static BOOLEAN btm_sec_is_serv_level0(UINT16 psm)
|
||||||
static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport,
|
static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRANSPORT transport,
|
||||||
UINT8 encr_enable)
|
UINT8 encr_enable)
|
||||||
{
|
{
|
||||||
if (fixed_queue_is_empty(btm_cb.sec_pending_q))
|
if (fixed_queue_is_empty(btm_cb.sec_pending_q)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UINT8 res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
|
UINT8 res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
|
||||||
list_t *list = fixed_queue_get_list(btm_cb.sec_pending_q);
|
list_t *list = fixed_queue_get_list(btm_cb.sec_pending_q);
|
||||||
|
|
|
@ -1161,9 +1161,10 @@ void GATT_SetIdleTimeout (BD_ADDR bd_addr, UINT16 idle_tout, tBT_TRANSPORT trans
|
||||||
if (p_tcb->att_lcid == L2CAP_ATT_CID) {
|
if (p_tcb->att_lcid == L2CAP_ATT_CID) {
|
||||||
status = L2CA_SetFixedChannelTout (bd_addr, L2CAP_ATT_CID, idle_tout);
|
status = L2CA_SetFixedChannelTout (bd_addr, L2CAP_ATT_CID, idle_tout);
|
||||||
|
|
||||||
if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP)
|
if (idle_tout == GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP) {
|
||||||
L2CA_SetIdleTimeoutByBdAddr(p_tcb->peer_bda,
|
L2CA_SetIdleTimeoutByBdAddr(p_tcb->peer_bda,
|
||||||
GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, BT_TRANSPORT_LE);
|
GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, BT_TRANSPORT_LE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
status = L2CA_SetIdleTimeout (p_tcb->att_lcid, idle_tout, FALSE);
|
status = L2CA_SetIdleTimeout (p_tcb->att_lcid, idle_tout, FALSE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,17 +270,21 @@ UINT16 L2CA_ErtmConnectReq (UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_ERTM_INFO *p_e
|
||||||
p_ccb->ertm_info = *p_ertm_info;
|
p_ccb->ertm_info = *p_ertm_info;
|
||||||
|
|
||||||
/* Replace default indicators with the actual default pool */
|
/* Replace default indicators with the actual default pool */
|
||||||
if (p_ccb->ertm_info.fcr_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.fcr_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.fcr_rx_buf_size = L2CAP_FCR_RX_BUF_SIZE;
|
p_ccb->ertm_info.fcr_rx_buf_size = L2CAP_FCR_RX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->ertm_info.fcr_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.fcr_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.fcr_tx_buf_size = L2CAP_FCR_TX_BUF_SIZE;
|
p_ccb->ertm_info.fcr_tx_buf_size = L2CAP_FCR_TX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->ertm_info.user_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.user_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.user_rx_buf_size = L2CAP_USER_RX_BUF_SIZE;
|
p_ccb->ertm_info.user_rx_buf_size = L2CAP_USER_RX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->ertm_info.user_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.user_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.user_tx_buf_size = L2CAP_USER_TX_BUF_SIZE;
|
p_ccb->ertm_info.user_tx_buf_size = L2CAP_USER_TX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
p_ccb->max_rx_mtu = p_ertm_info->user_rx_buf_size -
|
p_ccb->max_rx_mtu = p_ertm_info->user_rx_buf_size -
|
||||||
(L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET + L2CAP_FCS_LEN);
|
(L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET + L2CAP_FCS_LEN);
|
||||||
|
@ -416,17 +420,21 @@ BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 re
|
||||||
p_ccb->ertm_info = *p_ertm_info;
|
p_ccb->ertm_info = *p_ertm_info;
|
||||||
|
|
||||||
/* Replace default indicators with the actual default pool */
|
/* Replace default indicators with the actual default pool */
|
||||||
if (p_ccb->ertm_info.fcr_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.fcr_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.fcr_rx_buf_size = L2CAP_FCR_RX_BUF_SIZE;
|
p_ccb->ertm_info.fcr_rx_buf_size = L2CAP_FCR_RX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->ertm_info.fcr_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.fcr_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.fcr_tx_buf_size = L2CAP_FCR_TX_BUF_SIZE;
|
p_ccb->ertm_info.fcr_tx_buf_size = L2CAP_FCR_TX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->ertm_info.user_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.user_rx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.user_rx_buf_size = L2CAP_USER_RX_BUF_SIZE;
|
p_ccb->ertm_info.user_rx_buf_size = L2CAP_USER_RX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->ertm_info.user_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE)
|
if (p_ccb->ertm_info.user_tx_buf_size == L2CAP_INVALID_ERM_BUF_SIZE) {
|
||||||
p_ccb->ertm_info.user_tx_buf_size = L2CAP_USER_TX_BUF_SIZE;
|
p_ccb->ertm_info.user_tx_buf_size = L2CAP_USER_TX_BUF_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
p_ccb->max_rx_mtu = p_ertm_info->user_rx_buf_size -
|
p_ccb->max_rx_mtu = p_ertm_info->user_rx_buf_size -
|
||||||
(L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET + L2CAP_FCS_LEN);
|
(L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET + L2CAP_FCS_LEN);
|
||||||
|
@ -1340,9 +1348,10 @@ UINT16 L2CA_RegisterLECoc(UINT16 psm, tL2CAP_APPL_INFO *p_cb_info)
|
||||||
for (vpsm = 0x0080; vpsm < 0x0100; vpsm++)
|
for (vpsm = 0x0080; vpsm < 0x0100; vpsm++)
|
||||||
{
|
{
|
||||||
p_rcb = l2cu_find_ble_rcb_by_psm(vpsm);
|
p_rcb = l2cu_find_ble_rcb_by_psm(vpsm);
|
||||||
if (p_rcb == NULL)
|
if (p_rcb == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
L2CAP_TRACE_API("%s Real PSM: 0x%04x Virtual PSM: 0x%04x", __func__, psm, vpsm);
|
L2CAP_TRACE_API("%s Real PSM: 0x%04x Virtual PSM: 0x%04x", __func__, psm, vpsm);
|
||||||
}
|
}
|
||||||
|
@ -1390,21 +1399,25 @@ void L2CA_DeregisterLECoc(UINT16 psm)
|
||||||
tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
|
tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
|
||||||
for (int i = 0; i < MAX_L2CAP_LINKS; i++, p_lcb++)
|
for (int i = 0; i < MAX_L2CAP_LINKS; i++, p_lcb++)
|
||||||
{
|
{
|
||||||
if (!p_lcb->in_use || p_lcb->transport != BT_TRANSPORT_LE)
|
if (!p_lcb->in_use || p_lcb->transport != BT_TRANSPORT_LE) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
tL2C_CCB *p_ccb = p_lcb->ccb_queue.p_first_ccb;
|
tL2C_CCB *p_ccb = p_lcb->ccb_queue.p_first_ccb;
|
||||||
if ((p_ccb == NULL) || (p_lcb->link_state == LST_DISCONNECTING))
|
if ((p_ccb == NULL) || (p_lcb->link_state == LST_DISCONNECTING)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->in_use &&
|
if (p_ccb->in_use &&
|
||||||
(p_ccb->chnl_state == CST_W4_L2CAP_DISCONNECT_RSP ||
|
(p_ccb->chnl_state == CST_W4_L2CAP_DISCONNECT_RSP ||
|
||||||
p_ccb->chnl_state == CST_W4_L2CA_DISCONNECT_RSP))
|
p_ccb->chnl_state == CST_W4_L2CA_DISCONNECT_RSP)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->p_rcb == p_rcb)
|
if (p_ccb->p_rcb == p_rcb) {
|
||||||
l2c_csm_execute(p_ccb, L2CEVT_L2CA_DISCONNECT_REQ, NULL);
|
l2c_csm_execute(p_ccb, L2CEVT_L2CA_DISCONNECT_REQ, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
l2cu_release_rcb (p_rcb);
|
l2cu_release_rcb (p_rcb);
|
||||||
}
|
}
|
||||||
|
@ -1473,8 +1486,9 @@ UINT16 L2CA_ConnectLECocReq(UINT16 psm, BD_ADDR p_bd_addr, tL2CAP_LE_CFG_INFO *p
|
||||||
p_ccb->p_rcb = p_rcb;
|
p_ccb->p_rcb = p_rcb;
|
||||||
|
|
||||||
/* Save the configuration */
|
/* Save the configuration */
|
||||||
if (p_cfg)
|
if (p_cfg) {
|
||||||
memcpy(&p_ccb->local_conn_cfg, p_cfg, sizeof(tL2CAP_LE_CFG_INFO));
|
memcpy(&p_ccb->local_conn_cfg, p_cfg, sizeof(tL2CAP_LE_CFG_INFO));
|
||||||
|
}
|
||||||
|
|
||||||
/* If link is up, start the L2CAP connection */
|
/* If link is up, start the L2CAP connection */
|
||||||
if (p_lcb->link_state == LST_CONNECTED)
|
if (p_lcb->link_state == LST_CONNECTED)
|
||||||
|
@ -1549,8 +1563,9 @@ BOOLEAN L2CA_ConnectLECocRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 r
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_cfg)
|
if (p_cfg) {
|
||||||
memcpy(&p_ccb->local_conn_cfg, p_cfg, sizeof(tL2CAP_LE_CFG_INFO));
|
memcpy(&p_ccb->local_conn_cfg, p_cfg, sizeof(tL2CAP_LE_CFG_INFO));
|
||||||
|
}
|
||||||
|
|
||||||
if (result == L2CAP_CONN_OK)
|
if (result == L2CAP_CONN_OK)
|
||||||
l2c_csm_execute (p_ccb, L2CEVT_L2CA_CONNECT_RSP, NULL);
|
l2c_csm_execute (p_ccb, L2CEVT_L2CA_CONNECT_RSP, NULL);
|
||||||
|
@ -1589,8 +1604,9 @@ BOOLEAN L2CA_GetPeerLECocConfig (UINT16 lcid, tL2CAP_LE_CFG_INFO* peer_cfg)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (peer_cfg != NULL)
|
if (peer_cfg != NULL) {
|
||||||
memcpy(peer_cfg, &p_ccb->peer_conn_cfg, sizeof(tL2CAP_LE_CFG_INFO));
|
memcpy(peer_cfg, &p_ccb->peer_conn_cfg, sizeof(tL2CAP_LE_CFG_INFO));
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1675,7 +1691,9 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda, tBLE_ADDR_TYPE
|
||||||
peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask;
|
peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
peer_channel_mask = p_lcb->peer_chnl_mask[0];
|
peer_channel_mask = p_lcb->peer_chnl_mask[0];
|
||||||
|
}
|
||||||
|
|
||||||
// Check for supported channel
|
// Check for supported channel
|
||||||
if (!(peer_channel_mask & (1 << fixed_cid))) {
|
if (!(peer_channel_mask & (1 << fixed_cid))) {
|
||||||
|
@ -1795,7 +1813,9 @@ UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)
|
||||||
peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask;
|
peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
peer_channel_mask = p_lcb->peer_chnl_mask[0];
|
peer_channel_mask = p_lcb->peer_chnl_mask[0];
|
||||||
|
}
|
||||||
|
|
||||||
if ((peer_channel_mask & (1 << fixed_cid)) == 0) {
|
if ((peer_channel_mask & (1 << fixed_cid)) == 0) {
|
||||||
L2CAP_TRACE_WARNING ("L2CA_SendFixedChnlData() - peer does not support fixed chnl: 0x%04x", fixed_cid);
|
L2CAP_TRACE_WARNING ("L2CA_SendFixedChnlData() - peer does not support fixed chnl: 0x%04x", fixed_cid);
|
||||||
|
|
|
@ -1260,8 +1260,9 @@ UINT32 CalConnectParamTimeout(tL2C_LCB *p_lcb)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb)
|
void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb)
|
||||||
{
|
{
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
||||||
{
|
{
|
||||||
|
@ -1285,8 +1286,9 @@ void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result)
|
void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result)
|
||||||
{
|
{
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
||||||
{
|
{
|
||||||
|
@ -1310,8 +1312,9 @@ void l2cble_credit_based_conn_res (tL2C_CCB *p_ccb, UINT16 result)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value)
|
void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value)
|
||||||
{
|
{
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
||||||
{
|
{
|
||||||
|
@ -1337,8 +1340,9 @@ void l2cble_send_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value)
|
||||||
void l2cble_send_peer_disc_req(tL2C_CCB *p_ccb)
|
void l2cble_send_peer_disc_req(tL2C_CCB *p_ccb)
|
||||||
{
|
{
|
||||||
L2CAP_TRACE_DEBUG ("%s",__func__);
|
L2CAP_TRACE_DEBUG ("%s",__func__);
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
if (p_ccb->p_lcb && p_ccb->p_lcb->transport != BT_TRANSPORT_LE)
|
||||||
{
|
{
|
||||||
|
@ -1396,8 +1400,9 @@ void l2cble_sec_comp(BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data,
|
||||||
if (sec_act == BTM_SEC_ENCRYPT_MITM)
|
if (sec_act == BTM_SEC_ENCRYPT_MITM)
|
||||||
{
|
{
|
||||||
BTM_GetSecurityFlagsByTransport(p_bda, &sec_flag, transport);
|
BTM_GetSecurityFlagsByTransport(p_bda, &sec_flag, transport);
|
||||||
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
|
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED) {
|
||||||
(*(p_buf->p_callback))(p_bda, BT_TRANSPORT_LE, p_buf->p_ref_data, status);
|
(*(p_buf->p_callback))(p_bda, BT_TRANSPORT_LE, p_buf->p_ref_data, status);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
L2CAP_TRACE_DEBUG ("%s MITM Protection Not present", __func__);
|
L2CAP_TRACE_DEBUG ("%s MITM Protection Not present", __func__);
|
||||||
|
@ -1425,11 +1430,12 @@ void l2cble_sec_comp(BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data,
|
||||||
{
|
{
|
||||||
p_buf = (tL2CAP_SEC_DATA*) fixed_queue_dequeue(p_lcb->le_sec_pending_q);
|
p_buf = (tL2CAP_SEC_DATA*) fixed_queue_dequeue(p_lcb->le_sec_pending_q);
|
||||||
|
|
||||||
if (status != BTM_SUCCESS)
|
if (status != BTM_SUCCESS) {
|
||||||
(*(p_buf->p_callback))(p_bda, BT_TRANSPORT_LE, p_buf->p_ref_data, status);
|
(*(p_buf->p_callback))(p_bda, BT_TRANSPORT_LE, p_buf->p_ref_data, status);
|
||||||
else
|
} else {
|
||||||
l2ble_sec_access_req(p_bda, p_buf->psm, p_buf->is_originator,
|
l2ble_sec_access_req(p_bda, p_buf->psm, p_buf->is_originator,
|
||||||
p_buf->p_callback, p_buf->p_ref_data);
|
p_buf->p_callback, p_buf->p_ref_data);
|
||||||
|
}
|
||||||
|
|
||||||
osi_free(p_buf);
|
osi_free(p_buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,10 +837,10 @@ static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data)
|
||||||
if (p_ccb->local_cid >= L2CAP_FIRST_FIXED_CHNL &&
|
if (p_ccb->local_cid >= L2CAP_FIRST_FIXED_CHNL &&
|
||||||
p_ccb->local_cid <= L2CAP_LAST_FIXED_CHNL) {
|
p_ccb->local_cid <= L2CAP_LAST_FIXED_CHNL) {
|
||||||
if (p_ccb->local_cid < L2CAP_BASE_APPL_CID) {
|
if (p_ccb->local_cid < L2CAP_BASE_APPL_CID) {
|
||||||
if (l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
|
if (l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb) {
|
||||||
(*l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
|
(*l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
|
||||||
(p_ccb->local_cid, p_ccb->p_lcb->remote_bd_addr, (BT_HDR *)p_data);
|
(p_ccb->local_cid, p_ccb->p_lcb->remote_bd_addr, (BT_HDR *)p_data);
|
||||||
else {
|
} else {
|
||||||
osi_free (p_data);
|
osi_free (p_data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1382,8 +1382,10 @@ static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_wo
|
||||||
(p_ccb->local_cid, p_ccb->p_lcb->remote_bd_addr, p_buf);
|
(p_ccb->local_cid, p_ccb->p_lcb->remote_bd_addr, p_buf);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_buf);
|
l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_buf);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (packet_ok);
|
return (packet_ok);
|
||||||
}
|
}
|
||||||
|
@ -2149,8 +2151,9 @@ static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked)
|
||||||
|
|
||||||
/* update sum, max and min of round trip delay of acking */
|
/* update sum, max and min of round trip delay of acking */
|
||||||
list_t *list = NULL;
|
list_t *list = NULL;
|
||||||
if (! fixed_queue_is_empty(p_ccb->fcrb.waiting_for_ack_q))
|
if (! fixed_queue_is_empty(p_ccb->fcrb.waiting_for_ack_q)) {
|
||||||
list = fixed_queue_get_list(p_ccb->fcrb.waiting_for_ack_q);
|
list = fixed_queue_get_list(p_ccb->fcrb.waiting_for_ack_q);
|
||||||
|
}
|
||||||
if (list != NULL) {
|
if (list != NULL) {
|
||||||
for (const list_node_t *node = list_begin(list), xx = 0;
|
for (const list_node_t *node = list_begin(list), xx = 0;
|
||||||
(node != list_end(list)) && (xx < num_bufs_acked);
|
(node != list_end(list)) && (xx < num_bufs_acked);
|
||||||
|
|
|
@ -191,11 +191,11 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda)
|
||||||
l2cu_send_peer_info_req (p_lcb, L2CAP_EXTENDED_FEATURES_INFO_TYPE);
|
l2cu_send_peer_info_req (p_lcb, L2CAP_EXTENDED_FEATURES_INFO_TYPE);
|
||||||
|
|
||||||
/* Tell BTM Acl management about the link */
|
/* Tell BTM Acl management about the link */
|
||||||
if ((p_dev_info = btm_find_dev (p_bda)) != NULL)
|
if ((p_dev_info = btm_find_dev (p_bda)) != NULL) {
|
||||||
btm_acl_created (ci.bd_addr, p_dev_info->dev_class,
|
btm_acl_created (ci.bd_addr, p_dev_info->dev_class,
|
||||||
p_dev_info->sec_bd_name, handle,
|
p_dev_info->sec_bd_name, handle,
|
||||||
p_lcb->link_role, BT_TRANSPORT_BR_EDR);
|
p_lcb->link_role, BT_TRANSPORT_BR_EDR);
|
||||||
else {
|
} else {
|
||||||
btm_acl_created (ci.bd_addr, NULL, NULL, handle, p_lcb->link_role, BT_TRANSPORT_BR_EDR);
|
btm_acl_created (ci.bd_addr, NULL, NULL, handle, p_lcb->link_role, BT_TRANSPORT_BR_EDR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,8 +399,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
|
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* Tell SCO management to drop any SCOs on this ACL */
|
/* Tell SCO management to drop any SCOs on this ACL */
|
||||||
btm_sco_acl_removed (p_lcb->remote_bd_addr);
|
btm_sco_acl_removed (p_lcb->remote_bd_addr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If waiting for disconnect and reconnect is pending start the reconnect now
|
/* If waiting for disconnect and reconnect is pending start the reconnect now
|
||||||
|
@ -998,9 +1000,11 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
|
||||||
l2cb.ble_check_round_robin = TRUE;
|
l2cb.ble_check_round_robin = TRUE;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
l2cb.check_round_robin = TRUE;
|
l2cb.check_round_robin = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If this is called from uncongested callback context break recursive calling.
|
/* If this is called from uncongested callback context break recursive calling.
|
||||||
** This LCB will be served when receiving number of completed packet event.
|
** This LCB will be served when receiving number of completed packet event.
|
||||||
|
|
|
@ -237,8 +237,10 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
osi_free (p_msg);
|
osi_free (p_msg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
else if (rcv_cid == L2CAP_BLE_SIGNALLING_CID) {
|
else if (rcv_cid == L2CAP_BLE_SIGNALLING_CID) {
|
||||||
//counter_add("l2cap.ble.rx.bytes", l2cap_len);
|
//counter_add("l2cap.ble.rx.bytes", l2cap_len);
|
||||||
|
@ -263,9 +265,10 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
|
||||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||||
l2c_fcr_proc_pdu (p_ccb, p_msg);
|
l2c_fcr_proc_pdu (p_ccb, p_msg);
|
||||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||||
} else
|
} else {
|
||||||
(*l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
|
(*l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
|
||||||
(rcv_cid, p_lcb->remote_bd_addr, p_msg);
|
(rcv_cid, p_lcb->remote_bd_addr, p_msg);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
osi_free (p_msg);
|
osi_free (p_msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,8 +151,10 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
|
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* Release all SCO links */
|
/* Release all SCO links */
|
||||||
btm_remove_sco_links(p_lcb->remote_bd_addr);
|
btm_remove_sco_links(p_lcb->remote_bd_addr);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (p_lcb->sent_not_acked > 0) {
|
if (p_lcb->sent_not_acked > 0) {
|
||||||
|
@ -189,12 +191,13 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell BTM Acl management the link was removed */
|
/* Tell BTM Acl management the link was removed */
|
||||||
if ((p_lcb->link_state == LST_CONNECTED) || (p_lcb->link_state == LST_DISCONNECTING))
|
if ((p_lcb->link_state == LST_CONNECTED) || (p_lcb->link_state == LST_DISCONNECTING)) {
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
btm_acl_removed (p_lcb->remote_bd_addr, p_lcb->transport);
|
btm_acl_removed (p_lcb->remote_bd_addr, p_lcb->transport);
|
||||||
#else
|
#else
|
||||||
btm_acl_removed (p_lcb->remote_bd_addr, BT_TRANSPORT_BR_EDR);
|
btm_acl_removed (p_lcb->remote_bd_addr, BT_TRANSPORT_BR_EDR);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Release any held buffers */
|
/* Release any held buffers */
|
||||||
if (p_lcb->link_xmit_data_q) {
|
if (p_lcb->link_xmit_data_q) {
|
||||||
|
@ -246,8 +249,9 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
|
||||||
while (!fixed_queue_is_empty(p_lcb->le_sec_pending_q))
|
while (!fixed_queue_is_empty(p_lcb->le_sec_pending_q))
|
||||||
{
|
{
|
||||||
tL2CAP_SEC_DATA *p_buf = (tL2CAP_SEC_DATA*) fixed_queue_dequeue(p_lcb->le_sec_pending_q);
|
tL2CAP_SEC_DATA *p_buf = (tL2CAP_SEC_DATA*) fixed_queue_dequeue(p_lcb->le_sec_pending_q);
|
||||||
if (p_buf->p_callback)
|
if (p_buf->p_callback) {
|
||||||
p_buf->p_callback(p_lcb->remote_bd_addr, p_lcb->transport, p_buf->p_ref_data, BTM_DEV_RESET);
|
p_buf->p_callback(p_lcb->remote_bd_addr, p_lcb->transport, p_buf->p_ref_data, BTM_DEV_RESET);
|
||||||
|
}
|
||||||
osi_free(p_buf);
|
osi_free(p_buf);
|
||||||
}
|
}
|
||||||
fixed_queue_free(p_lcb->le_sec_pending_q, NULL);
|
fixed_queue_free(p_lcb->le_sec_pending_q, NULL);
|
||||||
|
@ -1880,9 +1884,10 @@ tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm)
|
||||||
|
|
||||||
for (xx = 0; xx < BLE_MAX_L2CAP_CLIENTS; xx++, p_rcb++)
|
for (xx = 0; xx < BLE_MAX_L2CAP_CLIENTS; xx++, p_rcb++)
|
||||||
{
|
{
|
||||||
if ((p_rcb->in_use) && (p_rcb->psm == psm))
|
if ((p_rcb->in_use) && (p_rcb->psm == psm)) {
|
||||||
return (p_rcb);
|
return (p_rcb);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If here, no match found */
|
/* If here, no match found */
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
@ -2862,7 +2867,7 @@ void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else if ( (peer_channel_mask & (1 << (xx + L2CAP_FIRST_FIXED_CHNL)))
|
} else if ( (peer_channel_mask & (1 << (xx + L2CAP_FIRST_FIXED_CHNL)))
|
||||||
&& (l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb != NULL) )
|
&& (l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb != NULL) ) {
|
||||||
#if BLE_INCLUDED == TRUE
|
#if BLE_INCLUDED == TRUE
|
||||||
(*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
|
(*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
|
||||||
p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
|
p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, p_lcb->transport);
|
||||||
|
@ -2871,6 +2876,7 @@ void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb)
|
||||||
p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
|
p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2960,8 +2966,9 @@ void l2cu_send_peer_ble_credit_based_conn_req (tL2C_CCB *p_ccb)
|
||||||
UINT16 mps;
|
UINT16 mps;
|
||||||
UINT16 initial_credit;
|
UINT16 initial_credit;
|
||||||
|
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
p_lcb = p_ccb->p_lcb;
|
p_lcb = p_ccb->p_lcb;
|
||||||
|
|
||||||
/* Create an identifier for this packet */
|
/* Create an identifier for this packet */
|
||||||
|
@ -3082,8 +3089,9 @@ void l2cu_send_peer_ble_flow_control_credit(tL2C_CCB *p_ccb, UINT16 credit_value
|
||||||
UINT8 *p;
|
UINT8 *p;
|
||||||
tL2C_LCB *p_lcb = NULL;
|
tL2C_LCB *p_lcb = NULL;
|
||||||
|
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
p_lcb = p_ccb->p_lcb;
|
p_lcb = p_ccb->p_lcb;
|
||||||
|
|
||||||
/* Create an identifier for this packet */
|
/* Create an identifier for this packet */
|
||||||
|
@ -3125,8 +3133,9 @@ void l2cu_send_peer_ble_credit_based_disconn_req(tL2C_CCB *p_ccb)
|
||||||
tL2C_LCB *p_lcb = NULL;
|
tL2C_LCB *p_lcb = NULL;
|
||||||
L2CAP_TRACE_DEBUG ("%s",__func__);
|
L2CAP_TRACE_DEBUG ("%s",__func__);
|
||||||
|
|
||||||
if (!p_ccb)
|
if (!p_ccb) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
p_lcb = p_ccb->p_lcb;
|
p_lcb = p_ccb->p_lcb;
|
||||||
|
|
||||||
/* Create an identifier for this packet */
|
/* Create an identifier for this packet */
|
||||||
|
|
|
@ -1185,8 +1185,9 @@ int PORT_ReadData (UINT16 handle, char *p_data, UINT16 max_len, UINT16 *p_len)
|
||||||
while (max_len)
|
while (max_len)
|
||||||
{
|
{
|
||||||
p_buf = (BT_HDR *)fixed_queue_try_peek_first(p_port->rx.queue);
|
p_buf = (BT_HDR *)fixed_queue_try_peek_first(p_port->rx.queue);
|
||||||
if (p_buf == NULL)
|
if (p_buf == NULL){
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_buf->len > max_len) {
|
if (p_buf->len > max_len) {
|
||||||
memcpy (p_data, (UINT8 *)(p_buf + 1) + p_buf->offset, max_len);
|
memcpy (p_data, (UINT8 *)(p_buf + 1) + p_buf->offset, max_len);
|
||||||
|
|
|
@ -899,11 +899,11 @@ UINT16 SDP_DiDiscover( BD_ADDR remote_device, tSDP_DISCOVERY_DB *p_db,
|
||||||
init_uuid.len = 2;
|
init_uuid.len = 2;
|
||||||
init_uuid.uu.uuid16 = di_uuid;
|
init_uuid.uu.uuid16 = di_uuid;
|
||||||
|
|
||||||
if ( SDP_InitDiscoveryDb(p_db, len, num_uuids, &init_uuid, 0, NULL) )
|
if ( SDP_InitDiscoveryDb(p_db, len, num_uuids, &init_uuid, 0, NULL) ) {
|
||||||
if ( SDP_ServiceSearchRequest(remote_device, p_db, p_cb) ) {
|
if ( SDP_ServiceSearchRequest(remote_device, p_db, p_cb) ) {
|
||||||
result = SDP_SUCCESS;
|
result = SDP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
return SDP_DI_DISC_FAILED;
|
return SDP_DI_DISC_FAILED;
|
||||||
|
|
|
@ -467,12 +467,13 @@ static void sdp_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed)
|
||||||
SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc, CID: 0x%x\n", l2cap_cid);
|
SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc, CID: 0x%x\n", l2cap_cid);
|
||||||
#if SDP_CLIENT_ENABLED == TRUE
|
#if SDP_CLIENT_ENABLED == TRUE
|
||||||
/* Tell the user if he has a callback */
|
/* Tell the user if he has a callback */
|
||||||
if (p_ccb->p_cb)
|
if (p_ccb->p_cb) {
|
||||||
(*p_ccb->p_cb) ((UINT16) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
|
(*p_ccb->p_cb) ((UINT16) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
|
||||||
SDP_SUCCESS : SDP_CONN_FAILED));
|
SDP_SUCCESS : SDP_CONN_FAILED));
|
||||||
else if (p_ccb->p_cb2)
|
} else if (p_ccb->p_cb2) {
|
||||||
(*p_ccb->p_cb2) ((UINT16) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
|
(*p_ccb->p_cb2) ((UINT16) ((p_ccb->con_state == SDP_STATE_CONNECTED) ?
|
||||||
SDP_SUCCESS : SDP_CONN_FAILED), p_ccb->user_data);
|
SDP_SUCCESS : SDP_CONN_FAILED), p_ccb->user_data);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
sdpu_release_ccb (p_ccb);
|
sdpu_release_ccb (p_ccb);
|
||||||
|
|
|
@ -242,6 +242,7 @@ UINT8 *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr)
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#endif /* 0xFFFF - 0xFF */
|
#endif /* 0xFFFF - 0xFF */
|
||||||
|
{
|
||||||
#if (SDP_MAX_ATTR_LEN > 0xFF)
|
#if (SDP_MAX_ATTR_LEN > 0xFF)
|
||||||
if (p_attr->len > 0xFF) {
|
if (p_attr->len > 0xFF) {
|
||||||
UINT8_TO_BE_STREAM (p_out, (p_attr->type << 3) | SIZE_IN_NEXT_WORD);
|
UINT8_TO_BE_STREAM (p_out, (p_attr->type << 3) | SIZE_IN_NEXT_WORD);
|
||||||
|
@ -253,7 +254,7 @@ UINT8 *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr)
|
||||||
UINT8_TO_BE_STREAM (p_out, (p_attr->type << 3) | SIZE_IN_NEXT_BYTE);
|
UINT8_TO_BE_STREAM (p_out, (p_attr->type << 3) | SIZE_IN_NEXT_BYTE);
|
||||||
UINT8_TO_BE_STREAM (p_out, p_attr->len);
|
UINT8_TO_BE_STREAM (p_out, p_attr->len);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (p_attr->value_ptr != NULL) {
|
if (p_attr->value_ptr != NULL) {
|
||||||
ARRAY_TO_BE_STREAM (p_out, p_attr->value_ptr, (int)p_attr->len);
|
ARRAY_TO_BE_STREAM (p_out, p_attr->value_ptr, (int)p_attr->len);
|
||||||
}
|
}
|
||||||
|
@ -666,10 +667,10 @@ BOOLEAN sdpu_compare_uuid_arrays (UINT8 *p_uuid1, UINT32 len1, UINT8 *p_uuid2, U
|
||||||
if (len1 == 2) {
|
if (len1 == 2) {
|
||||||
return ((p_uuid1[0] == p_uuid2[0]) && (p_uuid1[1] == p_uuid2[1]));
|
return ((p_uuid1[0] == p_uuid2[0]) && (p_uuid1[1] == p_uuid2[1]));
|
||||||
}
|
}
|
||||||
if (len1 == 4)
|
if (len1 == 4) {
|
||||||
return ( (p_uuid1[0] == p_uuid2[0]) && (p_uuid1[1] == p_uuid2[1])
|
return ( (p_uuid1[0] == p_uuid2[0]) && (p_uuid1[1] == p_uuid2[1])
|
||||||
&& (p_uuid1[2] == p_uuid2[2]) && (p_uuid1[3] == p_uuid2[3]) );
|
&& (p_uuid1[2] == p_uuid2[2]) && (p_uuid1[3] == p_uuid2[3]) );
|
||||||
else {
|
} else {
|
||||||
return (memcmp (p_uuid1, p_uuid2, (size_t)len1) == 0);
|
return (memcmp (p_uuid1, p_uuid2, (size_t)len1) == 0);
|
||||||
}
|
}
|
||||||
} else if (len1 > len2) {
|
} else if (len1 > len2) {
|
||||||
|
@ -926,6 +927,7 @@ UINT16 sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr)
|
||||||
} else
|
} else
|
||||||
|
|
||||||
#endif/* 0xFFFF - 0xFF */
|
#endif/* 0xFFFF - 0xFF */
|
||||||
|
{
|
||||||
#if (SDP_MAX_ATTR_LEN > 0xFF)
|
#if (SDP_MAX_ATTR_LEN > 0xFF)
|
||||||
if (p_attr->len > 0xFF) {
|
if (p_attr->len > 0xFF) {
|
||||||
len += 3;
|
len += 3;
|
||||||
|
@ -935,6 +937,7 @@ UINT16 sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr)
|
||||||
{
|
{
|
||||||
len += 2;
|
len += 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
len += p_attr->len;
|
len += p_attr->len;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,25 +241,25 @@ static uint_8t gf_inv(const uint_8t x)
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; ; ) {
|
for ( ; ; ) {
|
||||||
if (n1)
|
if (n1) {
|
||||||
while (n2 >= n1) { /* divide polynomial p2 by p1 */
|
while (n2 >= n1) { /* divide polynomial p2 by p1 */
|
||||||
n2 /= n1; /* shift smaller polynomial left */
|
n2 /= n1; /* shift smaller polynomial left */
|
||||||
p2 ^= (p1 * n2) & 0xff; /* and remove from larger one */
|
p2 ^= (p1 * n2) & 0xff; /* and remove from larger one */
|
||||||
v2 ^= (v1 * n2); /* shift accumulated value and */
|
v2 ^= (v1 * n2); /* shift accumulated value and */
|
||||||
n2 = hibit(p2); /* add into result */
|
n2 = hibit(p2); /* add into result */
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
return v1;
|
return v1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n2) /* repeat with values swapped */
|
if (n2) { /* repeat with values swapped */
|
||||||
while (n1 >= n2) {
|
while (n1 >= n2) {
|
||||||
n1 /= n2;
|
n1 /= n2;
|
||||||
p1 ^= p2 * n1;
|
p1 ^= p2 * n1;
|
||||||
v1 ^= v2 * n1;
|
v1 ^= v2 * n1;
|
||||||
n1 = hibit(p1);
|
n1 = hibit(p1);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
return v2;
|
return v2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,9 +363,10 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||||
le_key.key_size = p_cb->loc_enc_size;
|
le_key.key_size = p_cb->loc_enc_size;
|
||||||
le_key.sec_level = p_cb->sec_level;
|
le_key.sec_level = p_cb->sec_level;
|
||||||
|
|
||||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
|
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||||
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC,
|
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC,
|
||||||
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
SMP_TRACE_DEBUG ("%s\n", __func__);
|
SMP_TRACE_DEBUG ("%s\n", __func__);
|
||||||
|
|
||||||
|
@ -385,9 +386,10 @@ void smp_send_id_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||||
smp_send_cmd(SMP_OPCODE_IDENTITY_INFO, p_cb);
|
smp_send_cmd(SMP_OPCODE_IDENTITY_INFO, p_cb);
|
||||||
smp_send_cmd(SMP_OPCODE_ID_ADDR, p_cb);
|
smp_send_cmd(SMP_OPCODE_ID_ADDR, p_cb);
|
||||||
|
|
||||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
|
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||||
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LID,
|
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LID,
|
||||||
&le_key, TRUE);
|
&le_key, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
smp_key_distribution_by_transport(p_cb, NULL);
|
smp_key_distribution_by_transport(p_cb, NULL);
|
||||||
}
|
}
|
||||||
|
@ -995,10 +997,11 @@ void smp_proc_master_id(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||||
le_key.sec_level = p_cb->sec_level;
|
le_key.sec_level = p_cb->sec_level;
|
||||||
le_key.key_size = p_cb->loc_enc_size;
|
le_key.key_size = p_cb->loc_enc_size;
|
||||||
|
|
||||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
|
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||||
btm_sec_save_le_key(p_cb->pairing_bda,
|
btm_sec_save_le_key(p_cb->pairing_bda,
|
||||||
BTM_LE_KEY_PENC,
|
BTM_LE_KEY_PENC,
|
||||||
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
smp_key_distribution(p_cb, NULL);
|
smp_key_distribution(p_cb, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1038,9 +1041,10 @@ void smp_proc_id_addr(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||||
memcpy(p_cb->id_addr, pid_key.static_addr, BD_ADDR_LEN);
|
memcpy(p_cb->id_addr, pid_key.static_addr, BD_ADDR_LEN);
|
||||||
|
|
||||||
/* store the ID key from peer device */
|
/* store the ID key from peer device */
|
||||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
|
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||||
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_PID,
|
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_PID,
|
||||||
(tBTM_LE_KEY_VALUE *)&pid_key, TRUE);
|
(tBTM_LE_KEY_VALUE *)&pid_key, TRUE);
|
||||||
|
}
|
||||||
smp_key_distribution_by_transport(p_cb, NULL);
|
smp_key_distribution_by_transport(p_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1060,10 +1064,11 @@ void smp_proc_srk_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||||
memcpy (le_key.csrk, p_data, BT_OCTET16_LEN); /* get peer CSRK */
|
memcpy (le_key.csrk, p_data, BT_OCTET16_LEN); /* get peer CSRK */
|
||||||
le_key.counter = 0; /* initialize the peer counter */
|
le_key.counter = 0; /* initialize the peer counter */
|
||||||
|
|
||||||
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND))
|
if ((p_cb->peer_auth_req & SMP_AUTH_BOND) && (p_cb->loc_auth_req & SMP_AUTH_BOND)) {
|
||||||
btm_sec_save_le_key(p_cb->pairing_bda,
|
btm_sec_save_le_key(p_cb->pairing_bda,
|
||||||
BTM_LE_KEY_PCSRK,
|
BTM_LE_KEY_PCSRK,
|
||||||
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
|
||||||
|
}
|
||||||
smp_key_distribution_by_transport(p_cb, NULL);
|
smp_key_distribution_by_transport(p_cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue