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

Commit efc47696 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Stat-ify and remove unused functions am: c08eb3a2

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1708810

Change-Id: If3408b32355cc3dbe46d49a28df1d77f4c1c8f47
parents d1dc5562 c08eb3a2
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ static void bta_gattc_phy_update_cback(tGATT_IF gatt_if, uint16_t conn_id,
static void bta_gattc_conn_update_cback(tGATT_IF gatt_if, uint16_t conn_id,
                                        uint16_t interval, uint16_t latency,
                                        uint16_t timeout, tGATT_STATUS status);
static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data,
                                   tBTA_GATTC_RCB* p_clreg);

static tGATT_CBACK bta_gattc_cl_cback = {
    .p_conn_cb = bta_gattc_conn_cback,
@@ -152,7 +154,7 @@ void bta_gattc_disable() {
}

/** start an application interface */
void bta_gattc_start_if(uint8_t client_if) {
static void bta_gattc_start_if(uint8_t client_if) {
  if (!bta_gattc_cl_get_regcb(client_if)) {
    LOG(ERROR) << "Unable to start app.: Unknown client_if=" << +client_if;
    return;
@@ -308,7 +310,8 @@ void bta_gattc_process_api_open_cancel(const tBTA_GATTC_DATA* p_msg) {
}

/** process encryption complete message */
void bta_gattc_process_enc_cmpl(tGATT_IF client_if, const RawAddress& bda) {
static void bta_gattc_process_enc_cmpl(tGATT_IF client_if,
                                       const RawAddress& bda) {
  tBTA_GATTC_RCB* p_clreg = bta_gattc_cl_get_regcb(client_if);

  if (!p_clreg || !p_clreg->p_cback) return;
@@ -378,9 +381,10 @@ void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {
}

/** Process API Open for a background connection */
void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data,
static void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data,
                                   tBTA_GATTC_RCB* p_clreg) {
  if (!bta_gattc_mark_bg_conn(p_data->client_if, p_data->remote_bda, true)) {
    LOG_WARN("Unable to find space for acceptlist connection mask");
    bta_gattc_send_open_cback(p_clreg, GATT_NO_RESOURCES, p_data->remote_bda,
                              GATT_INVALID_CONN_ID, BT_TRANSPORT_LE, 0);
    return;
@@ -617,7 +621,7 @@ void bta_gattc_disc_close(tBTA_GATTC_CLCB* p_clcb,
}

/** when a SRCB start discovery, tell all related clcb and set the state */
void bta_gattc_set_discover_st(tBTA_GATTC_SERV* p_srcb) {
static void bta_gattc_set_discover_st(tBTA_GATTC_SERV* p_srcb) {
  uint8_t i;

  for (i = 0; i < BTA_GATTC_CLCB_MAX; i++) {
@@ -1181,12 +1185,12 @@ void bta_gattc_process_api_refresh(const RawAddress& remote_bda) {
}

/** process service change indication */
bool bta_gattc_process_srvc_chg_ind(uint16_t conn_id, tBTA_GATTC_RCB* p_clrcb,
static bool bta_gattc_process_srvc_chg_ind(uint16_t conn_id,
                                           tBTA_GATTC_RCB* p_clrcb,
                                           tBTA_GATTC_SERV* p_srcb,
                                           tBTA_GATTC_CLCB* p_clcb,
                                           tBTA_GATTC_NOTIFY* p_notify,
                                           tGATT_VALUE* att_value) {

  Uuid gattp_uuid = Uuid::From16Bit(UUID_SERVCLASS_GATT_SERVER);
  Uuid srvc_chg_uuid = Uuid::From16Bit(GATT_UUID_GATT_SRV_CHGD);

@@ -1259,7 +1263,7 @@ bool bta_gattc_process_srvc_chg_ind(uint16_t conn_id, tBTA_GATTC_RCB* p_clrcb,
}

/** process all non-service change indication/notification */
void bta_gattc_proc_other_indication(tBTA_GATTC_CLCB* p_clcb, uint8_t op,
static void bta_gattc_proc_other_indication(tBTA_GATTC_CLCB* p_clcb, uint8_t op,
                                            tGATT_CL_COMPLETE* p_data,
                                            tBTA_GATTC_NOTIFY* p_notify) {
  VLOG(1) << __func__
@@ -1282,7 +1286,7 @@ void bta_gattc_proc_other_indication(tBTA_GATTC_CLCB* p_clcb, uint8_t op,
}

/** process indication/notification */
void bta_gattc_process_indicate(uint16_t conn_id, tGATTC_OPTYPE op,
static void bta_gattc_process_indicate(uint16_t conn_id, tGATTC_OPTYPE op,
                                       tGATT_CL_COMPLETE* p_data) {
  uint16_t handle = p_data->att_value.handle;
  tBTA_GATTC_NOTIFY notify;
+0 −2
Original line number Diff line number Diff line
@@ -388,8 +388,6 @@ extern void bta_gattc_op_cmpl_during_discovery(tBTA_GATTC_CLCB* p_clcb,
                                               const tBTA_GATTC_DATA* p_data);
extern void bta_gattc_restart_discover(tBTA_GATTC_CLCB* p_clcb,
                                       const tBTA_GATTC_DATA* p_msg);
extern void bta_gattc_init_bk_conn(const tBTA_GATTC_API_OPEN* p_data,
                                   tBTA_GATTC_RCB* p_clreg);
extern void bta_gattc_cancel_bk_conn(const tBTA_GATTC_API_CANCEL_OPEN* p_data);
extern void bta_gattc_send_open_cback(tBTA_GATTC_RCB* p_clreg,
                                      tGATT_STATUS status,
+3 −3
Original line number Diff line number Diff line
@@ -849,7 +849,7 @@ static void gatts_process_mtu_req(tGATT_TCB& tcb, uint16_t cid, uint16_t len,
 * Returns          void
 *
 ******************************************************************************/
void gatts_process_read_by_type_req(tGATT_TCB& tcb, uint16_t cid,
static void gatts_process_read_by_type_req(tGATT_TCB& tcb, uint16_t cid,
                                           uint8_t op_code, uint16_t len,
                                           uint8_t* p_data) {
  Uuid uuid = Uuid::kEmpty;
+15 −51
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@

using base::StringPrintf;
static void srvc_eng_s_request_cback(uint16_t conn_id, uint32_t trans_id,
                                     uint8_t op_code, tGATTS_DATA* p_data);
                                     tGATTS_REQ_TYPE type, tGATTS_DATA* p_data);
static void srvc_eng_connect_cback(UNUSED_ATTR tGATT_IF gatt_if,
                                   const RawAddress& bda, uint16_t conn_id,
                                   bool connected, tGATT_DISCONN_REASON reason,
@@ -53,35 +53,12 @@ typedef void (*tSRVC_ENG_C_CMPL_ACTION)(tSRVC_CLCB* p_clcb, tGATTC_OPTYPE op,
                                        tGATT_STATUS status,
                                        tGATT_CL_COMPLETE* p_data);

const tSRVC_ENG_C_CMPL_ACTION srvc_eng_c_cmpl_act[SRVC_ID_MAX] = {
static const tSRVC_ENG_C_CMPL_ACTION srvc_eng_c_cmpl_act[SRVC_ID_MAX] = {
    dis_c_cmpl_cback,
};

tSRVC_ENG_CB srvc_eng_cb;

/*******************************************************************************
 *
 * Function         srvc_eng_find_conn_id_by_bd_addr
 *
 * Description      The function searches all LCB with macthing bd address
 *
 * Returns          total number of clcb found.
 *
 ******************************************************************************/
uint16_t srvc_eng_find_conn_id_by_bd_addr(const RawAddress& bda) {
  uint8_t i_clcb;
  tSRVC_CLCB* p_clcb = NULL;

  for (i_clcb = 0, p_clcb = srvc_eng_cb.clcb; i_clcb < SRVC_MAX_APPS;
       i_clcb++, p_clcb++) {
    if (p_clcb->in_use && p_clcb->connected && p_clcb->bda == bda) {
      return p_clcb->conn_id;
    }
  }

  return GATT_INVALID_CONN_ID;
}

/*******************************************************************************
 *
 * Function         srvc_eng_find_clcb_by_bd_addr
@@ -91,7 +68,7 @@ uint16_t srvc_eng_find_conn_id_by_bd_addr(const RawAddress& bda) {
 * Returns          Pointer to the found link conenction control block.
 *
 ******************************************************************************/
tSRVC_CLCB* srvc_eng_find_clcb_by_bd_addr(const RawAddress& bda) {
static tSRVC_CLCB* srvc_eng_find_clcb_by_bd_addr(const RawAddress& bda) {
  uint8_t i_clcb;
  tSRVC_CLCB* p_clcb = NULL;

@@ -135,7 +112,7 @@ tSRVC_CLCB* srvc_eng_find_clcb_by_conn_id(uint16_t conn_id) {
 * Returns          Pointer to the found link conenction control block.
 *
 ******************************************************************************/
uint8_t srvc_eng_find_clcb_idx_by_conn_id(uint16_t conn_id) {
static uint8_t srvc_eng_find_clcb_idx_by_conn_id(uint16_t conn_id) {
  uint8_t i_clcb;
  tSRVC_CLCB* p_clcb = NULL;

@@ -158,7 +135,8 @@ uint8_t srvc_eng_find_clcb_idx_by_conn_id(uint16_t conn_id) {
 *                  block.
 *
 ******************************************************************************/
tSRVC_CLCB* srvc_eng_clcb_alloc(uint16_t conn_id, const RawAddress& bda) {
static tSRVC_CLCB* srvc_eng_clcb_alloc(uint16_t conn_id,
                                       const RawAddress& bda) {
  uint8_t i_clcb = 0;
  tSRVC_CLCB* p_clcb = NULL;

@@ -183,7 +161,7 @@ tSRVC_CLCB* srvc_eng_clcb_alloc(uint16_t conn_id, const RawAddress& bda) {
 * Returns          True the deallocation is successful
 *
 ******************************************************************************/
bool srvc_eng_clcb_dealloc(uint16_t conn_id) {
static bool srvc_eng_clcb_dealloc(uint16_t conn_id) {
  uint8_t i_clcb = 0;
  tSRVC_CLCB* p_clcb = NULL;

@@ -203,8 +181,10 @@ bool srvc_eng_clcb_dealloc(uint16_t conn_id) {
/*******************************************************************************
 *   Service Engine Server Attributes Database Read/Read Blob Request process
 ******************************************************************************/
uint8_t srvc_eng_process_read_req(uint8_t clcb_idx, tGATT_READ_REQ* p_data,
                                  tGATTS_RSP* p_rsp, tGATT_STATUS* p_status) {
static uint8_t srvc_eng_process_read_req(uint8_t clcb_idx,
                                         tGATT_READ_REQ* p_data,
                                         tGATTS_RSP* p_rsp,
                                         tGATT_STATUS* p_status) {
  tGATT_STATUS status = GATT_NOT_FOUND;
  uint8_t act = SRVC_ACT_RSP;

@@ -222,7 +202,8 @@ uint8_t srvc_eng_process_read_req(uint8_t clcb_idx, tGATT_READ_REQ* p_data,
/*******************************************************************************
 *   Service Engine Server Attributes Database write Request process
 ******************************************************************************/
uint8_t srvc_eng_process_write_req(uint8_t clcb_idx, tGATT_WRITE_REQ* p_data,
static uint8_t srvc_eng_process_write_req(uint8_t clcb_idx,
                                          tGATT_WRITE_REQ* p_data,
                                          UNUSED_ATTR tGATTS_RSP* p_rsp,
                                          tGATT_STATUS* p_status) {
  uint8_t act = SRVC_ACT_RSP;
@@ -415,20 +396,3 @@ tGATT_STATUS srvc_eng_init(void) {
  }
  return GATT_SUCCESS;
}

void srvc_sr_rsp(uint8_t clcb_idx, tGATT_STATUS st, tGATTS_RSP* p_rsp) {
  if (srvc_eng_cb.clcb[clcb_idx].trans_id != 0) {
    GATTS_SendRsp(srvc_eng_cb.clcb[clcb_idx].conn_id,
                  srvc_eng_cb.clcb[clcb_idx].trans_id, st, p_rsp);

    srvc_eng_cb.clcb[clcb_idx].trans_id = 0;
  }
}
void srvc_sr_notify(const RawAddress& remote_bda, uint16_t handle, uint16_t len,
                    uint8_t* p_value) {
  uint16_t conn_id = srvc_eng_find_conn_id_by_bd_addr(remote_bda);

  if (conn_id != GATT_INVALID_CONN_ID) {
    GATTS_HandleValueNotification(conn_id, handle, len, p_value);
  }
}
+0 −6
Original line number Diff line number Diff line
@@ -57,14 +57,8 @@ typedef struct {
extern tSRVC_ENG_CB srvc_eng_cb;

extern tSRVC_CLCB* srvc_eng_find_clcb_by_conn_id(uint16_t conn_id);
extern tSRVC_CLCB* srvc_eng_find_clcb_by_bd_addr(const RawAddress& bda);
extern uint16_t srvc_eng_find_conn_id_by_bd_addr(const RawAddress& bda);

extern void srvc_eng_release_channel(uint16_t conn_id);
extern bool srvc_eng_request_channel(const RawAddress& remote_bda,
                                     uint8_t srvc_id);
extern void srvc_sr_rsp(uint8_t clcb_idx, tGATT_STATUS st, tGATTS_RSP* p_rsp);
extern void srvc_sr_notify(const RawAddress& remote_bda, uint16_t handle,
                           uint16_t len, uint8_t* p_value);

#endif