if (bta_av_cb.features & BTA_AV_FEAT_CENTRAL)
BTM_block_role_switch_for(p_scb->PeerAddress());
- tBTM_STATUS status =
- BTM_SwitchRole(p_scb->PeerAddress(), HCI_ROLE_CENTRAL);
+ tBTM_STATUS status = BTM_SwitchRoleToCentral(p_scb->PeerAddress());
if (status != BTM_CMD_STARTED) {
/* can not switch role on SCB - start the timer on SCB */
- LOG_ERROR("%s: peer %s BTM_SwitchRole(HCI_ROLE_CENTRAL) error: %d",
- __func__, p_scb->PeerAddress().ToString().c_str(), status);
+ LOG_ERROR(
+ "%s: peer %s BTM_SwitchRoleToCentral(HCI_ROLE_CENTRAL) error: %d",
+ __func__, p_scb->PeerAddress().ToString().c_str(), status);
}
if (status != BTM_MODE_UNSUPPORTED && status != BTM_DEV_BLACKLISTED) {
is_ok = false;
/* more than one connections and the AV connection is role switched
* to peripheral
* switch it back to central and remove the switch policy */
- BTM_SwitchRole(bd_addr, HCI_ROLE_CENTRAL);
+ BTM_SwitchRoleToCentral(bd_addr);
need_policy_change = true;
} else if (p_bta_dm_cfg->avoid_scatter && (new_role == HCI_ROLE_CENTRAL)) {
/* if the link updated to be central include AV activities, remove
if ((p_dev->conn_state == BTA_DM_CONNECTED) &&
(p_dev->info & BTA_DM_DI_AV_ACTIVE)) {
/* make central and take away the role switch policy */
- BTM_SwitchRole(p_dev->peer_bdaddr, HCI_ROLE_CENTRAL);
+ BTM_SwitchRoleToCentral(p_dev->peer_bdaddr);
/* else either already central or can not switch for some reasons */
BTM_block_role_switch_for(p_dev->peer_bdaddr);
break;
if (bta_dm_cb.device_list.peer_device[i].pref_role !=
BTA_PERIPHERAL_ROLE_ONLY &&
!delay_role_switch) {
- BTM_SwitchRole(bta_dm_cb.device_list.peer_device[i].peer_bdaddr,
- HCI_ROLE_CENTRAL);
+ BTM_SwitchRoleToCentral(
+ bta_dm_cb.device_list.peer_device[i].peer_bdaddr);
} else {
alarm_set_on_mloop(bta_dm_cb.switch_delay_timer,
BTA_DM_SWITCH_DELAY_TIMER_MS,
};
/* Structure returned with Role Switch information (in tBTM_CMPL_CB callback
- * function) in response to BTM_SwitchRole call.
+ * function) in response to BTM_SwitchRoleToCentral call.
*/
typedef struct {
RawAddress remote_bd_addr; /* Remote BD addr involved with the switch */
/*******************************************************************************
*
- * Function BTM_SwitchRole
+ * Function BTM_SwitchRoleToCentral
*
* Description This function is called to switch role between central and
* peripheral. If role is already set it will do nothing.
* BTM_BUSY if the previous command is not completed
*
******************************************************************************/
-tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role) {
+tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr) {
if (!controller_get_interface()->supports_central_peripheral_role_switch()) {
LOG_INFO("Local controller does not support role switching");
return BTM_MODE_UNSUPPORTED;
return BTM_UNKNOWN_ADDR;
}
- if (p_acl->link_role == new_role) {
+ if (p_acl->link_role == HCI_ROLE_CENTRAL) {
LOG_INFO("Requested role is already in effect");
return BTM_SUCCESS;
}
p_acl->set_encryption_off();
p_acl->set_switch_role_encryption_off();
} else {
- btsnd_hcic_switch_role(remote_bd_addr, new_role);
+ btsnd_hcic_switch_role(remote_bd_addr, HCI_ROLE_CENTRAL);
p_acl->set_switch_role_in_progress();
p_acl->rs_disc_pending = BTM_SEC_RS_PENDING;
}
/*******************************************************************************
*
- * Function BTM_SwitchRole
+ * Function BTM_SwitchRoleToCentral
*
* Description This function is called to switch role between central and
* peripheral. If role is already set it will do nothing.
* role switching
*
******************************************************************************/
-tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role);
+tBTM_STATUS BTM_SwitchRoleToCentral(const RawAddress& remote_bd_addr);
/*******************************************************************************
*
p_lcb->link_state = LST_CONNECTING_WAIT_SWITCH;
p_lcb->SetLinkRoleAsCentral();
- if (BTM_SwitchRole(p_lcb_cur->remote_bd_addr, HCI_ROLE_CENTRAL) ==
+ if (BTM_SwitchRoleToCentral(p_lcb_cur->remote_bd_addr) ==
BTM_CMD_STARTED) {
alarm_set_on_mloop(p_lcb->l2c_lcb_timer,
L2CAP_LINK_ROLE_SWITCH_TIMEOUT_MS,