OSDN Git Service

We always want to switch role to central
authorHansong Zhang <hsz@google.com>
Wed, 4 Nov 2020 22:55:45 +0000 (14:55 -0800)
committerHansong Zhang <hsz@google.com>
Thu, 5 Nov 2020 19:59:22 +0000 (11:59 -0800)
When we continue role switch from mode change or encryption change, we
always want to switch to central, as we only made requests to change to
central.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Iff4ef160956fe2ba5901d24bf1f804570ef3d57e

stack/acl/btm_acl.cc

index abf79ef..245701f 100644 (file)
@@ -576,7 +576,7 @@ void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
       p->set_switch_role_switching();
     }
 
-    btsnd_hcic_switch_role(p->remote_addr, (uint8_t)!p->link_role);
+    btsnd_hcic_switch_role(p->remote_addr, HCI_ROLE_CENTRAL);
     p->rs_disc_pending = BTM_SEC_RS_PENDING;
   }
   /* Finished enabling Encryption after role switch */
@@ -2101,7 +2101,7 @@ void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
       if (p->is_switch_role_mode_change()) {
         p->set_switch_role_in_progress();
         p->rs_disc_pending = BTM_SEC_RS_PENDING;
-        btsnd_hcic_switch_role(p->remote_addr, (uint8_t)!p->link_role);
+        btsnd_hcic_switch_role(p->remote_addr, HCI_ROLE_CENTRAL);
       }
     }
   }