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

Commit 184213e8 authored by Chris Manton's avatar Chris Manton
Browse files

legacy: Const-ify more quality report

Bug: 187830698
Tag: #refactor
Test: gd/cert/run

Change-Id: I3705f6c0f2f5e7010053f6119fa29c9cefac108e
parent 4e7cdc6b
Loading
Loading
Loading
Loading
+7 −6
Original line number Original line Diff line number Diff line
@@ -243,7 +243,7 @@ typedef struct {
  // Buffer underflow count (in byte).
  // Buffer underflow count (in byte).
  uint32_t buffer_underflow_bytes;
  uint32_t buffer_underflow_bytes;
  // For the controller vendor to obtain more vendor specific parameters.
  // For the controller vendor to obtain more vendor specific parameters.
  uint8_t* vendor_specific_parameter;
  const uint8_t* vendor_specific_parameter;
} BqrLinkQualityEvent;
} BqrLinkQualityEvent;


// Log dump related BQR event
// Log dump related BQR event
@@ -253,7 +253,7 @@ typedef struct {
  // Connection handle of the connection.
  // Connection handle of the connection.
  uint16_t connection_handle;
  uint16_t connection_handle;
  // For the controller vendor to obtain more vendor specific parameters.
  // For the controller vendor to obtain more vendor specific parameters.
  uint8_t* vendor_specific_parameter;
  const uint8_t* vendor_specific_parameter;
} BqrLogDumpEvent;
} BqrLogDumpEvent;


// BQR sub-event of Vendor Specific Event
// BQR sub-event of Vendor Specific Event
@@ -269,14 +269,15 @@ class BqrVseSubEvt {
  // @param fd The File Descriptor of the log file.
  // @param fd The File Descriptor of the log file.
  // @param length Total length of all parameters contained in the sub-event.
  // @param length Total length of all parameters contained in the sub-event.
  // @param p_param_buf A pointer to the parameters contained in the sub-event.
  // @param p_param_buf A pointer to the parameters contained in the sub-event.
  void WriteLmpLlTraceLogFile(int fd, uint8_t length, uint8_t* p_param_buf);
  void WriteLmpLlTraceLogFile(int fd, uint8_t length,
                              const uint8_t* p_param_buf);
  // Write the Bluetooth Multi-profile/Coex scheduling trace to the log file.
  // Write the Bluetooth Multi-profile/Coex scheduling trace to the log file.
  //
  //
  // @param fd The File Descriptor of the log file.
  // @param fd The File Descriptor of the log file.
  // @param length Total length of all parameters contained in the sub-event.
  // @param length Total length of all parameters contained in the sub-event.
  // @param p_param_buf A pointer to the parameters contained in the sub-event.
  // @param p_param_buf A pointer to the parameters contained in the sub-event.
  void WriteBtSchedulingTraceLogFile(int fd, uint8_t length,
  void WriteBtSchedulingTraceLogFile(int fd, uint8_t length,
                                     uint8_t* p_param_buf);
                                     const uint8_t* p_param_buf);
  // Get a string representation of the Bluetooth Quality event.
  // Get a string representation of the Bluetooth Quality event.
  //
  //
  // @return a string representation of the Bluetooth Quality event.
  // @return a string representation of the Bluetooth Quality event.
@@ -356,7 +357,7 @@ void AddLinkQualityEventToQueue(uint8_t length,
//
//
// @param length Lengths of the LMP/LL message trace event.
// @param length Lengths of the LMP/LL message trace event.
// @param p_lmp_ll_message_event A pointer to the LMP/LL message trace event.
// @param p_lmp_ll_message_event A pointer to the LMP/LL message trace event.
void DumpLmpLlMessage(uint8_t length, uint8_t* p_lmp_ll_message_event);
void DumpLmpLlMessage(uint8_t length, const uint8_t* p_lmp_ll_message_event);


// Open the LMP/LL message trace log file.
// Open the LMP/LL message trace log file.
//
//
@@ -369,7 +370,7 @@ int OpenLmpLlTraceLogFile();
//   event.
//   event.
// @param p_bt_scheduling_event A pointer to the Bluetooth Multi-profile/Coex
// @param p_bt_scheduling_event A pointer to the Bluetooth Multi-profile/Coex
//   scheduling trace event.
//   scheduling trace event.
void DumpBtScheduling(uint8_t length, uint8_t* p_bt_scheduling_event);
void DumpBtScheduling(uint8_t length, const uint8_t* p_bt_scheduling_event);


// Open the Bluetooth Multi-profile/Coex scheduling trace log file.
// Open the Bluetooth Multi-profile/Coex scheduling trace log file.
//
//
+4 −4
Original line number Original line Diff line number Diff line
@@ -78,7 +78,7 @@ void BqrVseSubEvt::ParseBqrLinkQualityEvt(uint8_t length,
}
}


void BqrVseSubEvt::WriteLmpLlTraceLogFile(int fd, uint8_t length,
void BqrVseSubEvt::WriteLmpLlTraceLogFile(int fd, uint8_t length,
                                          uint8_t* p_param_buf) {
                                          const uint8_t* p_param_buf) {
  const auto now = system_clock::to_time_t(system_clock::now());
  const auto now = system_clock::to_time_t(system_clock::now());
  localtime_r(&now, &tm_timestamp_);
  localtime_r(&now, &tm_timestamp_);


@@ -100,7 +100,7 @@ void BqrVseSubEvt::WriteLmpLlTraceLogFile(int fd, uint8_t length,
}
}


void BqrVseSubEvt::WriteBtSchedulingTraceLogFile(int fd, uint8_t length,
void BqrVseSubEvt::WriteBtSchedulingTraceLogFile(int fd, uint8_t length,
                                                 uint8_t* p_param_buf) {
                                                 const uint8_t* p_param_buf) {
  const auto now = system_clock::to_time_t(system_clock::now());
  const auto now = system_clock::to_time_t(system_clock::now());
  localtime_r(&now, &tm_timestamp_);
  localtime_r(&now, &tm_timestamp_);


@@ -430,7 +430,7 @@ void AddLinkQualityEventToQueue(uint8_t length,
  kpBqrEventQueue->Enqueue(p_bqr_event.release());
  kpBqrEventQueue->Enqueue(p_bqr_event.release());
}
}


void DumpLmpLlMessage(uint8_t length, uint8_t* p_lmp_ll_message_event) {
void DumpLmpLlMessage(uint8_t length, const uint8_t* p_lmp_ll_message_event) {
  std::unique_ptr<BqrVseSubEvt> p_bqr_event = std::make_unique<BqrVseSubEvt>();
  std::unique_ptr<BqrVseSubEvt> p_bqr_event = std::make_unique<BqrVseSubEvt>();


  if (LmpLlMessageTraceLogFd == INVALID_FD ||
  if (LmpLlMessageTraceLogFd == INVALID_FD ||
@@ -465,7 +465,7 @@ int OpenLmpLlTraceLogFile() {
  return logfile_fd;
  return logfile_fd;
}
}


void DumpBtScheduling(uint8_t length, uint8_t* p_bt_scheduling_event) {
void DumpBtScheduling(uint8_t length, const uint8_t* p_bt_scheduling_event) {
  std::unique_ptr<BqrVseSubEvt> p_bqr_event = std::make_unique<BqrVseSubEvt>();
  std::unique_ptr<BqrVseSubEvt> p_bqr_event = std::make_unique<BqrVseSubEvt>();


  if (BtSchedulingTraceLogFd == INVALID_FD ||
  if (BtSchedulingTraceLogFd == INVALID_FD ||
+1 −1
Original line number Original line Diff line number Diff line
@@ -287,7 +287,7 @@ class BleAdvertiserVscHciInterfaceImpl : public BleAdvertiserHciInterface {
  }
  }


 public:
 public:
  static void VendorSpecificEventCback(uint8_t length, uint8_t* p) {
  static void VendorSpecificEventCback(uint8_t length, const uint8_t* p) {
    VLOG(1) << __func__;
    VLOG(1) << __func__;


    LOG_ASSERT(p);
    LOG_ASSERT(p);
+2 −1
Original line number Original line Diff line number Diff line
@@ -58,7 +58,8 @@ bool can_do_batch_scan() {
}
}


/* VSE callback for batch scan, filter, and tracking events */
/* VSE callback for batch scan, filter, and tracking events */
void btm_ble_batchscan_filter_track_adv_vse_cback(uint8_t len, uint8_t* p) {
void btm_ble_batchscan_filter_track_adv_vse_cback(uint8_t len,
                                                  const uint8_t* p) {
  tBTM_BLE_TRACK_ADV_DATA adv_data;
  tBTM_BLE_TRACK_ADV_DATA adv_data;


  uint8_t sub_event = 0;
  uint8_t sub_event = 0;
+7 −5
Original line number Original line Diff line number Diff line
@@ -73,7 +73,8 @@ extern void btm_pm_reset(void);
/******************************************************************************/
/******************************************************************************/


static void decode_controller_support();
static void decode_controller_support();
static void BTM_BT_Quality_Report_VSE_CBack(uint8_t length, uint8_t* p_stream);
static void BTM_BT_Quality_Report_VSE_CBack(uint8_t length,
                                            const uint8_t* p_stream);


/*******************************************************************************
/*******************************************************************************
 *
 *
@@ -549,13 +550,13 @@ tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB* p_cb, bool is_register) {
 * Returns          void
 * Returns          void
 *
 *
 ******************************************************************************/
 ******************************************************************************/
void btm_vendor_specific_evt(uint8_t* p, uint8_t evt_len) {
void btm_vendor_specific_evt(const uint8_t* p, uint8_t evt_len) {
  uint8_t i;
  uint8_t i;


  BTM_TRACE_DEBUG("BTM Event: Vendor Specific event from controller");
  BTM_TRACE_DEBUG("BTM Event: Vendor Specific event from controller");


  // Handle BQR events
  // Handle BQR events
  uint8_t* bqr_ptr = p;
  const uint8_t* bqr_ptr = p;
  uint8_t event_code;
  uint8_t event_code;
  uint8_t len;
  uint8_t len;
  STREAM_TO_UINT8(event_code, bqr_ptr);
  STREAM_TO_UINT8(event_code, bqr_ptr);
@@ -567,7 +568,7 @@ void btm_vendor_specific_evt(uint8_t* p, uint8_t evt_len) {
    if (sub_event_code == HCI_VSE_SUBCODE_BQR_SUB_EVT) {
    if (sub_event_code == HCI_VSE_SUBCODE_BQR_SUB_EVT) {
      // Excluding the HCI Event packet header and 1 octet sub-event code
      // Excluding the HCI Event packet header and 1 octet sub-event code
      int16_t bqr_parameter_length = evt_len - HCIE_PREAMBLE_SIZE - 1;
      int16_t bqr_parameter_length = evt_len - HCIE_PREAMBLE_SIZE - 1;
      uint8_t* p_bqr_event = bqr_ptr;
      const uint8_t* p_bqr_event = bqr_ptr;
      // The stream currently points to the BQR sub-event parameters
      // The stream currently points to the BQR sub-event parameters
      switch (sub_event_code) {
      switch (sub_event_code) {
        case bluetooth::bqr::QUALITY_REPORT_ID_LMP_LL_MESSAGE_TRACE:
        case bluetooth::bqr::QUALITY_REPORT_ID_LMP_LL_MESSAGE_TRACE:
@@ -754,7 +755,8 @@ void btm_delete_stored_link_key_complete(uint8_t* p) {
 *                    from the Bluetooth controller via Vendor Specific Event.
 *                    from the Bluetooth controller via Vendor Specific Event.
 *
 *
 ******************************************************************************/
 ******************************************************************************/
static void BTM_BT_Quality_Report_VSE_CBack(uint8_t length, uint8_t* p_stream) {
static void BTM_BT_Quality_Report_VSE_CBack(uint8_t length,
                                            const uint8_t* p_stream) {
  if (length == 0) {
  if (length == 0) {
    LOG(WARNING) << __func__ << ": Lengths of all of the parameters are zero.";
    LOG(WARNING) << __func__ << ": Lengths of all of the parameters are zero.";
    return;
    return;
Loading