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

Commit 9d9ff7fa authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge "hci_metrics_logger: support le enhanced connection complete"

parents 0d54e3ea 93bcfc57
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -568,22 +568,36 @@ void log_link_layer_connection_other_hci_event(EventView packet, storage::Storag

void log_link_layer_connection_event_le_meta(LeMetaEventView le_meta_event_view) {
  SubeventCode leEvt = le_meta_event_view.GetSubeventCode();
  auto le_connection_complete_view = LeConnectionCompleteView::Create(std::move(le_meta_event_view));
  if (!le_connection_complete_view.IsValid()) {
  if (leEvt != SubeventCode::ENHANCED_CONNECTION_COMPLETE && leEvt != SubeventCode::CONNECTION_COMPLETE) {
    // function is called for all le meta events. Only need to process le connection complete.
    return;
  }
  ASSERT(le_connection_complete_view.IsValid());
  // init parameters to log

  EventCode event_code = EventCode::LE_META_EVENT;
  Address address = le_connection_complete_view.GetPeerAddress();
  uint32_t connection_handle = le_connection_complete_view.GetConnectionHandle();
  Address address;
  uint32_t connection_handle;
  android::bluetooth::DirectionEnum direction = android::bluetooth::DIRECTION_UNKNOWN;
  uint16_t link_type = android::bluetooth::LINK_TYPE_ACL;
  ErrorCode status = le_connection_complete_view.GetStatus();
  ErrorCode status;
  ErrorCode reason = ErrorCode::UNKNOWN_HCI_COMMAND;
  uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;

  if (leEvt == SubeventCode::CONNECTION_COMPLETE) {
    auto le_connection_complete_view = LeConnectionCompleteView::Create(std::move(le_meta_event_view));
    ASSERT(le_connection_complete_view.IsValid());
    address = le_connection_complete_view.GetPeerAddress();
    connection_handle = le_connection_complete_view.GetConnectionHandle();
    status = le_connection_complete_view.GetStatus();
  } else if (leEvt == SubeventCode::ENHANCED_CONNECTION_COMPLETE) {
    auto le_enhanced_connection_complete_view = LeEnhancedConnectionCompleteView::Create(std::move(le_meta_event_view));
    ASSERT(le_enhanced_connection_complete_view.IsValid());
    address = le_enhanced_connection_complete_view.GetPeerAddress();
    connection_handle = le_enhanced_connection_complete_view.GetConnectionHandle();
    status = le_enhanced_connection_complete_view.GetStatus();
  } else {
    LOG_ALWAYS_FATAL("WTF");
  }

  os::LogMetricLinkLayerConnectionEvent(
      &address,
      connection_handle,