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

Commit 1c782fe4 authored by Chris Manton's avatar Chris Manton
Browse files

6/10 Unfriend bta::dm::tBTA_DM_PEER_DEVICE

Add is/set/reset ssr active
Bug: 296647114
Test: m .

Change-Id: Id7fae51794f1376e20e1288b0d233a8a09508bbb
parent 1637fc2a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -278,6 +278,10 @@ struct tBTA_DM_PEER_DEVICE {
    info &= ~(BTA_DM_DI_INT_SNIFF | BTA_DM_DI_ACP_SNIFF | BTA_DM_DI_SET_SNIFF);
  }

  void set_ssr_active() { info |= BTA_DM_DI_USE_SSR; }
  void reset_ssr_active() { info &= ~BTA_DM_DI_USE_SSR; }
  bool is_ssr_active() const { return info & BTA_DM_DI_USE_SSR; }

  tBTA_DM_ENCRYPT_CBACK* p_encrypt_cback;
  tBTM_PM_STATUS prev_low; /* previous low power mode used */
  tBTA_DM_PM_ACTION pm_mode_attempted;
+5 −6
Original line number Diff line number Diff line
@@ -379,8 +379,7 @@ static void bta_dm_pm_cback(tBTA_SYS_CONN_STATUS status, const tBTA_SYS_ID id,

  /* set SSR parameters on SYS CONN OPEN */
  int index = BTA_DM_PM_SSR0;
  if ((BTA_SYS_CONN_OPEN == status) && p_dev &&
      (p_dev->Info() & BTA_DM_DI_USE_SSR)) {
  if ((BTA_SYS_CONN_OPEN == status) && p_dev && (p_dev->is_ssr_active())) {
    index = get_bta_dm_pm_spec()[p_bta_dm_pm_cfg[i].spec_idx].ssr;
  } else if (BTA_ID_AV == id) {
    if (BTA_SYS_CONN_BUSY == status) {
@@ -789,7 +788,7 @@ void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) {
  if (mode != BTM_PM_MD_SNIFF ||
      (controller->supports_sniff_subrating() && p_rem_feat &&
       HCI_SNIFF_SUB_RATE_SUPPORTED(p_rem_feat) &&
       !(p_peer_dev->Info() & BTA_DM_DI_USE_SSR))) {
       !(p_peer_dev->is_ssr_active()))) {
    /* Dont initiate Sniff if controller has alreay accepted
     * remote sniff params. This avoid sniff loop issue with
     * some agrresive headsets who use sniff latencies more than
@@ -1040,7 +1039,7 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
      /* save the previous low power mode - for SSR.
       * SSR parameters are sent to controller on "conn open".
       * the numbers stay good until park/hold/detach */
      if (p_dev->info & BTA_DM_DI_USE_SSR) p_dev->prev_low = status;
      if (p_dev->is_ssr_active()) p_dev->prev_low = status;
      break;

    case BTM_PM_STS_SSR:
@@ -1048,11 +1047,11 @@ void bta_dm_pm_btm_status(const RawAddress& bd_addr, tBTM_PM_STATUS status,
        LOG_WARN("Received error when attempting to set sniff subrating mode");
      }
      if (interval) {
        p_dev->info |= BTA_DM_DI_USE_SSR;
        p_dev->set_ssr_active();
        LOG_DEBUG("Enabling sniff subrating mode for peer:%s",
                  ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
      } else {
        p_dev->info &= ~BTA_DM_DI_USE_SSR;
        p_dev->reset_ssr_active();
        LOG_DEBUG("Disabling sniff subrating mode for peer:%s",
                  ADDRESS_TO_LOGGABLE_CSTR(bd_addr));
      }