Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49392290 authored by Chris Manton's avatar Chris Manton
Browse files

Use btm_ble_[increment|decrement]_link_topology_mask

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Test: act.py -tc BleCocTest

Change-Id: I7e3ea469d564bf4bf3778d30d59aabccdcdfdaf7
parent 05dfb832
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -2286,7 +2286,8 @@ bool btm_ble_clear_topology_mask(tBTM_BLE_STATE_MASK request_state_mask) {
 * Returns          void
 * Returns          void
 *
 *
 ******************************************************************************/
 ******************************************************************************/
void btm_ble_update_link_topology_mask(uint8_t link_role, bool increase) {
static void btm_ble_update_link_topology_mask(uint8_t link_role,
                                              bool increase) {
  btm_ble_clear_topology_mask(BTM_BLE_STATE_ALL_CONN_MASK);
  btm_ble_clear_topology_mask(BTM_BLE_STATE_ALL_CONN_MASK);


  if (increase)
  if (increase)
+0 −1
Original line number Original line Diff line number Diff line
@@ -117,7 +117,6 @@ extern bool btm_ble_resume_bg_conn(void);
extern void btm_ble_update_mode_operation(uint8_t link_role,
extern void btm_ble_update_mode_operation(uint8_t link_role,
                                          const RawAddress* bda,
                                          const RawAddress* bda,
                                          uint8_t status);
                                          uint8_t status);
extern void btm_ble_update_link_topology_mask(uint8_t role, bool increase);
extern void btm_ble_bgconn_cancel_if_disconnected(const RawAddress& bd_addr);
extern void btm_ble_bgconn_cancel_if_disconnected(const RawAddress& bd_addr);


/* BLE address management */
/* BLE address management */
+1 −1
Original line number Original line Diff line number Diff line
@@ -265,7 +265,7 @@ void l2cble_notify_le_connection(const RawAddress& bda) {
void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda,
                      tBLE_ADDR_TYPE type, uint16_t conn_interval,
                      tBLE_ADDR_TYPE type, uint16_t conn_interval,
                      uint16_t conn_latency, uint16_t conn_timeout) {
                      uint16_t conn_latency, uint16_t conn_timeout) {
  btm_ble_update_link_topology_mask(role, true);
  btm_ble_increment_link_topology_mask(role);


  // role == HCI_ROLE_MASTER => scanner completed connection
  // role == HCI_ROLE_MASTER => scanner completed connection
  // role == HCI_ROLE_SLAVE => advertiser completed connection
  // role == HCI_ROLE_SLAVE => advertiser completed connection
+1 −1
Original line number Original line Diff line number Diff line
@@ -343,7 +343,7 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) {


    /* Check for BLE and handle that differently */
    /* Check for BLE and handle that differently */
    if (p_lcb->transport == BT_TRANSPORT_LE)
    if (p_lcb->transport == BT_TRANSPORT_LE)
      btm_ble_update_link_topology_mask(p_lcb->LinkRole(), false);
      btm_ble_decrement_link_topology_mask(p_lcb->LinkRole());
    /* Link is disconnected. For all channels, send the event through */
    /* Link is disconnected. For all channels, send the event through */
    /* their FSMs. The CCBs should remove themselves from the LCB     */
    /* their FSMs. The CCBs should remove themselves from the LCB     */
    for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;) {
    for (p_ccb = p_lcb->ccb_queue.p_first_ccb; p_ccb;) {