Merge branch 'bugfix/btdm_fix_warning_when_disable_logs_v3.2' into 'release/v3.2'

components/bt: Fix warning when disable debug logs or in release mode and improve the code structure

See merge request idf/esp-idf!4620
This commit is contained in:
Jiang Jiang Jian 2019-04-15 18:52:09 +08:00
commit fa40e43c8d
53 changed files with 478 additions and 265 deletions

View file

@ -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.
* call disc_res now */
/* 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,
UUID_SERVCLASS_AUDIO_SOURCE);
}
} else {
/* we do not know the peer device and it is using non-SBC codec
* we need to know all the SEPs on SNK */

View file

@ -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) {
p_data->rc_msg.msg.hdr.ctype = BTA_AV_RSP_NOT_IMPL;
#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 =
bta_av_group_navi_supported(p_data->rc_msg.msg.pass.pass_len,
p_data->rc_msg.msg.pass.p_pass_data, is_inquiry);
}
#endif
} else {
p_data->rc_msg.msg.hdr.ctype = bta_av_op_supported(p_data->rc_msg.msg.pass.op_id, is_inquiry);
@ -890,7 +891,9 @@ 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);
} else
#endif
{
evt = BTA_AV_VENDOR_CMD_EVT;
}
}
/* else if configured to support vendor specific and it's a response */
else if ((p_cb->features & BTA_AV_FEAT_VENDOR) &&
@ -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;
} else
#endif
{
evt = BTA_AV_VENDOR_RSP_EVT;
}
}
/* else if not configured to support vendor specific and it's a command */

View file

@ -1268,7 +1268,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
** Returns char *
**
*******************************************************************************/
static char *bta_av_st_code(UINT8 state)
UNUSED_ATTR static char *bta_av_st_code(UINT8 state)
{
switch (state) {
case BTA_AV_INIT_ST: return "INIT";

View file

@ -28,6 +28,7 @@
#include <string.h>
#include "bta/bta_av_co.h"
#include "bta_av_int.h"
#include "osi/osi.h"
/*****************************************************************************
** Constants and types
@ -564,7 +565,7 @@ void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb)
** Returns char *
**
*******************************************************************************/
static char *bta_av_sst_code(UINT8 state)
UNUSED_ATTR static char *bta_av_sst_code(UINT8 state)
{
switch (state) {
case BTA_AV_INIT_SST: return "INIT";

View file

@ -636,13 +636,15 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
/* 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_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 & ~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 & ~BTA_DM_IGNORE) | disc_mode);
}
BTM_SetDiscoverability(p_data->set_visibility.disc_mode,
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_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 & ~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 & ~BTA_DM_IGNORE) | conn_mode);
}
BTM_SetConnectability(p_data->set_visibility.conn_mode,
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 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)))
#endif
if ((bta_dm_search_cb.services & ((BTA_ALL_SERVICE_MASK | BTA_USER_SERVICE_MASK ) & ~BTA_BLE_SERVICE_MASK))) {
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));
/* 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 */
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 &=
(tBTA_SERVICE_MASK)(~(BTA_SERVICE_ID_TO_SERVICE_MASK(bta_dm_search_cb.service_index)));
}
} else
#endif
@ -3640,11 +3647,11 @@ static char *bta_dm_get_remname(void)
char *p_temp;
/* 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) {
p_name = p_temp;
}
}
return p_name;
}
#endif ///SDP_INCLUDED == TRUE || SMP_INCLUDED == TRUE
@ -5181,9 +5188,10 @@ void bta_dm_ble_setup_storage (tBTA_DM_MSG *p_data)
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,
btm_status);
}
}
/*******************************************************************************
@ -5211,9 +5219,10 @@ void bta_dm_ble_enable_batch_scan (tBTA_DM_MSG *p_data)
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,
btm_status);
}
}
/*******************************************************************************
@ -5237,9 +5246,10 @@ void bta_dm_ble_disable_batch_scan (tBTA_DM_MSG *p_data)
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,
btm_status);
}
}
/*******************************************************************************
@ -5263,9 +5273,10 @@ void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data)
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,
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.cond_type, 0, status,
p_data->ble_cfg_filter_cond.ref_value);
}
return;
}
@ -5429,9 +5441,10 @@ void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data)
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.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.ref_value, status);
}
return;
}
@ -5777,6 +5791,8 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
((p2[0]) << 24) + ((p2[1]) << 16) + ((p2[2]) << 8) + (p2[3]),
((p2[4]) << 8) + p2[5]);
UNUSED(p1);
UNUSED(p2);
APPL_TRACE_DEBUG("BTA_GATTC_OPEN_EVT conn_id = %d client_if=%d status = %d" ,
p_data->conn_id,
p_data->client_if,

View file

@ -1038,9 +1038,10 @@ 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);
/* 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_RESTART);
}
}
}

View file

@ -676,7 +676,7 @@ void bta_gattc_conn(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
bta_gattc_reset_discover_st(p_clcb->p_srcb, BTA_GATT_OK);
//register service change
bta_gattc_register_service_change_notify(p_clcb->bta_conn_id, p_clcb->bda);
} else
} else
#endif
{ /* cache is building */
p_clcb->p_srcb->state = BTA_GATTC_SERV_DISC;
@ -1073,8 +1073,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)
{
if (!bta_gattc_enqueue(p_clcb, p_data))
if (!bta_gattc_enqueue(p_clcb, p_data)) {
return;
}
tGATT_READ_PARAM read_param;
memset (&read_param, 0 ,sizeof(tGATT_READ_PARAM));
@ -1142,8 +1143,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)
{
if (!bta_gattc_enqueue(p_clcb, p_data))
if (!bta_gattc_enqueue(p_clcb, p_data)) {
return;
}
tBTA_GATT_STATUS status = BTA_GATT_OK;
tGATT_VALUE attr;
@ -1744,7 +1746,7 @@ void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
tBTA_GATTC gattc_cb = {0};
gattc_cb.set_assoc.client_if = p_msg->api_assoc.client_if;
BOOLEAN state = FALSE;
tBTA_GATTC_CLCB *p_assoc_clcb = bta_gattc_find_clcb_by_cif(p_msg->api_assoc.client_if,
tBTA_GATTC_CLCB *p_assoc_clcb = bta_gattc_find_clcb_by_cif(p_msg->api_assoc.client_if,
p_msg->api_assoc.assoc_addr, BTA_TRANSPORT_LE);
tBTA_GATTC_RCB *p_clrcb = bta_gattc_cl_get_regcb(p_msg->api_assoc.client_if);
if (p_assoc_clcb != NULL) {
@ -1785,7 +1787,7 @@ void bta_gattc_process_api_cache_assoc(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_m
}
return;
}
void bta_gattc_process_api_cache_get_addr_list(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_msg)
{

View file

@ -93,7 +93,7 @@ static char *bta_gattc_attr_type[] = {
};
/* utility functions */
bool display_cache_attribute(void *data, void *context)
bool display_cache_attribute(void *data, void *context)
{
//tBTA_GATTC_CACHE_ATTR *p_attr = data;
//APPL_TRACE_ERROR("\t Attr handle[%d] uuid[0x%04x] type[%s] prop[0x%1x]",
@ -102,7 +102,7 @@ bool display_cache_attribute(void *data, void *context)
return true;
}
bool display_cache_service(void *data, void *context)
bool display_cache_service(void *data, void *context)
{
tBTA_GATTC_SERVICE *p_cur_srvc = data;
APPL_TRACE_API("Service: handle[%d ~ %d] %s[0x%04x] inst[%d]",
@ -213,9 +213,9 @@ static void bta_gattc_free(void *ptr)
osi_free(ptr);
}
void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE *p_new_srvc)
void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE *p_new_srvc)
{
// services/p_new_srvc is NULL
// services/p_new_srvc is NULL
if (!services || !p_new_srvc) {
APPL_TRACE_ERROR("%s services/p_new_srvc is NULL", __func__);
return;
@ -243,7 +243,7 @@ void bta_gattc_insert_sec_service_to_cache(list_t *services, tBTA_GATTC_SERVICE
return;
}
}
}
}
}
}
@ -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.
This is just a temporary workaround.
*/
if (service->e_handle < value_handle)
if (service->e_handle < value_handle) {
service->e_handle = value_handle;
}
tBTA_GATTC_CHARACTERISTIC *characteristic = osi_malloc(sizeof(tBTA_GATTC_CHARACTERISTIC));
if (!characteristic) {
@ -554,10 +555,10 @@ void bta_gattc_update_include_service(const list_t *services) {
if(include_service && !include_service->included_service) {
//update
include_service->included_service = bta_gattc_find_matching_service(services, include_service->incl_srvc_s_handle);
if(!include_service->included_service) {
if(!include_service->included_service) {
//not match, free it
list_remove(service->included_svc, include_service);
osi_free(include_service);
osi_free(include_service);
}
}
}
@ -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.service_type);
if (!pri_srvc)
if (!pri_srvc) {
bta_gattc_add_srvc_to_list(p_srvc_cb,
p_data->value.incl_service.s_handle,
p_data->value.incl_service.e_handle,
p_data->value.incl_service.service_type,
FALSE);
}
/* add into database */
bta_gattc_add_attr_to_cache(p_srvc_cb,
p_data->handle,
@ -1007,8 +1009,8 @@ void bta_gattc_disc_res_cback (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_
case GATT_DISC_CHAR_DSCPT:
bta_gattc_add_attr_to_cache(p_srvc_cb,
p_data->handle,
&p_data->type,
p_data->handle,
&p_data->type,
0,
0 /* incl_srvc_s_handle */,
0 /* incl_srvc_e_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);
if ( p_clcb && (status != GATT_SUCCESS || p_clcb->status != GATT_SUCCESS) ) {
if (status == GATT_SUCCESS)
if (status == GATT_SUCCESS) {
p_clcb->status = status;
}
bta_gattc_sm_execute(p_clcb, BTA_GATTC_DISCOVER_CMPL_EVT, NULL);
return;
}
@ -1071,15 +1074,17 @@ void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid)
{
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;
}
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)) {
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;
}
#if (defined BTA_GATT_DEBUG && BTA_GATT_DEBUG == TRUE)
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->s_handle);
#endif
if (!p_clcb->p_rcb->p_cback)
if (!p_clcb->p_rcb->p_cback) {
continue;
}
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) {
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 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) {
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
if (p_clcb == NULL )
if (p_clcb == NULL ) {
return NULL;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
@ -1121,63 +1129,68 @@ const list_t* bta_gattc_get_services(UINT16 conn_id) {
}
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;
}
for (list_node_t *sn = list_begin(services);
sn != list_end(services); sn = list_next(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 NULL;
}
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
{
const list_t *services = bta_gattc_get_services_srcb(p_srcb);
return bta_gattc_find_matching_service(services, handle);
}
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle)
const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id, UINT16 handle)
{
const list_t *services = bta_gattc_get_services(conn_id);
return bta_gattc_find_matching_service(services, handle);
}
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
{
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
if (!service)
if (!service) {
return NULL;
}
for (list_node_t *cn = list_begin(service->characteristics);
cn != list_end(service->characteristics); cn = list_next(cn)) {
tBTA_GATTC_CHARACTERISTIC *p_char = list_node(cn);
if (handle == p_char->handle)
if (handle == p_char->handle) {
return p_char;
}
}
return NULL;
}
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle)
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle)
{
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
if (p_clcb == NULL )
if (p_clcb == NULL ) {
return NULL;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
return bta_gattc_get_characteristic_srcb(p_srcb, handle);
}
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle)
{
const tBTA_GATTC_SERVICE* service = bta_gattc_get_service_for_handle_srcb(p_srcb, handle);
@ -1191,20 +1204,22 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor_srcb(tBTA_GATTC_SERV *p_srcb, U
for (list_node_t *dn = list_begin(p_char->descriptors);
dn != list_end(p_char->descriptors); dn = list_next(dn)) {
tBTA_GATTC_DESCRIPTOR *p_desc = list_node(dn);
if (handle == p_desc->handle)
if (handle == p_desc->handle) {
return p_desc;
}
}
}
return NULL;
}
tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
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);
if (p_clcb == NULL )
if (p_clcb == NULL ) {
return NULL;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
return bta_gattc_get_descriptor_srcb(p_srcb, handle);
@ -1443,7 +1458,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
}
}
}
}
}
@ -1476,7 +1491,7 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
}
if (type == BTGATT_DB_PRIMARY_SERVICE || type == BTGATT_DB_SECONDARY_SERVICE) {
if ((type == BTGATT_DB_PRIMARY_SERVICE && p_cur_srvc->is_primary) ||
if ((type == BTGATT_DB_PRIMARY_SERVICE && p_cur_srvc->is_primary) ||
(type == BTGATT_DB_SECONDARY_SERVICE && !p_cur_srvc->is_primary)) {
// if the current service is the last service in the db, need to ensure the current service start handle is not less than the start_handle.
if (!svc_length) {
@ -1572,10 +1587,11 @@ static size_t bta_gattc_get_db_size_with_type(list_t *services,
** Returns number of elements inside db from start_handle to end_handle
*******************************************************************************/
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;
}
size_t db_size = 0;
UINT16 svc_length = list_length(services) - 1;
@ -1598,9 +1614,10 @@ static size_t bta_gattc_get_db_size(list_t *services,
} else {
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;
}
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
cn != list_end(p_cur_srvc->characteristics); cn = list_next(cn)) {
@ -1657,7 +1674,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
*count = 0;
return;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
if (!p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
*count = 0;
@ -1676,7 +1693,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
*count = 0;
return;
}
tBTA_GATTC_SERV *p_srcb = p_clcb->p_srcb;
if (!p_srcb->p_srvc_cache || list_is_empty(p_srcb->p_srvc_cache)) {
*count = 0;
@ -1694,7 +1711,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
}
}
*count = bta_gattc_get_db_size_with_type(p_srcb->p_srvc_cache, type, NULL, start_handle, end_handle);
}
/*******************************************************************************
@ -1786,8 +1803,9 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
p_char->properties);
curr_db_attr++;
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
continue;
}
for (list_node_t *dn = list_begin(p_char->descriptors);
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;
}
for (list_node_t *isn = list_begin(p_cur_srvc->included_svc);
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)
{
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;
}
int i = 0;
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)) {
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;
}
for (list_node_t *cn = list_begin(p_cur_srvc->characteristics);
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 */,
FALSE);
if (!p_char->descriptors || list_is_empty(p_char->descriptors))
if (!p_char->descriptors || list_is_empty(p_char->descriptors)) {
continue;
}
for (list_node_t *dn = list_begin(p_char->descriptors);
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;
}
for (list_node_t *an = list_begin(p_cur_srvc->included_svc);
an != list_end(p_cur_srvc->included_svc); an = list_next(an)) {

View file

@ -416,8 +416,9 @@ tBTA_GATTC_SERV *bta_gattc_srcb_alloc(BD_ADDR bda)
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);
}
osi_free(p_tcb->p_srvc_list);
p_tcb->p_srvc_list = NULL;
//osi_free_and_reset((void **)&p_tcb->p_srvc_list);
@ -583,8 +584,9 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
* clear boundaries are always around service.
*/
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));
}
}
}
}
@ -937,8 +939,9 @@ 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)
{
for(i=0; i != 16; ++i)
for(i=0; i != 16; ++i) {
p_dest->uu[i] = base_uuid[i];
}
}
switch (p_src->len)

View file

@ -403,7 +403,7 @@ void bta_gatts_add_char(tBTA_GATTS_SRVC_CB *p_srvc_cb, tBTA_GATTS_DATA *p_msg)
UINT16 attr_id = 0;
tBTA_GATTS cb_data;
tGATT_ATTR_VAL *p_attr_val = NULL;
tGATT_ATTR_VAL *p_attr_val = NULL;
tGATTS_ATTR_CONTROL *p_control = NULL;
if(p_msg->api_add_char.attr_val.attr_max_len != 0){
@ -665,17 +665,18 @@ void bta_gatts_indicate_handle (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
&gatt_if, remote_bda, &transport)) {
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,
p_msg->api_indicate.attr_id,
p_msg->api_indicate.len,
p_msg->api_indicate.value);
else
} else {
status = GATTS_HandleValueNotification (p_msg->api_indicate.hdr.layer_specific,
p_msg->api_indicate.attr_id,
p_msg->api_indicate.len,
p_msg->api_indicate.value);
}
/* if over BR_EDR, inform PM for mode change */
if (transport == BTA_TRANSPORT_BR_EDR) {
@ -851,13 +852,13 @@ void bta_gatts_send_service_change_indication (tBTA_GATTS_DATA *p_msg)
memcpy(bd_addr, p_msg->api_send_service_change.remote_bda, BD_ADDR_LEN);
status = GATT_SendServiceChangeIndication(bd_addr);
} else {
status = GATT_SendServiceChangeIndication(NULL);
status = GATT_SendServiceChangeIndication(NULL);
}
if (p_rcb && p_rcb->p_cback) {
service_change.status = status;
service_change.server_if = p_msg->api_send_service_change.server_if;
(*p_rcb->p_cback)(BTA_GATTS_SEND_SERVICE_CHANGE_EVT, (tBTA_GATTS *)&service_change);
}
}
}
/*******************************************************************************
@ -933,7 +934,7 @@ static void bta_gatts_send_request_cback (UINT16 conn_id,
cb_data.req_data.p_data = (tBTA_GATTS_REQ_DATA *)p_data;
if(req_type == BTA_GATTS_CONF_EVT) {
cb_data.req_data.handle = p_data->handle;
cb_data.req_data.handle = p_data->handle;
}
(*p_rcb->p_cback)(req_type, &cb_data);
} else {

View file

@ -1159,6 +1159,7 @@ static char *bta_hf_client_skip_unknown(char *buffer)
buffer = tmp + 2;
APPL_TRACE_DEBUG("%s %.*s", __FUNCTION__, buffer - start - 2, start);
UNUSED(start);
return buffer;
}

View file

@ -308,6 +308,7 @@ static void bta_hf_client_sco_disc_cback(UINT16 sco_idx)
#if (BTM_SCO_HCI_INCLUDED == TRUE )
tBTM_STATUS status = BTM_ConfigScoPath(BTM_SCO_ROUTE_PCM, NULL, NULL, TRUE);
APPL_TRACE_DEBUG("%s close config status = %d", __FUNCTION__, status);
UNUSED(status);
/* SCO clean up here */
bta_hf_client_sco_co_close();
#endif

View file

@ -101,8 +101,10 @@ void bta_hh_api_enable(tBTA_HH_DATA *p_data)
bta_hh_le_enable();
} else
#endif
{
/* signal BTA call back event */
(* bta_hh_cb.p_cback)(BTA_HH_ENABLE_EVT, (tBTA_HH *)&status);
}
}
/*******************************************************************************
**
@ -901,7 +903,9 @@ 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);
} else
#endif
{
(*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;
} else
#endif
{
if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, &dev_handle)\
== HID_SUCCESS) {
dev_info.handle = dev_handle;
dev_info.status = BTA_HH_OK;
#if (defined BTA_HH_LE_INCLUDED && BTA_HH_LE_INCLUDED == TRUE)
/* 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 */
bta_hh_cb.cb_index[dev_handle] = p_cb->index;
}
}
} else { /* device already been added */
dev_info.handle = p_cb->hid_handle;
dev_info.status = BTA_HH_OK;

View file

@ -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_MOUSE_INPUT:
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 =
BTA_GATT_CLT_CONFIG_NOTIFICATION;
}
p_dev_cb->clt_cfg_idx ++;
bta_hh_le_write_rpt_clt_cfg(p_dev_cb, hid_inst_id);

View file

@ -75,11 +75,12 @@ UINT8 bta_hh_find_cb(BD_ADDR bda)
return xx;
}
#if BTA_HH_DEBUG
else
else {
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].hid_handle,
bta_hh_cb.kdev[xx].state);
}
#endif
}
@ -123,7 +124,9 @@ 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;
} else
#endif
{
bta_hh_cb.cb_index[p_cb->hid_handle] = BTA_HH_IDX_INVALID;
}
}
/* reset device control block */
@ -486,11 +489,12 @@ UINT8 bta_hh_dev_handle_to_cb_idx(UINT8 dev_handle)
#endif
} else
#endif
{
/* regular HID device checking */
if (dev_handle < BTA_HH_MAX_KNOWN ) {
index = bta_hh_cb.cb_index[dev_handle];
}
}
return index;
}

View file

@ -26,6 +26,7 @@
#include <stdlib.h>
#include "osi/allocator.h"
#include "osi/osi.h"
#include "stack/bt_types.h"
#include "bta/utl.h"
#include "bta/bta_sys.h"
@ -137,7 +138,7 @@ UINT8 bta_jv_alloc_sec_id(void)
return ret;
}
static int get_sec_id_used(void)
UNUSED_ATTR static int get_sec_id_used(void)
{
int i;
int used = 0;
@ -146,12 +147,13 @@ static int get_sec_id_used(void)
used++;
}
}
if (used == BTA_JV_NUM_SERVICE_ID)
if (used == BTA_JV_NUM_SERVICE_ID) {
APPL_TRACE_ERROR("get_sec_id_used, sec id exceeds the limit:%d",
BTA_JV_NUM_SERVICE_ID);
}
return used;
}
static int get_rfc_cb_used(void)
UNUSED_ATTR static int get_rfc_cb_used(void)
{
int i;
int used = 0;
@ -160,9 +162,10 @@ static int get_rfc_cb_used(void)
used++;
}
}
if (used == BTA_JV_MAX_RFC_CONN)
if (used == BTA_JV_MAX_RFC_CONN) {
APPL_TRACE_ERROR("get_sec_id_used, rfc ctrl block exceeds the limit:%d",
BTA_JV_MAX_RFC_CONN);
}
return used;
}
@ -474,19 +477,21 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
< BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) {
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(bta_jv_cb.rfc_cb[hi].rfc_hdl[si]);
if (p_pcb) {
if (NULL == p_pcb->p_pm_cb)
if (NULL == p_pcb->p_pm_cb) {
APPL_TRACE_WARNING("%s(jv_handle:"
" 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to "
"pm_cb?", __func__, jv_handle, p_pcb->port_handle, i);
}
p_cb = &p_pcb->p_pm_cb;
}
}
} else {
if (jv_handle < BTA_JV_MAX_L2C_CONN) {
tBTA_JV_L2C_CB *p_l2c_cb = &bta_jv_cb.l2c_cb[jv_handle];
if (NULL == p_l2c_cb->p_pm_cb)
if (NULL == p_l2c_cb->p_pm_cb) {
APPL_TRACE_WARNING("%s(jv_handle: "
"0x%x): p_pm_cb: %d: no link to pm_cb?", __func__, jv_handle, i);
}
p_cb = &p_l2c_cb->p_pm_cb;
}
}
@ -742,9 +747,10 @@ void bta_jv_get_channel_id(tBTA_JV_MSG *p_data)
bta_jv_cb.scn[channel - 1] = TRUE;
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,
p_data->alloc_channel.user_data);
}
return;
}
case BTA_JV_CONN_TYPE_L2CAP:
@ -998,6 +1004,9 @@ static bool create_base_record(const uint32_t sdp_handle, const char *name, cons
APPL_TRACE_DEBUG("create_base_record: successfully created base service "
"record, handle: 0x%08x, scn: %d, name: %s, with_obex: %d",
sdp_handle, channel, name, with_obex);
UNUSED(stage);
return TRUE;
}
@ -1031,6 +1040,8 @@ static int add_spp_sdp(const char *name, const int channel) {
APPL_TRACE_DEBUG("add_spp_sdp: service registered successfully, "
"service_name: %s, handle 0x%08x)", name, handle);
UNUSED(stage);
return handle;
}
@ -1523,6 +1534,7 @@ static int bta_jv_port_data_co_cback(UINT16 port_handle, UINT8 *buf, UINT16 len,
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(port_handle);
int ret = 0;
APPL_TRACE_DEBUG("%s, p_cb:%p, p_pcb:%p, len:%d, type:%d", __func__, p_cb, p_pcb, len, type);
UNUSED(p_cb);
if (p_pcb != NULL) {
switch (type) {
case DATA_CO_CALLBACK_TYPE_INCOMING:

View file

@ -615,6 +615,7 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
int frames_to_process = ((freq_multiple) / (num_blocks * num_subbands)) + 1;
APPL_TRACE_EVENT(" Frames to be processed in 20 ms %d\n", frames_to_process);
UNUSED(frames_to_process);
}
/*******************************************************************************

View file

@ -495,10 +495,11 @@ static UINT64 time_now_us()
static void log_tstamps_us(char *comment)
{
static UINT64 prev_us = 0;
const UINT64 now_us = time_now_us();
UINT64 now_us = time_now_us();
APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d", comment, now_us, now_us - prev_us,
fixed_queue_length(btc_aa_src_cb.TxAaQ));
prev_us = now_us;
UNUSED(prev_us);
}
/* when true media task discards any tx frames */

View file

@ -1199,10 +1199,13 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
BTC_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
}
}
UNUSED(que_len);
}
#else
static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
{
UNUSED(event);
UNUSED(p_data);
BTC_TRACE_WARNING("%s : event %u\n", __func__, event);
}
#endif

View file

@ -335,6 +335,8 @@ static void handle_rc_passthrough_rsp ( tBTA_AV_REMOTE_RSP *p_remote_rsp)
} else {
BTC_TRACE_ERROR("%s DUT does not support AVRCP controller role", __FUNCTION__);
}
UNUSED(status);
#else
BTC_TRACE_ERROR("%s AVRCP controller role is not enabled", __FUNCTION__);
#endif

View file

@ -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 )
{
if (is_connected(bd_addr))
if (is_connected(bd_addr)) {
return BT_STATUS_BUSY;
}
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_CONNECTING;
bdcpy(btc_hf_client_cb.connected_bda.address, bd_addr->address);
@ -713,14 +714,14 @@ static void process_ind_evt(tBTA_HF_CLIENT_IND *ind)
{
esp_hf_client_cb_param_t param;
memset(&param, 0, sizeof(esp_hf_client_cb_param_t));
switch (ind->type)
{
case BTA_HF_CLIENT_IND_CALL:
param.call.status = ind->value;
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CIND_CALL_EVT, &param);
break;
case BTA_HF_CLIENT_IND_CALLSETUP:
param.call_setup.status = ind->value;
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CIND_CALL_SETUP_EVT, &param);
@ -787,6 +788,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
{
BTC_TRACE_WARNING("%s: HF CLient open failed, but another device connected. status=%d state=%d connected device=%s",
__FUNCTION__, p_data->open.status, btc_hf_client_cb.state, bdaddr_to_string(&btc_hf_client_cb.connected_bda, bdstr, sizeof(bdstr)));
UNUSED(bdstr);
break;
}
@ -795,18 +797,20 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
param.conn_stat.state = btc_hf_client_cb.state;
param.conn_stat.peer_feat = 0;
param.conn_stat.chld_feat = 0;
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, &param);
} while (0);
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED)
bdsetany(btc_hf_client_cb.connected_bda.address);
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS)
if (btc_hf_client_cb.state == ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED) {
bdsetany(btc_hf_client_cb.connected_bda.address);
}
if (p_data->open.status != BTA_HF_CLIENT_SUCCESS) {
btc_queue_advance();
}
break;
@ -820,13 +824,13 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
param.conn_stat.state = btc_hf_client_cb.state;
param.conn_stat.peer_feat = btc_hf_client_cb.peer_feat;
param.conn_stat.chld_feat = btc_hf_client_cb.chld_feat;
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_CONNECTION_STATE_EVT, &param);
} while (0);
/* Inform the application about in-band ringtone */
if (btc_hf_client_cb.peer_feat & BTA_HF_CLIENT_PEER_INBAND)
{
@ -839,7 +843,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
btc_queue_advance();
break;
case BTA_HF_CLIENT_CLOSE_EVT:
btc_hf_client_cb.state = ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED;
do {
@ -847,7 +851,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
param.conn_stat.state = ESP_HF_CLIENT_CONNECTION_STATE_DISCONNECTED;
param.conn_stat.peer_feat = 0;
param.conn_stat.chld_feat = 0;
memcpy(param.conn_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
@ -980,7 +984,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
memset(&param, 0, sizeof(esp_hf_client_cb_param_t));
param.audio_stat.state = ESP_HF_CLIENT_AUDIO_STATE_CONNECTED;
memcpy(param.audio_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_AUDIO_STATE_EVT, &param);
} while (0);
break;
@ -989,7 +993,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
memset(&param, 0, sizeof(esp_hf_client_cb_param_t));
param.audio_stat.state = ESP_HF_CLIENT_AUDIO_STATE_CONNECTED_MSBC;
memcpy(param.audio_stat.remote_bda, &btc_hf_client_cb.connected_bda,
sizeof(esp_bd_addr_t));
sizeof(esp_bd_addr_t));
btc_hf_client_cb_to_app(ESP_HF_CLIENT_AUDIO_STATE_EVT, &param);
} while (0);
break;

View file

@ -145,9 +145,10 @@ void sbc_enc_bit_alloc_mono(SBC_ENC_PARAMS *pstrCodecParams)
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
if (*(ps16GenBufPtr) < s32BitSlice + 2) {
*(ps16GenArrPtr) = 0;
} else
} else {
*(ps16GenArrPtr) = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
}
ps16GenBufPtr++;
ps16GenArrPtr++;

View file

@ -132,9 +132,10 @@ void sbc_enc_bit_alloc_ste(SBC_ENC_PARAMS *pstrCodecParams)
for (s32Sb = 0; s32Sb < s32NumOfSubBands; s32Sb++) {
if (*ps16GenBufPtr < s32BitSlice + 2) {
*ps16GenArrPtr = 0;
} else
} else {
*ps16GenArrPtr = ((*(ps16GenBufPtr) - s32BitSlice) < 16) ?
(SINT16)(*(ps16GenBufPtr) - s32BitSlice) : 16;
}
ps16GenBufPtr++;
ps16GenArrPtr++;
}

View file

@ -61,8 +61,9 @@ bool list_contains(const list_t *list, const void *data)
assert(data != NULL);
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 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; ) {
list_node_t *next = node->next;
if (!callback(node->data, context))
if (!callback(node->data, context)) {
return node;
}
node = next;
}
return NULL;

View file

@ -605,8 +605,9 @@ void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data)
{
UNUSED(p_lcb);
if (p_data == NULL)
if (p_data == NULL) {
return;
}
osi_free(p_data->p_buf);
p_data->p_buf = NULL;

View file

@ -345,8 +345,10 @@ UINT8 *avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
p += 2;
BE_STREAM_TO_UINT32(ssrc, p);
UNUSED(ssrc);
UNUSED(o_p);
UNUSED(o_v);
UNUSED(o_cc);
switch (pt) {
case AVDT_RTCP_PT_SR: /* the packet type - SR (Sender Report) */
@ -627,15 +629,19 @@ void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
avdt_scb_hdl_pkt_frag(p_scb, p_data);
} else
#endif
{
#if AVDT_REPORTING == TRUE
if (p_data->p_pkt->layer_specific == AVDT_CHAN_REPORT) {
p = (UINT8 *)(p_data->p_pkt + 1) + p_data->p_pkt->offset;
avdt_scb_hdl_report(p_scb, p, p_data->p_pkt->len);
osi_free(p_data->p_pkt);
p_data->p_pkt = NULL;
osi_free(p_data->p_pkt);
p_data->p_pkt = NULL;
} else
#endif
{
avdt_scb_hdl_pkt_no_frag(p_scb, p_data);
}
}
}
/*******************************************************************************
@ -1303,7 +1309,9 @@ void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data)
#if AVDT_MULTIPLEXING == TRUE
if (fixed_queue_is_empty(p_scb->frag_q))
#endif
{
avdt_scb_hdl_write_req_no_frag(p_scb, p_data);
}
#if AVDT_MULTIPLEXING == TRUE
else {
avdt_scb_hdl_write_req_frag(p_scb, p_data);

View file

@ -120,10 +120,11 @@ BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
result = TRUE;
}
if (!result)
if (!result) {
AVRC_TRACE_ERROR(
"avrc_is_valid_player_attrib_value() found not matching attrib(x%x)-value(x%x) pair!",
attrib, value);
}
return result;
}

View file

@ -261,9 +261,10 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
#if BLE_INCLUDED == TRUE
p->transport = transport;
#if BLE_PRIVACY_SPT == TRUE
if (transport == BT_TRANSPORT_LE)
if (transport == BT_TRANSPORT_LE) {
btm_ble_refresh_local_resolvable_private_addr(bda,
btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr);
}
#else
p->conn_addr_type = BLE_ADDR_PUBLIC;
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? */
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 */
*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);
}
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 */
*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);
}
/* EDR 3 and 5 slot support? */
if (HCI_EDR_ACL_2MPS_SUPPORTED(p->peer_lmp_features[HCI_EXT_FEATURES_PAGE_0])

View file

@ -66,7 +66,7 @@ extern void gatt_notify_enc_cmpl(BD_ADDR bd_addr);
** bd_name - Name of the peer device. NULL if unknown.
** dev_type - Remote device's device type.
** addr_type - LE device address type.
** auth_mode - auth mode
** auth_mode - auth mode
**
** Returns TRUE if added OK, else FALSE
**
@ -887,8 +887,9 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
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;
}
}
else
{
@ -898,8 +899,9 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
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;
}
}
tBTM_BLE_SEC_REQ_ACT ble_sec_act = BTM_BLE_SEC_REQ_ACT_NONE;
@ -907,11 +909,13 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
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;
}
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE)
if (ble_sec_act == BTM_BLE_SEC_REQ_ACT_NONE) {
return BTM_SEC_OK;
}
UINT8 sec_flag = 0;
BTM_GetSecurityFlagsByTransport(bdaddr, &sec_flag, BT_TRANSPORT_LE);
@ -920,11 +924,13 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
BOOLEAN is_key_mitm = FALSE;
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;
}
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED)
if (sec_flag & BTM_SEC_FLAG_LKEY_AUTHED) {
is_key_mitm = TRUE;
}
}
if (auth_req & BTM_LE_AUTH_REQ_MITM)
@ -933,16 +939,18 @@ tBTM_SEC_ACTION btm_ble_determine_security_act(BOOLEAN is_originator, BD_ADDR bd
{
return BTM_SEC_ENCRYPT_MITM;
} else {
if (is_link_encrypted)
if (is_link_encrypted) {
return BTM_SEC_OK;
else
} else {
return BTM_SEC_ENCRYPT;
}
}
} else {
if (is_link_encrypted)
if (is_link_encrypted) {
return BTM_SEC_OK;
else
} else {
return BTM_SEC_ENCRYPT_NO_MITM;
}
}
return BTM_SEC_OK;
@ -1012,8 +1020,9 @@ BOOLEAN btm_ble_start_sec_check(BD_ADDR bd_addr, UINT16 psm, BOOLEAN is_originat
break;
}
if (ble_sec_act == BTM_BLE_SEC_NONE)
if (ble_sec_act == BTM_BLE_SEC_NONE) {
return status;
}
tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr(bd_addr, BT_TRANSPORT_LE);
p_lcb->sec_act = sec_act;

View file

@ -312,9 +312,10 @@ void btm_ble_scan_pf_cmpl_cback(tBTM_VSC_CMPL *p_params)
if (HCI_SUCCESS == status) {
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);
} else
} else {
btm_ble_cs_update_pf_counter(action, cond_type,
&btm_ble_adv_filt_cb.cur_filter_target, num_avail);
}
}
/* send ADV PF operation complete */
@ -855,9 +856,10 @@ tBTM_STATUS btm_ble_update_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
len,
param,
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,
sizeof(tBLE_BD_ADDR));
}
else {
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 */
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
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,
ref_value, NULL, NULL);
}
/* clear local name filter */
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,
ref_value, NULL, NULL);
}
/* update the counter for service data */
st = btm_ble_update_srvc_data_change(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL);
@ -936,16 +940,18 @@ 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,
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,
ref_value, NULL, NULL);
}
/* clear service data filter */
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);
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,
ref_value, NULL, NULL);
}
}
/* select feature based on control block settings */
@ -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) {
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 +
BTM_BLE_ADV_FILT_TRACK_NUM;
}
if ((st = BTM_VendorSpecificCommand (HCI_BLE_ADV_FILTER_OCF,
(UINT8)len,

View file

@ -427,9 +427,10 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
if (0 == num_records) {
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
&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,
data_len, p_data, status);
}
} else {
if ((len - 4) > 0) {
btm_ble_batchscan_enq_rep_data(report_format, num_records, p, len - 4);
@ -439,9 +440,10 @@ void btm_ble_batchscan_vsc_cmpl_cback (tBTM_VSC_CMPL *p_params)
btm_ble_batchscan_deq_rep_data(report_format, &ref_value, &num_records,
&p_data, &data_len);
/* 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,
num_records, data_len, p_data, status);
}
}
}
}

View file

@ -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",
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,
total_energy_used, status);
}
return;
}

View file

@ -280,9 +280,10 @@ void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy)
/* if adv active, stop and restart */
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->adv_addr_type);
}
btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
BTM_BLE_GAP_ADV_SLOW_INT),
@ -738,7 +739,7 @@ void BTM_VendorHciEchoCmdTest(uint8_t echo)
{
BTM_VendorSpecificCommand (HCI_VENDOR_COMMON_ECHO_CMD_OPCODE,
1,
&echo,
&echo,
BTM_VendorHciEchoCmdCallback);
}
@ -1254,7 +1255,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
}
if(own_bda_type == BLE_ADDR_RANDOM) {
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) == BTM_BLE_GAP_ADDR_BIT_RANDOM) {
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) == BTM_BLE_GAP_ADDR_BIT_RANDOM) {
//close privacy
#if BLE_PRIVACY_SPT == TRUE
if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE) {
@ -1263,9 +1264,9 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
#endif
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, BD_ADDR_LEN);
// set address to controller
// set address to controller
btsnd_hcic_ble_set_random_addr(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr);
} else if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr, BD_ADDR_LEN);
@ -1275,7 +1276,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
if(adv_cb) {
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
}
return BTM_ILLEGAL_VALUE;
return BTM_ILLEGAL_VALUE;
}
} else if(own_bda_type == BLE_ADDR_PUBLIC_ID || own_bda_type == BLE_ADDR_RANDOM_ID) {
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
@ -1290,7 +1291,7 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
if(adv_cb) {
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
}
return BTM_ILLEGAL_VALUE;
return BTM_ILLEGAL_VALUE;
}
#endif
if(own_bda_type == BLE_ADDR_PUBLIC_ID) {
@ -1307,17 +1308,17 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
if(adv_cb) {
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
}
return BTM_ILLEGAL_VALUE;
return BTM_ILLEGAL_VALUE;
}
}
}
} else {
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
}
if (!BTM_BLE_ISVALID_PARAM(adv_int_min, BTM_BLE_ADV_INT_MIN, BTM_BLE_ADV_INT_MAX) ||
!BTM_BLE_ISVALID_PARAM(adv_int_max, BTM_BLE_ADV_INT_MIN, BTM_BLE_ADV_INT_MAX)) {
BTM_TRACE_ERROR ("adv_int_min or adv_int_max is invalid\n");
BTM_TRACE_ERROR ("adv_int_min or adv_int_max is invalid\n");
if(adv_cb) {
(* adv_cb)(HCI_ERR_ESP_VENDOR_FAIL);
}
@ -1372,7 +1373,6 @@ tBTM_STATUS BTM_BleSetAdvParamsStartAdv(UINT16 adv_int_min, UINT16 adv_int_max,
p_dir_bda->bda,
chnl_map,
p_cb->afp);
return btm_ble_start_adv();
}
@ -1492,11 +1492,11 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
BTM_BleConfigPrivacy(FALSE, NULL);
}
#endif
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, BD_ADDR_LEN);
// set address to controller
// set address to controller
btsnd_hcic_ble_set_random_addr(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr);
} else if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr, BD_ADDR_LEN);
@ -1506,12 +1506,12 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
}
BTM_TRACE_ERROR ("No random address yet, please set random address and try\n");
return;
return;
}
} else if(addr_type_own == BLE_ADDR_PUBLIC_ID || addr_type_own == BLE_ADDR_RANDOM_ID) {
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) == BTM_BLE_GAP_ADDR_BIT_RESOLVABLE) {
addr_type_own = BLE_ADDR_RANDOM;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_RANDOM;
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr, BD_ADDR_LEN);
btsnd_hcic_ble_set_random_addr(btm_cb.ble_ctr_cb.addr_mgnt_cb.resolvale_addr);
} else {
@ -1521,12 +1521,12 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
if (scan_setup_status_cback != NULL) {
scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
}
return;
return;
}
#endif
if(addr_type_own == BLE_ADDR_PUBLIC_ID) {
addr_type_own = BLE_ADDR_PUBLIC;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
} else {
//own_bda_type == BLE_ADDR_RANDOM_ID
if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) == BTM_BLE_GAP_ADDR_BIT_RANDOM) {
@ -1539,12 +1539,12 @@ void BTM_BleSetScanFilterParams(tGATT_IF client_if, UINT32 scan_interval, UINT32
if (scan_setup_status_cback != NULL) {
scan_setup_status_cback(client_if, BTM_ILLEGAL_VALUE);
}
return;
return;
}
}
}
} else {
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = BLE_ADDR_PUBLIC;
}
/* If not supporting extended scan support, use the older range for checking */
@ -1663,7 +1663,7 @@ tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_le
** Returns status
**
*******************************************************************************/
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info,
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info,
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb)
{
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
@ -1796,8 +1796,9 @@ tBTM_STATUS BTM_BleWriteAdvDataRaw(UINT8 *p_raw_adv, UINT32 raw_adv_len)
*******************************************************************************/
tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
{
if (rand_addr == NULL)
if (rand_addr == NULL) {
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)) {
BTM_TRACE_ERROR("Advertising or scaning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
@ -1864,7 +1865,7 @@ BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type)
memset(addr, 0, BD_ADDR_LEN);
return FALSE;
}
return TRUE;
return TRUE;
}
/*******************************************************************************
@ -2847,7 +2848,7 @@ void btm_ble_cache_adv_data(BD_ADDR bda, tBTM_INQ_RESULTS *p_cur, UINT8 data_len
memset(p_le_inq_cb->adv_data_cache, 0, BTM_BLE_CACHE_ADV_DATA_MAX);
p_cur->adv_data_len = 0;
p_cur->scan_rsp_len = 0;
}
}
//Clear the adv cache if the addresses are not equal
if(memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN) != 0) {
@ -3301,7 +3302,7 @@ void btm_ble_process_adv_pkt (UINT8 *p_data)
#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
temp_addr_type = addr_type;
memcpy(temp_bda, bda, BD_ADDR_LEN);
/* map address to security record */
match = btm_identity_addr_to_random_pseudo(bda, &addr_type, FALSE);
@ -3424,13 +3425,13 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
0x02 Scannable undirected advertising (ADV_SCAN_IND)
0x03 Non connectable undirected advertising (ADV_NONCONN_IND)
0x04 Scan Response (SCAN_RSP)
0x05-0xFF Reserved for future use
0x05-0xFF Reserved for future use
*/
//if scan duplicate is enabled, the adv packet without scan response is allowed to report to higher layer
if(p_le_inq_cb->scan_duplicate_filter == BTM_BLE_SCAN_DUPLICATE_ENABLE) {
/*
Bluedroid will put the advertising packet and scan response into a packet and send it to the higher layer.
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
packet will be discarded. So we added the following judgment:
1. For different addresses, send the last advertising packet to higher layer
2. For same address and same advertising type (not scan response), send the last advertising packet to higher layer
@ -3778,7 +3779,7 @@ tBTM_STATUS btm_ble_start_adv(void)
btm_execute_wl_dev_operation();
btm_cb.ble_ctr_cb.wl_state |= BTM_BLE_WL_ADV;
}
/* The complete event comes up immediately after the 'btsnd_hcic_ble_set_adv_enable' being called in dual core,
/* The complete event comes up immediately after the 'btsnd_hcic_ble_set_adv_enable' being called in dual core,
this causes the 'adv_mode' and 'state' not be set yet, so we set the state first */
tBTM_BLE_GAP_STATE temp_state = p_cb->state;
UINT8 adv_mode = p_cb->adv_mode;
@ -4087,7 +4088,7 @@ BOOLEAN btm_ble_clear_topology_mask (tBTM_BLE_STATE_MASK request_state_mask)
**
** Description Get BLE topology bit mask
**
** Returns state mask.
** Returns state mask.
**
*******************************************************************************/
tBTM_BLE_STATE_MASK btm_ble_get_topology_mask (void)

View file

@ -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);
}
if (st == BTM_CMD_STARTED)
if (st == BTM_CMD_STARTED) {
btm_ble_enq_resolving_list_pending(p_dev_rec->bd_addr,
BTM_BLE_META_READ_IRK_ENTRY);
}
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_META_ADD_IRK_ENTRY);
}
/* if resolving list has been turned on, re-enable it */
if (rl_mask) {

View file

@ -207,8 +207,9 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr, tBT_TRANSPORT transport)
extern void BTM_SecClearSecurityFlags (BD_ADDR 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;
}
p_dev_rec->sec_flags = 0;
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;

View file

@ -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_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_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_ACL_PKT_TYPES_MASK_DM5);
}
/* Add in EDR related ACL types */
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p_features)) {
@ -297,13 +299,15 @@ 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 */
if (HCI_EDR_ACL_2MPS_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_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_ACL_PKT_TYPES_MASK_NO_3_DH5);
}
}
BTM_TRACE_DEBUG("Local supported ACL packet types: 0x%04x",

View file

@ -1042,9 +1042,10 @@ 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);
} else
#endif
{
return (btm_initiate_rem_name (remote_bda, p_cur, BTM_RMT_NAME_EXT,
BTM_EXT_RMT_NAME_TIMEOUT, p_cb));
}
}
/*******************************************************************************
@ -1080,11 +1081,13 @@ tBTM_STATUS BTM_CancelRemoteDeviceName (void)
}
} else
#endif
{
if (btsnd_hcic_rmt_name_req_cancel (p_inq->remname_bda)) {
return (BTM_CMD_STARTED);
} else {
return (BTM_NO_RESOURCES);
}
}
} else {
return (BTM_WRONG_MODE);
}

View file

@ -887,7 +887,9 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
#ifdef APPL_AUTH_WRITE_EXCEPTION
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
#endif
{
btsnd_hcic_write_auth_enable (TRUE);
}
btm_cb.acl_disc_reason = 0xff ;
@ -907,9 +909,10 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
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,
p_dev_rec->sec_bd_name, HCI_ERR_AUTH_FAILURE);
}
}
return;
}
@ -1400,7 +1403,9 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE
}
} else
#endif
{
rc = btm_sec_execute_procedure (p_dev_rec);
}
if (rc != BTM_CMD_STARTED && rc != BTM_BUSY) {
if (p_callback) {
@ -2167,9 +2172,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__,
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,
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
}
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
}
@ -2529,9 +2535,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__,
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,
BTM_MODE4_LEVEL4_NOT_SUPPORTED);
}
return (BTM_MODE4_LEVEL4_NOT_SUPPORTED);
}
@ -3017,9 +3024,10 @@ 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 */
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,
p_dev_rec->sec_bd_name);
}
}
} else {
dev_class[0] = 0;
@ -3104,9 +3112,10 @@ 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);
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,
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
}
}
}
return;
@ -3132,10 +3141,11 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
/* that some authentication has been completed */
/* This is required when different entities receive link notification and auth complete */
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,
p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, HCI_SUCCESS);
}
}
}
@ -3911,10 +3921,11 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
/* User probably Disabled the keyboard while it was asleap. Let her try */
if (btm_cb.api.p_auth_complete_callback) {
/* 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,
p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, status);
}
}
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
@ -4185,9 +4196,10 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
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,
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
}
}
}
#endif ///SMP_INCLUDED == TRUE
@ -4412,10 +4424,11 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
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,
p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, HCI_SUCCESS);
}
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
@ -4721,9 +4734,10 @@ 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)
/* for derived key, always send authentication callback for BR channel */
|| 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,
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 */
@ -4833,10 +4847,11 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
NULL,
name, HCI_ERR_CONNECTION_TOUT);
} else
} else {
(*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_CONNECTION_TOUT);
}
}
break;
@ -4892,10 +4907,11 @@ static void btm_sec_pairing_timeout (TIMER_LIST_ENT *p_tle)
(*btm_cb.api.p_auth_complete_callback) (p_cb->pairing_bda,
NULL,
name, HCI_ERR_CONNECTION_TOUT);
} else
} else {
(*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_CONNECTION_TOUT);
}
}
break;
@ -5524,10 +5540,11 @@ 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)
{
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,
p_dev_rec->sec_bd_name, p_dev_rec->link_key,
p_dev_rec->link_key_type);
}
}
#endif ///SMP_INCLUDED == TRUE
@ -5707,7 +5724,9 @@ 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);
} else
#endif
{
(*p_callback) (p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, p_dev_rec->p_ref_data, res);
}
}
#if (SMP_INCLUDED == TRUE)
btm_sec_check_pending_reqs();
@ -5765,7 +5784,9 @@ static BOOLEAN btm_sec_check_prefetch_pin (tBTM_SEC_DEV_REC *p_dev_rec)
#ifdef APPL_AUTH_WRITE_EXCEPTION
if (!(APPL_AUTH_WRITE_EXCEPTION)(p_dev_rec->bd_addr))
#endif
{
btsnd_hcic_write_auth_enable (TRUE);
}
}
} else {
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_LOCAL_PIN);
@ -5917,8 +5938,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,
UINT8 encr_enable)
{
if (fixed_queue_is_empty(btm_cb.sec_pending_q))
if (fixed_queue_is_empty(btm_cb.sec_pending_q)) {
return;
}
UINT8 res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING;
list_t *list = fixed_queue_get_list(btm_cb.sec_pending_q);

View file

@ -292,7 +292,7 @@ UINT16 GATTS_AddIncludeService (UINT16 service_handle, UINT16 include_svc_handle
**
*******************************************************************************/
UINT16 GATTS_AddCharacteristic (UINT16 service_handle, tBT_UUID *p_char_uuid,
tGATT_PERM perm, tGATT_CHAR_PROP property,
tGATT_PERM perm, tGATT_CHAR_PROP property,
tGATT_ATTR_VAL *attr_val, tGATTS_ATTR_CONTROL *control)
{
tGATT_HDL_LIST_ELEM *p_decl;
@ -311,7 +311,7 @@ UINT16 GATTS_AddCharacteristic (UINT16 service_handle, tBT_UUID *p_char_uuid,
return gatts_add_characteristic(&p_decl->svc_db,
perm,
property,
p_char_uuid,
p_char_uuid,
attr_val, control);
}
/*******************************************************************************
@ -734,7 +734,7 @@ tGATT_STATUS GATTS_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *v
return GATT_INVALID_ATTR_LEN;
}
if ((p_decl = gatt_find_hdl_buffer_by_attr_handle(attr_handle)) == NULL) {
GATT_TRACE_DEBUG("Service not created\n");
GATT_TRACE_DEBUG("Service not created\n");
return GATT_INVALID_HANDLE;
}
@ -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) {
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,
GATT_LINK_IDLE_TIMEOUT_WHEN_NO_APP, BT_TRANSPORT_LE);
}
} else {
status = L2CA_SetIdleTimeout (p_tcb->att_lcid, idle_tout, FALSE);
}
@ -1511,7 +1512,7 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
srv_chg_ind_pending = gatt_is_srv_chg_ind_pending(p_tcb);
if (!srv_chg_ind_pending) {
status = gatt_send_srv_chg_ind(addr);
status = gatt_send_srv_chg_ind(addr);
} else {
status = GATT_BUSY;
GATT_TRACE_DEBUG("discard srv chg - already has one in the queue");

View file

@ -94,7 +94,7 @@ void gatt_free_pending_ind(tGATT_TCB *p_tcb)
if (p_tcb->pending_ind_q == NULL) {
return;
}
/* release all queued indications */
while (!fixed_queue_is_empty(p_tcb->pending_ind_q)) {
osi_free(fixed_queue_try_dequeue(p_tcb->pending_ind_q));
@ -118,7 +118,7 @@ void gatt_free_pending_enc_queue(tGATT_TCB *p_tcb)
if (p_tcb->pending_enc_clcb == NULL) {
return;
}
/* release all queued indications */
while (!fixed_queue_is_empty(p_tcb->pending_enc_clcb)) {
osi_free(fixed_queue_try_dequeue(p_tcb->pending_enc_clcb));
@ -387,7 +387,7 @@ tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_attr_handle(UINT16 attr_handle)
p_list = p_list_info->p_first;
while (p_list != NULL) {
if (p_list->in_use && (p_list->asgn_range.s_handle <= attr_handle)
if (p_list->in_use && (p_list->asgn_range.s_handle <= attr_handle)
&& (p_list->asgn_range.e_handle >= attr_handle)) {
return (p_list);
}
@ -2197,9 +2197,10 @@ void gatt_end_operation(tGATT_CLCB *p_clcb, tGATT_STATUS status, void *p_data)
(*p_disc_cmpl_cb)(conn_id, disc_type, status);
} else if (p_cmpl_cb && op) {
(*p_cmpl_cb)(conn_id, op, status, &cb_data);
} else
} else {
GATT_TRACE_WARNING ("gatt_end_operation not sent out op=%d p_disc_cmpl_cb:%p p_cmpl_cb:%p",
operation, p_disc_cmpl_cb, p_cmpl_cb);
}
}
/*******************************************************************************

View file

@ -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;
/* 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;
}
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;
}
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;
}
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->max_rx_mtu = p_ertm_info->user_rx_buf_size -
(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;
/* 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;
}
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;
}
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;
}
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->max_rx_mtu = p_ertm_info->user_rx_buf_size -
(L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET + L2CAP_FCS_LEN);
@ -1340,8 +1348,9 @@ UINT16 L2CA_RegisterLECoc(UINT16 psm, tL2CAP_APPL_INFO *p_cb_info)
for (vpsm = 0x0080; vpsm < 0x0100; vpsm++)
{
p_rcb = l2cu_find_ble_rcb_by_psm(vpsm);
if (p_rcb == NULL)
if (p_rcb == NULL) {
break;
}
}
L2CAP_TRACE_API("%s Real PSM: 0x%04x Virtual PSM: 0x%04x", __func__, psm, vpsm);
@ -1390,20 +1399,24 @@ void L2CA_DeregisterLECoc(UINT16 psm)
tL2C_LCB *p_lcb = &l2cb.lcb_pool[0];
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;
}
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;
}
if (p_ccb->in_use &&
(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;
}
if (p_ccb->p_rcb == p_rcb)
if (p_ccb->p_rcb == p_rcb) {
l2c_csm_execute(p_ccb, L2CEVT_L2CA_DISCONNECT_REQ, NULL);
}
}
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;
/* Save the configuration */
if (p_cfg)
if (p_cfg) {
memcpy(&p_ccb->local_conn_cfg, p_cfg, sizeof(tL2CAP_LE_CFG_INFO));
}
/* If link is up, start the L2CAP connection */
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;
}
if (p_cfg)
if (p_cfg) {
memcpy(&p_ccb->local_conn_cfg, p_cfg, sizeof(tL2CAP_LE_CFG_INFO));
}
if (result == L2CAP_CONN_OK)
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;
}
if (peer_cfg != NULL)
if (peer_cfg != NULL) {
memcpy(peer_cfg, &p_ccb->peer_conn_cfg, sizeof(tL2CAP_LE_CFG_INFO));
}
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;
} else
#endif
{
peer_channel_mask = p_lcb->peer_chnl_mask[0];
}
// Check for supported channel
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;
} else
#endif
{
peer_channel_mask = p_lcb->peer_chnl_mask[0];
}
if ((peer_channel_mask & (1 << fixed_cid)) == 0) {
L2CAP_TRACE_WARNING ("L2CA_SendFixedChnlData() - peer does not support fixed chnl: 0x%04x", fixed_cid);

View file

@ -1260,8 +1260,9 @@ UINT32 CalConnectParamTimeout(tL2C_LCB *p_lcb)
*******************************************************************************/
void l2cble_credit_based_conn_req (tL2C_CCB *p_ccb)
{
if (!p_ccb)
if (!p_ccb) {
return;
}
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)
{
if (!p_ccb)
if (!p_ccb) {
return;
}
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)
{
if (!p_ccb)
if (!p_ccb) {
return;
}
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)
{
L2CAP_TRACE_DEBUG ("%s",__func__);
if (!p_ccb)
if (!p_ccb) {
return;
}
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)
{
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);
}
else
{
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);
if (status != BTM_SUCCESS)
if (status != BTM_SUCCESS) {
(*(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,
p_buf->p_callback, p_buf->p_ref_data);
}
osi_free(p_buf);
}

View file

@ -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 &&
p_ccb->local_cid <= L2CAP_LAST_FIXED_CHNL) {
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)
(p_ccb->local_cid, p_ccb->p_lcb->remote_bd_addr, (BT_HDR *)p_data);
else {
} else {
osi_free (p_data);
}
break;

View file

@ -246,13 +246,13 @@ void l2c_fcr_cleanup (tL2C_CCB *p_ccb)
fixed_queue_free(p_fcrb->retrans_q, osi_free_func);
p_fcrb->retrans_q = NULL;
btu_free_quick_timer (&p_fcrb->ack_timer);
memset(&p_fcrb->ack_timer, 0, sizeof(TIMER_LIST_ENT));
btu_free_quick_timer (&p_ccb->fcrb.mon_retrans_timer);
memset(&p_fcrb->mon_retrans_timer, 0, sizeof(TIMER_LIST_ENT));
#if (L2CAP_ERTM_STATS == TRUE)
if ( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID) && (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) ) {
UINT32 dur = osi_time_get_os_boottime_ms() - p_ccb->fcrb.connect_tick_count;
@ -1382,7 +1382,9 @@ 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);
} else
#endif
{
l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_buf);
}
}
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 */
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);
}
if (list != NULL) {
for (const list_node_t *node = list_begin(list), xx = 0;
(node != list_end(list)) && (xx < num_bufs_acked);

View file

@ -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);
/* 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,
p_dev_info->sec_bd_name, handle,
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);
}
@ -399,8 +399,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
#if (BLE_INCLUDED == TRUE)
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
#endif
{
/* Tell SCO management to drop any SCOs on this ACL */
btm_sco_acl_removed (p_lcb->remote_bd_addr);
}
#endif
/* If waiting for disconnect and reconnect is pending start the reconnect now
@ -657,7 +659,7 @@ void l2c_info_timeout (tL2C_LCB *p_lcb)
}
}
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
#endif ///CLASSIC_BT_INCLUDED == TRUE
}
}
@ -998,7 +1000,9 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf)
l2cb.ble_check_round_robin = TRUE;
} else
#endif
{
l2cb.check_round_robin = TRUE;
}
}
}

View file

@ -242,7 +242,9 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
/* nothing to do */
} else
#endif
{
osi_free (p_msg);
}
}
#if (BLE_INCLUDED == TRUE)
else if (rcv_cid == L2CAP_BLE_SIGNALLING_CID) {
@ -268,9 +270,10 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
#if (CLASSIC_BT_INCLUDED == TRUE)
l2c_fcr_proc_pdu (p_ccb, p_msg);
#endif ///CLASSIC_BT_INCLUDED == TRUE
} else
} else {
(*l2cb.fixed_reg[rcv_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)
(rcv_cid, p_lcb->remote_bd_addr, p_msg);
}
} else {
osi_free (p_msg);
}
@ -400,7 +403,6 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
STREAM_TO_UINT16 (rej_mtu, p);
/* What to do with the MTU reject ? We have negotiated an MTU. For now */
/* we will ignore it and let a higher protocol timeout take care of it */
L2CAP_TRACE_WARNING ("L2CAP - MTU rej Handle: %d MTU: %d", p_lcb->handle, rej_mtu);
}
if (rej_reason == L2CAP_CMD_REJ_INVALID_CID) {
@ -763,6 +765,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
}
}
UNUSED(rej_mtu);
}
#endif ///CLASSIC_BT_INCLUDED == TRUE
@ -885,7 +888,7 @@ void l2c_free(void)
l2cb.rcv_pending_q = NULL;
#if L2C_DYNAMIC_MEMORY
FREE_AND_RESET(l2c_cb_ptr);
#endif
#endif
}
/*******************************************************************************

View file

@ -151,8 +151,10 @@ void l2cu_release_lcb (tL2C_LCB *p_lcb)
#if (BLE_INCLUDED == TRUE)
if (p_lcb->transport == BT_TRANSPORT_BR_EDR)
#endif
{
/* Release all SCO links */
btm_remove_sco_links(p_lcb->remote_bd_addr);
}
#endif
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 */
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)
btm_acl_removed (p_lcb->remote_bd_addr, p_lcb->transport);
#else
btm_acl_removed (p_lcb->remote_bd_addr, BT_TRANSPORT_BR_EDR);
#endif
}
/* Release any held buffers */
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))
{
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);
}
osi_free(p_buf);
}
fixed_queue_free(p_lcb->le_sec_pending_q, NULL);
@ -1880,8 +1884,9 @@ tL2C_RCB *l2cu_find_ble_rcb_by_psm (UINT16 psm)
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);
}
}
/* If here, no match found */
@ -2862,7 +2867,7 @@ void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb)
#endif
}
} 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
(*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);
@ -2870,6 +2875,7 @@ void l2cu_process_fixed_disc_cback (tL2C_LCB *p_lcb)
(*l2cb.fixed_reg[xx].pL2CA_FixedConn_Cb)(xx + L2CAP_FIRST_FIXED_CHNL,
p_lcb->remote_bd_addr, FALSE, p_lcb->disc_reason, BT_TRANSPORT_BR_EDR);
#endif
}
}
#endif
}
@ -2960,8 +2966,9 @@ void l2cu_send_peer_ble_credit_based_conn_req (tL2C_CCB *p_ccb)
UINT16 mps;
UINT16 initial_credit;
if (!p_ccb)
if (!p_ccb) {
return;
}
p_lcb = p_ccb->p_lcb;
/* 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;
tL2C_LCB *p_lcb = NULL;
if (!p_ccb)
if (!p_ccb) {
return;
}
p_lcb = p_ccb->p_lcb;
/* 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;
L2CAP_TRACE_DEBUG ("%s",__func__);
if (!p_ccb)
if (!p_ccb) {
return;
}
p_lcb = p_ccb->p_lcb;
/* Create an identifier for this packet */

View file

@ -1185,8 +1185,9 @@ int PORT_ReadData (UINT16 handle, char *p_data, UINT16 max_len, UINT16 *p_len)
while (max_len)
{
p_buf = (BT_HDR *)fixed_queue_try_peek_first(p_port->rx.queue);
if (p_buf == NULL)
if (p_buf == NULL){
break;
}
if (p_buf->len > max_len) {
memcpy (p_data, (UINT8 *)(p_buf + 1) + p_buf->offset, max_len);

View file

@ -899,11 +899,11 @@ UINT16 SDP_DiDiscover( BD_ADDR remote_device, tSDP_DISCOVERY_DB *p_db,
init_uuid.len = 2;
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) ) {
result = SDP_SUCCESS;
}
}
return result;
#else
return SDP_DI_DISC_FAILED;

View file

@ -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);
#if SDP_CLIENT_ENABLED == TRUE
/* 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) ?
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) ?
SDP_SUCCESS : SDP_CONN_FAILED), p_ccb->user_data);
}
#endif
sdpu_release_ccb (p_ccb);

View file

@ -242,6 +242,7 @@ UINT8 *sdpu_build_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr)
} else
#endif /* 0xFFFF - 0xFF */
{
#if (SDP_MAX_ATTR_LEN > 0xFF)
if (p_attr->len > 0xFF) {
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->len);
}
}
if (p_attr->value_ptr != NULL) {
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) {
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])
&& (p_uuid1[2] == p_uuid2[2]) && (p_uuid1[3] == p_uuid2[3]) );
else {
} else {
return (memcmp (p_uuid1, p_uuid2, (size_t)len1) == 0);
}
} else if (len1 > len2) {
@ -926,6 +927,7 @@ UINT16 sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr)
} else
#endif/* 0xFFFF - 0xFF */
{
#if (SDP_MAX_ATTR_LEN > 0xFF)
if (p_attr->len > 0xFF) {
len += 3;
@ -935,6 +937,7 @@ UINT16 sdpu_get_attrib_entry_len(tSDP_ATTRIBUTE *p_attr)
{
len += 2;
}
}
len += p_attr->len;
return len;
}

View file

@ -241,25 +241,25 @@ static uint_8t gf_inv(const uint_8t x)
}
for ( ; ; ) {
if (n1)
if (n1) {
while (n2 >= n1) { /* divide polynomial p2 by p1 */
n2 /= n1; /* shift smaller polynomial left */
p2 ^= (p1 * n2) & 0xff; /* and remove from larger one */
v2 ^= (v1 * n2); /* shift accumulated value and */
n2 = hibit(p2); /* add into result */
}
else {
} else {
return v1;
}
if (n2) /* repeat with values swapped */
if (n2) { /* repeat with values swapped */
while (n1 >= n2) {
n1 /= n2;
p1 ^= p2 * n1;
v1 ^= v2 * n1;
n1 = hibit(p1);
}
else {
} else {
return v2;
}
}

View file

@ -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.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,
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
}
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_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,
&le_key, TRUE);
}
smp_key_distribution_by_transport(p_cb, NULL);
}
@ -526,7 +528,7 @@ uint16_t smp_get_auth_mode (tSMP_ASSO_MODEL model)
auth = 0;
}
return auth;
}
}
/*******************************************************************************
** Function smp_proc_pair_cmd
@ -735,7 +737,7 @@ void smp_process_pairing_public_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
STREAM_TO_ARRAY(p_cb->peer_publ_key.x, p, BT_OCTET32_LEN);
STREAM_TO_ARRAY(p_cb->peer_publ_key.y, p, BT_OCTET32_LEN);
/* In order to prevent the x and y coordinates of the public key from being modified,
/* In order to prevent the x and y coordinates of the public key from being modified,
we need to check whether the x and y coordinates are on the given elliptic curve. */
if (!ECC_CheckPointIsInElliCur_P256((Point *)&p_cb->peer_publ_key)) {
SMP_TRACE_ERROR("%s, Invalid Public key.", __func__);
@ -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.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_LE_KEY_PENC,
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
}
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);
/* 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,
(tBTM_LE_KEY_VALUE *)&pid_key, TRUE);
}
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 */
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_LE_KEY_PCSRK,
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
}
smp_key_distribution_by_transport(p_cb, NULL);
}
@ -1939,10 +1944,10 @@ void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable)
}
smp_sm_event(&smp_cb, SMP_ENCRYPTED_EVT, &encr_enable);
}
else if(p_dev_rec && !p_dev_rec->enc_init_by_we){
}
else if(p_dev_rec && !p_dev_rec->enc_init_by_we){
/*
/*
if enc_init_by_we is false, it means that client initiates encryption before slave calls esp_ble_set_encryption()
we need initiate pairing_bda and p_cb->role then encryption, for example iPhones
*/