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

Commit 43e3ec24 authored by En-Shuo Hsu's avatar En-Shuo Hsu Committed by Gerrit Code Review
Browse files

Merge changes Idc9dbff0,I2cdac937

* changes:
  Floss: Add tBTM_SCO_PKT_STATUS to HCI SCO
  Floss: Add struct to record mSBC packets' status
parents 223e2666 3070c770
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -409,6 +409,13 @@ class JniHeadsetCallbacks : bluetooth::headset::Callbacks {
    sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onAtBia, service, roam,
                                 signal, battery, addr.get());
  }

  void DebugDumpCallback(bool active, bool wbs, int total_num_decoded_frames,
                         double pkt_loss_ratio, uint64_t begin_ts,
                         uint64_t end_ts, const char* pkt_status_in_hex,
                         const char* pkt_status_in_binary) override {
    ALOGE("Not implemented and shouldn't be called");
  }
};

static void classInitNative(JNIEnv* env, jclass clazz) {
+14 −0
Original line number Diff line number Diff line
@@ -859,6 +859,7 @@ class HeadsetInterface : Interface {
  bt_status_t SetScoAllowed(bool value) override;
  bt_status_t SendBsir(bool value, RawAddress* bd_addr) override;
  bt_status_t SetActiveDevice(RawAddress* active_device_addr) override;
  bt_status_t DebugDump() override;
};

bt_status_t HeadsetInterface::Init(Callbacks* callbacks, int max_hf_clients,
@@ -1577,6 +1578,19 @@ bt_status_t HeadsetInterface::SetActiveDevice(RawAddress* active_device_addr) {
  return BT_STATUS_SUCCESS;
}

bt_status_t HeadsetInterface::DebugDump() {
  CHECK_BTHF_INIT();
  tBTM_SCO_DEBUG_DUMP debug_dump = BTM_GetScoDebugDump();
  bt_hf_callbacks->DebugDumpCallback(
      debug_dump.is_active, debug_dump.is_wbs,
      debug_dump.total_num_decoded_frames, debug_dump.pkt_loss_ratio,
      debug_dump.latest_msbc_data.begin_ts_raw_us,
      debug_dump.latest_msbc_data.end_ts_raw_us,
      debug_dump.latest_msbc_data.status_in_hex.c_str(),
      debug_dump.latest_msbc_data.status_in_binary.c_str());
  return BT_STATUS_SUCCESS;
}

/*******************************************************************************
 *
 * Function         btif_hf_execute_service
+21 −0
Original line number Diff line number Diff line
@@ -227,6 +227,27 @@ class DBusHeadsetCallbacks : public headset::Callbacks {
             battery, ADDRESS_TO_LOGGABLE_CSTR(*bd_addr));
  }

  void DebugDumpCallback(
      bool active,
      bool wbs,
      int total_num_decoded_frames,
      double packet_loss_ratio,
      uint64_t begin_ts,
      uint64_t end_ts,
      const char* pkt_status_in_hex,
      const char* pkt_status_in_binary) override {
    LOG_WARN(
        "DebugDumpCallback %d %d %d %f %llu %llu %s %s",
        active,
        wbs,
        total_num_decoded_frames,
        packet_loss_ratio,
        (unsigned long long)begin_ts,
        (unsigned long long)end_ts,
        pkt_status_in_hex,
        pkt_status_in_binary);
  }

 private:
  headset::Interface* headset_;
};
+18 −0
Original line number Diff line number Diff line
@@ -204,6 +204,24 @@ class Callbacks {
   */
  virtual void AtBiaCallback(bool service, bool roam, bool signal, bool battery,
                             RawAddress* bd_addr) = 0;

  /**
   * Callback for DebugDump.
   *
   * @param active whether the SCO is active
   * @param wbs whether it is under WBS, false for NBS.
   * @param total_num_decoded_frames the number of WBS frames decoded.
   * @param pkt_loss_ratio the ratio of lost frames
   * @param begin_ts time of the packet status window starts in microseconds.
   * @param end_ts time of the packet status window ends in microseconds.
   * @param pkt_status_in_hex recorded WBS packets' status in hex string.
   * @param pkt_status_in_binary recorde WBS packets' status in binary string.
   */
  virtual void DebugDumpCallback(bool active, bool wbs,
                                 int total_num_decoded_frames,
                                 double pkt_loss_ratio, uint64_t begin_ts,
                                 uint64_t end_ts, const char* pkt_status_in_hex,
                                 const char* pkt_status_in_binary) = 0;
};

}  // namespace headset
+5 −0
Original line number Diff line number Diff line
@@ -264,6 +264,11 @@ class Interface {
   * @param active_device_addr remote device address
   */
  virtual bt_status_t SetActiveDevice(RawAddress* active_device_addr) = 0;

  /**
   * Trigger a debug dump of the Headset Profile
   */
  virtual bt_status_t DebugDump() = 0;
};

}  // namespace headset
Loading