summaryrefslogtreecommitdiffstats
path: root/stack/btm
diff options
context:
space:
mode:
Diffstat (limited to 'stack/btm')
-rw-r--r--stack/btm/btm_acl.c110
-rw-r--r--stack/btm/btm_ble.c240
-rw-r--r--stack/btm/btm_ble_addr.c98
-rw-r--r--stack/btm/btm_ble_bgconn.c96
-rw-r--r--stack/btm/btm_ble_gap.c290
-rw-r--r--stack/btm/btm_ble_int.h44
-rw-r--r--stack/btm/btm_dev.c53
-rw-r--r--stack/btm/btm_devctl.c127
-rw-r--r--stack/btm/btm_inq.c266
-rw-r--r--stack/btm/btm_int.h66
-rw-r--r--stack/btm/btm_main.c35
-rw-r--r--stack/btm/btm_pm.c65
-rw-r--r--stack/btm/btm_sco.c123
-rw-r--r--[-rwxr-xr-x]stack/btm/btm_sec.c125
14 files changed, 953 insertions, 785 deletions
diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c
index 4dd229c..e3ac11b 100644
--- a/stack/btm/btm_acl.c
+++ b/stack/btm/btm_acl.c
@@ -1,19 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_acl.c
-**
-** Description: This file contains functions that handle ACL connections.
-** This includes operations such as hold and sniff modes,
-** supported packet types.
-**
-** This module contains both internal and external (API)
-** functions. External (API) functions are distinguishable
-** by their names beginning with uppercase BTM.
-**
-**
-** Copyright (c) 2000-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2000-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions that handle ACL connections. This includes
+ * operations such as hold and sniff modes, supported packet types.
+ *
+ ******************************************************************************/
#include <stdlib.h>
#include <string.h>
@@ -131,7 +139,7 @@ UINT8 btm_handle_to_acl_index (UINT16 hci_handle)
** Returns void
**
*******************************************************************************/
-void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
+void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
UINT16 hci_handle, UINT8 link_role, UINT8 is_le_link)
{
tBTM_SEC_DEV_REC *p_dev_rec;
@@ -194,10 +202,10 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
{
BTM_TRACE_DEBUG1 ("device_type=0x%x", p_dev_rec->device_type);
}
-#endif
+#endif
- if (p_dev_rec
+ if (p_dev_rec
#if (BLE_INCLUDED == TRUE)
&& p_dev_rec->device_type != BT_DEVICE_TYPE_BLE
#endif
@@ -213,7 +221,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
if (p_dev_rec->features[yy])
{
memcpy (p->features, p_dev_rec->features, BD_FEATURES_LEN);
- if (BTM_SEC_MODE_SP == btm_cb.security_mode &&
+ if (BTM_SEC_MODE_SP == btm_cb.security_mode &&
HCI_SIMPLE_PAIRING_SUPPORTED(p->features))
{
/* if SM4 supported, check peer support for SM4
@@ -237,7 +245,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
btm_establish_continue(p);
if (link_role == HCI_ROLE_MASTER)
- {
+ {
btm_ble_update_bg_state();
btm_ble_resume_bg_conn (NULL, FALSE);
@@ -337,7 +345,7 @@ void btm_acl_removed (BD_ADDR bda)
#if (defined BLE_INCLUDED && BLE_INCLUDED == TRUE)
- BTM_TRACE_DEBUG4 ("acl hci_handle=%d is_le_link=%d connectable_mode=0x%0x link_role=%d",
+ BTM_TRACE_DEBUG4 ("acl hci_handle=%d is_le_link=%d connectable_mode=0x%0x link_role=%d",
p->hci_handle,
p->is_le_link,
btm_cb.ble_ctr_cb.inq_var.connectable_mode,
@@ -380,7 +388,7 @@ void btm_acl_removed (BD_ADDR bda)
}
else
{
- BTM_TRACE_DEBUG0("Bletooth link down");
+ BTM_TRACE_DEBUG0("Bletooth link down");
p_dev_rec->sec_flags &= ~(BTM_SEC_AUTHORIZED | BTM_SEC_AUTHENTICATED | BTM_SEC_ENCRYPTED | BTM_SEC_ROLE_SWITCHED);
}
BTM_TRACE_DEBUG1("after update p_dev_rec->sec_flags=0x%x", p_dev_rec->sec_flags);
@@ -530,7 +538,7 @@ tBTM_STATUS BTM_GetRole (BD_ADDR remote_bd_addr, UINT8 *p_role)
** Function BTM_SwitchRole
**
** Description This function is called to switch role between master and
-** slave. If role is already set it will do nothing. If the
+** slave. If role is already set it will do nothing. If the
** command was initiated, the callback function is called upon
** completion.
**
@@ -626,7 +634,7 @@ tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr, UINT8 new_role, tBTM_CMPL_CB
/* Coverity FALSE-POSITIVE error from Coverity tool. Please do NOT remove following comment. */
/* coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode
the other data members of tBTM_PM_PWR_MD are ignored
-*/
+*/
settings.mode = BTM_PM_MD_ACTIVE;
status = BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p->remote_addr, &settings);
if (status != BTM_CMD_STARTED)
@@ -671,7 +679,7 @@ tBTM_STATUS BTM_SwitchRole (BD_ADDR remote_bd_addr, UINT8 new_role, tBTM_CMPL_CB
if (p_cb)
{
memcpy (btm_cb.devcb.switch_role_ref_data.remote_bd_addr, remote_bd_addr,
- BD_ADDR_LEN);
+ BD_ADDR_LEN);
btm_cb.devcb.switch_role_ref_data.role = new_role;
/* initialized to an error code */
btm_cb.devcb.switch_role_ref_data.hci_status = HCI_ERR_UNSUPPORTED_VALUE;
@@ -736,7 +744,7 @@ tBTM_STATUS BTM_ChangeLinkKey (BD_ADDR remote_bd_addr, tBTM_CMPL_CB *p_cb)
/* Coverity: FALSE-POSITIVE error from Coverity tool. Please do NOT remove following comment. */
/* coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode
the other data members of tBTM_PM_PWR_MD are ignored
-*/
+*/
settings.mode = BTM_PM_MD_ACTIVE;
status = BTM_SetPowerMode (BTM_PM_SET_ONLY_ID, p->remote_addr, &settings);
if (status != BTM_CMD_STARTED)
@@ -770,7 +778,7 @@ tBTM_STATUS BTM_ChangeLinkKey (BD_ADDR remote_bd_addr, tBTM_CMPL_CB *p_cb)
/* Initialize return structure in case request fails */
memcpy (btm_cb.devcb.chg_link_key_ref_data.remote_bd_addr, remote_bd_addr,
- BD_ADDR_LEN);
+ BD_ADDR_LEN);
btm_cb.devcb.p_chg_link_key_cb = p_cb;
return(BTM_CMD_STARTED);
}
@@ -843,7 +851,7 @@ void btm_acl_link_key_change (UINT16 handle, UINT8 status)
**
** Function btm_acl_encrypt_change
**
-** Description This function is when encryption of the connection is
+** Description This function is when encryption of the connection is
** completed by the LM. Checks to see if a role switch or
** change of link key was active and initiates or continues
** process if needed.
@@ -930,7 +938,7 @@ void btm_acl_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable)
BTM_TRACE_WARNING0("btm_acl_encrypt_change -> Issuing delayed HCI_Disconnect!!!");
btsnd_hcic_disconnect(p_dev_rec->hci_handle, HCI_ERR_PEER_USER);
}
- BTM_TRACE_ERROR2("btm_acl_encrypt_change: tBTM_SEC_DEV:0x%x rs_disc_pending=%d",
+ BTM_TRACE_ERROR2("btm_acl_encrypt_change: tBTM_SEC_DEV:0x%x rs_disc_pending=%d",
(UINT32)p_dev_rec, p_dev_rec->rs_disc_pending);
p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
}
@@ -1216,7 +1224,7 @@ void btm_read_remote_features_complete (UINT8 *p)
memcpy (p_dev_rec->features, p_acl_cb->features, BD_FEATURES_LEN);
- if (BTM_SEC_MODE_SP == btm_cb.security_mode &&
+ if (BTM_SEC_MODE_SP == btm_cb.security_mode &&
HCI_SIMPLE_PAIRING_SUPPORTED(p_acl_cb->features))
{
/* if SM4 supported, check peer support for SM4
@@ -1375,10 +1383,10 @@ static void btm_establish_continue (tACL_CONN *p_acl_cb)
btm_acl_update_busy_level (BTM_BLI_ACL_UP_EVT);
#else
if (btm_cb.p_acl_changed_cb)
- (*btm_cb.p_acl_changed_cb) (p_acl_cb->remote_addr,
- p_acl_cb->remote_dc,
- p_acl_cb->remote_name,
- p_acl_cb->features,
+ (*btm_cb.p_acl_changed_cb) (p_acl_cb->remote_addr,
+ p_acl_cb->remote_dc,
+ p_acl_cb->remote_name,
+ p_acl_cb->features,
TRUE);
#endif
}
@@ -1421,7 +1429,7 @@ tBTM_STATUS BTM_SetLinkSuperTout (BD_ADDR remote_bda, UINT16 timeout)
/* Only send if current role is Master; 2.0 spec requires this */
if (p->link_role == BTM_ROLE_MASTER)
{
- if (!btsnd_hcic_write_link_super_tout (LOCAL_BR_EDR_CONTROLLER_ID,
+ if (!btsnd_hcic_write_link_super_tout (LOCAL_BR_EDR_CONTROLLER_ID,
p->hci_handle, timeout))
return(BTM_NO_RESOURCES);
@@ -1812,7 +1820,7 @@ BOOLEAN BTM_IsAclConnectionUp (BD_ADDR remote_bda)
**
** Function BTM_GetNumAclLinks
**
-** Description This function is called to count the number of
+** Description This function is called to count the number of
** ACL links that are active.
**
** Returns UINT16 Number of active ACL links
@@ -2098,7 +2106,7 @@ UINT8 BTM_AllocateSCN(void)
** Function BTM_TryAllocateSCN
**
** Description Try to allocate a fixed server channel
-**
+**
** Returns Returns TRUE if server channel was available
**
*******************************************************************************/
@@ -2119,7 +2127,7 @@ BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
btm_cb.btm_scn[scn-1] = TRUE;
return TRUE;
}
-
+
return (FALSE); /* Port was busy */
}
@@ -2291,7 +2299,7 @@ UINT16 btm_get_max_packet_size (BD_ADDR addr)
#ifdef BRCM_VS
/* Using HCI size 1017 instead of 1021 */
- if ((pkt_size == HCI_EDR3_DH5_PACKET_SIZE)
+ if ((pkt_size == HCI_EDR3_DH5_PACKET_SIZE)
&& (btu_cb.hcit_acl_data_size == 1017))
pkt_size = 1017;
#endif
@@ -2423,7 +2431,7 @@ tBTM_STATUS BTM_SetQoS (BD_ADDR bd, FLOW_SPEC *p_flow, tBTM_CMPL_CB *p_cb)
btu_start_timer (&btm_cb.devcb.qossu_timer, BTU_TTYPE_BTM_ACL, BTM_DEV_REPLY_TIMEOUT);
btm_cb.devcb.p_qossu_cmpl_cb = p_cb;
- if (!btsnd_hcic_qos_setup (p->hci_handle, p_flow->qos_flags, p_flow->service_type,
+ if (!btsnd_hcic_qos_setup (p->hci_handle, p_flow->qos_flags, p_flow->service_type,
p_flow->token_rate, p_flow->peak_bandwidth, p_flow->latency,p_flow->delay_variation))
{
btm_cb.devcb.p_qossu_cmpl_cb = NULL;
@@ -2469,7 +2477,7 @@ void btm_qos_setup_complete (UINT8 status, UINT16 handle, FLOW_SPEC *p_flow)
qossu.flow.token_rate = p_flow->token_rate;
qossu.flow.peak_bandwidth = p_flow->peak_bandwidth;
qossu.flow.latency = p_flow->latency;
- qossu.flow.delay_variation = p_flow->delay_variation;
+ qossu.flow.delay_variation = p_flow->delay_variation;
}
BTM_TRACE_DEBUG1 ("BTM: p_flow->delay_variation: 0x%02x",
qossu.flow.delay_variation);
@@ -2571,8 +2579,8 @@ tBTM_STATUS BTM_ReadLinkQuality (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
**
** Function BTM_ReadTxPower
**
-** Description This function is called to read the current
-** TX power of the connection. The tx power level results
+** Description This function is called to read the current
+** TX power of the connection. The tx power level results
** are returned in the callback.
** (tBTM_RSSI_RESULTS)
**
@@ -2608,7 +2616,7 @@ tBTM_STATUS BTM_ReadTxPower (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
memcpy(btm_cb.devcb.read_tx_pwr_addr, remote_bda, BD_ADDR_LEN);
ret = btsnd_hcic_ble_read_adv_chnl_tx_power();
}
- else
+ else
#endif
{
ret = btsnd_hcic_read_tx_power (p->hci_handle, BTM_READ_RSSI_TYPE_CUR);
@@ -2656,7 +2664,7 @@ void btm_read_tx_power_complete (UINT8 *p, BOOLEAN is_ble)
if (results.hci_status == HCI_SUCCESS)
{
results.status = BTM_SUCCESS;
-
+
if (!is_ble)
{
STREAM_TO_UINT16 (handle, p);
@@ -2871,7 +2879,7 @@ void btm_cont_rswitch_or_chglinkkey (tACL_CONN *p, tBTM_SEC_DEV_REC *p_dev_rec,
BOOLEAN sw_ok = TRUE;
BOOLEAN chlk_ok = TRUE;
BTM_TRACE_DEBUG0 ("btm_cont_rswitch_or_chglinkkey ");
- /* Check to see if encryption needs to be turned off if pending
+ /* Check to see if encryption needs to be turned off if pending
change of link key or role switch */
if (p->switch_role_state == BTM_ACL_SWKEY_STATE_MODE_CHANGE ||
p->change_key_state == BTM_ACL_SWKEY_STATE_MODE_CHANGE)
@@ -3102,13 +3110,13 @@ void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type)
/* 3 and 5 slot packets? */
if (!HCI_3_SLOT_PACKETS_SUPPORTED(p->features))
*p_pkt_type &= ~(BTM_ACL_PKT_TYPES_MASK_DH3 +BTM_ACL_PKT_TYPES_MASK_DM3);
-
+
if (!HCI_5_SLOT_PACKETS_SUPPORTED(p->features))
*p_pkt_type &= ~(BTM_ACL_PKT_TYPES_MASK_DH5 + BTM_ACL_PKT_TYPES_MASK_DM5);
- /* If HCI version > 2.0, then also check EDR packet types */
+ /* If HCI version > 2.0, then also check EDR packet types */
if (btm_cb.devcb.local_version.hci_version >= HCI_PROTO_VERSION_2_0)
- {
+ {
/* 2 and 3 MPS support? */
if (!HCI_EDR_ACL_2MPS_SUPPORTED(p->features))
/* Not supported. Add 'not_supported' mask for all 2MPS packet types */
@@ -3118,7 +3126,7 @@ void btm_acl_chk_peer_pkt_type_support (tACL_CONN *p, UINT16 *p_pkt_type)
/* 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? */
+ /* EDR 3 and 5 slot support? */
if (HCI_EDR_ACL_2MPS_SUPPORTED(p->features) || HCI_EDR_ACL_3MPS_SUPPORTED(p->features))
{
if (!HCI_3_SLOT_EDR_ACL_SUPPORTED(p->features))
diff --git a/stack/btm/btm_ble.c b/stack/btm/btm_ble.c
index e34b8e2..74b5767 100644
--- a/stack/btm/btm_ble.c
+++ b/stack/btm/btm_ble.c
@@ -1,15 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_ble.c
-**
-** Description: This file contains functions for BLE device control utilities,
-** and LE security functions.
-**
-**
-**
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions for BLE device control utilities, and LE
+ * security functions.
+ *
+ ******************************************************************************/
#include <string.h>
@@ -47,7 +59,7 @@ static void btm_ble_update_active_bgconn_scan_params(void);
** Returns TRUE if added OK, else FALSE
**
*******************************************************************************/
-BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE dev_type,
+BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE dev_type,
tBLE_ADDR_TYPE addr_type)
{
#if BLE_INCLUDED == TRUE
@@ -78,9 +90,9 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
p_dev_rec->hci_handle = BTM_GetHCIConnHandle (bd_addr);
/* update conn params, use default value for background connection params */
- p_dev_rec->conn_params.min_conn_int =
- p_dev_rec->conn_params.max_conn_int =
- p_dev_rec->conn_params.supervision_tout =
+ p_dev_rec->conn_params.min_conn_int =
+ p_dev_rec->conn_params.max_conn_int =
+ p_dev_rec->conn_params.supervision_tout =
p_dev_rec->conn_params.slave_latency = BTM_BLE_CONN_PARAM_UNDEF;
BTM_TRACE_DEBUG1 ("hci_handl=0x%x ", p_dev_rec->hci_handle );
@@ -106,7 +118,7 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
}
p_dev_rec->device_type = dev_type;
p_dev_rec->ble.ble_addr_type = addr_type;
- BTM_TRACE_DEBUG3 ("p_dev_rec->device_type =0x%x addr_type=0x%x sec_flags=0x%x",
+ BTM_TRACE_DEBUG3 ("p_dev_rec->device_type =0x%x addr_type=0x%x sec_flags=0x%x",
dev_type, addr_type, p_dev_rec->sec_flags);
/* sync up with the Inq Data base*/
@@ -115,7 +127,7 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
{
p_info->results.ble_addr_type = p_dev_rec->ble.ble_addr_type ;
p_info->results.device_type = p_dev_rec->device_type;
- BTM_TRACE_DEBUG2 ("InqDb device_type =0x%x addr_type=0x%x",
+ BTM_TRACE_DEBUG2 ("InqDb device_type =0x%x addr_type=0x%x",
p_info->results.device_type, p_info->results.ble_addr_type);
}
@@ -127,8 +139,8 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d
**
** Function BTM_SecAddBleKey
**
-** Description Add/modify LE device information. This function will be
-** normally called during host startup to restore all required
+** Description Add/modify LE device information. This function will be
+** normally called during host startup to restore all required
** information stored in the NVRAM.
**
** Parameters: bd_addr - BD address of the peer
@@ -144,7 +156,7 @@ BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_
tBTM_SEC_DEV_REC *p_dev_rec;
BTM_TRACE_DEBUG0 ("BTM_SecAddBleKey");
p_dev_rec = btm_find_dev (bd_addr);
- if (!p_dev_rec || !p_le_key ||
+ if (!p_dev_rec || !p_le_key ||
(key_type != BTM_LE_KEY_PENC && key_type != BTM_LE_KEY_PID &&
key_type != BTM_LE_KEY_PCSRK && key_type != BTM_LE_KEY_LENC))
{
@@ -168,7 +180,7 @@ BOOLEAN BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_
#endif
- return(TRUE);
+ return(TRUE);
}
/*******************************************************************************
@@ -299,8 +311,8 @@ void BTM_ReadConnectionAddr (BD_ADDR conn_addr)
** Description This function is called to grant security process.
**
** Parameters bd_addr - peer device bd address.
-** res - result of the operation BTM_SUCCESS if success.
-** Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts.
+** res - result of the operation BTM_SUCCESS if success.
+** Otherwise, BTM_REPEATED_ATTEMPTS is too many attempts.
**
** Returns None
**
@@ -322,7 +334,7 @@ void BTM_SecurityGrant(BD_ADDR bd_addr, UINT8 res)
** passkey request to the application.
**
** Parameters: bd_addr - Address of the device for which passkey was requested
-** res - result of the operation BTM_SUCCESS if success
+** res - result of the operation BTM_SUCCESS if success
** key_len - length in bytes of the Passkey
** p_passkey - pointer to array with the passkey
** trusted_mask - bitwise OR of trusted services (array of UINT32)
@@ -348,7 +360,7 @@ void BTM_BlePasskeyReply (BD_ADDR bd_addr, UINT8 res, UINT32 passkey)
** SMP in response to BTM_LE_OOB_REQ_EVT
**
** Parameters: bd_addr - Address of the peer device
-** res - result of the operation SMP_SUCCESS if success
+** res - result of the operation SMP_SUCCESS if success
** p_data - simple pairing Randomizer C.
**
*******************************************************************************/
@@ -398,8 +410,8 @@ void BTM_BleSetConnScanParams (UINT16 scan_interval, UINT16 scan_window)
p_ble_cb->scan_win = scan_window;
new_param = TRUE;
}
-
- if (new_param)
+
+ if (new_param)
btm_ble_update_active_bgconn_scan_params();
}
else
@@ -426,7 +438,7 @@ void BTM_BleSetConnScanParams (UINT16 scan_interval, UINT16 scan_window)
** Returns void
**
*******************************************************************************/
-void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
+void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
UINT16 min_conn_int, UINT16 max_conn_int,
UINT16 slave_latency, UINT16 supervision_tout)
{
@@ -486,8 +498,8 @@ void BTM_BleSetPrefConnParams (BD_ADDR bd_addr,
**
** Function BTM_ReadDevInfo
**
-** Description This function is called to read the device/address type
-** of BD address.
+** Description This function is called to read the device/address type
+** of BD address.
**
** Parameter remote_bda: remote device address
** p_dev_type: output parameter to read the device type.
@@ -499,7 +511,7 @@ void BTM_ReadDevInfo (BD_ADDR remote_bda, tBT_DEVICE_TYPE *p_dev_type, tBLE_ADDR
#if BLE_INCLUDED == TRUE
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (remote_bda);
tBTM_INQ_INFO *p_inq_info = BTM_InqDbRead(remote_bda);
-
+
*p_dev_type = BT_DEVICE_TYPE_BREDR;
*p_addr_type = BLE_ADDR_PUBLIC;
@@ -566,7 +578,7 @@ static void btm_ble_update_active_bgconn_scan_params(void)
btm_ble_start_select_conn(TRUE, p_select_cback);
}
}
- return;
+ return;
}
/*******************************************************************************
@@ -654,7 +666,7 @@ void btm_ble_increment_sign_ctr(BD_ADDR bd_addr, BOOLEAN is_local )
else
p_dev_rec->ble.keys.counter++;
BTM_TRACE_DEBUG3 ("is_local=%d local sign counter=%d peer sign counter=%d",
- is_local,
+ is_local,
p_dev_rec->ble.keys.local_counter,
p_dev_rec->ble.keys.counter);
}
@@ -727,7 +739,7 @@ BOOLEAN btm_get_local_div (BD_ADDR bd_addr, UINT16 *p_div)
** Returns void
**
*******************************************************************************/
-void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys,
+void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY_VALUE *p_keys,
BOOLEAN pass_to_application)
{
tBTM_SEC_DEV_REC *p_rec;
@@ -750,20 +762,20 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY
memcpy(p_rec->ble.keys.rand, p_keys->penc_key.rand, BT_OCTET8_LEN);
p_rec->ble.keys.sec_level = p_keys->penc_key.sec_level;
p_rec->ble.keys.ediv = p_keys->penc_key.ediv;
- p_rec->ble.keys.key_size = p_keys->penc_key.key_size;
+ p_rec->ble.keys.key_size = p_keys->penc_key.key_size;
p_rec->ble.key_type |= BTM_LE_KEY_PENC;
p_rec->sec_flags |= BTM_SEC_LINK_KEY_KNOWN;
if (p_keys->penc_key.sec_level == SMP_SEC_AUTHENTICATED)
p_rec->sec_flags |= BTM_SEC_LINK_KEY_AUTHED;
else
p_rec->sec_flags &= ~BTM_SEC_LINK_KEY_AUTHED;
- BTM_TRACE_DEBUG3("BTM_LE_KEY_PENC key_type=0x%x sec_flags=0x%x sec_leve=0x%x",
- p_rec->ble.key_type,
+ BTM_TRACE_DEBUG3("BTM_LE_KEY_PENC key_type=0x%x sec_flags=0x%x sec_leve=0x%x",
+ p_rec->ble.key_type,
p_rec->sec_flags,
p_rec->ble.keys.sec_level);
break;
- case BTM_LE_KEY_PID:
+ case BTM_LE_KEY_PID:
memcpy(p_rec->ble.keys.irk, p_keys->pid_key, BT_OCTET16_LEN);
p_rec->ble.key_type |= BTM_LE_KEY_PID;
BTM_TRACE_DEBUG1("BTM_LE_KEY_PID key_type=0x%x save peer IRK", p_rec->ble.key_type);
@@ -780,8 +792,8 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY
else
p_rec->sec_flags &= ~BTM_SEC_LINK_KEY_AUTHED;
- BTM_TRACE_DEBUG4("BTM_LE_KEY_PCSRK key_type=0x%x sec_flags=0x%x sec_level=0x%x peer_counter=%d",
- p_rec->ble.key_type,
+ BTM_TRACE_DEBUG4("BTM_LE_KEY_PCSRK key_type=0x%x sec_flags=0x%x sec_level=0x%x peer_counter=%d",
+ p_rec->ble.key_type,
p_rec->sec_flags,
p_rec->ble.keys.srk_sec_level,
p_rec->ble.keys.counter );
@@ -790,11 +802,11 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY
case BTM_LE_KEY_LENC:
p_rec->ble.keys.div = p_keys->lenc_key.div; /* update DIV */
p_rec->ble.keys.sec_level = p_keys->lenc_key.sec_level;
- p_rec->ble.keys.key_size = p_keys->lenc_key.key_size;
+ p_rec->ble.keys.key_size = p_keys->lenc_key.key_size;
p_rec->ble.key_type |= BTM_LE_KEY_LENC;
- BTM_TRACE_DEBUG4("BTM_LE_KEY_LENC key_type=0x%x DIV=0x%x key_size=0x%x sec_level=0x%x",
- p_rec->ble.key_type,
+ BTM_TRACE_DEBUG4("BTM_LE_KEY_LENC key_type=0x%x DIV=0x%x key_size=0x%x sec_level=0x%x",
+ p_rec->ble.key_type,
p_rec->ble.keys.div,
p_rec->ble.keys.key_size,
p_rec->ble.keys.sec_level );
@@ -805,8 +817,8 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY
p_rec->ble.keys.local_csrk_sec_level = p_keys->lcsrk_key.sec_level;
p_rec->ble.keys.local_counter = p_keys->lcsrk_key.counter;
p_rec->ble.key_type |= BTM_LE_KEY_LCSRK;
- BTM_TRACE_DEBUG4("BTM_LE_KEY_LCSRK key_type=0x%x DIV=0x%x scrk_sec_level=0x%x local_counter=%d",
- p_rec->ble.key_type,
+ BTM_TRACE_DEBUG4("BTM_LE_KEY_LCSRK key_type=0x%x DIV=0x%x scrk_sec_level=0x%x local_counter=%d",
+ p_rec->ble.key_type,
p_rec->ble.keys.div,
p_rec->ble.keys.local_csrk_sec_level,
p_rec->ble.keys.local_counter );
@@ -818,7 +830,7 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY
}
BTM_TRACE_DEBUG3 ("BLE key type 0x%02x updated for BDA: %08x%04x (btm_sec_save_le_key)", key_type,
- (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
+ (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
(bd_addr[4]<<8)+bd_addr[5]);
/* Notify the application that one of the BLE keys has been updated
@@ -834,7 +846,7 @@ void btm_sec_save_le_key(BD_ADDR bd_addr, tBTM_LE_KEY_TYPE key_type, tBTM_LE_KEY
}
BTM_TRACE_WARNING3 ("BLE key type 0x%02x called for Unknown BDA or type: %08x%04x !! (btm_sec_save_le_key)", key_type,
- (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
+ (bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8)+bd_addr[3],
(bd_addr[4]<<8)+bd_addr[5]);
if (p_rec)
@@ -899,11 +911,11 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr);
UINT8 req_sec_level, cur_sec_level;
- BTM_TRACE_DEBUG1 ("btm_ble_link_sec_check auth_req =0x%x", auth_req);
+ BTM_TRACE_DEBUG1 ("btm_ble_link_sec_check auth_req =0x%x", auth_req);
if (p_dev_rec == NULL)
{
- BTM_TRACE_ERROR0 ("btm_ble_link_sec_check received for unknown device");
+ BTM_TRACE_ERROR0 ("btm_ble_link_sec_check received for unknown device");
return;
}
@@ -939,7 +951,7 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
else
cur_sec_level = BTM_LE_SEC_NONE;
}
-
+
if (cur_sec_level >= req_sec_level)
{
if (cur_sec_level == BTM_LE_SEC_NONE)
@@ -965,7 +977,7 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
BTM_TRACE_DEBUG3("cur_sec_level=%d req_sec_level=%d sec_req_act=%d",
cur_sec_level,
req_sec_level,
- *p_sec_req_act);
+ *p_sec_req_act);
}
@@ -973,7 +985,7 @@ void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE
**
** Function btm_ble_set_encryption
**
-** Description This function is called to ensure that LE connection is
+** Description This function is called to ensure that LE connection is
** encrypted. Should be called only on an open connection.
** Typically only needed for connections that first want to
** bring up unencrypted links, then later encrypt them.
@@ -1006,7 +1018,7 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin
if (link_role == BTM_ROLE_MASTER)
{
/* start link layer encryption using the security info stored */
- btm_ble_start_encrypt(bd_addr, FALSE, NULL);
+ btm_ble_start_encrypt(bd_addr, FALSE, NULL);
p_rec->sec_state = BTM_SEC_STATE_ENCRYPTING;
cmd = BTM_CMD_STARTED;
break;
@@ -1018,7 +1030,7 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin
if (SMP_Pair(bd_addr) == SMP_STARTED)
{
- cmd = BTM_CMD_STARTED;
+ cmd = BTM_CMD_STARTED;
p_rec->sec_state = BTM_SEC_STATE_AUTHENTICATING;
}
break;
@@ -1036,8 +1048,8 @@ tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, void *p_ref_data, UINT8 lin
**
** Description This function is called when encryption request is received
** on a slave device.
-**
-**
+**
+**
** Returns void
**
*******************************************************************************/
@@ -1064,8 +1076,8 @@ void btm_ble_ltk_request(UINT16 handle, UINT8 rand[8], UINT16 ediv)
** Function btm_ble_start_encrypt
**
** Description This function is called to start LE encryption.
-**
-**
+**
+**
** Returns void
**
*******************************************************************************/
@@ -1092,19 +1104,19 @@ BOOLEAN btm_ble_start_encrypt(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
}
else
{
- if (!btsnd_hcic_ble_start_enc(p_rec->hci_handle, p_rec->ble.keys.rand,
+ if (!btsnd_hcic_ble_start_enc(p_rec->hci_handle, p_rec->ble.keys.rand,
p_rec->ble.keys.ediv, p_rec->ble.keys.ltk))
return FALSE;
}
return TRUE;
-}
+}
/*******************************************************************************
**
** Function btm_ble_link_encrypted
**
** Description This function is called when LE link encrption status is changed.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1179,7 +1191,7 @@ static void btm_enc_proc_slave_y(tSMP_ENC *p)
BTM_TRACE_DEBUG0 ("LTK request OK");
/* calculating LTK , LTK = E er(div) */
SMP_Encrypt(p_cb->devcb.er, BT_OCTET16_LEN, (UINT8 *)&div, 2, &output);
- btm_enc_proc_ltk(&output);
+ btm_enc_proc_ltk(&output);
}
else
{
@@ -1190,15 +1202,15 @@ static void btm_enc_proc_slave_y(tSMP_ENC *p)
}
}
-}
+}
/*******************************************************************************
**
** Function btm_ble_ltk_request_reply
**
-** Description This function is called to send a LTK request reply on a slave
+** Description This function is called to send a LTK request reply on a slave
** device.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1226,18 +1238,18 @@ void btm_ble_ltk_request_reply(BD_ADDR bda, BOOLEAN use_stk, BT_OCTET16 stk)
else /* calculate LTK using peer device */
{
/* generate Y= Encrypt(DHK, Rand) received from encrypt request */
- SMP_Encrypt(p_cb->devcb.id_keys.dhk, BT_OCTET16_LEN, p_cb->enc_rand,
+ SMP_Encrypt(p_cb->devcb.id_keys.dhk, BT_OCTET16_LEN, p_cb->enc_rand,
BT_OCTET8_LEN, &output);
btm_enc_proc_slave_y(&output);
}
-}
+}
/*******************************************************************************
**
** Function btm_ble_io_capabilities_req
**
** Description This function is called to handle SMP get IO capability request.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1258,7 +1270,7 @@ UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p
{
p_data->auth_req &= BTM_LE_AUTH_REQ_MASK;
- BTM_TRACE_DEBUG2 ("btm_ble_io_capabilities_req 1: p_dev_rec->security_required = %d auth_req:%d",
+ BTM_TRACE_DEBUG2 ("btm_ble_io_capabilities_req 1: p_dev_rec->security_required = %d auth_req:%d",
p_dev_rec->security_required, p_data->auth_req);
BTM_TRACE_DEBUG2 ("btm_ble_io_capabilities_req 2: i_keys=0x%x r_keys=0x%x (bit 0-LTK 1-IRK 2-CSRK)",
p_data->init_keys,
@@ -1280,7 +1292,7 @@ UINT8 btm_ble_io_capabilities_req(tBTM_SEC_DEV_REC *p_dev_rec, tBTM_LE_IO_REQ *p
p_data->init_keys,
p_data->resp_keys);
- BTM_TRACE_DEBUG2 ("btm_ble_io_capabilities_req 5: p_data->io_cap = %d auth_req:%d",
+ BTM_TRACE_DEBUG2 ("btm_ble_io_capabilities_req 5: p_data->io_cap = %d auth_req:%d",
p_data->io_cap, p_data->auth_req);
/* remove MITM protection requirement if IO cap does not allow it */
@@ -1328,7 +1340,7 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
}
else
{
- BTM_TRACE_ERROR0 ("btm_proc_smp_cback: btm_cb.api.p_le_callback ==NULL");
+ BTM_TRACE_ERROR0 ("btm_proc_smp_cback: btm_cb.api.p_le_callback ==NULL");
}
if (event == SMP_COMPLT_EVT)
@@ -1337,7 +1349,7 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
res = (p_data->cmplt.reason == SMP_SUCCESS) ? BTM_SUCCESS : BTM_ERR_PROCESSING;
- BTM_TRACE_DEBUG3 ("after update result=%d sec_level=0x%x sec_flags=0x%x",
+ BTM_TRACE_DEBUG3 ("after update result=%d sec_level=0x%x sec_flags=0x%x",
res, p_data->cmplt.sec_level , p_dev_rec->sec_flags );
btm_sec_dev_rec_cback_event(p_dev_rec, res);
@@ -1366,12 +1378,12 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
btm_remove_acl(bd_addr);
#endif
- BTM_TRACE_DEBUG3 ("btm_cb pairing_state=%x pairing_flags=%x pin_code_len=%x",
- btm_cb.pairing_state,
+ BTM_TRACE_DEBUG3 ("btm_cb pairing_state=%x pairing_flags=%x pin_code_len=%x",
+ btm_cb.pairing_state,
btm_cb.pairing_flags,
btm_cb.pin_code_len );
BTM_TRACE_DEBUG6 ("btm_cb.pairing_bda %02x:%02x:%02x:%02x:%02x:%02x",
- btm_cb.pairing_bda[0], btm_cb.pairing_bda[1], btm_cb.pairing_bda[2],
+ btm_cb.pairing_bda[0], btm_cb.pairing_bda[1], btm_cb.pairing_bda[2],
btm_cb.pairing_bda[3], btm_cb.pairing_bda[4], btm_cb.pairing_bda[5]);
memset (btm_cb.pairing_bda, 0xff, BD_ADDR_LEN);
@@ -1407,14 +1419,14 @@ UINT8 btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data)
**
** Parameter bd_addr: target device the data to be signed for.
** p_text: singing data
-** len: length of the data to be signed.
-** signature: output parameter where data signature is going to
-** be stored.
+** len: length of the data to be signed.
+** signature: output parameter where data signature is going to
+** be stored.
**
** Returns TRUE if signing sucessul, otherwise FALSE.
**
*******************************************************************************/
-BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
+BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
BLE_SIGNATURE signature)
{
BOOLEAN ret = FALSE;
@@ -1428,7 +1440,7 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
UINT16 r=1;
UINT8 *p=temp, *p_mac = (UINT8 *)signature;
tSMP_ENC output;
- BT_OCTET16 local_csrk;
+ BT_OCTET16 local_csrk;
BTM_TRACE_DEBUG0 ("BTM_BleDataSignature");
if (p_rec == NULL)
@@ -1439,7 +1451,7 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
{
if ((p_buf = (UINT8 *)GKI_getbuf((UINT16)(len + 4))) != NULL)
{
- BTM_TRACE_DEBUG0("Start to generate Local CSRK");
+ BTM_TRACE_DEBUG0("Start to generate Local CSRK");
/* prepare plain text */
if (p_text)
{
@@ -1472,30 +1484,30 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
if (!SMP_Encrypt(er, BT_OCTET16_LEN, temp, 4, &output))
{
- BTM_TRACE_ERROR0("Local CSRK generation failed ");
+ BTM_TRACE_ERROR0("Local CSRK generation failed ");
}
else
{
- BTM_TRACE_DEBUG0("local CSRK generation success");
- memcpy((void *)local_csrk, output.param_buf, BT_OCTET16_LEN);
+ BTM_TRACE_DEBUG0("local CSRK generation success");
+ memcpy((void *)local_csrk, output.param_buf, BT_OCTET16_LEN);
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
if (btm_cb.devcb.enable_test_local_sign_cntr)
{
- UINT32_TO_STREAM(p_mac, btm_cb.devcb.test_local_sign_cntr);
+ UINT32_TO_STREAM(p_mac, btm_cb.devcb.test_local_sign_cntr);
}
else
{
- UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
+ UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
}
#else
- UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
+ UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
#endif
if ((ret = AES_CMAC(local_csrk, p_buf, (UINT16)(len + 4), BTM_CMAC_TLEN_SIZE, p_mac)) == TRUE)
{
- btm_ble_increment_sign_ctr(bd_addr, TRUE);
+ btm_ble_increment_sign_ctr(bd_addr, TRUE);
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
if ( btm_cb.devcb.enable_test_mac_val)
@@ -1506,9 +1518,9 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
#endif
}
BTM_TRACE_DEBUG1("BTM_BleDataSignature p_mac = %d", p_mac);
- BTM_TRACE_DEBUG4("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x",
+ BTM_TRACE_DEBUG4("p_mac[0] = 0x%02x p_mac[1] = 0x%02x p_mac[2] = 0x%02x p_mac[3] = 0x%02x",
*p_mac, *(p_mac + 1), *(p_mac + 2), *(p_mac + 3));
- BTM_TRACE_DEBUG4("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x",
+ BTM_TRACE_DEBUG4("p_mac[4] = 0x%02x p_mac[5] = 0x%02x p_mac[6] = 0x%02x p_mac[7] = 0x%02x",
*(p_mac + 4), *(p_mac + 5), *(p_mac + 6), *(p_mac + 7));
GKI_freebuf(p_buf);
@@ -1528,9 +1540,9 @@ BOOLEAN BTM_BleDataSignature (BD_ADDR bd_addr, UINT8 *p_text, UINT16 len,
**
** Parameter bd_addr: target device the data to be signed for.
** p_orig: original data before signature.
-** len: length of the signing data
+** len: length of the signing data
** counter: counter used when doing data signing
-** p_comp: signature to be compared against.
+** p_comp: signature to be compared against.
** Returns TRUE if signature verified correctly; otherwise FALSE.
**
@@ -1558,7 +1570,7 @@ BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, UINT16 len, UINT
else
{
BTM_TRACE_DEBUG2 ("BTM_BleVerifySignature rcv_cnt=%d >= expected_cnt=%d", counter, p_rec->ble.keys.counter);
-
+
if (AES_CMAC(p_rec->ble.keys.csrk, p_orig, len, BTM_CMAC_TLEN_SIZE, p_mac))
{
if (memcmp(p_mac, p_comp, BTM_CMAC_TLEN_SIZE) == 0)
@@ -1580,9 +1592,9 @@ BOOLEAN BTM_BleVerifySignature (BD_ADDR bd_addr, UINT8 *p_orig, UINT16 len, UINT
**
** Function btm_notify_new_key
**
-** Description This function is to notify application new keys have been
+** Description This function is to notify application new keys have been
** generated.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1621,7 +1633,7 @@ static void btm_notify_new_key(UINT8 key_type)
**
** Description This function is called when ER is generated, store it in
** local control block.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1647,7 +1659,7 @@ static void btm_ble_process_er2(tBTM_RAND_ENC *p)
**
** Description This function is called when ER is generated, store it in
** local control block.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1677,7 +1689,7 @@ static void btm_ble_process_er(tBTM_RAND_ENC *p)
**
** Description This function is called when IRK is generated, store it in
** local control block.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1706,9 +1718,9 @@ static void btm_ble_process_irk(tSMP_ENC *p)
** Function btm_ble_process_dhk
**
** Description This function is called when DHK is calculated, store it in
-** local control block, and proceed to generate ER, a 128-bits
+** local control block, and proceed to generate ER, a 128-bits
** random number.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1726,7 +1738,7 @@ static void btm_ble_process_dhk(tSMP_ENC *p)
BTM_TRACE_DEBUG0("BLE DHK generated.");
/* IRK = D1(IR, 1) */
- if (!SMP_Encrypt(btm_cb.devcb.id_keys.ir, BT_OCTET16_LEN, &btm_ble_irk_pt,
+ if (!SMP_Encrypt(btm_cb.devcb.id_keys.ir, BT_OCTET16_LEN, &btm_ble_irk_pt,
1, &output))
{
/* reset all identity root related key */
@@ -1751,7 +1763,7 @@ static void btm_ble_process_dhk(tSMP_ENC *p)
**
** Description This function is called when IR is generated, proceed to calculate
** DHK = Eir({0x03, 0, 0 ...})
-**
+**
**
** Returns void
**
@@ -1771,9 +1783,9 @@ static void btm_ble_process_ir2(tBTM_RAND_ENC *p)
/* generate DHK= Eir({0x03, 0x00, 0x00 ...}) */
- SMP_Encrypt(btm_cb.devcb.id_keys.ir, BT_OCTET16_LEN, &btm_ble_dhk_pt,
- 1, &output);
- btm_ble_process_dhk(&output);
+ SMP_Encrypt(btm_cb.devcb.id_keys.ir, BT_OCTET16_LEN, &btm_ble_dhk_pt,
+ 1, &output);
+ btm_ble_process_dhk(&output);
BTM_TRACE_DEBUG0("BLE IR generated.");
}
@@ -1790,7 +1802,7 @@ static void btm_ble_process_ir2(tBTM_RAND_ENC *p)
**
** Description This function is called when IR is generated, proceed to calculate
** DHK = Eir({0x02, 0, 0 ...})
-**
+**
**
** Returns void
**
@@ -1817,7 +1829,7 @@ static void btm_ble_process_ir(tBTM_RAND_ENC *p)
** Function btm_ble_reset_id
**
** Description This function is called to reset LE device identity.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1837,9 +1849,9 @@ void btm_ble_reset_id( void )
**
** Function btm_ble_set_no_disc_if_pair_fail
**
-** Description This function indicates that whether no disconnect of the ACL
+** Description This function indicates that whether no disconnect of the ACL
** should be used if pairing failed
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1854,7 +1866,7 @@ void btm_ble_set_no_disc_if_pair_fail(BOOLEAN disable_disc )
** Function btm_ble_set_test_mac_value
**
** Description This function set test MAC value
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1870,16 +1882,16 @@ void btm_ble_set_test_mac_value(BOOLEAN enable, UINT8 *p_test_mac_val )
** Function btm_ble_set_test_local_sign_cntr_value
**
** Description This function set test local sign counter value
-**
+**
** Returns void
**
*******************************************************************************/
void btm_ble_set_test_local_sign_cntr_value(BOOLEAN enable, UINT32 test_local_sign_cntr )
{
- BTM_TRACE_DEBUG2 ("btm_ble_set_test_local_sign_cntr_value enable=%d local_sign_cntr=%d",
+ BTM_TRACE_DEBUG2 ("btm_ble_set_test_local_sign_cntr_value enable=%d local_sign_cntr=%d",
enable, test_local_sign_cntr);
btm_cb.devcb.enable_test_local_sign_cntr = enable;
- btm_cb.devcb.test_local_sign_cntr = test_local_sign_cntr;
+ btm_cb.devcb.test_local_sign_cntr = test_local_sign_cntr;
}
#endif /* BTM_BLE_CONFORMANCE_TESTING */
diff --git a/stack/btm/btm_ble_addr.c b/stack/btm/btm_ble_addr.c
index 08a3018..04872f9 100644
--- a/stack/btm/btm_ble_addr.c
+++ b/stack/btm/btm_ble_addr.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: btm_ble_addr.c
-**
-** Description: This file contains functions for BLE address management.
-**
-**
-**
-** Copyright (c) 1999-2010, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions for BLE address management.
+ *
+ ******************************************************************************/
#include <string.h>
@@ -26,22 +38,22 @@
**
** Function btm_gen_resolve_paddr_cmpl
**
-** Description This is callback functioin when resolvable private address
+** Description This is callback functioin when resolvable private address
** generation is complete.
-**
+**
** Returns void
**
*******************************************************************************/
-static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
+static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
{
tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
tBTM_BLE_INQ_CB *p_inq_cb = &btm_cb.ble_ctr_cb.inq_var;
BTM_TRACE_EVENT0 ("btm_gen_resolve_paddr_cmpl");
if (p && p->param_buf)
{
- /* get the high bytes of the random address */
- p_cb->private_addr[2] = p->param_buf[0];
- p_cb->private_addr[1] = p->param_buf[1];
+ /* get the high bytes of the random address */
+ p_cb->private_addr[2] = p->param_buf[0];
+ p_cb->private_addr[1] = p->param_buf[1];
p_cb->private_addr[0] = p->param_buf[2];
/* mask off the 1st MSB */
p_cb->private_addr[0] &= 0xfe;
@@ -54,8 +66,8 @@ static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
/* start a periodical timer to refresh random addr */
btu_stop_timer(&p_cb->raddr_timer_ent);
- btu_start_timer (&p_cb->raddr_timer_ent, BTU_TTYPE_BLE_RANDOM_ADDR,
- BTM_BLE_PRIVATE_ADDR_INT);
+ btu_start_timer (&p_cb->raddr_timer_ent, BTU_TTYPE_BLE_RANDOM_ADDR,
+ BTM_BLE_PRIVATE_ADDR_INT);
/* if adv is active, restart adv with new private addr */
if (p_inq_cb->adv_mode == BTM_BLE_ADV_ENABLE)
@@ -63,12 +75,12 @@ static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_DISABLE);
btsnd_hcic_ble_write_adv_params (p_inq_cb->adv_interval_min,
- p_inq_cb->adv_interval_max,
- p_inq_cb->evt_type,
- p_inq_cb->own_addr_type,
- p_inq_cb->direct_bda.type,
+ p_inq_cb->adv_interval_max,
+ p_inq_cb->evt_type,
+ p_inq_cb->own_addr_type,
+ p_inq_cb->direct_bda.type,
p_inq_cb->direct_bda.bda,
- p_inq_cb->adv_chnl_map,
+ p_inq_cb->adv_chnl_map,
p_inq_cb->afp);
}
}
@@ -84,7 +96,7 @@ static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p)
**
** Description This function is called when random address has generate the
** random number base for low 3 byte bd address.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -97,8 +109,8 @@ static void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p)
BTM_TRACE_EVENT0 ("btm_gen_resolve_paddr_low");
if (p && p->param_buf)
{
- p_cb->private_addr[5] = p->param_buf[0];
- p_cb->private_addr[4] = p->param_buf[1];
+ p_cb->private_addr[5] = p->param_buf[0];
+ p_cb->private_addr[4] = p->param_buf[1];
p_cb->private_addr[3] = p->param_buf[2];
/* encrypt with ur IRK */
@@ -133,9 +145,9 @@ void btm_gen_resolvable_private_addr (void)
**
** Function btm_gen_non_resolve_paddr_cmpl
**
-** Description This is the callback function when non-resolvable private
+** Description This is the callback function when non-resolvable private
** function is generated and write to controller.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -157,7 +169,7 @@ static void btm_gen_non_resolve_paddr_cmpl(tBTM_RAND_ENC *p)
}
else
{
- BTM_TRACE_DEBUG0("btm_gen_non_resolvable_private_addr failed");
+ BTM_TRACE_DEBUG0("btm_gen_non_resolvable_private_addr failed");
}
}
/*******************************************************************************
@@ -165,7 +177,7 @@ static void btm_gen_non_resolve_paddr_cmpl(tBTM_RAND_ENC *p)
** Function btm_gen_non_resolvable_private_addr
**
** Description This function generate a non-resolvable private address.
-**
+**
**
** Returns void
**
@@ -188,7 +200,7 @@ void btm_gen_non_resolvable_private_addr (void)
**
** Description This function sends the random address resolving complete
** callback.
-**
+**
** Returns None.
**
*******************************************************************************/
@@ -211,7 +223,7 @@ static void btm_ble_resolve_address_cmpl(void)
**
** Description This function compares the X with random address 3 MSO bytes
** to find a match, if not match, continue for next record.
-**
+**
** Returns None.
**
*******************************************************************************/
@@ -243,8 +255,8 @@ static BOOLEAN btm_ble_proc_resolve_x(tSMP_ENC *p)
**
** Description This function match the random address to the appointed device
** record, starting from calculating IRK. If record index exceed
-** the maximum record number, matching failed and send callback.
-**
+** the maximum record number, matching failed and send callback.
+**
** Returns None.
**
*******************************************************************************/
@@ -272,8 +284,8 @@ static BOOLEAN btm_ble_match_random_bda(UINT16 rec_index)
if ((p_dev_rec->device_type == BT_DEVICE_TYPE_BLE) &&
(p_dev_rec->ble.key_type & BTM_LE_KEY_PID))
{
- /* generate X = E irk(R0, R1, R2) and R is random address 3 LSO */
- SMP_Encrypt(p_dev_rec->ble.keys.irk, BT_OCTET16_LEN,
+ /* generate X = E irk(R0, R1, R2) and R is random address 3 LSO */
+ SMP_Encrypt(p_dev_rec->ble.keys.irk, BT_OCTET16_LEN,
&rand[0], 3, &output);
return btm_ble_proc_resolve_x(&output);
}
@@ -296,13 +308,13 @@ static BOOLEAN btm_ble_match_random_bda(UINT16 rec_index)
** Function btm_ble_resolve_random_addr
**
** Description This function is called to resolve a random address.
-**
-** Returns pointer to the security record of the device whom a random
+**
+** Returns pointer to the security record of the device whom a random
** address is matched to.
**
*******************************************************************************/
void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK * p_cback, void *p)
-{
+{
tBTM_LE_RANDOM_CB *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
BTM_TRACE_EVENT0 ("btm_ble_resolve_random_addr");
@@ -310,7 +322,7 @@ void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK * p_
{
p_mgnt_cb->p = p;
p_mgnt_cb->busy = TRUE;
- p_mgnt_cb->index = 0;
+ p_mgnt_cb->index = 0;
p_mgnt_cb->p_resolve_cback = p_cback;
memcpy(p_mgnt_cb->random_bda, random_bda, BD_ADDR_LEN);
/* start to resolve random address */
@@ -342,7 +354,7 @@ tBLE_ADDR_TYPE btm_ble_map_bda_to_conn_bda(BD_ADDR bd_addr)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
BTM_TRACE_EVENT0 ("btm_ble_map_bda_to_conn_bda");
- if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL &&
+ if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL &&
p_dev_rec->device_type == BT_DEVICE_TYPE_BLE)
{
if (p_dev_rec->ble.ble_addr_type != BLE_ADDR_PUBLIC)
@@ -358,7 +370,7 @@ tBLE_ADDR_TYPE btm_ble_map_bda_to_conn_bda(BD_ADDR bd_addr)
**
** Function btm_ble_map_bda_to_pseudo_bda
**
-** Description This function map a BD address to a pseudo address when the
+** Description This function map a BD address to a pseudo address when the
** address given is a random address.
**
*******************************************************************************/
diff --git a/stack/btm/btm_ble_bgconn.c b/stack/btm/btm_ble_bgconn.c
index bf574ab..aa002e8 100644
--- a/stack/btm/btm_ble_bgconn.c
+++ b/stack/btm/btm_ble_bgconn.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: btm_ble_bgconn.c
-**
-** Description: This file contains functions for BLE whitelist operation.
-**
-**
-**
-** Copyright (c) 1999-2010, Broadcom Corp., All Rights Reserved.
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions for BLE whitelist operation.
+ *
+ ******************************************************************************/
#include <string.h>
@@ -33,12 +45,12 @@ void btm_update_scanner_filter_policy(tBTM_BLE_SFP scan_policy)
{
tBTM_BLE_INQ_CB *p_inq = &btm_cb.ble_ctr_cb.inq_var;
BTM_TRACE_EVENT0 ("btm_update_scanner_filter_policy");
- btm_cb.ble_ctr_cb.inq_var.sfp = scan_policy;
+ btm_cb.ble_ctr_cb.inq_var.sfp = scan_policy;
btsnd_hcic_ble_set_scan_params ((UINT8)((p_inq->scan_type == BTM_BLE_SCAN_MODE_NONE) ? BTM_BLE_SCAN_MODE_ACTI: p_inq->scan_type),
- (UINT16)(!p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval),
+ (UINT16)(!p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval),
(UINT16)(!p_inq->scan_window ? BTM_BLE_GAP_DISC_SCAN_WIN : p_inq->scan_window),
- BLE_ADDR_PUBLIC,
+ BLE_ADDR_PUBLIC,
scan_policy);
}
/*******************************************************************************
@@ -65,7 +77,7 @@ BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
tBTM_SEC_DEV_REC *p_dev_rec;
BD_ADDR dummy_bda = {0};
- BOOLEAN started = FALSE, suspend = FALSE;
+ BOOLEAN started = FALSE, suspend = FALSE;
if (btm_cb.btm_inq_vars.inq_active)
{
@@ -73,7 +85,7 @@ BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_
btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE);
}
- if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL &&
+ if ((p_dev_rec = btm_find_dev (bd_addr)) != NULL &&
p_dev_rec->device_type == BT_DEVICE_TYPE_BLE)
{
BTM_TRACE_DEBUG0("btm_update_dev_to_white_list 1");
@@ -87,7 +99,7 @@ BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_
if ( p_dev_rec->ble.ble_addr_type == BLE_ADDR_PUBLIC)
- {
+ {
if (to_add)
started = btsnd_hcic_ble_add_white_list (BLE_ADDR_PUBLIC, bd_addr);
else
@@ -152,7 +164,7 @@ void btm_ble_clear_white_list_complete(UINT8 *p_data, UINT16 evt_len)
UINT8 status;
BTM_TRACE_EVENT0 ("btm_ble_clear_white_list_complete");
STREAM_TO_UINT8 (status, p_data);
-
+
if (status == HCI_SUCCESS)
p_cb->num_empty_filter = p_cb->max_filter_entries;
@@ -281,7 +293,7 @@ BOOLEAN btm_update_bg_conn_list(BOOLEAN to_add, BD_ADDR bd_addr)
**
** Function btm_write_bg_conn_wl
**
-** Description This function write background connection device list into
+** Description This function write background connection device list into
** controller.
*******************************************************************************/
void btm_write_bg_conn_wl(void)
@@ -304,8 +316,8 @@ void btm_write_bg_conn_wl(void)
**
** Description This function is to start/stop auto connection procedure.
**
-** Parameters start: TRUE to start; FALSE to stop.
-**
+** Parameters start: TRUE to start; FALSE to stop.
+**
** Returns void
**
*******************************************************************************/
@@ -318,7 +330,7 @@ BOOLEAN btm_ble_start_auto_conn(BOOLEAN start)
scan_int = (p_cb->scan_int == BTM_BLE_CONN_PARAM_UNDEF) ? BTM_BLE_CONN_EST_SCAN_INT : p_cb->scan_int;
scan_win = (p_cb->scan_win == BTM_BLE_CONN_PARAM_UNDEF) ? BTM_BLE_CONN_EST_SCAN_WIND : p_cb->scan_win;
-
+
if (start)
{
if (!l2cb.is_ble_connecting &&
@@ -331,7 +343,7 @@ BOOLEAN btm_ble_start_auto_conn(BOOLEAN start)
0x01, /* UINT8 white_list */
BLE_ADDR_PUBLIC, /* UINT8 addr_type_peer */
dummy_bda, /* BD_ADDR bda_peer */
- BLE_ADDR_PUBLIC, /* UINT8 addr_type_own */
+ BLE_ADDR_PUBLIC, /* UINT8 addr_type_own */
BTM_BLE_CONN_INT_MIN_DEF, /* UINT16 conn_int_min */
BTM_BLE_CONN_INT_MAX_DEF, /* UINT16 conn_int_max */
BTM_BLE_CONN_SLAVE_LATENCY_DEF, /* UINT16 conn_latency */
@@ -349,7 +361,7 @@ BOOLEAN btm_ble_start_auto_conn(BOOLEAN start)
}
}
else
- exec = FALSE;
+ exec = FALSE;
}
else
{
@@ -370,10 +382,10 @@ BOOLEAN btm_ble_start_auto_conn(BOOLEAN start)
**
** Description This function is to start/stop selective connection procedure.
**
-** Parameters start: TRUE to start; FALSE to stop.
-** p_select_cback: callback function to return application
+** Parameters start: TRUE to start; FALSE to stop.
+** p_select_cback: callback function to return application
** selection.
-**
+**
** Returns BOOLEAN: selective connectino procedure is started.
**
*******************************************************************************/
@@ -388,7 +400,7 @@ BOOLEAN btm_ble_start_select_conn(BOOLEAN start,tBTM_BLE_SEL_CBACK *p_select_c
scan_win = (p_cb->scan_win == BTM_BLE_CONN_PARAM_UNDEF) ? BTM_BLE_CONN_EST_SCAN_WIND : p_cb->scan_win;
if (start)
- {
+ {
if (!btm_cb.btm_inq_vars.inq_active)
{
btm_cb.ble_ctr_cb.p_select_cback = p_select_cback;
@@ -408,7 +420,7 @@ BOOLEAN btm_ble_start_select_conn(BOOLEAN start,tBTM_BLE_SEL_CBACK *p_select_c
BTM_TRACE_ERROR0("peripheral device cannot initiate a selective connection");
return FALSE;
}
- else if (p_cb->bg_conn_dev_num > 0 && btm_ble_count_unconn_dev_in_whitelist() > 0 )
+ else if (p_cb->bg_conn_dev_num > 0 && btm_ble_count_unconn_dev_in_whitelist() > 0 )
{
if (!btsnd_hcic_ble_set_scan_enable(TRUE, TRUE)) /* duplicate filtering enabled */
@@ -451,10 +463,10 @@ BOOLEAN btm_ble_start_select_conn(BOOLEAN start,tBTM_BLE_SEL_CBACK *p_select_c
**
** Description This function is to start/stop selective connection procedure.
**
-** Parameters start: TRUE to start; FALSE to stop.
-** p_select_cback: callback function to return application
+** Parameters start: TRUE to start; FALSE to stop.
+** p_select_cback: callback function to return application
** selection.
-**
+**
** Returns BOOLEAN: selective connectino procedure is started.
**
*******************************************************************************/
@@ -478,7 +490,7 @@ void btm_ble_initiate_select_conn(BD_ADDR bda)
** procedure.
**
** Parameters none.
-**
+**
** Returns none.
**
*******************************************************************************/
@@ -501,7 +513,7 @@ void btm_ble_suspend_bg_sele_conn(void)
** procedure.
**
** Parameters none.
-**
+**
** Returns none.
**
*******************************************************************************/
@@ -520,7 +532,7 @@ void btm_ble_suspend_bg_conn(void)
**
** Function btm_ble_scan_param_idle
**
-** Description This function is to process the scan parameter idle timeout
+** Description This function is to process the scan parameter idle timeout
** timeout.
********************************************************************************/
void btm_ble_scan_param_idle(void)
@@ -535,7 +547,7 @@ void btm_ble_scan_param_idle(void)
** procedure.
**
** Parameters none.
-**
+**
** Returns none.
**
*******************************************************************************/
@@ -552,11 +564,11 @@ BOOLEAN btm_ble_resume_bg_conn(tBTM_BLE_SEL_CBACK *p_sele_callback, BOOLEAN def_
p_cb->scan_win = BTM_BLE_CONN_PARAM_UNDEF;
/* start scan param idle timer */
- btu_start_timer(&p_cb->scan_param_idle_timer,
- BTU_TTYPE_BLE_SCAN_PARAM_IDLE,
+ btu_start_timer(&p_cb->scan_param_idle_timer,
+ BTU_TTYPE_BLE_SCAN_PARAM_IDLE,
BTM_BLE_SCAN_PARAM_TOUT);
- }
-
+ }
+
if (p_cb->bg_conn_type == BTM_BLE_CONN_AUTO)
ret = btm_ble_start_auto_conn(TRUE);
@@ -575,7 +587,7 @@ BOOLEAN btm_ble_resume_bg_conn(tBTM_BLE_SEL_CBACK *p_sele_callback, BOOLEAN def_
if (ret)
p_cb->bg_conn_state = BLE_BG_CONN_ACTIVE;
-
+
}
return ret;
@@ -587,7 +599,7 @@ BOOLEAN btm_ble_resume_bg_conn(tBTM_BLE_SEL_CBACK *p_sele_callback, BOOLEAN def_
** Description This function is to update the bg connection status.
**
** Parameters none.
-**
+**
** Returns none.
**
*******************************************************************************/
diff --git a/stack/btm/btm_ble_gap.c b/stack/btm/btm_ble_gap.c
index 9092d5d..b9e17c0 100644
--- a/stack/btm/btm_ble_gap.c
+++ b/stack/btm/btm_ble_gap.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: btm_ble_gap.c
-**
-** Description: This file contains functions for BLE GAP.
-**
-**
-**
-** Copyright (c) 2008-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2008-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions for BLE GAP.
+ *
+ ******************************************************************************/
#include <string.h>
#include <stdio.h>
@@ -27,9 +39,9 @@
#define BTM_BLE_NAME_CMPL 0x02
#define BTM_BLE_FILTER_TARGET_UNKNOWN 0xff
-#define BTM_BLE_POLICY_UNKNOWN 0xff
+#define BTM_BLE_POLICY_UNKNOWN 0xff
-#define BLE_RESOLVE_ADDR_MSB 0x40 /* most significant bit, bit7, bit6 is 01 to be resolvable random */
+#define BLE_RESOLVE_ADDR_MSB 0x40 /* most significant bit, bit7, bit6 is 01 to be resolvable random */
#define BLE_RESOLVE_ADDR_MASK 0xc0 /* bit 6, and bit7 */
#define BTM_BLE_IS_RESOLVE_BDA(x) ((x[0] & BLE_RESOLVE_ADDR_MASK) == BLE_RESOLVE_ADDR_MSB)
@@ -60,7 +72,7 @@ static UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_ds
** Description This function is called to reset ULP controller.
**
** Parameters None.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -73,16 +85,16 @@ void BTM_BleReset(void)
**
** Function BTM_BleObserve
**
-** Description This procedure keep the device listening for advertising
-** events from a broadcast device.
+** Description This procedure keep the device listening for advertising
+** events from a broadcast device.
**
** Parameters start: start or stop observe.
** white_list: use white list in observer mode or not.
-**
+**
** Returns void
**
*******************************************************************************/
-tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
+tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
tBTM_INQ_RESULTS_CB *p_results_cb, tBTM_CMPL_CB *p_cmpl_cb)
{
tBTM_BLE_INQ_CB *p_inq = &btm_cb.ble_ctr_cb.inq_var;
@@ -100,7 +112,7 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
/* allow config scanning type */
if (btsnd_hcic_ble_set_scan_params ((UINT8)((p_inq->scan_type == BTM_BLE_SCAN_MODE_NONE) ? BTM_BLE_SCAN_MODE_ACTI: p_inq->scan_type),
- (UINT16)(!p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval),
+ (UINT16)(!p_inq->scan_interval ? BTM_BLE_GAP_DISC_SCAN_INT : p_inq->scan_interval),
(UINT16)(!p_inq->scan_window ? BTM_BLE_GAP_DISC_SCAN_WIN : p_inq->scan_window),
BLE_ADDR_PUBLIC,
BTM_BLE_DEFAULT_SFP)) /* assume observe always not using white list */
@@ -115,7 +127,7 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
if (duration != 0)
{
/* start inquiry timer */
- btu_start_timer (&p_inq->inq_timer_ent, BTU_TTYPE_BLE_INQUIRY, duration);
+ btu_start_timer (&p_inq->inq_timer_ent, BTU_TTYPE_BLE_INQUIRY, duration);
}
}
}
@@ -132,10 +144,10 @@ tBTM_STATUS BTM_BleObserve(BOOLEAN start, UINT8 duration,
**
** Function BTM_BleBroadcast
**
-** Description This function is to start or stop broadcasting.
+** Description This function is to start or stop broadcasting.
**
** Parameters start: start or stop broadcasting.
-**
+**
** Returns status.
**
*******************************************************************************/
@@ -143,12 +155,12 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
{
tBTM_STATUS status = BTM_NO_RESOURCES;
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
- UINT8 evt_type = p_cb->scan_rsp ? BTM_BLE_DISCOVER_EVT: BTM_BLE_NON_CONNECT_EVT;
+ UINT8 evt_type = p_cb->scan_rsp ? BTM_BLE_DISCOVER_EVT: BTM_BLE_NON_CONNECT_EVT;
#ifdef BTM_BLE_PC_ADV_TEST_MODE
if (BTM_BLE_PC_ADV_TEST_MODE)
{
- evt_type = p_cb->scan_rsp ? BTM_BLE_CONNECT_EVT: BTM_BLE_NON_CONNECT_EVT;
+ evt_type = p_cb->scan_rsp ? BTM_BLE_CONNECT_EVT: BTM_BLE_NON_CONNECT_EVT;
}
#endif
@@ -156,11 +168,11 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
{
/* update adv params */
if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min : BTM_BLE_GAP_ADV_INT),
- (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_INT),
- evt_type,
- p_cb->own_addr_type,
+ (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_INT),
+ evt_type,
+ p_cb->own_addr_type,
p_cb->direct_bda.type, p_cb->direct_bda.bda,
- p_cb->adv_chnl_map,
+ p_cb->adv_chnl_map,
p_cb->afp))
status = BTM_NO_RESOURCES;
@@ -186,7 +198,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
else
{
status = BTM_WRONG_MODE;
- BTM_TRACE_ERROR2("Can not %s Broadcast, device %s in Broadcast mode",
+ BTM_TRACE_ERROR2("Can not %s Broadcast, device %s in Broadcast mode",
(start ? "Start" : "Stop"), (start ? "alerady" :"not"));
}
@@ -203,12 +215,12 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start)
**
** Function BTM_RegisterScanReqEvt
**
-** Description This function is called to register a scan request callback
+** Description This function is called to register a scan request callback
** on the advertiser.
**
** Parameters p_scan_req_cback: scan request callback. If NULL, remove the
-** registration.
-**
+** registration.
+**
** Returns void
**
*******************************************************************************/
@@ -226,11 +238,11 @@ void BTM_RegisterScanReqEvt(tBTM_BLE_SCAN_REQ_CBACK *p_scan_req_cback)
**
** Function BTM_BleConfigPrivacy
**
-** Description This function is called to enable or disable the privacy in
+** Description This function is called to enable or disable the privacy in
** the local device.
**
-** Parameters enable: TRUE to enable it; FALSE to disable it.
-**
+** Parameters enable: TRUE to enable it; FALSE to disable it.
+**
** Returns void
**
*******************************************************************************/
@@ -245,17 +257,17 @@ void BTM_BleConfigPrivacy(BOOLEAN enable)
**
** Function BTM_BleSetBgConnType
**
-** Description This function is called to set BLE connectable mode for a
+** Description This function is called to set BLE connectable mode for a
** peripheral device.
**
-** Parameters bg_conn_type: it can be auto connection, or selective connection.
+** Parameters bg_conn_type: it can be auto connection, or selective connection.
** p_select_cback: callback function when selective connection procedure
** is being used.
-**
+**
** Returns void
**
*******************************************************************************/
-BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type,
+BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type,
tBTM_BLE_SEL_CBACK *p_select_cback)
{
BOOLEAN started = TRUE;
@@ -275,7 +287,7 @@ BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type,
{
btm_ble_start_auto_conn(FALSE);
}
- started = btm_ble_start_select_conn(TRUE, p_select_cback);
+ started = btm_ble_start_select_conn(TRUE, p_select_cback);
break;
case BTM_BLE_CONN_NONE:
@@ -313,7 +325,7 @@ BOOLEAN BTM_BleSetBgConnType(tBTM_BLE_CONN_TYPE bg_conn_type,
**
** Parameters add_remove: TRUE to add; FALSE to remove.
** remote_bda: device address to add/remove.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -366,12 +378,12 @@ BOOLEAN BTM_BleUpdateBgConnDev(BOOLEAN add_remove, BD_ADDR remote_bda)
**
** Function BTM_BleSetConnMode
**
-** Description This function is called to set BLE connectable mode for a
+** Description This function is called to set BLE connectable mode for a
** peripheral device.
**
** Parameters directed: is directed connectable mode, or non-directed.
-** p_dir_bda: connectable direct initiator's LE device address
-**
+** p_dir_bda: connectable direct initiator's LE device address
+**
** Returns void
**
*******************************************************************************/
@@ -423,13 +435,13 @@ tBTM_STATUS BTM_BleSetConnMode(BOOLEAN directed, tBLE_BD_ADDR *p_dir_bda)
**
** Parameters adv_int_min: minimum advertising interval
** adv_int_max: maximum advertising interval
-** p_dir_bda: connectable direct initiator's LE device address
+** p_dir_bda: connectable direct initiator's LE device address
** chnl_map: advertising channel map.
-**
+**
** Returns void
**
*******************************************************************************/
-tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
+tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
tBLE_BD_ADDR *p_dir_bda,
tBTM_BLE_ADV_CHNL_MAP chnl_map)
{
@@ -474,16 +486,16 @@ tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
else
/* update adv params */
if (!btsnd_hcic_ble_write_adv_params (p_cb->adv_interval_min,
- p_cb->adv_interval_max,
- p_cb->evt_type,
- p_cb->own_addr_type,
- p_cb->direct_bda.type,
+ p_cb->adv_interval_max,
+ p_cb->evt_type,
+ p_cb->own_addr_type,
+ p_cb->direct_bda.type,
p_cb->direct_bda.bda,
- p_cb->adv_chnl_map,
+ p_cb->adv_chnl_map,
p_cb->afp))
status = BTM_NO_RESOURCES;
-
+
else if (!btsnd_hcic_ble_set_adv_enable (BTM_BLE_ADV_ENABLE))
{
p_cb->adv_mode = BTM_BLE_ADV_DISABLE;
@@ -504,9 +516,9 @@ tBTM_STATUS BTM_BleSetAdvParams(UINT16 adv_int_min, UINT16 adv_int_max,
**
** Parameters adv_int_min: minimum advertising interval
** adv_int_max: maximum advertising interval
-** p_dir_bda: connectable direct initiator's LE device address
+** p_dir_bda: connectable direct initiator's LE device address
** chnl_map: advertising channel map.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -536,10 +548,10 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
**
** Parameters adv_int_min: minimum advertising interval
** adv_int_max: maximum advertising interval
-** p_dir_bda: connectable direct initiator's LE device address
+** p_dir_bda: connectable direct initiator's LE device address
** chnl_map: advertising channel map.
** scan_type: active scan or passive scan
-**
+**
** Returns void
**
*******************************************************************************/
@@ -548,7 +560,7 @@ void BTM_BleSetScanParams(UINT16 scan_interval, UINT16 scan_window, tBTM_BLE_SCA
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
BTM_TRACE_EVENT0 (" BTM_BleSetScanParams");
-
+
if (BTM_BLE_VALID_PRAM(scan_interval, BTM_BLE_SCAN_INT_MIN, BTM_BLE_SCAN_INT_MAX) &&
BTM_BLE_VALID_PRAM(scan_window, BTM_BLE_SCAN_WIN_MIN, BTM_BLE_SCAN_WIN_MAX) &&
(scan_mode == BTM_BLE_SCAN_MODE_ACTI || scan_mode == BTM_BLE_SCAN_MODE_PASS))
@@ -563,7 +575,7 @@ void BTM_BleSetScanParams(UINT16 scan_interval, UINT16 scan_window, tBTM_BLE_SCA
}
else
{
- BTM_TRACE_ERROR2("Illegal params: scan_interval = %d scan_window = %d",
+ BTM_TRACE_ERROR2("Illegal params: scan_interval = %d scan_window = %d",
scan_interval, scan_window);
}
@@ -576,14 +588,14 @@ void BTM_BleSetScanParams(UINT16 scan_interval, UINT16 scan_window, tBTM_BLE_SCA
** Description This function is called to write LE scan response.
**
** Parameters: p_scan_rsp: scan response information.
-**
+**
** Returns void
**
*******************************************************************************/
tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p_data)
{
tBTM_STATUS status = BTM_NO_RESOURCES;
- UINT8 rsp_data[BTM_BLE_AD_DATA_LEN],
+ UINT8 rsp_data[BTM_BLE_AD_DATA_LEN],
*p = rsp_data;
BTM_TRACE_EVENT0 (" BTM_BleWriteScanRsp");
@@ -592,7 +604,7 @@ tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p
if (btsnd_hcic_ble_set_scan_rsp_data((UINT8)(p - rsp_data), rsp_data))
{
- status = BTM_SUCCESS;
+ status = BTM_SUCCESS;
if (p_data != NULL)
btm_cb.ble_ctr_cb.inq_var.scan_rsp = TRUE;
@@ -612,7 +624,7 @@ tBTM_STATUS BTM_BleWriteScanRsp(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p
** Description This function is called to write advertising data.
**
** Parameters: None.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -638,7 +650,7 @@ tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p
p_cb_data->data_mask &= ~mask;
- if (btsnd_hcic_ble_set_adv_data((UINT8)(p_cb_data->p_pad - p_cb_data->ad_data),
+ if (btsnd_hcic_ble_set_adv_data((UINT8)(p_cb_data->p_pad - p_cb_data->ad_data),
p_cb_data->ad_data))
return BTM_SUCCESS;
else
@@ -656,7 +668,7 @@ tBTM_STATUS BTM_BleWriteAdvData(tBTM_BLE_AD_MASK data_mask, tBTM_BLE_ADV_DATA *p
** type - finding ADV data type
** p_length - return the length of ADV data not including type
**
-** Returns pointer of ADV data
+** Returns pointer of ADV data
**
*******************************************************************************/
UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length)
@@ -695,7 +707,7 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length)
static UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_dst, tBTM_BLE_ADV_DATA *p_data)
{
UINT16 data_mask = *p_data_mask;
- UINT8 *p = *p_dst,
+ UINT8 *p = *p_dst,
*p_flag = NULL;
UINT16 len = BTM_BLE_AD_DATA_LEN, cp_len = 0;
UINT8 i = 0;
@@ -736,14 +748,14 @@ static UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_ds
cp_len = (UINT16)strlen(btm_cb.cfg.bd_name);
*p++ = cp_len + 1;
*p++ = BTM_BLE_AD_TYPE_NAME_CMPL;
- ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
+ ARRAY_TO_STREAM(p, btm_cb.cfg.bd_name, cp_len);
}
len -= (cp_len + 2);
data_mask &= ~BTM_BLE_AD_BIT_DEV_NAME;
}
/* manufacturer data */
- if (len > 2 && data_mask & BTM_BLE_AD_BIT_MANU &&
+ if (len > 2 && data_mask & BTM_BLE_AD_BIT_MANU &&
p_data && p_data->manu.len != 0 && p_data->manu.p_val)
{
if (p_data->manu.len > (len - 2))
@@ -777,13 +789,13 @@ static UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_ds
{
cp_len = (len - 2)/2;
*p ++ = 1 + cp_len * 2;
- *p++ = BTM_BLE_AD_TYPE_SRV_PART;
+ *p++ = BTM_BLE_AD_TYPE_SRV_PART;
}
else
{
cp_len = p_data->services.num_service;
*p++ = 1 + cp_len * 2;
- *p++ = BTM_BLE_AD_TYPE_SRV_CMPL;
+ *p++ = BTM_BLE_AD_TYPE_SRV_CMPL;
}
for (i = 0; i < cp_len; i ++)
{
@@ -820,7 +832,7 @@ static UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_ds
}
else
break;
- }
+ }
if (i == p_data->attr.num_attr)
data_mask &= ~BTM_BLE_AD_BIT_ATTR;
}
@@ -861,7 +873,7 @@ static UINT8 *btm_ble_build_adv_data(tBTM_BLE_AD_MASK *p_data_mask, UINT8 **p_ds
** Description This function is called to set BLE discoverable mode.
**
** Parameters: mode: discoverability mode.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -906,13 +918,13 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
{
BTM_TRACE_EVENT0 ("mode == BTM_BLE_NON_DISCOVERABLE ");
- if (p_cb->connectable_mode == BTM_BLE_NON_CONNECTABLE)
+ if (p_cb->connectable_mode == BTM_BLE_NON_CONNECTABLE)
{
p_cb->br_edr_supported_flag = 0;
BTM_TRACE_EVENT0 ("always disable adv in non-discoverable non-connectable mode if no scan rsp ");
if (!p_cb->scan_rsp )
- new_mode = BTM_BLE_ADV_DISABLE;
+ new_mode = BTM_BLE_ADV_DISABLE;
}
else
{
@@ -943,11 +955,11 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
/* update adv params */
if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min : BTM_BLE_GAP_ADV_INT),
- (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_INT),
- evt_type,
- p_cb->own_addr_type,
+ (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_INT),
+ evt_type,
+ p_cb->own_addr_type,
p_cb->direct_bda.type, p_cb->direct_bda.bda,
- p_cb->adv_chnl_map,
+ p_cb->adv_chnl_map,
p_cb->afp))
status = BTM_NO_RESOURCES;
@@ -969,8 +981,8 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
{
BTM_TRACE_EVENT1 ("start timer for limited disc mode duration=%d (30 secs)", BTM_BLE_GAP_LIM_TOUT);
/* start Tgap(lim_timeout) */
- btu_start_timer (&p_cb->inq_timer_ent, BTU_TTYPE_BLE_GAP_LIM_DISC,
- BTM_BLE_GAP_LIM_TOUT);
+ btu_start_timer (&p_cb->inq_timer_ent, BTU_TTYPE_BLE_GAP_LIM_DISC,
+ BTM_BLE_GAP_LIM_TOUT);
}
return status;
}
@@ -982,7 +994,7 @@ tBTM_STATUS btm_ble_set_discoverability(UINT16 combined_mode)
** Description This function is called to set BLE connectability mode.
**
** Parameters: mode: connectability mode.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -992,10 +1004,10 @@ tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode)
UINT16 mode = (combined_mode & BTM_BLE_CONNECTABLE_MASK);
UINT8 cur_flag = 0;
UINT8 cur_br_edr_not_sup_flag;
- UINT8 new_flag;
+ UINT8 new_flag;
UINT8 new_mode = BTM_BLE_ADV_ENABLE;
UINT8 evt_type = (p_cb->scan_rsp) ? BTM_BLE_DISCOVER_EVT: BTM_BLE_NON_CONNECT_EVT;
- tBTM_STATUS status = BTM_SUCCESS;
+ tBTM_STATUS status = BTM_SUCCESS;
BTM_TRACE_EVENT2 ("btm_ble_set_connectability mode=0x%0x combined_mode=0x%x", mode, combined_mode);
@@ -1051,12 +1063,12 @@ tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode)
}
if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min : BTM_BLE_GAP_ADV_INT),
- (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_INT),
- evt_type,
- p_cb->own_addr_type,
- p_cb->direct_bda.type,
+ (UINT16)(p_cb->adv_interval_max ? p_cb->adv_interval_max : BTM_BLE_GAP_ADV_INT),
+ evt_type,
+ p_cb->own_addr_type,
+ p_cb->direct_bda.type,
p_cb->direct_bda.bda,
- p_cb->adv_chnl_map,
+ p_cb->adv_chnl_map,
p_cb->afp))
status = BTM_NO_RESOURCES;
else
@@ -1088,7 +1100,7 @@ tBTM_STATUS btm_ble_set_connectability(UINT16 combined_mode)
** p_results_cb - callback returning pointer to results (tBTM_INQ_RESULTS)
** p_cmpl_cb - callback indicating the end of an inquiry
**
-**
+**
**
** Returns BTM_CMD_STARTED if successfully started
** BTM_ILLEGAL_VALUE if a bad parameter is detected
@@ -1117,15 +1129,15 @@ tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8 duration)
if (btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_ENABLE, BTM_BLE_DUPLICATE_DISABLE))
{
status = BTM_SUCCESS;
- p_inq->proc_mode = mode;
+ p_inq->proc_mode = mode;
if (duration != 0)
{
/* start inquiry timer */
- btu_start_timer (&p_inq->inq_timer_ent, BTU_TTYPE_BLE_INQUIRY, duration);
+ btu_start_timer (&p_inq->inq_timer_ent, BTU_TTYPE_BLE_INQUIRY, duration);
}
}
-
+
return status;
}
@@ -1134,7 +1146,7 @@ tBTM_STATUS btm_ble_start_inquiry (UINT8 mode, UINT8 duration)
** Function btm_ble_read_remote_name_cmpl
**
** Description This function is called when BLE remote name is received.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1159,11 +1171,11 @@ void btm_ble_read_remote_name_cmpl(BOOLEAN status, BD_ADDR bda, UINT16 length, c
**
** Function btm_ble_read_remote_name
**
-** Description This function read remote LE device name using GATT read
+** Description This function read remote LE device name using GATT read
** procedure.
**
** Parameters: None.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1205,7 +1217,7 @@ tBTM_STATUS btm_ble_read_remote_name(BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur, t
** Description This function cancel read remote LE device name.
**
** Parameters: None.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1231,7 +1243,7 @@ BOOLEAN btm_ble_cancel_remote_name(BD_ADDR remote_bda)
** data.
**
** Parameters: None.
-**
+**
** Returns void
**
*******************************************************************************/
@@ -1261,11 +1273,11 @@ static void btm_ble_update_adv_flag(UINT8 flag)
*p++ = 2;
*p++ = BTM_BLE_AD_TYPE_FLAG;
p_adv_data->p_flags = p;
- *p++ = flag;
+ *p++ = flag;
p_adv_data->p_pad = p;
}
- if (btsnd_hcic_ble_set_adv_data((UINT8)(p_adv_data->p_pad - p_adv_data->ad_data),
+ if (btsnd_hcic_ble_set_adv_data((UINT8)(p_adv_data->p_pad - p_adv_data->ad_data),
p_adv_data->ad_data))
p_adv_data->data_mask |= BTM_BLE_AD_BIT_FLAGS;
@@ -1281,12 +1293,12 @@ static void btm_ble_update_adv_flag(UINT8 flag)
** Returns pointer to entry, or NULL if not found
**
*******************************************************************************/
-static void btm_ble_parse_adv_data(tBTM_INQ_INFO *p_info, UINT8 *p_data,
+static void btm_ble_parse_adv_data(tBTM_INQ_INFO *p_info, UINT8 *p_data,
UINT8 len, tBTM_BLE_INQ_DATA *p_adv_data, UINT8 *p_buf)
{
UINT8 *p_cur = p_data;
UINT8 ad_len, ad_type, ad_flag;
- tBTM_BLE_ATTR *p_attr;
+ tBTM_BLE_ATTR *p_attr;
BTM_TRACE_EVENT0 (" btm_ble_parse_adv_data");
@@ -1312,7 +1324,7 @@ static void btm_ble_parse_adv_data(tBTM_INQ_INFO *p_info, UINT8 *p_data,
BTM_BLE_NAME_SHORT: BTM_BLE_NAME_CMPL;
memcpy(p_info->remote_name, p_cur, ad_len -1);
p_info->remote_name[ad_len] = 0;
- p_adv_data->p_remote_name = p_info->remote_name;
+ p_adv_data->p_remote_name = p_info->remote_name;
p_info->remote_name_len = p_adv_data->remote_name_len = ad_len - 1;
BTM_TRACE_DEBUG1("BTM_BLE_AD_TYPE_NAME name = %s",p_adv_data->p_remote_name);
}
@@ -1375,7 +1387,7 @@ static void btm_ble_parse_adv_data(tBTM_INQ_INFO *p_info, UINT8 *p_data,
**
** Function btm_ble_cache_adv_data
**
-** Description Update advertising cache data.
+** Description Update advertising cache data.
**
** Returns void
**
@@ -1421,7 +1433,7 @@ void btm_ble_cache_adv_data(tBTM_INQ_RESULTS *p_cur, UINT8 data_len, UINT8 *p, U
** Description check ADV flag to make sure device is discoverable and match
** the search condition
**
-** Parameters
+** Parameters
**
** Returns void
**
@@ -1448,14 +1460,14 @@ BOOLEAN btm_ble_is_discoverable(BD_ADDR bda, UINT8 evt_type, UINT8 *p)
BTM_TRACE_DEBUG0("BD ADDR does not meet filter condition");
return FALSE;
}
-
+
/* scan response does not include the flag */
if (evt_type == BTM_BLE_SCAN_RSP_EVT)
return FALSE;
if (data_len > BTM_BLE_ADV_DATA_LEN_MAX)
{
- BTM_TRACE_WARNING1("ADV data too long %d. discard", data_len);
+ BTM_TRACE_WARNING1("ADV data too long %d. discard", data_len);
return FALSE;
}
@@ -1464,30 +1476,30 @@ BOOLEAN btm_ble_is_discoverable(BD_ADDR bda, UINT8 evt_type, UINT8 *p)
if ((p_flag = BTM_CheckAdvData(p, BTM_BLE_AD_TYPE_FLAG, &data_len)) != NULL)
{
flag = * p_flag;
-
+
if ((btm_cb.ble_ctr_cb.inq_var.proc_mode == BTM_BLE_GENERAL_INQUIRY) &&
(flag & (BTM_BLE_LIMIT_DISC_FLAG|BTM_BLE_GEN_DISC_FLAG)) != 0)
{
- BTM_TRACE_DEBUG0("Find Generable Discoverable device");
+ BTM_TRACE_DEBUG0("Find Generable Discoverable device");
is_discoverable = TRUE;
}
else if (btm_cb.ble_ctr_cb.inq_var.proc_mode == BTM_BLE_LIMITED_INQUIRY &&
(flag & BTM_BLE_LIMIT_DISC_FLAG) != 0)
{
- BTM_TRACE_DEBUG0("Find limited discoverable device");
+ BTM_TRACE_DEBUG0("Find limited discoverable device");
is_discoverable = TRUE;
}
-
+
}
}
-
+
if (!is_discoverable)
{
BTM_TRACE_ERROR1("discoverable flag not desired: %d", flag);
}
- return is_discoverable;
+ return is_discoverable;
}
/*******************************************************************************
**
@@ -1495,7 +1507,7 @@ BOOLEAN btm_ble_is_discoverable(BD_ADDR bda, UINT8 evt_type, UINT8 *p)
**
** Description Update adv packet information into inquiry result.
**
-** Parameters
+** Parameters
**
** Returns void
**
@@ -1515,7 +1527,7 @@ BOOLEAN btm_ble_update_inq_result(tINQ_DB_ENT *p_i, UINT8 addr_type, UINT8 evt_t
if (data_len > BTM_BLE_ADV_DATA_LEN_MAX)
{
- BTM_TRACE_WARNING1("EIR data too long %d. discard", data_len);
+ BTM_TRACE_WARNING1("EIR data too long %d. discard", data_len);
return FALSE;
}
btm_ble_cache_adv_data(p_cur, data_len, p, evt_type);
@@ -1557,12 +1569,12 @@ BOOLEAN btm_ble_update_inq_result(tINQ_DB_ENT *p_i, UINT8 addr_type, UINT8 evt_t
/* if BR/EDR not supported is not set, assume is a DUMO device */
if ((p_cur->flag & BTM_BLE_BREDR_NOT_SPT) == 0)
{
- BTM_TRACE_ERROR0("BR/EDR NOT support bit not set, treat as DUMO");
+ BTM_TRACE_ERROR0("BR/EDR NOT support bit not set, treat as DUMO");
p_cur->device_type |= BT_DEVICE_TYPE_DUMO;
}
else
{
- BTM_TRACE_DEBUG0("BR/EDR NOT SUPPORT bit set, LE only device");
+ BTM_TRACE_DEBUG0("BR/EDR NOT SUPPORT bit set, LE only device");
}
return to_report;
@@ -1575,7 +1587,7 @@ BOOLEAN btm_ble_update_inq_result(tINQ_DB_ENT *p_i, UINT8 addr_type, UINT8 evt_t
**
** Description send selection connection request callback.
**
-** Parameters
+** Parameters
**
** Returns void
**
@@ -1585,13 +1597,13 @@ void btm_send_sel_conn_callback(BD_ADDR remote_bda, UINT8 evt_type, UINT8 *p_dat
UINT8 data_len, len;
UINT8 *p_dev_name, remname[31] = {0};
- if (btm_cb.ble_ctr_cb.p_select_cback == NULL ||
+ if (btm_cb.ble_ctr_cb.p_select_cback == NULL ||
/* non-connectable device */
(evt_type != BTM_BLE_EVT_CONN_ADV && evt_type != BTM_BLE_EVT_CONN_DIR_ADV))
return;
STREAM_TO_UINT8 (data_len, p_data);
-
+
/* get the device name if exist in ADV data */
if (data_len != 0)
{
@@ -1615,7 +1627,7 @@ void btm_send_sel_conn_callback(BD_ADDR remote_bda, UINT8 evt_type, UINT8 *p_dat
**
** Function btm_ble_resolve_random_addr_cmpl
**
-** Description resolve random address complete callback.
+** Description resolve random address complete callback.
**
** Returns void
**
@@ -1648,17 +1660,17 @@ static void btm_ble_resolve_random_addr_cmpl(void * p_rec, void *p)
btm_ble_process_adv_pkt_cont(bda, addr_type, evt_type, pp);
return;
-}
+}
/*******************************************************************************
**
** Function btm_ble_process_adv_pkt
**
-** Description This function is called when adv packet report events are
-** received from the device. It updates the inquiry database.
+** Description This function is called when adv packet report events are
+** received from the device. It updates the inquiry database.
** If the inquiry database is full, the oldest entry is discarded.
**
-** Parameters
+** Parameters
**
** Returns void
**
@@ -1688,9 +1700,9 @@ void btm_ble_process_adv_pkt (UINT8 *p_data)
#endif
/* Only process the results if the inquiry is still active */
- if (!btm_cb.btm_inq_vars.inq_active &&
+ if (!btm_cb.btm_inq_vars.inq_active &&
(btm_cb.ble_ctr_cb.bg_conn_type != BTM_BLE_CONN_SELECTIVE ||
- /* or selective auto connection is active */
+ /* or selective auto connection is active */
btm_cb.ble_ctr_cb.p_select_cback == NULL))
return;
@@ -1709,10 +1721,10 @@ void btm_ble_process_adv_pkt (UINT8 *p_data)
**
** Function btm_ble_process_adv_pkt_cont
**
-** Description This function is called after random address resolution is
+** Description This function is called after random address resolution is
** done, and proceed to process adv packet.
**
-** Parameters
+** Parameters
**
** Returns void
**
@@ -1731,11 +1743,11 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
if (btm_inq_find_bdaddr(bda))
{
/* never been report as an LE device */
- if ((p_i &&
+ if ((p_i &&
(!(p_i->inq_info.results.device_type & BT_DEVICE_TYPE_BLE) ||
/* scan repsonse to be updated */
(!p_i->scan_rsp)))
- ||
+ ||
btm_cb.ble_ctr_cb.inq_var.proc_mode == BTM_BLE_OBSERVE)
{
BTM_TRACE_DEBUG0("update new BLE information ");
@@ -1761,7 +1773,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
{
if ((p_i = btm_inq_db_new (bda)) != NULL)
{
- p_inq->inq_cmpl_info.num_resp++;
+ p_inq->inq_cmpl_info.num_resp++;
BTM_TRACE_DEBUG0("adv pkt process: new record is added into inq db");
to_report = TRUE;
}
@@ -1776,7 +1788,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
}
else if (p_i->inq_count != p_inq->inq_counter) /* first time seen in this inquiry */
{
- p_inq->inq_cmpl_info.num_resp++;
+ p_inq->inq_cmpl_info.num_resp++;
}
/* update the LE device information in inquiry database */
@@ -1787,7 +1799,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
#if BTM_USE_INQ_RESULTS_FILTER == TRUE
/* If the number of responses found and limited, issue a cancel inquiry */
- if (p_inq->inqparms.max_resps &&
+ if (p_inq->inqparms.max_resps &&
p_inq->inq_cmpl_info.num_resp == p_inq->inqparms.max_resps)
{
/* new device */
@@ -1795,7 +1807,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
(/* assume a DUMO device, BR/EDR inquiry is always active */
p_i && p_i->inq_info.results.device_type == BT_DEVICE_TYPE_BLE && p_i->scan_rsp))
{
- BTM_TRACE_WARNING0("INQ RES: Extra Response Received...cancelling inquiry..");
+ BTM_TRACE_WARNING0("INQ RES: Extra Response Received...cancelling inquiry..");
if (!(p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE) )
btsnd_hcic_inq_cancel();
@@ -1813,11 +1825,11 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
/* background connection in selective connection mode */
if (btm_cb.ble_ctr_cb.bg_conn_type == BTM_BLE_CONN_SELECTIVE)
{
- btm_send_sel_conn_callback(bda, evt_type, p, addr_type);
+ btm_send_sel_conn_callback(bda, evt_type, p, addr_type);
}
else if (p_inq_results_cb && to_report)
{
- BTM_TRACE_DEBUG0("BTMINQ LE: Found devices, send callback btm_inqrslt_cb");
+ BTM_TRACE_DEBUG0("BTMINQ LE: Found devices, send callback btm_inqrslt_cb");
if (p_inq->inq_active)
(p_inq_results_cb)((tBTM_INQ_RESULTS *) &p_i->inq_info.results, p_le_inq_cb->adv_data_cache);
@@ -1850,7 +1862,7 @@ void btm_ble_stop_scan(void)
btsnd_hcic_ble_set_scan_enable (BTM_BLE_SCAN_DISABLE, BTM_BLE_DUPLICATE_ENABLE);
/* If we have a callback registered for inquiry complete, call it */
- BTM_TRACE_DEBUG2 ("BTM Inq Compl Callback: status 0x%02x, num results %d",
+ BTM_TRACE_DEBUG2 ("BTM Inq Compl Callback: status 0x%02x, num results %d",
p_inq->inq_cmpl_info.status, p_inq->inq_cmpl_info.num_resp);
btm_update_scanner_filter_policy(SP_ADV_ALL);
@@ -1863,7 +1875,7 @@ void btm_ble_stop_scan(void)
**
** Function btm_ble_stop_adv
**
-** Description Stop the BLE advertising.
+** Description Stop the BLE advertising.
**
** Returns void
**
@@ -1920,7 +1932,7 @@ void btm_ble_timeout(TIMER_LIST_ENT *p_tle)
**
** Function btm_ble_connected
**
-** Description This function is when a LE connection to the peer device is
+** Description This function is when a LE connection to the peer device is
** establsihed
**
** Returns void
diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h
index b03e124..449de8f 100644
--- a/stack/btm/btm_ble_int.h
+++ b/stack/btm/btm_ble_int.h
@@ -1,13 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_ble_int.h
-**
-** Description: this file contains the main Bluetooth Manager (BTM)
-** internal definitions.
-**
-** Copyright (c) 1999-2008, Broadcom Corp., All Rights Reserved
-** WIDCOMM Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * this file contains the main Bluetooth Manager (BTM) internal
+ * definitions.
+ *
+ ******************************************************************************/
#ifndef BTM_BLE_INT_H
#define BTM_BLE_INT_H
@@ -61,7 +75,7 @@
#define BTM_BLE_SEC_REQ_ACT_NONE 0
#define BTM_BLE_SEC_REQ_ACT_ENCRYPT 1 /* encrypt the link using current key or key refresh */
-#define BTM_BLE_SEC_REQ_ACT_PAIR 2
+#define BTM_BLE_SEC_REQ_ACT_PAIR 2
#define BTM_BLE_SEC_REQ_ACT_DISCARD 3 /* discard the sec request while encryption is started but not completed */
typedef UINT8 tBTM_BLE_SEC_REQ_ACT;
@@ -121,7 +135,7 @@ typedef struct
UINT8 max_bd_entries;
tBLE_BD_ADDR local_bda;
-
+
tBTM_BLE_LOCAL_ADV_DATA adv_data;
tBTM_BLE_ADV_CHNL_MAP adv_chnl_map;
@@ -180,19 +194,19 @@ typedef struct
#define BLE_BG_CONN_IDLE 0
#define BLE_BG_CONN_ACTIVE 1
#define BLE_BG_CONN_SUSPEND 2
-
+
UINT8 bg_conn_state;
/* random address management control block */
tBTM_LE_RANDOM_CB addr_mgnt_cb;
-
+
/* white list information */
UINT8 num_empty_filter; /* Number of entries in white list */
UINT8 max_filter_entries; /* Maximum number of entries that can be stored */
BOOLEAN enabled;
BOOLEAN privacy; /* privacy enabled or disabled */
-#ifdef BTM_BLE_PC_ADV_TEST_MODE
+#ifdef BTM_BLE_PC_ADV_TEST_MODE
tBTM_BLE_SCAN_REQ_CBACK *p_scan_req_cback;
#endif
diff --git a/stack/btm/btm_dev.c b/stack/btm/btm_dev.c
index f163403..04994d1 100644
--- a/stack/btm/btm_dev.c
+++ b/stack/btm/btm_dev.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-** *
-** Name: btm_dev.c *
-** *
-** Description: This file contains functions for the Bluetooth Device *
-** Manager *
-** *
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved. *
-** Broadcom Bluetooth Core. Proprietary and confidential. *
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions for the Bluetooth Device Manager
+ *
+ ******************************************************************************/
#include <stdlib.h>
#include <string.h>
@@ -36,14 +49,14 @@ static tBTM_SEC_DEV_REC *btm_find_oldest_dev (void);
** dev_class - Device Class
** bd_name - Name of the peer device. NULL if unknown.
** features - Remote device's supported features. NULL if not known
-** trusted_mask - Bitwise OR of services that do not
+** trusted_mask - Bitwise OR of services that do not
** require authorization. (array of UINT32)
** link_key - Connection link key. NULL if unknown.
**
** Returns TRUE if added OK, else FALSE
**
*******************************************************************************/
-BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
+BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
BD_FEATURES features, UINT32 trusted_mask[],
LINK_KEY link_key, UINT8 key_type, tBTM_IO_CAP io_cap)
{
@@ -178,7 +191,7 @@ char *BTM_SecReadDevName (BD_ADDR bd_addr)
**
** Function btm_sec_alloc_dev
**
-** Description Look for the record in the device database for the record
+** Description Look for the record in the device database for the record
** with specified handle
**
** Returns Pointer to the record or NULL
@@ -310,7 +323,7 @@ BOOLEAN btm_dev_support_switch (BD_ADDR bd_addr)
break;
}
}
-
+
/* If we don't know peer's capabilities, assume it supports Role-switch */
if (feature_empty)
{
@@ -327,7 +340,7 @@ BOOLEAN btm_dev_support_switch (BD_ADDR bd_addr)
**
** Function btm_find_dev_by_handle
**
-** Description Look for the record in the device database for the record
+** Description Look for the record in the device database for the record
** with specified handle
**
** Returns Pointer to the record or NULL
@@ -340,7 +353,7 @@ tBTM_SEC_DEV_REC *btm_find_dev_by_handle (UINT16 handle)
for (i = 0; i < BTM_SEC_MAX_DEVICE_RECORDS; i++, p_dev_rec++)
{
- if ((p_dev_rec->sec_flags & BTM_SEC_IN_USE)
+ if ((p_dev_rec->sec_flags & BTM_SEC_IN_USE)
&& (p_dev_rec->hci_handle == handle))
return(p_dev_rec);
}
@@ -351,7 +364,7 @@ tBTM_SEC_DEV_REC *btm_find_dev_by_handle (UINT16 handle)
**
** Function btm_find_dev
**
-** Description Look for the record in the device database for the record
+** Description Look for the record in the device database for the record
** with specified BD address
**
** Returns Pointer to the record or NULL
@@ -366,7 +379,7 @@ tBTM_SEC_DEV_REC *btm_find_dev (BD_ADDR bd_addr)
{
for (i = 0; i < BTM_SEC_MAX_DEVICE_RECORDS; i++, p_dev_rec++)
{
- if ((p_dev_rec->sec_flags & BTM_SEC_IN_USE)
+ if ((p_dev_rec->sec_flags & BTM_SEC_IN_USE)
&& (!memcmp (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN)))
return(p_dev_rec);
}
@@ -378,7 +391,7 @@ tBTM_SEC_DEV_REC *btm_find_dev (BD_ADDR bd_addr)
**
** Function btm_find_or_alloc_dev
**
-** Description Look for the record in the device database for the record
+** Description Look for the record in the device database for the record
** with specified BD address
**
** Returns Pointer to the record or NULL
@@ -418,7 +431,7 @@ tBTM_SEC_DEV_REC *btm_find_oldest_dev (void)
/* First look for the non-paired devices for the oldest entry */
for (i = 0; i < BTM_SEC_MAX_DEVICE_RECORDS; i++, p_dev_rec++)
{
- if (((p_dev_rec->sec_flags & BTM_SEC_IN_USE) == 0)
+ if (((p_dev_rec->sec_flags & BTM_SEC_IN_USE) == 0)
|| ((p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN) != 0))
continue; /* Device is paired so skip it */
diff --git a/stack/btm/btm_devctl.c b/stack/btm/btm_devctl.c
index f668caf..3715072 100644
--- a/stack/btm/btm_devctl.c
+++ b/stack/btm/btm_devctl.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_devctl.c
-**
-** Description: This file contains functions that handle BTM interface
-** functions for the Bluetooth device including Rest, HCI
-** buffer size and others
-**
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions that handle BTM interface functions for the
+ * Bluetooth device including Rest, HCI buffer size and others
+ *
+ ******************************************************************************/
#include <stdlib.h>
#include <string.h>
@@ -67,19 +80,19 @@ extern BOOLEAN BTA_PRM_CHECK_FW_VER(UINT8 *p);
#define BTM_AFTER_RESET_TIMEOUT 0
#endif
-/* Internal baseband so the parameters such as local features, version etc. are known
+/* Internal baseband so the parameters such as local features, version etc. are known
so there is no need to issue HCI commands and wait for responses at BTM initialization */
#ifndef BTM_INTERNAL_BB
#define BTM_INTERNAL_BB FALSE
#endif
-/* The local version information in the format specified in the HCI read local version
+/* The local version information in the format specified in the HCI read local version
response message */
#ifndef BTM_INTERNAL_LOCAL_VER
#define BTM_INTERNAL_LOCAL_VER {0x00, 0x01, 0x05, 0x81, 0x01, 0x30, 0x00, 0x40, 0x8D}
#endif
-/* The local features information in the format specified in the HCI read local features
+/* The local features information in the format specified in the HCI read local features
response message */
#ifndef BTM_INTERNAL_LOCAL_FEA
#define BTM_INTERNAL_LOCAL_FEA {0x00, 0xFF, 0xF9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}
@@ -239,7 +252,7 @@ void btm_dev_absent (void)
** Function BTM_DeviceReset
**
** Description This function is called to reset the HCI. Callback function
-** if provided is called when startup of the device is
+** if provided is called when startup of the device is
** completed.
**
** Returns void
@@ -300,7 +313,7 @@ BOOLEAN BTM_IsDeviceUp (void)
*******************************************************************************/
tBTM_STATUS BTM_SetAfhChannels (UINT8 first, UINT8 last)
{
- BTM_TRACE_API4 ("BTM_SetAfhChannels first: %d (%d) last: %d (%d)",
+ BTM_TRACE_API4 ("BTM_SetAfhChannels first: %d (%d) last: %d (%d)",
first, btm_cb.first_disabled_channel, last,
btm_cb.last_disabled_channel);
@@ -377,9 +390,9 @@ void BTM_ContinueReset (void)
**
*******************************************************************************/
static void btm_dev_reset (void)
-{
+{
btm_cb.devcb.state = BTM_DEV_STATE_WAIT_RESET_CMPLT;
-
+
/* flush out the command complete queue and command transmit queue */
btu_hcif_flush_cmd_queue();
@@ -403,12 +416,12 @@ static void btm_dev_reset (void)
*******************************************************************************/
void btm_get_hci_buf_size (void)
{
-
+
btu_start_timer (&btm_cb.devcb.reset_timer, BTU_TTYPE_BTM_DEV_CTL, BTM_DEV_REPLY_TIMEOUT);
/* Send a Read Buffer Size message to the Host Controller. */
btsnd_hcic_read_buffer_size ();
-
+
}
#if BLE_INCLUDED == TRUE
/*******************************************************************************
@@ -425,7 +438,7 @@ void btm_read_ble_wl_size(void)
BTM_TRACE_DEBUG0("btm_read_ble_wl_size ");
btu_start_timer (&btm_cb.devcb.reset_timer, BTU_TTYPE_BTM_DEV_CTL, BTM_DEV_REPLY_TIMEOUT);
- /* Send a Read Buffer Size message to the Host Controller. */
+ /* Send a Read Buffer Size message to the Host Controller. */
btsnd_hcic_ble_read_white_list_size();
}
/*******************************************************************************
@@ -457,7 +470,7 @@ void btm_get_ble_buffer_size(void)
*******************************************************************************/
void btm_get_local_version (void)
{
-
+
btu_start_timer (&btm_cb.devcb.reset_timer, BTU_TTYPE_BTM_DEV_CTL, BTM_DEV_REPLY_TIMEOUT);
/* Send a Read Local Version message to the Host Controller. */
@@ -467,7 +480,7 @@ void btm_get_local_version (void)
#if BTM_PWR_MGR_INCLUDED == TRUE
btm_pm_reset();
#endif
-
+
}
/*******************************************************************************
@@ -521,7 +534,7 @@ void btm_dev_timeout (TIMER_LIST_ENT *p_tle)
**
** Description This function is called when command complete for HCI_Reset
** is received. It does not make sense to send next command
-** because device is resetting after command complete is
+** because device is resetting after command complete is
** received. Just start timer and set required state.
**
** Returns void
@@ -641,7 +654,7 @@ void btm_after_reset_hold_complete (void)
**
** Function btm_read_hci_buf_size_complete
**
-** Description This function is called when command complete for
+** Description This function is called when command complete for
** get HCI buffer size is received. Start timer and send
** read local featues request
**
@@ -705,7 +718,7 @@ void btm_read_hci_buf_size_complete (UINT8 *p, UINT16 evt_len)
**
** Function btm_read_ble_buf_size_complete
**
-** Description This function is called when command complete for
+** Description This function is called when command complete for
** get HCI buffer size is received. Start timer and send
** read local featues request
**
@@ -791,7 +804,7 @@ void btm_read_local_version_complete (UINT8 *p, UINT16 evt_len)
STREAM_TO_UINT8 (status, p);
if (status == HCI_SUCCESS)
{
-
+
STREAM_TO_UINT8 (p_vi->hci_version, p);
STREAM_TO_UINT16 (p_vi->hci_revision, p);
STREAM_TO_UINT8 (p_vi->lmp_version, p);
@@ -847,7 +860,7 @@ void btm_read_local_features_complete (UINT8 *p, UINT16 evt_len)
{
/* stop guard timer to avoid accidental timeout */
btu_stop_timer(&p_devcb->reset_timer);
-
+
p_devcb->state = BTM_DEV_STATE_READY;
/* Extract features and create "btm_acl_pkt_types_supported" flag
@@ -865,10 +878,10 @@ void btm_read_local_features_complete (UINT8 *p, UINT16 evt_len)
BTM_ACL_PKT_TYPES_MASK_DM3);
if (HCI_5_SLOT_PACKETS_SUPPORTED(p_devcb->local_features))
- btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH5 +
+ btm_cb.btm_acl_pkt_types_supported |= (BTM_ACL_PKT_TYPES_MASK_DH5 +
BTM_ACL_PKT_TYPES_MASK_DM5);
- /* _NO_X_DXX masks are reserved before ver 2.0.
+ /* _NO_X_DXX masks are reserved before ver 2.0.
Set them only for later versions of controller */
if (btm_cb.devcb.local_version.hci_version >= HCI_PROTO_VERSION_2_0)
{
@@ -902,7 +915,7 @@ void btm_read_local_features_complete (UINT8 *p, UINT16 evt_len)
}
}
- BTM_TRACE_DEBUG1("Local supported ACL packet types: 0x%04x",
+ BTM_TRACE_DEBUG1("Local supported ACL packet types: 0x%04x",
btm_cb.btm_acl_pkt_types_supported);
/* Create (e)SCO supported packet types mask
@@ -960,7 +973,7 @@ void btm_read_local_features_complete (UINT8 *p, UINT16 evt_len)
}
#endif
- BTM_TRACE_DEBUG1("Local supported SCO packet types: 0x%04x",
+ BTM_TRACE_DEBUG1("Local supported SCO packet types: 0x%04x",
btm_cb.btm_sco_pkt_types_supported);
/* Create Default Policy Settings
@@ -1113,7 +1126,7 @@ tBTM_STATUS BTM_SetLocalDeviceName (char *p_name)
** Returns status of the operation
** If success, BTM_SUCCESS is returned and p_name points stored
** local device name
-** If BTM doesn't store local device name, BTM_NO_RESOURCES is
+** If BTM doesn't store local device name, BTM_NO_RESOURCES is
** is returned and p_name is set to NULL
**
*******************************************************************************/
@@ -1133,7 +1146,7 @@ tBTM_STATUS BTM_ReadLocalDeviceName (char **p_name)
**
** Function BTM_ReadLocalDeviceNameFromController
**
-** Description Get local device name from controller. Do not use cached
+** Description Get local device name from controller. Do not use cached
** name (used to get chip-id prior to btm reset complete).
**
** Returns BTM_CMD_STARTED if successful, otherwise an error
@@ -1145,12 +1158,12 @@ tBTM_STATUS BTM_ReadLocalDeviceNameFromController (tBTM_CMPL_CB *p_rln_cmpl_cbac
if (btm_cb.devcb.p_rln_cmpl_cb)
return(BTM_NO_RESOURCES);
- /* Save callback */
+ /* Save callback */
btm_cb.devcb.p_rln_cmpl_cb = p_rln_cmpl_cback;
-
+
btsnd_hcic_read_name();
btu_start_timer (&btm_cb.devcb.rln_timer, BTU_TTYPE_BTM_DEV_CTL, BTM_DEV_REPLY_TIMEOUT);
-
+
return BTM_CMD_STARTED;
}
@@ -1288,7 +1301,7 @@ tBTM_STATUS BTM_SetDeviceClass (DEV_CLASS dev_class)
if (!btsnd_hcic_write_dev_class (dev_class))
return (BTM_NO_RESOURCES);
- return (BTM_SUCCESS);
+ return (BTM_SUCCESS);
}
@@ -1337,7 +1350,7 @@ UINT8 *BTM_ReadBrcmFeatures (void)
/*******************************************************************************
**
-** Function BTM_RegisterForDeviceStatusNotif
+** Function BTM_RegisterForDeviceStatusNotif
**
** Description This function is called to register for device status
** change notifications.
@@ -1359,7 +1372,7 @@ tBTM_DEV_STATUS_CB *BTM_RegisterForDeviceStatusNotif (tBTM_DEV_STATUS_CB *p_cb)
/*******************************************************************************
**
-** Function BTM_VendorSpecificCommand
+** Function BTM_VendorSpecificCommand
**
** Description Send a vendor specific HCI command to the controller.
**
@@ -1408,7 +1421,7 @@ tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, UINT8 param_len,
**
** Returns void
**
-*******************************************************************************/
+*******************************************************************************/
void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
tBTM_CMPL_CB *p_vsc_cplt_cback)
{
@@ -1487,9 +1500,9 @@ tBTM_STATUS BTM_RegisterForVSEvents (tBTM_VS_EVT_CB *p_cb, BOOLEAN is_register)
/*******************************************************************************
**
-** Function btm_vendor_specific_evt
+** Function btm_vendor_specific_evt
**
-** Description Process event HCI_VENDOR_SPECIFIC_EVT
+** Description Process event HCI_VENDOR_SPECIFIC_EVT
**
** Note: Some controllers do not send command complete, so
** the callback and busy flag are cleared here also.
@@ -1513,12 +1526,12 @@ void btm_vendor_specific_evt (UINT8 *p, UINT8 evt_len)
/*******************************************************************************
**
-** Function BTM_WritePageTimeout
+** Function BTM_WritePageTimeout
**
** Description Send HCI Write Page Timeout.
**
** Returns
-** BTM_SUCCESS Command sent.
+** BTM_SUCCESS Command sent.
** BTM_NO_RESOURCES If out of resources to send the command.
**
**
@@ -1536,13 +1549,13 @@ tBTM_STATUS BTM_WritePageTimeout(UINT16 timeout)
/*******************************************************************************
**
-** Function BTM_WriteVoiceSettings
+** Function BTM_WriteVoiceSettings
**
** Description Send HCI Write Voice Settings command.
** See hcidefs.h for settings bitmask values.
**
** Returns
-** BTM_SUCCESS Command sent.
+** BTM_SUCCESS Command sent.
** BTM_NO_RESOURCES If out of resources to send the command.
**
**
@@ -1560,22 +1573,22 @@ tBTM_STATUS BTM_WriteVoiceSettings(UINT16 settings)
/*******************************************************************************
**
-** Function BTM_EnableTestMode
+** Function BTM_EnableTestMode
**
** Description Send HCI the enable device under test command.
**
-** Note: Controller can only be taken out of this mode by
+** Note: Controller can only be taken out of this mode by
** resetting the controller.
**
** Returns
-** BTM_SUCCESS Command sent.
+** BTM_SUCCESS Command sent.
** BTM_NO_RESOURCES If out of resources to send the command.
**
**
*******************************************************************************/
tBTM_STATUS BTM_EnableTestMode(void)
{
- UINT8 cond;
+ UINT8 cond;
BTM_TRACE_EVENT0 ("BTM: BTM_EnableTestMode");
@@ -1591,23 +1604,23 @@ tBTM_STATUS BTM_EnableTestMode(void)
/* put device to connectable mode */
if (!BTM_SetConnectability(BTM_CONNECTABLE, BTM_DEFAULT_CONN_WINDOW,
- BTM_DEFAULT_CONN_INTERVAL) == BTM_SUCCESS)
+ BTM_DEFAULT_CONN_INTERVAL) == BTM_SUCCESS)
{
- return BTM_NO_RESOURCES;
+ return BTM_NO_RESOURCES;
}
/* put device to discoverable mode */
if (!BTM_SetDiscoverability(BTM_GENERAL_DISCOVERABLE, BTM_DEFAULT_DISC_WINDOW,
- BTM_DEFAULT_DISC_INTERVAL) == BTM_SUCCESS)
+ BTM_DEFAULT_DISC_INTERVAL) == BTM_SUCCESS)
{
- return BTM_NO_RESOURCES;
+ return BTM_NO_RESOURCES;
}
/* mask off all of event from controller */
if (!btsnd_hcic_set_event_mask(LOCAL_BR_EDR_CONTROLLER_ID,
(UINT8 *)"\x00\x00\x00\x00\x00\x00\x00\x00"))
{
- return BTM_NO_RESOURCES;
+ return BTM_NO_RESOURCES;
}
/* Send the HCI command */
@@ -1641,7 +1654,7 @@ UINT8 btm_get_hci_version (void)
** device from the NVRAM storage attached to the Bluetooth
** controller.
**
-** Parameters: bd_addr - Address of the device
+** Parameters: bd_addr - Address of the device
** p_cb - Call back function to be called to return
** the results
**
diff --git a/stack/btm/btm_inq.c b/stack/btm/btm_inq.c
index 2339150..5598562 100644
--- a/stack/btm/btm_inq.c
+++ b/stack/btm/btm_inq.c
@@ -1,19 +1,29 @@
-/*****************************************************************************
-**
-** Name: btm_inq.c
-**
-** Description: This file contains functions that handle inquiries. These
-** include setting discoverable mode, controlling the mode
-** of the Baseband, and maintaining a small database of
-** inquiry responses, with API for people to browse it.
-**
-** NOTE: Only ONE inquiry is allowed to run at a time
-** (including periodic inquiries);
-**
-**
-** Copyright (c) 1999-2012, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions that handle inquiries. These include
+ * setting discoverable mode, controlling the mode of the Baseband, and
+ * maintaining a small database of inquiry responses, with API for people
+ * to browse it.
+ *
+ ******************************************************************************/
#include <stdlib.h>
#include <string.h>
@@ -141,7 +151,7 @@ static UINT8 btm_convert_uuid_to_eir_service( UINT16 uuid16 );
#endif
#if (BTM_EIR_CLIENT_INCLUDED == TRUE)
static void btm_set_eir_uuid( UINT8 *p_eir, tBTM_INQ_RESULTS *p_results );
-static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
+static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
UINT8 *p_num_uuid, UINT8 *p_uuid_list_type );
static UINT16 btm_convert_uuid_to_uuid16( UINT8 *p_uuid, UINT8 uuid_size );
#endif
@@ -174,13 +184,13 @@ tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 inter
BOOLEAN cod_limited;
BTM_TRACE_API0 ("BTM_SetDiscoverability");
-#if (BLE_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
- if (btm_ble_set_discoverability((UINT16)(inq_mode))
+#if (BLE_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
+ if (btm_ble_set_discoverability((UINT16)(inq_mode))
== BTM_SUCCESS)
{
btm_cb.btm_inq_vars.discoverable_mode &= (~BTM_BLE_DISCOVERABLE_MASK);
btm_cb.btm_inq_vars.discoverable_mode |= (inq_mode & BTM_BLE_CONNECTABLE_MASK);
- }
+ }
inq_mode &= ~BTM_BLE_DISCOVERABLE_MASK;
#endif
@@ -216,7 +226,7 @@ tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 inter
return (BTM_ILLEGAL_VALUE);
}
}
-
+
/* Set the IAC if needed */
if (inq_mode != BTM_NON_DISCOVERABLE)
{
@@ -225,9 +235,9 @@ tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 inter
/* Use the GIAC and LIAC codes for limited discoverable mode */
memcpy (temp_lap[0], limited_inq_lap, LAP_LEN);
memcpy (temp_lap[1], general_inq_lap, LAP_LEN);
-
+
if (!btsnd_hcic_write_cur_iac_lap (2, (LAP * const) temp_lap))
- return (BTM_NO_RESOURCES); /* Cannot continue */
+ return (BTM_NO_RESOURCES); /* Cannot continue */
}
else
{
@@ -250,10 +260,10 @@ tBTM_STATUS BTM_SetDiscoverability (UINT16 inq_mode, UINT16 window, UINT16 inter
else
return (BTM_NO_RESOURCES);
}
-
+
if (btm_cb.btm_inq_vars.connectable_mode & BTM_CONNECTABLE_MASK)
scan_mode |= HCI_PAGE_SCAN_ENABLED;
-
+
if (btsnd_hcic_write_scan_enable (scan_mode))
{
btm_cb.btm_inq_vars.discoverable_mode &= (~BTM_DISCOVERABLE_MASK);
@@ -470,21 +480,21 @@ tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms, UINT16 max_d
BTM_TRACE_API6 ("BTM_SetPeriodicInquiryMode: mode: %d, dur: %d, rsps: %d, flt: %d, min: %d, max: %d",
p_inqparms->mode, p_inqparms->duration, p_inqparms->max_resps,
p_inqparms->filter_cond_type, min_delay, max_delay);
-
+
/*** Make sure the device is ready ***/
if (!BTM_IsDeviceUp())
return (BTM_WRONG_MODE);
-
+
/* Only one active inquiry is allowed in this implementation.
Also do not allow an inquiry if the inquiry filter is being updated */
if (p_inq->inq_active || p_inq->inqfilt_active)
return (BTM_BUSY);
-
+
/* If illegal parameters return FALSE */
if (p_inqparms->mode != BTM_GENERAL_INQUIRY &&
p_inqparms->mode != BTM_LIMITED_INQUIRY)
return (BTM_ILLEGAL_VALUE);
-
+
/* Verify the parameters for this command */
if (p_inqparms->duration < BTM_MIN_INQUIRY_LEN ||
p_inqparms->duration > BTM_MAX_INQUIRY_LENGTH ||
@@ -497,7 +507,7 @@ tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms, UINT16 max_d
{
return (BTM_ILLEGAL_VALUE);
}
-
+
/* Save the inquiry parameters to be used upon the completion of setting/clearing the inquiry filter */
p_inq->inqparms = *p_inqparms;
p_inq->per_min_delay = min_delay;
@@ -528,16 +538,16 @@ tBTM_STATUS BTM_SetPeriodicInquiryMode (tBTM_INQ_PARMS *p_inqparms, UINT16 max_d
}
else /* The filter is not being used so simply clear it; the inquiry can start after this operation */
p_inq->state = BTM_INQ_SET_FILT_STATE;
-
+
/* Before beginning the inquiry the current filter must be cleared, so initiate the command */
if ((status = btm_set_inq_event_filter (p_inqparms->filter_cond_type, &p_inqparms->filter_cond)) != BTM_CMD_STARTED)
{
/* If set filter command is not succesful reset the state */
p_inq->p_inq_results_cb = NULL;
p_inq->state = BTM_INQ_INACTIVE_STATE;
-
+
}
-
+
#endif
return (status);
}
@@ -560,7 +570,7 @@ tBTM_STATUS BTM_CancelPeriodicInquiry(void)
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
tBTM_STATUS status = BTM_SUCCESS;
BTM_TRACE_API0 ("BTM_CancelPeriodicInquiry called");
-
+
/*** Make sure the device is ready ***/
if (!BTM_IsDeviceUp())
return (BTM_WRONG_MODE);
@@ -582,7 +592,7 @@ tBTM_STATUS BTM_CancelPeriodicInquiry(void)
p_inq->inqfilt_active = FALSE;
p_inq->inq_counter++;
}
-
+
return (status);
}
@@ -607,14 +617,14 @@ tBTM_STATUS BTM_SetConnectability (UINT16 page_mode, UINT16 window, UINT16 inter
BTM_TRACE_API0 ("BTM_SetConnectability");
-#if (BLE_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
+#if (BLE_INCLUDED == TRUE && BLE_INCLUDED == TRUE)
if (btm_ble_set_connectability(page_mode) == BTM_SUCCESS)
{
p_inq->connectable_mode &= (~BTM_BLE_CONNECTABLE_MASK);
p_inq->connectable_mode |= (page_mode & BTM_BLE_CONNECTABLE_MASK);
}
page_mode &= ~BTM_BLE_CONNECTABLE_MASK;
-
+
#endif
/*** Check mode parameter ***/
@@ -664,7 +674,7 @@ tBTM_STATUS BTM_SetConnectability (UINT16 page_mode, UINT16 window, UINT16 inter
/* Keep the inquiry scan as previouosly set */
if (p_inq->discoverable_mode & BTM_DISCOVERABLE_MASK)
scan_mode |= HCI_INQUIRY_SCAN_ENABLED;
-
+
if (btsnd_hcic_write_scan_enable (scan_mode))
{
p_inq->connectable_mode &= (~BTM_CONNECTABLE_MASK);
@@ -819,7 +829,7 @@ tBTM_STATUS BTM_CancelInquiry(void)
*******************************************************************************/
tBTM_STATUS BTM_StartInquiry (tBTM_INQ_PARMS *p_inqparms, tBTM_INQ_RESULTS_CB *p_results_cb,
tBTM_CMPL_CB *p_cmpl_cb)
-{
+{
tBTM_STATUS status;
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
@@ -854,7 +864,7 @@ tBTM_STATUS BTM_StartInquiry (tBTM_INQ_PARMS *p_inqparms, tBTM_INQ_RESULTS_CB *p
p_inq->p_inq_results_cb = p_results_cb;
p_inq->inq_cmpl_info.num_resp = 0; /* Clear the results counter */
p_inq->inq_active = (UINT8)(1 << (p_inqparms->mode & BTM_BR_INQUIRY_MASK));
-
+
BTM_TRACE_DEBUG1("BTM_StartInquiry: p_inq->inq_active = 0x%02x", p_inq->inq_active);
/* start LE inquiry here if requested */
@@ -939,11 +949,11 @@ tBTM_STATUS BTM_ReadRemoteDeviceName (BD_ADDR remote_bda, tBTM_CMPL_CB *p_cb)
tBTM_INQ_INFO *p_cur = NULL;
tINQ_DB_ENT *p_i;
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE
tBT_DEVICE_TYPE dev_type;
tBLE_ADDR_TYPE addr_type;
#endif
-
+
BTM_TRACE_API6 ("BTM_ReadRemoteDeviceName: bd addr [%02x%02x%02x%02x%02x%02x]",
remote_bda[0], remote_bda[1], remote_bda[2],
remote_bda[3], remote_bda[4], remote_bda[5]);
@@ -996,11 +1006,11 @@ tBTM_STATUS BTM_CancelRemoteDeviceName (void)
tBT_DEVICE_TYPE dev_type;
tBLE_ADDR_TYPE addr_type;
#endif
-
+
BTM_TRACE_API0 ("BTM_CancelRemoteDeviceName()");
/* Make sure there is not already one in progress */
- if (p_inq->remname_active)
+ if (p_inq->remname_active)
{
#if BLE_INCLUDED == TRUE
BTM_ReadDevInfo(p_inq->remname_bda, &dev_type, &addr_type);
@@ -1027,7 +1037,7 @@ tBTM_STATUS BTM_CancelRemoteDeviceName (void)
** Function BTM_InqFirstResult
**
** Description This function looks through the inquiry database for the first
-** used entrysince the LAST inquiry. This is used in conjunction
+** used entrysince the LAST inquiry. This is used in conjunction
** with BTM_InqNext by applications as a way to walk through the
** inquiry results database.
**
@@ -1067,18 +1077,18 @@ tBTM_INQ_INFO *BTM_InqNextResult (tBTM_INQ_INFO *p_cur)
tINQ_DB_ENT *p_ent;
UINT16 inx;
UINT32 cur_inq_count = btm_cb.btm_inq_vars.inq_counter - 1;
-
+
if (p_cur)
{
p_ent = (tINQ_DB_ENT *) ((UINT8 *)p_cur - offsetof (tINQ_DB_ENT, inq_info));
inx = (UINT16)((p_ent - btm_cb.btm_inq_vars.inq_db) + 1);
-
+
for (p_ent = &btm_cb.btm_inq_vars.inq_db[inx]; inx < BTM_INQ_DB_SIZE; inx++, p_ent++)
{
if (p_ent->in_use && p_ent->inq_count == cur_inq_count)
return (&p_ent->inq_info);
}
-
+
/* If here, more entries found */
return ((tBTM_INQ_INFO *)NULL);
}
@@ -1160,18 +1170,18 @@ tBTM_INQ_INFO *BTM_InqDbNext (tBTM_INQ_INFO *p_cur)
{
tINQ_DB_ENT *p_ent;
UINT16 inx;
-
+
if (p_cur)
{
p_ent = (tINQ_DB_ENT *) ((UINT8 *)p_cur - offsetof (tINQ_DB_ENT, inq_info));
inx = (UINT16)((p_ent - btm_cb.btm_inq_vars.inq_db) + 1);
-
+
for (p_ent = &btm_cb.btm_inq_vars.inq_db[inx]; inx < BTM_INQ_DB_SIZE; inx++, p_ent++)
{
if (p_ent->in_use)
return (&p_ent->inq_info);
}
-
+
/* If here, more entries found */
return ((tBTM_INQ_INFO *)NULL);
}
@@ -1199,7 +1209,7 @@ tBTM_STATUS BTM_ClearInqDb (BD_ADDR p_bda)
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
/* If an inquiry or remote name is in progress return busy */
- if (p_inq->inq_active != BTM_INQUIRY_INACTIVE ||
+ if (p_inq->inq_active != BTM_INQUIRY_INACTIVE ||
p_inq->inqfilt_active)
return (BTM_BUSY);
@@ -1257,7 +1267,7 @@ tBTM_STATUS BTM_InquiryRegisterForChanges (tBTM_INQ_DB_CHANGE_CB *p_cb)
**
** Function BTM_SetInquiryFilterCallback
**
-** Description Host can register to be asked whenever an inquiry result
+** Description Host can register to be asked whenever an inquiry result
** is received. If host does not like the device no name
** request is issued for the device
**
@@ -1274,7 +1284,7 @@ void BTM_SetInquiryFilterCallback (tBTM_FILTER_CB *p_callback)
** Function BTM_ReadInquiryRspTxPower
**
** Description This command will read the inquiry Transmit Power level used
-** to transmit the FHS and EIR data packets.
+** to transmit the FHS and EIR data packets.
** This can be used directly in the Tx Power Level EIR data type.
**
** Returns BTM_SUCCESS if successful
@@ -1303,11 +1313,11 @@ tBTM_STATUS BTM_ReadInquiryRspTxPower (tBTM_CMPL_CB *p_cb)
**
** Function BTM_WriteInquiryTxPower
**
-** Description This command is used to write the inquiry transmit power level
-** used to transmit the inquiry (ID) data packets. The Controller
+** Description This command is used to write the inquiry transmit power level
+** used to transmit the inquiry (ID) data packets. The Controller
** should use the supported TX power level closest to the Tx_Power
** parameter.
-**
+**
** Returns BTM_SUCCESS if successful
**
*******************************************************************************/
@@ -1321,7 +1331,7 @@ tBTM_STATUS BTM_WriteInquiryTxPower (INT8 tx_power)
}
else if (!btsnd_hcic_write_inq_tx_power(tx_power))
status = BTM_NO_RESOURCES;
-
+
return status;
}
/*********************************************************************************
@@ -1371,10 +1381,10 @@ void btm_inq_db_reset (void)
}
/* Cancel a remote name request if active, and notify the caller (if waiting) */
- if (p_inq->remname_active )
+ if (p_inq->remname_active )
{
btu_stop_timer (&p_inq->rmt_name_timer_ent);
- p_inq->remname_active = FALSE;
+ p_inq->remname_active = FALSE;
memset(p_inq->remname_bda, 0, BD_ADDR_LEN);
if (p_inq->p_remname_cmpl_cb)
@@ -1400,7 +1410,7 @@ void btm_inq_db_reset (void)
p_inq->state = BTM_INQ_INACTIVE_STATE;
p_inq->pending_filt_complete_event = 0;
- p_inq->p_inq_results_cb = NULL;
+ p_inq->p_inq_results_cb = NULL;
btm_clr_inq_db(NULL); /* Clear out all the entries in the database */
btm_clr_inq_result_flt();
@@ -1503,7 +1513,7 @@ void btm_clr_inq_db (BD_ADDR p_bda)
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
tINQ_DB_ENT *p_ent = p_inq->inq_db;
UINT16 xx;
-
+
#if (BTM_INQ_DEBUG == TRUE)
BTM_TRACE_DEBUG2 ("btm_clr_inq_db: inq_active:0x%x state:%d",
btm_cb.btm_inq_vars.inq_active, btm_cb.btm_inq_vars.state);
@@ -1520,7 +1530,7 @@ void btm_clr_inq_db (BD_ADDR p_bda)
#if (BTM_INQ_GET_REMOTE_NAME == TRUE)
p_ent->inq_info.remote_name_state = BTM_INQ_RMT_NAME_EMPTY;
#endif
-
+
if (btm_cb.btm_inq_vars.p_inq_change_cb)
(*btm_cb.btm_inq_vars.p_inq_change_cb) (&p_ent->inq_info, FALSE);
}
@@ -1691,7 +1701,7 @@ tINQ_DB_ENT *btm_inq_db_new (BD_ADDR p_bda)
** (BTM_SetInqEventFilter). It is used internally as part of the
** inquiry processing.
**
-** Input Params:
+** Input Params:
** filter_cond_type - this is the type of inquiry filter to apply:
** BTM_FILTER_COND_DEVICE_CLASS,
** BTM_FILTER_COND_BD_ADDR, or
@@ -1741,7 +1751,7 @@ static tBTM_STATUS btm_set_inq_event_filter (UINT8 filter_cond_type,
case BTM_CLR_INQUIRY_FILTER:
condition_length = 0;
break;
-
+
default:
return (BTM_ILLEGAL_VALUE); /* Bad parameter was passed in */
}
@@ -1751,7 +1761,7 @@ static tBTM_STATUS btm_set_inq_event_filter (UINT8 filter_cond_type,
/* Filter the inquiry results for the specified condition type and value */
if (btsnd_hcic_set_event_filter(HCI_FILTER_INQUIRY_RESULT, filter_cond_type,
p_cond, condition_length))
-
+
return (BTM_CMD_STARTED);
else
return (BTM_NO_RESOURCES);
@@ -1775,7 +1785,7 @@ void btm_event_filter_complete (UINT8 *p)
tBTM_STATUS status;
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
tBTM_CMPL_CB *p_cb = p_inq->p_inqfilter_cmpl_cb;
-
+
#if (BTM_INQ_DEBUG == TRUE)
BTM_TRACE_DEBUG3 ("btm_event_filter_complete: inq_active:0x%x state:%d inqfilt_active:%d",
btm_cb.btm_inq_vars.inq_active, btm_cb.btm_inq_vars.state, btm_cb.btm_inq_vars.inqfilt_active);
@@ -1801,7 +1811,7 @@ void btm_event_filter_complete (UINT8 *p)
}
else
status = BTM_SUCCESS;
-
+
/* If the set filter was initiated externally (via BTM_SetInqEventFilter), call the
callback function to notify the initiator that it has completed */
if (p_inq->state == BTM_INQ_INACTIVE_STATE)
@@ -1947,7 +1957,7 @@ void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
tBTM_INQ_RESULTS *p_cur;
BOOLEAN is_new = TRUE;
BOOLEAN update = FALSE;
- INT8 i_rssi;
+ INT8 i_rssi;
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
tBTM_INQ_RESULTS_CB *p_inq_results_cb = p_inq->p_inq_results_cb;
UINT8 page_scan_rep_mode = 0;
@@ -1995,13 +2005,13 @@ void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
p_i = btm_inq_db_find (bda);
-#if BTM_USE_INQ_RESULTS_FILTER == TRUE
+#if BTM_USE_INQ_RESULTS_FILTER == TRUE
/* Only process the num_resp is smaller than max_resps.
If results are queued to BTU task while canceling inquiry,
or when more than one result is in this response, > max_resp
responses could be processed which can confuse some apps
*/
- if (p_inq->inqparms.max_resps &&
+ if (p_inq->inqparms.max_resps &&
p_inq->inq_cmpl_info.num_resp >= p_inq->inqparms.max_resps
#if BLE_INCLUDED == TRUE
/* new device response */
@@ -2027,7 +2037,7 @@ void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
i_rssi = (INT8)rssi;
/* If this new RSSI is higher than the last one */
- if(p_inq->inqparms.report_dup && (rssi != 0) &&
+ if(p_inq->inqparms.report_dup && (rssi != 0) &&
p_i && (i_rssi > p_i->inq_info.results.rssi || p_i->inq_info.results.rssi == 0
#if BLE_INCLUDED == TRUE
/* BR/EDR inquiry information update */
@@ -2117,11 +2127,11 @@ void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
#if BTM_USE_INQ_RESULTS_FILTER == TRUE
/* If the number of responses found and not unlimited, issue a cancel inquiry */
if (!(p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE) &&
- p_inq->inqparms.max_resps &&
+ p_inq->inqparms.max_resps &&
p_inq->inq_cmpl_info.num_resp == p_inq->inqparms.max_resps
#if BLE_INCLUDED == TRUE
/* BLE scanning is active and received adv */
- && ((((p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK) != 0) &&
+ && ((((p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK) != 0) &&
p_cur->device_type == BT_DEVICE_TYPE_DUMO && p_i->scan_rsp) ||
(p_inq->inqparms.mode & BTM_BLE_INQUIRY_MASK) == 0)
#endif
@@ -2151,10 +2161,10 @@ void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
#if (BTM_EIR_CLIENT_INCLUDED == TRUE)
if( inq_res_mode == BTM_INQ_RESULT_EXTENDED )
{
- if((p_eir_data = BTM_CheckEirData( p, BTM_EIR_COMPLETE_LOCAL_NAME_TYPE,
+ if((p_eir_data = BTM_CheckEirData( p, BTM_EIR_COMPLETE_LOCAL_NAME_TYPE,
&remote_name_len )) == NULL)
{
- p_eir_data = BTM_CheckEirData( p, BTM_EIR_SHORTENED_LOCAL_NAME_TYPE,
+ p_eir_data = BTM_CheckEirData( p, BTM_EIR_SHORTENED_LOCAL_NAME_TYPE,
&remote_name_len );
}
@@ -2182,7 +2192,7 @@ void btm_process_inq_results (UINT8 *p, UINT8 inq_res_mode)
#if (BTM_EIR_CLIENT_INCLUDED == TRUE)
if( inq_res_mode == BTM_INQ_RESULT_EXTENDED )
{
- memset( p_cur->eir_uuid, 0,
+ memset( p_cur->eir_uuid, 0,
BTM_EIR_SERVICE_ARRAY_SIZE * (BTM_EIR_ARRAY_BITS/8));
/* set bit map of UUID list from received EIR */
btm_set_eir_uuid( p, p_cur );
@@ -2224,10 +2234,10 @@ void btm_sort_inq_result(void)
tINQ_DB_ENT *p_ent = btm_cb.btm_inq_vars.inq_db;
tINQ_DB_ENT *p_next = btm_cb.btm_inq_vars.inq_db+1;
int size;
-
+
num_resp = (btm_cb.btm_inq_vars.inq_cmpl_info.num_resp<BTM_INQ_DB_SIZE)?
btm_cb.btm_inq_vars.inq_cmpl_info.num_resp: BTM_INQ_DB_SIZE;
-
+
if((p_tmp = (tINQ_DB_ENT *)GKI_getbuf(sizeof(tINQ_DB_ENT))) != NULL)
{
size = sizeof(tINQ_DB_ENT);
@@ -2243,7 +2253,7 @@ void btm_sort_inq_result(void)
}
}
}
-
+
GKI_freebuf(p_tmp);
}
}
@@ -2265,7 +2275,7 @@ void btm_process_inq_complete (UINT8 status, UINT8 mode)
{
tBTM_CMPL_CB *p_inq_cb = btm_cb.btm_inq_vars.p_inq_cmpl_cb;
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
-
+
#if (BTM_INQ_GET_REMOTE_NAME==TRUE)
tBTM_INQ_INFO *p_cur;
UINT8 tempstate;
@@ -2305,7 +2315,7 @@ void btm_process_inq_complete (UINT8 status, UINT8 mode)
}
}
#endif
-
+
/* Notify caller that the inquiry has completed; (periodic inquiries do not send completion events */
if (!(p_inq->inq_active & BTM_PERIODIC_INQUIRY_ACTIVE) && p_inq->inqparms.mode == 0)
{
@@ -2315,7 +2325,7 @@ void btm_process_inq_complete (UINT8 status, UINT8 mode)
p_inq->inq_counter++;
btm_clr_inq_result_flt();
-
+
if((p_inq->inq_cmpl_info.status == BTM_SUCCESS) && HCI_LMP_INQ_RSSI_SUPPORTED(btm_cb.devcb.local_features))
{
btm_sort_inq_result();
@@ -2327,7 +2337,7 @@ void btm_process_inq_complete (UINT8 status, UINT8 mode)
p_inq->p_inq_cmpl_cb = (tBTM_CMPL_CB *) NULL;
/* If we have a callback registered for inquiry complete, call it */
- BTM_TRACE_DEBUG2 ("BTM Inq Compl Callback: status 0x%02x, num results %d",
+ BTM_TRACE_DEBUG2 ("BTM Inq Compl Callback: status 0x%02x, num results %d",
p_inq->inq_cmpl_info.status, p_inq->inq_cmpl_info.num_resp);
if (p_inq_cb)
@@ -2385,13 +2395,13 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
{
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
BOOLEAN cmd_ok;
-
-
+
+
/*** Make sure the device is ready ***/
if (!BTM_IsDeviceUp())
return (BTM_WRONG_MODE);
-
-
+
+
if (origin == BTM_RMT_NAME_SEC)
{
cmd_ok = btsnd_hcic_rmt_name_req (remote_bda, HCI_PAGE_SCAN_REP_MODE_R1,
@@ -2404,12 +2414,12 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
/* Make sure there are no two remote name requests from external API in progress */
else if (origin == BTM_RMT_NAME_EXT)
{
- if (p_inq->remname_active)
- {
+ if (p_inq->remname_active)
+ {
return (BTM_BUSY);
}
else
- {
+ {
/* If there is no remote name request running,call the callback function and start timer */
p_inq->p_remname_cmpl_cb = p_cb;
memcpy(p_inq->remname_bda, remote_bda, BD_ADDR_LEN);
@@ -2442,7 +2452,7 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
}
/* If the inquire feature is on */
#if (BTM_INQ_GET_REMOTE_NAME==TRUE)
-
+
else if (origin == BTM_RMT_NAME_INQ)
{
/* If the database entry exists for the device, use its clock offset */
@@ -2464,16 +2474,16 @@ tBTM_STATUS btm_initiate_rem_name (BD_ADDR remote_bda, tBTM_INQ_INFO *p_cur,
else
return BTM_NO_RESOURCES;
}
-#endif
+#endif
else
{
-
+
return BTM_ILLEGAL_VALUE;
-
+
}
-
+
}
/*******************************************************************************
@@ -2493,9 +2503,9 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
tBTM_INQUIRY_VAR_ST *p_inq = &btm_cb.btm_inq_vars;
tBTM_CMPL_CB *p_cb = p_inq->p_remname_cmpl_cb;
UINT8 *p_n1;
-
+
UINT16 temp_evt_len;
-
+
#if (BTM_INQ_GET_REMOTE_NAME==TRUE)
/*** These are only used if part of the Inquiry Process ***/
tBTM_CMPL_CB *p_inq_cb;
@@ -2503,12 +2513,12 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
UINT8 *p_n;
tBTM_INQ_INFO *p_cur;
#endif
-#if BLE_INCLUDED == TRUE
+#if BLE_INCLUDED == TRUE
tBT_DEVICE_TYPE dev_type;
tBLE_ADDR_TYPE addr_type;
#endif
-
+
if (bda != NULL)
{
BTM_TRACE_EVENT6("BDA %02x:%02x:%02x:%02x:%02x:%02x",bda[0], bda[1],
@@ -2519,10 +2529,10 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
BTM_TRACE_EVENT6("Inquire BDA %02x:%02x:%02x:%02x:%02x:%02x",p_inq->remname_bda[0], p_inq->remname_bda[1],
p_inq->remname_bda[2], p_inq->remname_bda[3],
p_inq->remname_bda[4], p_inq->remname_bda[5]);
-
-
- /* If the inquire BDA and remote DBA are the same, then stop the timer and set the active to false */
+
+
+ /* If the inquire BDA and remote DBA are the same, then stop the timer and set the active to false */
if ((p_inq->remname_active ==TRUE)&&
(((bda != NULL) &&
(memcmp(bda, p_inq->remname_bda,BD_ADDR_LEN)==0)) || bda == NULL))
@@ -2543,7 +2553,7 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
/* inquiry complete callback is called. */
if ((hci_status == HCI_SUCCESS))
- {
+ {
/* Copy the name from the data stream into the return structure */
/* Note that even if it is not being returned, it is used as a */
/* temporary buffer. */
@@ -2557,9 +2567,9 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
*p_n1++ = *bdn++;
temp_evt_len--;
}
- }
-
-
+ }
+
+
/* If processing a stand alone remote name then report the error in the callback */
else
{
@@ -2572,7 +2582,7 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
p_inq->p_remname_cmpl_cb = NULL;
if (p_cb)
- (p_cb)((tBTM_REMOTE_DEV_NAME *)&rem_name);
+ (p_cb)((tBTM_REMOTE_DEV_NAME *)&rem_name);
}
@@ -2652,7 +2662,7 @@ void btm_process_remote_name (BD_ADDR bda, BD_NAME bdn, UINT16 evt_len, UINT8 hc
p_inq->state = BTM_INQ_INACTIVE_STATE;
p_inq->inq_active = BTM_INQUIRY_INACTIVE;
p_inq->p_inq_cmpl_cb = NULL;
-
+
/* If we have a callback registered for inquiry complete, call it */
if (p_inq_cb)
(p_inq_cb)((tBTM_INQUIRY_CMPL *) &p_inq->inq_cmpl_info);
@@ -2734,10 +2744,10 @@ void btm_read_linq_tx_power_complete(UINT8 *p)
**
** Description This function is called to write EIR data to controller.
**
-** Parameters p_buff - allocated HCI command buffer including extended
+** Parameters p_buff - allocated HCI command buffer including extended
** inquriry response
**
-** Returns BTM_SUCCESS - if successful
+** Returns BTM_SUCCESS - if successful
** BTM_MODE_UNSUPPORTED - if local device cannot support it
**
*******************************************************************************/
@@ -2771,7 +2781,7 @@ tBTM_STATUS BTM_WriteEIR( BT_HDR *p_buff )
** type - finding EIR data type
** p_length - return the length of EIR data not including type
**
-** Returns pointer of EIR data
+** Returns pointer of EIR data
**
*******************************************************************************/
UINT8 *BTM_CheckEirData( UINT8 *p_eir, UINT8 type, UINT8 *p_length )
@@ -2837,7 +2847,7 @@ static UINT8 btm_convert_uuid_to_eir_service( UINT16 uuid16 )
**
** Description This function is called to know if UUID in bit map of UUID.
**
-** Parameters p_eir_uuid - bit map of UUID list
+** Parameters p_eir_uuid - bit map of UUID list
** uuid16 - UUID 16-bit
**
** Returns TRUE - if found
@@ -2952,7 +2962,7 @@ void BTM_RemoveEirService( UINT32 *p_eir_uuid, UINT16 uuid16 )
** BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
**
*******************************************************************************/
-UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid, UINT8 **p,
+UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid, UINT8 **p,
UINT8 max_num_uuid16, UINT8 *p_num_uuid16)
{
#if (BTM_EIR_SERVER_INCLUDED == TRUE)
@@ -3003,7 +3013,7 @@ UINT8 BTM_GetEirSupportedServices( UINT32 *p_eir_uuid, UINT8 **p,
** BTM_EIR_MORE_128BITS_UUID_TYPE
**
*******************************************************************************/
-UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
+UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
UINT8 *p_uuid_list, UINT8 max_num_uuid)
{
#if (BTM_EIR_CLIENT_INCLUDED == TRUE)
@@ -3023,18 +3033,18 @@ UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
if( *p_num_uuid > max_num_uuid )
{
BTM_TRACE_WARNING2("BTM_GetEirUuidList number of uuid in EIR = %d, size of uuid list = %d",
- *p_num_uuid, max_num_uuid );
+ *p_num_uuid, max_num_uuid );
*p_num_uuid = max_num_uuid;
}
- BTM_TRACE_DEBUG2("BTM_GetEirUuidList type = %02X, number of uuid = %d", type, *p_num_uuid );
-
+ BTM_TRACE_DEBUG2("BTM_GetEirUuidList type = %02X, number of uuid = %d", type, *p_num_uuid );
+
if( uuid_size == LEN_UUID_16 )
{
for( yy = 0; yy < *p_num_uuid; yy++ )
{
STREAM_TO_UINT16(*(p_uuid16 + yy), p_uuid_data);
- BTM_TRACE_DEBUG1(" 0x%04X", *(p_uuid16 + yy));
+ BTM_TRACE_DEBUG1(" 0x%04X", *(p_uuid16 + yy));
}
}
else if( uuid_size == LEN_UUID_32 )
@@ -3042,7 +3052,7 @@ UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
for( yy = 0; yy < *p_num_uuid; yy++ )
{
STREAM_TO_UINT32(*(p_uuid32 + yy), p_uuid_data);
- BTM_TRACE_DEBUG1(" 0x%08X", *(p_uuid32 + yy));
+ BTM_TRACE_DEBUG1(" 0x%08X", *(p_uuid32 + yy));
}
}
else if( uuid_size == LEN_UUID_128 )
@@ -3052,7 +3062,7 @@ UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
STREAM_TO_ARRAY16(p_uuid_list + yy * LEN_UUID_128, p_uuid_data);
for( xx = 0; xx < LEN_UUID_128; xx++ )
sprintf(buff + xx*2, "%02X", *(p_uuid_list + yy * LEN_UUID_128 + xx));
- BTM_TRACE_DEBUG1(" 0x%s", buff);
+ BTM_TRACE_DEBUG1(" 0x%s", buff);
}
}
@@ -3077,10 +3087,10 @@ UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
** p_uuid_list_type - EIR data type
**
** Returns NULL - if UUID list with uuid_size is not found
-** beginning of UUID list in EIR - otherwise
+** beginning of UUID list in EIR - otherwise
**
*******************************************************************************/
-static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
+static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
UINT8 *p_num_uuid, UINT8 *p_uuid_list_type )
{
UINT8 *p_uuid_data;
@@ -3118,7 +3128,7 @@ static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
*p_uuid_list_type = complete_type;
}
- *p_num_uuid = uuid_len / uuid_size;
+ *p_num_uuid = uuid_len / uuid_size;
return p_uuid_data;
}
@@ -3132,7 +3142,7 @@ static UINT8 *btm_eir_get_uuid_list( UINT8 *p_eir, UINT8 uuid_size,
** uuid_size - size of UUID
**
** Returns 0 - if UUID cannot be converted to UUID 16-bit
-** UUID 16-bit - otherwise
+** UUID 16-bit - otherwise
**
*******************************************************************************/
static UINT16 btm_convert_uuid_to_uuid16( UINT8 *p_uuid, UINT8 uuid_size )
@@ -3191,7 +3201,7 @@ static UINT16 btm_convert_uuid_to_uuid16( UINT8 *p_uuid, UINT8 uuid_size )
** Parameters p_eir - pointer of EIR significant part
** p_results - pointer of inquiry result
**
-** Returns None
+** Returns None
**
*******************************************************************************/
void btm_set_eir_uuid( UINT8 *p_eir, tBTM_INQ_RESULTS *p_results )
@@ -3248,8 +3258,8 @@ void btm_set_eir_uuid( UINT8 *p_eir, tBTM_INQ_RESULTS *p_results )
}
}
- BTM_TRACE_DEBUG2("btm_set_eir_uuid eir_uuid=0x%08X %08X",
- p_results->eir_uuid[1], p_results->eir_uuid[0] );
+ BTM_TRACE_DEBUG2("btm_set_eir_uuid eir_uuid=0x%08X %08X",
+ p_results->eir_uuid[1], p_results->eir_uuid[0] );
}
#endif
diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h
index e8fb57b..e5f4c15 100644
--- a/stack/btm/btm_int.h
+++ b/stack/btm/btm_int.h
@@ -1,13 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_int.h
-**
-** Description: this file contains the main Bluetooth Manager (BTM)
-** internal definitions.
-**
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * this file contains the main Bluetooth Manager (BTM) internal
+ * definitions.
+ *
+ ******************************************************************************/
#ifndef BTM_INT_H
#define BTM_INT_H
@@ -89,8 +103,8 @@ typedef struct
#define BTM_ACL_SWKEY_STATE_SWITCHING 3
#define BTM_ACL_SWKEY_STATE_ENCRYPTION_ON 4
#define BTM_ACL_SWKEY_STATE_IN_PROGRESS 5
- UINT8 switch_role_state;
- UINT8 change_key_state;
+ UINT8 switch_role_state;
+ UINT8 change_key_state;
#define BTM_ACL_ENCRYPT_STATE_IDLE 0
#define BTM_ACL_ENCRYPT_STATE_ENCRYPT_OFF 1 /* encryption turning off */
@@ -141,7 +155,7 @@ typedef struct
TIMER_LIST_ENT txpwer_timer;
tBTM_CMPL_CB *p_txpwer_cmpl_cb; /* Callback function to be called when */
/* read inq tx power function completes */
-
+
TIMER_LIST_ENT qossu_timer;
tBTM_CMPL_CB *p_qossu_cmpl_cb; /* Callback function to be called when */
/* qos setup function completes */
@@ -168,7 +182,7 @@ typedef struct
BT_OCTET16 er; /* BLE encryption key */
#if BTM_BLE_CONFORMANCE_TESTING == TRUE
- BOOLEAN no_disc_if_pair_fail;
+ BOOLEAN no_disc_if_pair_fail;
BOOLEAN enable_test_mac_val;
BT_OCTET8 test_mac;
BOOLEAN enable_test_local_sign_cntr;
@@ -302,7 +316,7 @@ typedef struct
typedef UINT8 *BTM_BD_NAME_PTR; /* Pointer to Device name */
-/* Security callback is called by this unit when security
+/* Security callback is called by this unit when security
** procedures are completed. Parameters are
** BD Address of remote
** Result of the operation
@@ -406,7 +420,7 @@ extern void btm_sco_chk_pend_rolechange (UINT16 hci_handle);
/*
** Define structure for Security Service Record.
-** A record exists for each service registered with the Security Manager
+** A record exists for each service registered with the Security Manager
*/
typedef struct
{
@@ -431,15 +445,15 @@ typedef struct
{
BT_OCTET16 irk; /* peer diverified identity root */
BT_OCTET16 ltk; /* peer long term key */
- BT_OCTET16 csrk; /* peer SRK peer device used to secured sign local data */
+ BT_OCTET16 csrk; /* peer SRK peer device used to secured sign local data */
BT_OCTET8 rand; /* random vector for LTK generation */
- UINT16 ediv; /* LTK diversifier of this slave device */
+ UINT16 ediv; /* LTK diversifier of this slave device */
UINT16 div; /* local DIV to generate local LTK=d1(ER,DIV,0) and CSRK=d1(ER,DIV,1) */
UINT8 sec_level; /* local pairing security level */
UINT8 key_size; /* key size of the LTK delivered to peer device */
- UINT8 srk_sec_level; /* security property of peer SRK for this device */
- UINT8 local_csrk_sec_level; /* security property of local CSRK for this device */
+ UINT8 srk_sec_level; /* security property of peer SRK for this device */
+ UINT8 local_csrk_sec_level; /* security property of local CSRK for this device */
UINT32 counter; /* peer sign counter for verifying rcv signed cmd */
UINT32 local_counter; /* local sign counter for sending signed write cmd*/
@@ -477,9 +491,9 @@ typedef struct
DEV_CLASS dev_class; /* DEV_CLASS of the device */
LINK_KEY link_key; /* Device link key */
-#define BTM_SEC_AUTHORIZED BTM_SEC_FLAG_AUTHORIZED
+#define BTM_SEC_AUTHORIZED BTM_SEC_FLAG_AUTHORIZED
#define BTM_SEC_AUTHENTICATED BTM_SEC_FLAG_AUTHENTICATED
-#define BTM_SEC_ENCRYPTED BTM_SEC_FLAG_ENCRYPTED
+#define BTM_SEC_ENCRYPTED BTM_SEC_FLAG_ENCRYPTED
#define BTM_SEC_NAME_KNOWN 0x08
#define BTM_SEC_LINK_KEY_KNOWN BTM_SEC_FLAG_LKEY_KNOWN
#define BTM_SEC_LINK_KEY_AUTHED 0x20
@@ -624,7 +638,7 @@ typedef struct
{
tBTM_PM_STATUS_CBACK *cback;/* to notify the registered party of mode change event */
UINT8 mask; /* registered request mask. 0, if this entry is not used */
-} tBTM_PM_RCB;
+} tBTM_PM_RCB;
#endif /* BTM_PWR_MGR_INCLUDED */
enum
@@ -755,7 +769,7 @@ typedef struct
tBTM_BLE_CB ble_ctr_cb;
UINT16 enc_handle;
- BT_OCTET8 enc_rand; /* received rand value from LTK request*/
+ BT_OCTET8 enc_rand; /* received rand value from LTK request*/
UINT16 ediv; /* received ediv value from LTK request */
UINT8 key_size;
#endif
@@ -777,7 +791,7 @@ typedef struct
*****************************************************/
#if BTM_SCO_INCLUDED == TRUE
tSCO_CB sco_cb;
-#endif
+#endif
/*****************************************************
** Security Management
@@ -802,7 +816,7 @@ typedef struct
BOOLEAN pin_type_changed; /* pin type changed during bonding */
BOOLEAN sec_req_pending; /* TRUE if a request is pending */
// btla-specific ++
-#ifdef PORCHE_PAIRING_CONFLICT
+#ifdef PORCHE_PAIRING_CONFLICT
UINT8 pin_code_len_saved; /* for legacy devices */
#endif
// btla-specific --
diff --git a/stack/btm/btm_main.c b/stack/btm/btm_main.c
index 67be0f2..f3037f6 100644
--- a/stack/btm/btm_main.c
+++ b/stack/btm/btm_main.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_main.c
-**
-** Description: This file contains the definition of the btm control block
-** when BTM_DYNAMIC_MEMORY is used.
-**
-**
-** Copyright (c) 2002-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2002-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains the definition of the btm control block when
+ * BTM_DYNAMIC_MEMORY is used.
+ *
+ ******************************************************************************/
#include "bt_types.h"
#include "bt_target.h"
diff --git a/stack/btm/btm_pm.c b/stack/btm/btm_pm.c
index afe7275..19b90d3 100644
--- a/stack/btm/btm_pm.c
+++ b/stack/btm/btm_pm.c
@@ -1,19 +1,32 @@
-/*****************************************************************************/
-/* */
-/* Name: btm_pm.c */
-/* */
-/* Description: This file contains functions that manages ACL link modes. */
-/* This includes operations such as active, hold, */
-/* park and sniff modes. */
-/* */
-/* This module contains both internal and external (API) */
-/* functions. External (API) functions are distinguishable */
-/* by their names beginning with uppercase BTM. */
-/* */
-/* */
-/* Copyright (c) 2000-2009, Broadcom Corp., All Rights Reserved. */
-/* WIDCOMM Bluetooth Core. Proprietary and confidential. */
-/*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2000-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/*****************************************************************************
+ *
+ * This file contains functions that manages ACL link modes.
+ * This includes operations such as active, hold,
+ * park and sniff modes.
+ *
+ * This module contains both internal and external (API)
+ * functions. External (API) functions are distinguishable
+ * by their names beginning with uppercase BTM.
+ *
+ *****************************************************************************/
#include <stdlib.h>
#include <string.h>
@@ -83,7 +96,7 @@ static tBTM_STATUS btm_pm_snd_md_req( UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD
*/
#if BTM_PM_DEBUG == TRUE
-const char * btm_pm_state_str[] =
+const char * btm_pm_state_str[] =
{
"pm_active_state",
"pm_hold_state",
@@ -92,7 +105,7 @@ const char * btm_pm_state_str[] =
"pm_pend_state"
};
-const char * btm_pm_event_str[] =
+const char * btm_pm_event_str[] =
{
"pm_set_mode_event",
"pm_hci_sts_event",
@@ -100,7 +113,7 @@ const char * btm_pm_event_str[] =
"pm_update_event"
};
-const char * btm_pm_action_str[] =
+const char * btm_pm_action_str[] =
{
"pm_set_mode_action",
"pm_update_db_action",
@@ -222,7 +235,7 @@ tBTM_STATUS BTM_SetPowerMode (UINT8 pm_id, BD_ADDR remote_bda, tBTM_PM_PWR_MD *p
temp_pm_id = BTM_MAX_PM_RECORDS;
/* update mode database */
- if( ((pm_id != BTM_PM_SET_ONLY_ID) &&
+ if( ((pm_id != BTM_PM_SET_ONLY_ID) &&
(btm_cb.pm_reg_db[pm_id].mask & BTM_PM_REG_SET))
|| ((pm_id == BTM_PM_SET_ONLY_ID) && (btm_cb.pm_pend_link != MAX_L2CAP_LINKS)) )
{
@@ -252,7 +265,7 @@ tBTM_STATUS BTM_SetPowerMode (UINT8 pm_id, BD_ADDR remote_bda, tBTM_PM_PWR_MD *p
return BTM_CMD_STORED;
}
-
+
return btm_pm_snd_md_req(pm_id, acl_ind, p_mode);
}
@@ -560,7 +573,7 @@ static tBTM_PM_MODE btm_pm_get_set_mode(UINT8 pm_id, tBTM_PM_MCB *p_cb, tBTM_PM_
** Function btm_pm_snd_md_req
** Description get the resulting mode and send the resuest to host controller
** Returns tBTM_STATUS
-**, BOOLEAN *p_chg_ind
+**, BOOLEAN *p_chg_ind
*******************************************************************************/
static tBTM_STATUS btm_pm_snd_md_req(UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *p_mode)
{
@@ -635,7 +648,7 @@ static tBTM_STATUS btm_pm_snd_md_req(UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *
break;
case BTM_PM_MD_HOLD:
- if (btsnd_hcic_hold_mode (btm_cb.acl_db[link_ind].hci_handle,
+ if (btsnd_hcic_hold_mode (btm_cb.acl_db[link_ind].hci_handle,
md_res.max, md_res.min))
{
btm_cb.pm_pend_link = link_ind;
@@ -643,7 +656,7 @@ static tBTM_STATUS btm_pm_snd_md_req(UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *
break;
case BTM_PM_MD_SNIFF:
- if (btsnd_hcic_sniff_mode (btm_cb.acl_db[link_ind].hci_handle,
+ if (btsnd_hcic_sniff_mode (btm_cb.acl_db[link_ind].hci_handle,
md_res.max, md_res.min, md_res.attempt,
md_res.timeout))
{
@@ -652,7 +665,7 @@ static tBTM_STATUS btm_pm_snd_md_req(UINT8 pm_id, int link_ind, tBTM_PM_PWR_MD *
break;
case BTM_PM_MD_PARK:
- if (btsnd_hcic_park_mode (btm_cb.acl_db[link_ind].hci_handle,
+ if (btsnd_hcic_park_mode (btm_cb.acl_db[link_ind].hci_handle,
md_res.max, md_res.min))
{
btm_cb.pm_pend_link = link_ind;
@@ -810,7 +823,7 @@ void btm_pm_proc_mode_change (UINT8 hci_status, UINT16 hci_handle, UINT8 mode, U
/* Mode changed from Sniff to Active while SCO is open. */
/* Packet types of active mode, not sniff mode, should be used for ACL when SCO is closed. */
p->restore_pkt_types = btm_cb.btm_acl_pkt_types_supported;
-
+
/* Exclude packet types not supported by the peer */
btm_acl_chk_peer_pkt_type_support (p, &p->restore_pkt_types);
}
diff --git a/stack/btm/btm_sco.c b/stack/btm/btm_sco.c
index 394ac0a..5a11404 100644
--- a/stack/btm/btm_sco.c
+++ b/stack/btm/btm_sco.c
@@ -1,18 +1,27 @@
-/*****************************************************************************
-**
-** Name: btm_sco.c
-**
-** Description: This file contains functions that handle SCO connections.
-** This includes operations such as connect, disconnect,
-** change supported packet types.
-**
-** This module contains both internal and external (API)
-** functions. External (API) functions are distinguishable
-** by their names beginning with uppercase BTM.
-**
-** Copyright (c) 2000-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2000-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions that handle SCO connections. This includes
+ * operations such as connect, disconnect, change supported packet types.
+ *
+ ******************************************************************************/
#include <string.h>
#include "bt_types.h"
@@ -80,7 +89,7 @@ void btm_sco_flush_sco_data(UINT16 sco_inx)
p = &btm_cb.sco_cb.sco_db[sco_inx];
while (p->xmit_data_q.p_first)
{
- if ((p_buf = (BT_HDR *)GKI_dequeue (&p->xmit_data_q)) != NULL)
+ if ((p_buf = (BT_HDR *)GKI_dequeue (&p->xmit_data_q)) != NULL)
GKI_freebuf (p_buf);
}
}
@@ -120,7 +129,7 @@ void btm_sco_init (void)
** the tx_bw, max_latency, content format, and packet_types are
** valid. The hci_status parameter should be
** ([0x0] to accept, [0x0d..0x0f] to reject)
-**
+**
** Returns void
**
*******************************************************************************/
@@ -190,7 +199,7 @@ static void btm_esco_conn_rsp (UINT16 sco_inx, UINT8 hci_status, BD_ADDR bda,
if (p_sco->esco.data.link_type == BTM_LINK_TYPE_SCO)
{
temp_pkt_types &= BTM_SCO_LINK_ONLY_MASK;
-
+
if (btm_cb.devcb.local_version.hci_version >= HCI_PROTO_VERSION_2_0)
{
temp_pkt_types |= BTM_SCO_EXCEPTION_PKTS_MASK;
@@ -242,7 +251,7 @@ void btm_sco_check_send_pkts (UINT16 sco_inx)
/* If there is data to send, send it now */
while (p_ccb->xmit_data_q.p_first != NULL)
- {
+ {
p_buf = NULL;
#if BTM_SCO_HCI_DEBUG
@@ -267,14 +276,14 @@ void btm_sco_check_send_pkts (UINT16 sco_inx)
void btm_route_sco_data(BT_HDR *p_msg)
{
#if BTM_SCO_HCI_INCLUDED == TRUE
- UINT16 sco_inx, handle;
+ UINT16 sco_inx, handle;
UINT8 *p = (UINT8 *)(p_msg + 1) + p_msg->offset;
UINT8 pkt_size = 0;
UINT8 pkt_status = 0;
/* Extract Packet_Status_Flag and handle */
STREAM_TO_UINT16 (handle, p);
- pkt_status = HCID_GET_EVENT(handle);
+ pkt_status = HCID_GET_EVENT(handle);
handle = HCID_GET_HANDLE (handle);
STREAM_TO_UINT8 (pkt_size, p);
@@ -285,8 +294,8 @@ void btm_route_sco_data(BT_HDR *p_msg)
if (!btm_cb.sco_cb.p_data_cb )
/* if no data callback registered, just free the buffer */
GKI_freebuf (p_msg);
- else
- {
+ else
+ {
(*btm_cb.sco_cb.p_data_cb)(sco_inx, p_msg, (tBTM_SCO_DATA_FLAG) pkt_status);
}
}
@@ -306,20 +315,20 @@ void btm_route_sco_data(BT_HDR *p_msg)
** Function BTM_WriteScoData
**
** Description This function write SCO data to a specified instance. The data
-** to be written p_buf needs to carry an offset of
-** HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
+** to be written p_buf needs to carry an offset of
+** HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
** exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is set
-** to 60 and is configurable. Data longer than the maximum bytes
-** will be truncated.
+** to 60 and is configurable. Data longer than the maximum bytes
+** will be truncated.
**
** Returns BTM_SUCCESS: data write is successful
** BTM_ILLEGAL_VALUE: SCO data contains illegal offset value.
-** BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO packet
-** size.
+** BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO packet
+** size.
** BTM_NO_RESOURCES: no resources.
** BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is not
** routed via HCI.
-**
+**
**
*******************************************************************************/
tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf)
@@ -347,7 +356,7 @@ tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf)
p = (UINT8 *)(p_buf + 1) + p_buf->offset;
/* add HCI handle */
UINT16_TO_STREAM (p, p_ccb->hci_handle);
- /* only sent the first BTM_SCO_DATA_SIZE_MAX bytes data if more than max,
+ /* only sent the first BTM_SCO_DATA_SIZE_MAX bytes data if more than max,
and set warning status */
if (p_buf->len > BTM_SCO_DATA_SIZE_MAX)
{
@@ -359,7 +368,7 @@ tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf)
p_buf->len += HCI_SCO_PREAMBLE_SIZE;
GKI_enqueue (&p_ccb->xmit_data_q, p_buf);
-
+
btm_sco_check_send_pkts (sco_inx);
}
}
@@ -367,7 +376,7 @@ tBTM_STATUS BTM_WriteScoData (UINT16 sco_inx, BT_HDR *p_buf)
{
GKI_freebuf(p_buf);
- BTM_TRACE_WARNING2 ("BTM_WriteScoData, invalid sco index: %d at state [%d]",
+ BTM_TRACE_WARNING2 ("BTM_WriteScoData, invalid sco index: %d at state [%d]",
sco_inx, btm_cb.sco_cb.sco_db[sco_inx].state);
status = BTM_UNKNOWN_ADDR;
}
@@ -441,7 +450,7 @@ static tBTM_STATUS btm_send_connect_request(UINT16 acl_handle,
p_setup->tx_bw, p_setup->rx_bw,
p_setup->max_latency, p_setup->voice_contfmt,
p_setup->retrans_effort, temp_pkt_types);
-
+
if (!btsnd_hcic_setup_esco_conn(acl_handle,
p_setup->tx_bw,
p_setup->rx_bw,
@@ -613,7 +622,7 @@ tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig, UINT16 pkt_types
/* Coverity: FALSE-POSITIVE error from Coverity tool. Please do NOT remove following comment. */
/* coverity[uninit_use_in_call] False-positive: setting the mode to BTM_PM_MD_ACTIVE only uses settings.mode
the other data members of tBTM_PM_PWR_MD are ignored
-*/
+*/
pm.mode = BTM_PM_MD_ACTIVE;
BTM_SetPowerMode(BTM_PM_SET_ONLY_ID, remote_bda, &pm);
p->state = SCO_ST_PEND_UNPARK;
@@ -682,7 +691,7 @@ tBTM_STATUS BTM_CreateSco (BD_ADDR remote_bda, BOOLEAN is_orig, UINT16 pkt_types
}
if( p->state != SCO_ST_PEND_UNPARK && p->state != SCO_ST_PEND_ROLECHANGE )
- {
+ {
if (is_orig)
{
BTM_TRACE_API2("BTM_CreateSco -> (e)SCO Link for ACL handle 0x%04x, Desired Type %d",
@@ -762,7 +771,7 @@ void btm_sco_chk_pend_rolechange (UINT16 hci_handle)
for (xx = 0; xx < BTM_MAX_SCO_LINKS; xx++, p++)
{
- if ((p->state == SCO_ST_PEND_ROLECHANGE) &&
+ if ((p->state == SCO_ST_PEND_ROLECHANGE) &&
((acl_handle = BTM_GetHCIConnHandle (p->esco.data.bd_addr)) == hci_handle))
{
@@ -842,7 +851,7 @@ void btm_sco_conn_req (BD_ADDR bda, DEV_CLASS dev_class, UINT8 link_type)
}
/* TCS usage */
- if (btm_cb.sco_cb.app_sco_ind_cb)
+ if (btm_cb.sco_cb.app_sco_ind_cb)
{
/* Now, try to find an unused control block */
for (xx = 0, p = &btm_cb.sco_cb.sco_db[0]; xx < BTM_MAX_SCO_LINKS; xx++, p++)
@@ -858,8 +867,8 @@ void btm_sco_conn_req (BD_ADDR bda, DEV_CLASS dev_class, UINT8 link_type)
break;
}
}
- if( xx < BTM_MAX_SCO_LINKS)
- {
+ if( xx < BTM_MAX_SCO_LINKS)
+ {
btm_cb.sco_cb.app_sco_ind_cb(xx);
return;
}
@@ -976,7 +985,7 @@ void btm_sco_connected (UINT8 hci_status, BD_ADDR bda, UINT16 hci_handle,
** Description Look through all active SCO connection for a match based on the
** HCI handle.
**
-** Returns index to matched SCO connection CB, or BTM_MAX_SCO_LINKS if
+** Returns index to matched SCO connection CB, or BTM_MAX_SCO_LINKS if
** no match.
**
*******************************************************************************/
@@ -1070,7 +1079,7 @@ void btm_remove_sco_links (BD_ADDR bda)
** Function btm_sco_removed
**
** Description This function is called by BTIF when an SCO connection
-** is removed.
+** is removed.
**
** Returns void
**
@@ -1131,7 +1140,7 @@ void btm_sco_acl_removed (BD_ADDR bda)
if ((!bda) || (!memcmp (p->esco.data.bd_addr, bda, BD_ADDR_LEN) && p->rem_bd_known))
{
btm_sco_flush_sco_data(xx);
-
+
p->state = SCO_ST_UNUSED;
p->esco.p_esco_cback = NULL; /* Deregister eSCO callback */
(*p->p_disc_cb)(xx);
@@ -1388,13 +1397,13 @@ tBTM_STATUS BTM_SetEScoMode (tBTM_SCO_TYPE sco_mode, tBTM_ESCO_PARAMS *p_parms)
** Function BTM_RegForEScoEvts
**
** Description This function registers a SCO event callback with the
-** specified instance. It should be used to received
+** specified instance. It should be used to received
** connection indication events and change of link parameter
-** events.
+** events.
**
** Returns BTM_SUCCESS if the successful.
** BTM_ILLEGAL_VALUE if there is an illegal sco_inx
-** BTM_MODE_UNSUPPORTED if controller version is not BT1.2 or
+** BTM_MODE_UNSUPPORTED if controller version is not BT1.2 or
** later or does not support eSCO.
**
*******************************************************************************/
@@ -1440,7 +1449,7 @@ tBTM_STATUS BTM_ReadEScoLinkParms (UINT16 sco_inx, tBTM_ESCO_DATA *p_parms)
#if (BTM_MAX_SCO_LINKS>0)
BTM_TRACE_API1("BTM_ReadEScoLinkParms -> sco_inx 0x%04x", sco_inx);
- if (sco_inx < BTM_MAX_SCO_LINKS &&
+ if (sco_inx < BTM_MAX_SCO_LINKS &&
btm_cb.sco_cb.sco_db[sco_inx].state >= SCO_ST_CONNECTED)
{
*p_parms = btm_cb.sco_cb.sco_db[sco_inx].esco.data;
@@ -1477,12 +1486,12 @@ tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx, tBTM_CHG_ESCO_PARAMS *p_par
tBTM_ESCO_PARAMS *p_setup;
tSCO_CONN *p_sco;
UINT16 temp_pkt_types;
-
+
/* Make sure sco handle is valid and on an active link */
- if (sco_inx >= BTM_MAX_SCO_LINKS ||
+ if (sco_inx >= BTM_MAX_SCO_LINKS ||
btm_cb.sco_cb.sco_db[sco_inx].state != SCO_ST_CONNECTED)
return (BTM_WRONG_MODE);
-
+
p_sco = &btm_cb.sco_cb.sco_db[sco_inx];
p_setup = &p_sco->esco.setup;
@@ -1490,9 +1499,9 @@ tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx, tBTM_CHG_ESCO_PARAMS *p_par
if (p_sco->esco.data.link_type == BTM_LINK_TYPE_SCO ||
!btm_cb.sco_cb.esco_supported)
{
- p_setup->packet_types = p_parms->packet_types &
+ p_setup->packet_types = p_parms->packet_types &
(btm_cb.btm_sco_pkt_types_supported & BTM_SCO_LINK_ONLY_MASK);
-
+
BTM_TRACE_API2("BTM_ChangeEScoLinkParms -> SCO Link for handle 0x%04x, pkt 0x%04x",
p_sco->hci_handle, p_setup->packet_types);
@@ -1548,7 +1557,7 @@ tBTM_STATUS BTM_ChangeEScoLinkParms (UINT16 sco_inx, tBTM_CHG_ESCO_PARAMS *p_par
** the tx_bw, max_latency, content format, and packet_types are
** valid. The hci_status parameter should be
** ([0x0] to accept, [0x0d..0x0f] to reject)
-**
+**
**
** Returns void
**
@@ -1570,9 +1579,9 @@ void BTM_EScoConnRsp (UINT16 sco_inx, UINT8 hci_status, tBTM_ESCO_PARAMS *p_parm
**
** Function btm_read_def_esco_mode
**
-** Description This function copies the current default esco settings into
+** Description This function copies the current default esco settings into
** the return buffer.
-**
+**
** Returns tBTM_SCO_TYPE
**
*******************************************************************************/
@@ -1591,7 +1600,7 @@ tBTM_SCO_TYPE btm_read_def_esco_mode (tBTM_ESCO_PARAMS *p_parms)
** Function btm_esco_proc_conn_chg
**
** Description This function is called by BTIF when an SCO connection
-** is changed.
+** is changed.
**
** Returns void
**
@@ -1636,7 +1645,7 @@ void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval,
**
** Function btm_is_sco_active
**
-** Description This function is called to see if a SCO handle is already in
+** Description This function is called to see if a SCO handle is already in
** use.
**
** Returns BOOLEAN
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index 5ef45b1..956364e 100755..100644
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-** *
-** Name: btm_sec.c *
-** *
-** Description: This file contains functions for the Bluetooth Security *
-** Manager *
-** *
-** Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved. *
-** Broadcom Bluetooth Core. Proprietary and confidential. *
-******************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 1999-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains functions for the Bluetooth Security Manager
+ *
+ ******************************************************************************/
#include <string.h>
#include "bt_types.h"
@@ -68,8 +81,8 @@ BOOLEAN btm_sec_are_all_trusted(UINT32 p_mask[]);
static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason);
tBTM_SEC_DEV_REC *btm_sec_find_dev_by_sec_state (UINT8 state);
-static BOOLEAN btm_sec_set_security_level ( CONNECTION_TYPE conn_type, char *p_name, UINT8 service_id,
- UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
+static BOOLEAN btm_sec_set_security_level ( CONNECTION_TYPE conn_type, char *p_name, UINT8 service_id,
+ UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
UINT32 mx_chan_id);
/* TRUE - authenticated link key is possible */
@@ -126,8 +139,8 @@ BOOLEAN BTM_SecRegister (tBTM_APPL_INFO *p_cb_info)
}
#endif
-
-
+
+
btm_cb.api = *p_cb_info;
#if BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
BTM_TRACE_ERROR1 ("BTM_SecRegister: btm_cb.api.p_le_callback = 0x%x ", btm_cb.api.p_le_callback);
@@ -391,11 +404,11 @@ void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired)
** Description Register UCD service security level with Security Manager
**
** Parameters: is_originator - TRUE if originating the connection, FALSE if not
-** p_name - Name of the service relevant only if
+** p_name - Name of the service relevant only if
** authorization will show this name to user. ignored
** if BTM_SEC_SERVICE_NAME_LEN is 0.
** service_id - service ID for the service passed to authorization callback
-** sec_level - bit mask of the security features
+** sec_level - bit mask of the security features
** psm - L2CAP PSM
** mx_proto_id - protocol ID of multiplexing proto below
** mx_chan_id - channel ID of multiplexing proto below
@@ -403,8 +416,8 @@ void BTM_SetPairableMode (BOOLEAN allow_pairing, BOOLEAN connect_only_paired)
** Returns TRUE if registered OK, else FALSE
**
*******************************************************************************/
-BOOLEAN BTM_SetUCDSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 service_id,
- UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
+BOOLEAN BTM_SetUCDSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 service_id,
+ UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
UINT32 mx_chan_id)
{
#if (L2CAP_UCD_INCLUDED == TRUE)
@@ -415,7 +428,7 @@ BOOLEAN BTM_SetUCDSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 serv
else
conn_type = CONNLESS_TERM;
- return(btm_sec_set_security_level (conn_type, p_name, service_id,
+ return(btm_sec_set_security_level (conn_type, p_name, service_id,
sec_level, psm, mx_proto_id, mx_chan_id));
#else
return FALSE;
@@ -429,11 +442,11 @@ BOOLEAN BTM_SetUCDSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 serv
** Description Register service security level with Security Manager
**
** Parameters: is_originator - TRUE if originating the connection, FALSE if not
-** p_name - Name of the service relevant only if
+** p_name - Name of the service relevant only if
** authorization will show this name to user. ignored
** if BTM_SEC_SERVICE_NAME_LEN is 0.
** service_id - service ID for the service passed to authorization callback
-** sec_level - bit mask of the security features
+** sec_level - bit mask of the security features
** psm - L2CAP PSM
** mx_proto_id - protocol ID of multiplexing proto below
** mx_chan_id - channel ID of multiplexing proto below
@@ -453,10 +466,10 @@ BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 service
else
conn_type = CONN_ORIENT_TERM;
- return(btm_sec_set_security_level (conn_type, p_name, service_id,
+ return(btm_sec_set_security_level (conn_type, p_name, service_id,
sec_level, psm, mx_proto_id, mx_chan_id));
#else
- return(btm_sec_set_security_level (is_originator, p_name, service_id,
+ return(btm_sec_set_security_level (is_originator, p_name, service_id,
sec_level, psm, mx_proto_id, mx_chan_id));
#endif
}
@@ -468,11 +481,11 @@ BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 service
** Description Register service security level with Security Manager
**
** Parameters: conn_type - TRUE if originating the connection, FALSE if not
-** p_name - Name of the service relevant only if
+** p_name - Name of the service relevant only if
** authorization will show this name to user. ignored
** if BTM_SEC_SERVICE_NAME_LEN is 0.
** service_id - service ID for the service passed to authorization callback
-** sec_level - bit mask of the security features
+** sec_level - bit mask of the security features
** psm - L2CAP PSM
** mx_proto_id - protocol ID of multiplexing proto below
** mx_chan_id - channel ID of multiplexing proto below
@@ -480,8 +493,8 @@ BOOLEAN BTM_SetSecurityLevel (BOOLEAN is_originator, char *p_name, UINT8 service
** Returns TRUE if registered OK, else FALSE
**
*******************************************************************************/
-static BOOLEAN btm_sec_set_security_level (CONNECTION_TYPE conn_type, char *p_name, UINT8 service_id,
- UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
+static BOOLEAN btm_sec_set_security_level (CONNECTION_TYPE conn_type, char *p_name, UINT8 service_id,
+ UINT16 sec_level, UINT16 psm, UINT32 mx_proto_id,
UINT32 mx_chan_id)
{
tBTM_SEC_SERV_REC *p_srec;
@@ -766,9 +779,9 @@ UINT8 btm_sec_clr_service_by_psm (UINT16 psm)
**
** Function BTM_SecClrUCDService
**
-** Description
+** Description
**
-** Parameters Service ID - Id of the service to remove.
+** Parameters Service ID - Id of the service to remove.
** ('0' removes all service records )
**
** Returns Number of records that were cleared.
@@ -784,7 +797,7 @@ UINT8 BTM_SecClrUCDService (UINT8 service_id)
for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_srec++)
{
/* Delete services with specified name (if in use and not SDP) */
- if ((p_srec->security_flags & BTM_SEC_IN_USE) &&
+ if ((p_srec->security_flags & BTM_SEC_IN_USE) &&
(!service_id || (service_id == (UINT32)p_srec->service_id)))
{
BTM_TRACE_API2("BTM_UCD_SEC_CLR[%d]: id %d", i, service_id);
@@ -902,7 +915,7 @@ 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;
- (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
+ (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, HCI_ERR_AUTH_FAILURE);
}
return;
@@ -911,7 +924,7 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
btm_cb.acl_disc_reason = HCI_SUCCESS;
-#ifdef PORCHE_PAIRING_CONFLICT
+#ifdef PORCHE_PAIRING_CONFLICT
BTM_TRACE_EVENT2("BTM_PINCodeReply(): Saving pin_len: %d btm_cb.pin_code_len: %d", pin_len, btm_cb.pin_code_len);
/* if this was not pre-fetched, save the PIN */
if (btm_cb.pin_code_len == 0)
@@ -1209,7 +1222,7 @@ tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr)
#if SMP_INCLUDED == TRUE
p = btm_bda_to_acl(bd_addr);
- if (p && p->is_le_link &&
+ if (p && p->is_le_link &&
(p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING))
{
BTM_TRACE_DEBUG0 ("Cancel LE pairing");
@@ -1219,7 +1232,7 @@ tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr)
}
else
{
- return BTM_WRONG_MODE;
+ return BTM_WRONG_MODE;
}
}
@@ -1450,12 +1463,12 @@ static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UIN
#if BTM_DISC_DURING_RS == TRUE
/* If a Role Switch is in progress, delay the HCI Disconnect to avoid controller problem (4329B1) */
if (p_dev_rec->rs_disc_pending == BTM_SEC_RS_PENDING)
- {
+ {
BTM_TRACE_ERROR0("RS in progress - Set DISC Pending flag in btm_sec_send_hci_disconnect to delay disconnect");
p_dev_rec->rs_disc_pending = BTM_SEC_DISC_PENDING;
return BTM_SUCCESS;
}
-#endif
+#endif
/* Tear down the HCI link */
if (!btsnd_hcic_disconnect (p_dev_rec->hci_handle, reason))
{
@@ -2224,7 +2237,7 @@ tBTM_STATUS btm_sec_l2cap_access_req (BD_ADDR bd_addr, UINT16 psm, UINT16 handle
(p_dev_rec->sec_flags & BTM_SEC_AUTHENTICATED), (p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED));
/* SM4, but we do not know for sure which level of security we need.
* as long as we have a link key, it's OK */
- if ((0 == (p_dev_rec->sec_flags & BTM_SEC_AUTHENTICATED))
+ if ((0 == (p_dev_rec->sec_flags & BTM_SEC_AUTHENTICATED))
||(0 == (p_dev_rec->sec_flags & BTM_SEC_ENCRYPTED)))
{
rc = BTM_DELAY_CHECK;
@@ -2885,7 +2898,7 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
{
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
- (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
+ (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, status);
return;
}
@@ -2902,7 +2915,7 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
}
}
- /* BT 2.1 or carkit, bring up the connection to force the peer to request PIN.
+ /* BT 2.1 or carkit, bring up the connection to force the peer to request PIN.
** Else prefetch (btm_sec_check_prefetch_pin will do the prefetching if needed)
*/
if ((p_dev_rec->sm4 != BTM_SM4_KNOWN) || !btm_sec_check_prefetch_pin(p_dev_rec))
@@ -2920,7 +2933,7 @@ void btm_sec_rmt_name_request_complete (UINT8 *p_bd_addr, UINT8 *p_bd_name, UINT
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
- (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
+ (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
}
}
@@ -3222,8 +3235,8 @@ void btm_io_capabilities_rsp (UINT8 *p)
* Use the connecting device's CoD for the connection */
/* coverity[uninit_use_in_call]
Event uninit_use_in_call: Using uninitialized element of array "evt_data.bd_addr" in call to function "memcmp"
-FALSE-POSITIVE error from Coverity test-tool. evt_data.bd_addr is set at the beginning with: STREAM_TO_BDADDR (evt_data.bd_addr, p);
-*/
+FALSE-POSITIVE error from Coverity test-tool. evt_data.bd_addr is set at the beginning with: STREAM_TO_BDADDR (evt_data.bd_addr, p);
+*/
if (!memcmp (evt_data.bd_addr, btm_cb.connecting_bda, BD_ADDR_LEN))
memcpy (p_dev_rec->dev_class, btm_cb.connecting_dc, DEV_CLASS_LEN);
@@ -3683,7 +3696,7 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status)
&& (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->dev_class,
p_dev_rec->sec_bd_name, status);
}
return;
@@ -3943,7 +3956,7 @@ static void btm_sec_connect_after_reject_timeout (TIMER_LIST_ENT *p_tle)
btm_sec_change_pairing_state (BTM_PAIR_STATE_IDLE);
- (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
+ (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr, p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, HCI_ERR_MEMORY_FULL);
}
}
@@ -4107,8 +4120,8 @@ void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode)
/* We need to notify host that the key is not known any more */
if (btm_cb.api.p_auth_complete_callback)
{
- (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
- p_dev_rec->dev_class,
+ (*btm_cb.api.p_auth_complete_callback) (p_dev_rec->bd_addr,
+ p_dev_rec->dev_class,
p_dev_rec->sec_bd_name, status);
}
}
@@ -4326,7 +4339,7 @@ void btm_sec_disconnected (UINT16 handle, UINT8 reason)
return;
#if BTM_DISC_DURING_RS == TRUE
- BTM_TRACE_ERROR0("btm_sec_disconnected - Clearing Pending flag");
+ BTM_TRACE_ERROR0("btm_sec_disconnected - Clearing Pending flag");
p_dev_rec->rs_disc_pending = BTM_SEC_RS_NOT_PENDING; /* reset flag */
#endif
@@ -4485,7 +4498,7 @@ void btm_sec_link_key_request (UINT8 *p_bda)
btsnd_hcic_link_key_req_reply (p_bda, p_dev_rec->link_key);
return;
}
-
+
/* Notify L2CAP to increase timeout */
l2c_pin_code_request (p_bda);
@@ -4654,7 +4667,7 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
if (btm_cb.pairing_state != BTM_PAIR_STATE_IDLE)
{
- if ( (memcmp (p_bda, btm_cb.pairing_bda, BD_ADDR_LEN) == 0) &&
+ if ( (memcmp (p_bda, btm_cb.pairing_bda, BD_ADDR_LEN) == 0) &&
(btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_AUTH_COMPLETE) )
{
/* fake this out - porshe carkit issue - */
@@ -4727,7 +4740,7 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
BTM_TRACE_EVENT0 ("btm_sec_pin_code_request bonding sending reply");
btsnd_hcic_pin_code_req_reply (p_bda, btm_cb.pin_code_len, p_cb->pin_code);
-#ifdef PORCHE_PAIRING_CONFLICT
+#ifdef PORCHE_PAIRING_CONFLICT
btm_cb.pin_code_len_saved = btm_cb.pin_code_len;
#endif
@@ -5189,7 +5202,7 @@ static tBTM_SEC_SERV_REC *btm_sec_find_mx_serv (UINT8 is_originator, UINT16 psm,
for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_serv_rec++)
{
if ((p_serv_rec->security_flags & BTM_SEC_IN_USE)
- && (p_serv_rec->psm == psm)
+ && (p_serv_rec->psm == psm)
&& (p_serv_rec->mx_proto_id == mx_proto_id)
&& (( is_originator && (p_serv_rec->orig_mx_chan_id == mx_chan_id))
|| (!is_originator && (p_serv_rec->term_mx_chan_id == mx_chan_id))))
@@ -5583,7 +5596,7 @@ void btm_sec_clear_ble_keys (tBTM_SEC_DEV_REC *p_dev_rec)
BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda)
{
- tBTM_SEC_DEV_REC *p_dev_rec= btm_find_dev (bda);
+ tBTM_SEC_DEV_REC *p_dev_rec= btm_find_dev (bda);
BOOLEAN is_bonded= FALSE;
#if (SMP_INCLUDED== TRUE)
@@ -5600,7 +5613,7 @@ BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda)
**
** Function btm_sec_find_bonded_dev
**
-** Description Find a bonded device starting from the specified index
+** Description Find a bonded device starting from the specified index
**
** Returns TRUE - found a bonded device
**
@@ -5610,7 +5623,7 @@ BOOLEAN btm_sec_find_bonded_dev (UINT8 start_idx, UINT8 *p_found_idx, tBTM_SEC_D
BOOLEAN found= FALSE;
#if (SMP_INCLUDED== TRUE)
- tBTM_SEC_DEV_REC *p_dev_rec;
+ tBTM_SEC_DEV_REC *p_dev_rec;
int i;
if (start_idx >= BTM_SEC_MAX_DEVICE_RECORDS)
{
@@ -5623,9 +5636,9 @@ BOOLEAN btm_sec_find_bonded_dev (UINT8 start_idx, UINT8 *p_found_idx, tBTM_SEC_D
{
if (p_dev_rec->ble.key_type || (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN))
{
- *p_found_idx = i;
+ *p_found_idx = i;
p_rec = p_dev_rec;
- break;
+ break;
}
}
BTM_TRACE_DEBUG1 ("btm_sec_find_bonded_dev=%d", found);