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

Commit c6d30a27 authored by weichinweng's avatar weichinweng Committed by Automerger Merge Worker
Browse files

ASHA: Don't retry if the phy update fail with not success status. am: 42467161

parents eba6a860 42467161
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -584,6 +584,7 @@ class HearingAidImpl : public HearingAid {
    }
  }

  // Just take care phy update successful case to avoid loop excuting.
  void OnPhyUpdateEvent(uint16_t conn_id, uint8_t tx_phys, uint8_t rx_phys,
                        tGATT_STATUS status) {
    HearingDevice* hearingDevice = hearingDevices.FindByConnId(conn_id);
@@ -591,14 +592,19 @@ class HearingAidImpl : public HearingAid {
      DVLOG(2) << "Skipping unknown device, conn_id=" << loghex(conn_id);
      return;
    }
    if (status == GATT_SUCCESS && tx_phys == PHY_LE_2M &&
        rx_phys == PHY_LE_2M) {
    if (status != GATT_SUCCESS) {
      LOG(WARNING) << hearingDevice->address
                   << " phy update fail with status: " << status;
      return;
    }
    if (tx_phys == PHY_LE_2M && rx_phys == PHY_LE_2M) {
      LOG(INFO) << hearingDevice->address << " phy update to 2M successful";
      return;
    }
    LOG(INFO) << hearingDevice->address
              << " phy update to 2M fail, try again. status: " << status
              << ", tx_phys: " << tx_phys << ", rx_phys: " << rx_phys;
    LOG(INFO)
        << hearingDevice->address
        << " phy update successful but not target phy, try again. tx_phys: "
        << tx_phys << ", rx_phys: " << rx_phys;
    BTM_BleSetPhy(hearingDevice->address, PHY_LE_2M, PHY_LE_2M, 0);
  }