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

Commit 9cea4f7a authored by Henri Chataing's avatar Henri Chataing
Browse files

system/bta/pan: Migrate to libbluetooth_log

Test: m com.android.btservices
Bug: 305066880
Flag: EXEMPT, mechanical refactor
Change-Id: I8adc2e310f6409f691cbd30fea80500475242035
parent b757ea57
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@

#define LOG_TAG "bluetooth"

#include <bluetooth/log.h>

#include <cstdint>

#include "bta/include/bta_pan_co.h"
@@ -37,6 +39,8 @@
#include "stack/include/pan_api.h"
#include "types/raw_address.h"

using namespace bluetooth;

#if (PAN_INCLUDED == TRUE)
void bta_pan_sm_execute(tBTA_PAN_SCB* p_scb, uint16_t event,
                        tBTA_PAN_DATA* p_data);
@@ -177,7 +181,7 @@ static void bta_pan_data_buf_ind_cback(uint16_t handle, const RawAddress& src,

  if (sizeof(BT_HDR) + sizeof(tBTA_PAN_DATA_PARAMS) + p_buf->len >
      PAN_BUF_SIZE) {
    LOG_ERROR("%s: received buffer length too large: %d", __func__, p_buf->len);
    log::error("received buffer length too large: {}", p_buf->len);
    return;
  }

@@ -410,7 +414,7 @@ void bta_pan_open(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {

  status = PAN_Connect(p_data->api_open.bd_addr, p_data->api_open.local_role,
                       p_data->api_open.peer_role, &p_scb->handle);
  LOG_VERBOSE("%s pan connect status: %d", __func__, status);
  log::verbose("pan connect status: {}", status);

  if (status == PAN_SUCCESS) {
    p_scb->bd_addr = p_data->api_open.bd_addr;
@@ -468,7 +472,7 @@ void bta_pan_api_close(tBTA_PAN_SCB* p_scb, UNUSED_ATTR tBTA_PAN_DATA* p_data) {
void bta_pan_conn_open(tBTA_PAN_SCB* p_scb, tBTA_PAN_DATA* p_data) {
  tBTA_PAN bta_pan;

  LOG_VERBOSE("%s pan connection result: %d", __func__, p_data->conn.result);
  log::verbose("pan connection result: {}", p_data->conn.result);

  bta_pan.open.bd_addr = p_scb->bd_addr;
  bta_pan.open.handle = p_scb->handle;
+10 −6
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@
 *  This file contains the PAN main functions and state machine.
 *
 ******************************************************************************/
#include <bluetooth/log.h>

#include <cstdint>

#include "bta/pan/bta_pan_int.h"
@@ -29,6 +31,8 @@
#include "osi/include/osi.h"  // UNUSED_ATTR
#include "stack/include/bt_hdr.h"

using namespace bluetooth;

/*****************************************************************************
 * Constants and types
 ****************************************************************************/
@@ -134,7 +138,7 @@ tBTA_PAN_SCB* bta_pan_scb_alloc(void) {
  for (i = 0; i < BTA_PAN_NUM_CONN; i++, p_scb++) {
    if (!p_scb->in_use) {
      p_scb->in_use = true;
      LOG_VERBOSE("bta_pan_scb_alloc %d", i);
      log::verbose("bta_pan_scb_alloc {}", i);
      break;
    }
  }
@@ -142,7 +146,7 @@ tBTA_PAN_SCB* bta_pan_scb_alloc(void) {
  if (i == BTA_PAN_NUM_CONN) {
    /* out of scbs */
    p_scb = NULL;
    LOG_WARN("Out of scbs");
    log::warn("Out of scbs");
  }
  return p_scb;
}
@@ -163,7 +167,7 @@ void bta_pan_sm_execute(tBTA_PAN_SCB* p_scb, uint16_t event,
  uint8_t action;
  int i;

  LOG_VERBOSE("PAN scb=%d event=0x%x state=%d", bta_pan_scb_to_idx(p_scb),
  log::verbose("PAN scb={} event=0x{:x} state={}", bta_pan_scb_to_idx(p_scb),
               event, p_scb->state);

  /* look up the state table for the current state */
@@ -251,7 +255,7 @@ void bta_pan_api_open(tBTA_PAN_DATA* p_data) {
 *
 ******************************************************************************/
void bta_pan_scb_dealloc(tBTA_PAN_SCB* p_scb) {
  LOG_VERBOSE("bta_pan_scb_dealloc %d", bta_pan_scb_to_idx(p_scb));
  log::verbose("bta_pan_scb_dealloc {}", bta_pan_scb_to_idx(p_scb));
  fixed_queue_free(p_scb->data_queue, NULL);
  memset(p_scb, 0, sizeof(tBTA_PAN_SCB));
}
@@ -291,7 +295,7 @@ tBTA_PAN_SCB* bta_pan_scb_by_handle(uint16_t handle) {
    }
  }

  LOG_WARN("No scb for handle %d", handle);
  log::warn("No scb for handle {}", handle);

  return NULL;
}
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#define PAN_API_H

#include <base/strings/stringprintf.h>
#include <bluetooth/log.h>

#include <cstdint>

@@ -441,4 +442,9 @@ void PAN_Init(void);

void PAN_Dumpsys(int fd);

namespace fmt {
template <>
struct formatter<tPAN_RESULT> : enum_formatter<tPAN_RESULT> {};
}  // namespace fmt

#endif /* PAN_API_H */