/** Bonds with peer device */
void bta_dm_bond(const RawAddress& bd_addr, tBTA_TRANSPORT transport) {
- tBTM_STATUS status;
tBTA_DM_SEC sec_event;
char* p_name;
- if (transport == BTA_TRANSPORT_UNKNOWN)
- status = BTM_SecBond(bd_addr, 0, NULL, 0);
- else
- status = BTM_SecBondByTransport(bd_addr, transport, 0, NULL, 0);
+ tBTM_STATUS status = BTM_SecBond(bd_addr, transport, 0, NULL, 0);
if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED)) {
memset(&sec_event, 0, sizeof(tBTA_DM_SEC));
}
/** This function initiates a bonding procedure with a peer device */
-void BTA_DmBond(const RawAddress& bd_addr) {
- do_in_main_thread(FROM_HERE,
- base::Bind(bta_dm_bond, bd_addr, BTA_TRANSPORT_UNKNOWN));
-}
-
-/** This function initiates a bonding procedure with a peer device */
-void BTA_DmBondByTransport(const RawAddress& bd_addr,
- tBTA_TRANSPORT transport) {
+void BTA_DmBond(const RawAddress& bd_addr, tBTA_TRANSPORT transport) {
do_in_main_thread(FROM_HERE, base::Bind(bta_dm_bond, bd_addr, transport));
}
* Function BTA_DmBond
*
* Description This function initiates a bonding procedure with a peer
- * device. The bonding procedure enables authentication
- * and optionally encryption on the Bluetooth link.
- *
- *
- * Returns void
- *
- ******************************************************************************/
-extern void BTA_DmBond(const RawAddress& bd_addr);
-
-/*******************************************************************************
- *
- * Function BTA_DmBondByTransport
- *
- * Description This function initiates a bonding procedure with a peer
* device by designated transport. The bonding procedure
* enables authentication and optionally encryption on the
* Bluetooth link.
* Returns void
*
******************************************************************************/
-extern void BTA_DmBondByTransport(const RawAddress& bd_addr,
- tBTA_TRANSPORT transport);
+extern void BTA_DmBond(const RawAddress& bd_addr, tBTA_TRANSPORT transport);
/*******************************************************************************
*
if (status != BT_STATUS_SUCCESS)
bond_state_changed(status, bd_addr, BT_BOND_STATE_NONE);
} else {
- BTA_DmBondByTransport(bd_addr, transport);
+ BTA_DmBond(bd_addr, transport);
}
/* Track originator of bond creation */
pairing_cb.is_local_initiated = true;
return controller_get_interface()->supports_ble_privacy();
}
-tBTM_STATUS bluetooth::shim::BTM_SecBondByTransport(const RawAddress& bd_addr,
- tBT_TRANSPORT transport,
- uint8_t pin_len,
- uint8_t* p_pin,
- uint32_t trusted_mask[]) {
- return shim_btm.CreateBond(bd_addr, transport, pin_len, p_pin, trusted_mask);
-}
-
tBTM_STATUS bluetooth::shim::BTM_SecBond(const RawAddress& bd_addr,
+ tBT_TRANSPORT transport,
uint8_t pin_len, uint8_t* p_pin,
uint32_t trusted_mask[]) {
- tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
- // TODO: do proper transport guessing
return shim_btm.CreateBond(bd_addr, transport, pin_len, p_pin, trusted_mask);
}
*
* Function BTM_SecBond
*
- * Description This function is called to perform bonding with peer device.
- *
- * Parameters: bd_addr - Address of the device to bond
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
- * trusted_mask - bitwise OR of trusted services
- * (array of uint32_t)
- * Returns BTM_CMD_STARTED if successfully initiated, otherwise error
- *
- ******************************************************************************/
-tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]);
-
-/*******************************************************************************
- *
- * Function BTM_SecBondByTransport
- *
* Description Perform bonding by designated transport
*
* Parameters: bd_addr - Address of the device to bond
* Returns BTM_CMD_STARTED if successfully initiated, otherwise error
*
******************************************************************************/
-tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]);
+tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+ uint8_t pin_len, uint8_t* p_pin,
+ uint32_t trusted_mask[]);
/*******************************************************************************
*
* Function BTM_SecBond
*
* Description This function is called to perform bonding with peer device.
- *
- * Parameters: bd_addr - Address of the device to bond
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
- * trusted_mask - bitwise OR of trusted services
- * (array of uint32_t)
- * Returns BTM_CMD_STARTED if successfully initiated, otherwise error
- *
- ******************************************************************************/
-tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]);
-
-/*******************************************************************************
- *
- * Function BTM_SecBondByTransport
- *
- * Description This function is called to perform bonding with peer device.
* If the connection is already up, but not secure, pairing
* is attempted. If already paired BTM_SUCCESS is returned.
*
*
* Note: After 2.1 parameters are not used and preserved here not to change API
******************************************************************************/
-tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]);
+tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+ uint8_t pin_len, uint8_t* p_pin,
+ uint32_t trusted_mask[]);
} // namespace shim
} // namespace bluetooth
/*******************************************************************************
*
- * Function BTM_SecBondByTransport
+ * Function BTM_SecBond
*
* Description This function is called to perform bonding with peer device.
* If the connection is already up, but not secure, pairing
*
* Note: After 2.1 parameters are not used and preserved here not to change API
******************************************************************************/
-tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr,
- tBT_TRANSPORT transport, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]) {
+tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, tBT_TRANSPORT transport,
+ uint8_t pin_len, uint8_t* p_pin,
+ uint32_t trusted_mask[]) {
if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::BTM_SecBondByTransport(bd_addr, transport, pin_len,
- p_pin, trusted_mask);
+ return bluetooth::shim::BTM_SecBond(bd_addr, transport, pin_len, p_pin,
+ trusted_mask);
}
+ if (transport == BT_TRANSPORT_INVALID)
+ transport = BTM_UseLeLink(bd_addr) ? BT_TRANSPORT_LE : BT_TRANSPORT_BR_EDR;
+
tBT_DEVICE_TYPE dev_type;
tBLE_ADDR_TYPE addr_type;
/*******************************************************************************
*
- * Function BTM_SecBond
- *
- * Description This function is called to perform bonding with peer device.
- * If the connection is already up, but not secure, pairing
- * is attempted. If already paired BTM_SUCCESS is returned.
- *
- * Parameters: bd_addr - Address of the device to bond
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
- * trusted_mask - bitwise OR of trusted services
- * (array of uint32_t)
- *
- * Note: After 2.1 parameters are not used and preserved here not to change API
- ******************************************************************************/
-tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]) {
- if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::BTM_SecBond(bd_addr, pin_len, p_pin, trusted_mask);
- }
-
- tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
- if (BTM_UseLeLink(bd_addr)) transport = BT_TRANSPORT_LE;
- return btm_sec_bond_by_transport(bd_addr, transport, pin_len, p_pin,
- trusted_mask);
-}
-/*******************************************************************************
- *
* Function BTM_SecBondCancel
*
* Description This function is called to cancel ongoing bonding process
*
* Function BTM_SecBond
*
- * Description This function is called to perform bonding with peer device.
- *
- * Parameters: bd_addr - Address of the device to bond
- * pin_len - length in bytes of the PIN Code
- * p_pin - pointer to array with the PIN Code
- * trusted_mask - bitwise OR of trusted services
- * (array of uint32_t)
- * Returns BTM_CMD_STARTED if successfully initiated, otherwise error
- *
- ******************************************************************************/
-extern tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len,
- uint8_t* p_pin, uint32_t trusted_mask[]);
-
-/*******************************************************************************
- *
- * Function BTM_SecBondByTransport
- *
* Description Perform bonding by designated transport
*
* Parameters: bd_addr - Address of the device to bond
* Returns BTM_CMD_STARTED if successfully initiated, otherwise error
*
******************************************************************************/
-extern tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr,
- tBT_TRANSPORT transport,
- uint8_t pin_len, uint8_t* p_pin,
- uint32_t trusted_mask[]);
+extern tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr,
+ tBT_TRANSPORT transport, uint8_t pin_len,
+ uint8_t* p_pin, uint32_t trusted_mask[]);
/*******************************************************************************
*