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

Commit 30c625bb authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I5e5bab4f,I766addf4 into main

* changes:
  system/stack/gap: Fix -Wmissing-prototype errors
  system/stack/gatt: Fix -Wmissing-prototype errors
parents 4eb01d96 83fb60f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@
#include "stack/include/avdt_api.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_status.h"
#include "stack/include/gatt_api.h"
#include "stack/include/hfp_lc3_decoder.h"
#include "stack/include/hfp_lc3_encoder.h"
#include "stack/include/hfp_msbc_decoder.h"
@@ -188,7 +189,6 @@ extern VolumeControlInterface* btif_volume_control_get_interface();

bt_status_t btif_av_sink_execute_service(bool b_enable);

extern void gatt_tcb_dump(int fd);
extern void bta_gatt_client_dump(int fd);

/*******************************************************************************
+1 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "stack/include/acl_api.h"
#include "stack/include/btm_ble_addr.h"
#include "stack/include/btm_ble_privacy.h"
#include "stack/include/gatt_api.h"
#include "stack/include/l2cap_hci_link_interface.h"
#include "types/raw_address.h"

@@ -144,8 +145,6 @@ void acl_ble_connection_fail(const tBLE_BD_ADDR& address_with_type, uint16_t /*
  btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, &address_with_type.bda, status);
}

void gatt_notify_conn_update(const RawAddress& remote, uint16_t interval, uint16_t latency,
                             uint16_t timeout, tHCI_STATUS status);
void acl_ble_update_event_received(tHCI_STATUS status, uint16_t handle, uint16_t interval,
                                   uint16_t latency, uint16_t timeout) {
  l2cble_process_conn_update_evt(handle, status, interval, latency, timeout);
+1 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include "stack/include/btm_ble_privacy.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/btm_log_history.h"
#include "stack/include/gatt_api.h"
#include "stack/include/l2cap_interface.h"
#include "types/raw_address.h"

@@ -54,7 +55,6 @@
using namespace bluetooth;

extern tBTM_CB btm_cb;
void gatt_consolidate(const RawAddress& identity_addr, const RawAddress& rpa);

namespace {

+22 −24
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <queue>

#include "gap_api.h"
#include "gap_int.h"
#include "gatt_api.h"
#include "hardware/bt_gatt_types.h"
#include "stack/include/bt_types.h"
@@ -33,9 +34,6 @@
#include "types/bt_transport.h"
#include "types/raw_address.h"

// TODO(b/369381361) Enfore -Wmissing-prototypes
#pragma GCC diagnostic ignored "-Wmissing-prototypes"

using bluetooth::Uuid;
using namespace bluetooth;

@@ -61,10 +59,10 @@ typedef struct {
  tGAP_BLE_ATTR_VALUE attr_value;
} tGAP_ATTR;

void server_attr_request_cback(tCONN_ID, uint32_t, tGATTS_REQ_TYPE, tGATTS_DATA*);
void client_connect_cback(tGATT_IF, const RawAddress&, tCONN_ID, bool, tGATT_DISCONN_REASON,
static void server_attr_request_cback(tCONN_ID, uint32_t, tGATTS_REQ_TYPE, tGATTS_DATA*);
static void client_connect_cback(tGATT_IF, const RawAddress&, tCONN_ID, bool, tGATT_DISCONN_REASON,
                                 tBT_TRANSPORT);
void client_cmpl_cback(tCONN_ID, tGATTC_OPTYPE, tGATT_STATUS, tGATT_CL_COMPLETE*);
static void client_cmpl_cback(tCONN_ID, tGATTC_OPTYPE, tGATT_STATUS, tGATT_CL_COMPLETE*);

tGATT_CBACK gap_cback = {
        .p_conn_cb = client_connect_cback,
@@ -88,7 +86,7 @@ std::array<tGAP_ATTR, GAP_MAX_CHAR_NUM> gatt_attr;
tGATT_IF gatt_if;

/** returns LCB with matching bd address, or nullptr */
tGAP_CLCB* find_clcb_by_bd_addr(const RawAddress& bda) {
static tGAP_CLCB* find_clcb_by_bd_addr(const RawAddress& bda) {
  for (auto& cb : gap_clcbs) {
    if (cb.bda == bda) {
      return &cb;
@@ -99,7 +97,7 @@ tGAP_CLCB* find_clcb_by_bd_addr(const RawAddress& bda) {
}

/** returns LCB with matching connection ID, or nullptr if not found  */
tGAP_CLCB* ble_find_clcb_by_conn_id(tCONN_ID conn_id) {
static tGAP_CLCB* ble_find_clcb_by_conn_id(tCONN_ID conn_id) {
  for (auto& cb : gap_clcbs) {
    if (cb.connected && cb.conn_id == conn_id) {
      return &cb;
@@ -110,7 +108,7 @@ tGAP_CLCB* ble_find_clcb_by_conn_id(tCONN_ID conn_id) {
}

/** allocates a GAP connection link control block */
tGAP_CLCB* clcb_alloc(const RawAddress& bda) {
static tGAP_CLCB* clcb_alloc(const RawAddress& bda) {
  gap_clcbs.emplace_back();
  tGAP_CLCB& cb = gap_clcbs.back();
  cb.bda = bda;
@@ -118,7 +116,7 @@ tGAP_CLCB* clcb_alloc(const RawAddress& bda) {
}

/** The function clean up the pending request queue in GAP */
void clcb_dealloc(tGAP_CLCB& clcb) {
static void clcb_dealloc(tGAP_CLCB& clcb) {
  // put last element into place of current element, and remove last one - just
  // fast remove.
  for (auto it = gap_clcbs.begin(); it != gap_clcbs.end(); it++) {
@@ -132,7 +130,7 @@ void clcb_dealloc(tGAP_CLCB& clcb) {
}

/** GAP Attributes Database Request callback */
tGATT_STATUS read_attr_value(uint16_t handle, tGATT_VALUE* p_value, bool is_long) {
static tGATT_STATUS read_attr_value(uint16_t handle, tGATT_VALUE* p_value, bool is_long) {
  uint8_t* p = p_value->value;
  uint16_t offset = p_value->offset;
  uint8_t* p_dev_name = NULL;
@@ -191,7 +189,7 @@ tGATT_STATUS read_attr_value(uint16_t handle, tGATT_VALUE* p_value, bool is_long
}

/** GAP Attributes Database Read/Read Blob Request process */
tGATT_STATUS proc_read(tGATTS_REQ_TYPE, tGATT_READ_REQ* p_data, tGATTS_RSP* p_rsp) {
static tGATT_STATUS proc_read(tGATTS_REQ_TYPE, tGATT_READ_REQ* p_data, tGATTS_RSP* p_rsp) {
  if (p_data->is_long) {
    p_rsp->attr_value.offset = p_data->offset;
  }
@@ -202,7 +200,7 @@ tGATT_STATUS proc_read(tGATTS_REQ_TYPE, tGATT_READ_REQ* p_data, tGATTS_RSP* p_rs
}

/** GAP ATT server process a write request */
tGATT_STATUS proc_write_req(tGATTS_REQ_TYPE, tGATT_WRITE_REQ* p_data) {
static tGATT_STATUS proc_write_req(tGATTS_REQ_TYPE, tGATT_WRITE_REQ* p_data) {
  for (const auto& db_addr : gatt_attr) {
    if (p_data->handle == db_addr.handle) {
      return GATT_WRITE_NOT_PERMIT;
@@ -213,7 +211,7 @@ tGATT_STATUS proc_write_req(tGATTS_REQ_TYPE, tGATT_WRITE_REQ* p_data) {
}

/** GAP ATT server attribute access request callback */
void server_attr_request_cback(tCONN_ID conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type,
static void server_attr_request_cback(tCONN_ID conn_id, uint32_t trans_id, tGATTS_REQ_TYPE type,
                                      tGATTS_DATA* p_data) {
  tGATT_STATUS status = GATT_INVALID_PDU;
  bool ignore = false;
@@ -262,7 +260,7 @@ void server_attr_request_cback(tCONN_ID conn_id, uint32_t trans_id, tGATTS_REQ_T
 * Utility function to send a read request for GAP characteristics.
 * Returns true if read started, else false if GAP is busy.
 */
bool send_cl_read_request(tGAP_CLCB& clcb) {
static bool send_cl_read_request(tGAP_CLCB& clcb) {
  if (!clcb.requests.size() || clcb.cl_op_uuid != 0) {
    return false;
  }
@@ -288,7 +286,7 @@ bool send_cl_read_request(tGAP_CLCB& clcb) {
}

/** GAP client operation complete callback */
void cl_op_cmpl(tGAP_CLCB& clcb, bool status, uint16_t len, uint8_t* p_name) {
static void cl_op_cmpl(tGAP_CLCB& clcb, bool status, uint16_t len, uint8_t* p_name) {
  tGAP_BLE_CMPL_CBACK* p_cback = clcb.p_cback;
  uint16_t op = clcb.cl_op_uuid;

@@ -311,7 +309,7 @@ void cl_op_cmpl(tGAP_CLCB& clcb, bool status, uint16_t len, uint8_t* p_name) {
}

/** Client connection callback */
void client_connect_cback(tGATT_IF, const RawAddress& bda, tCONN_ID conn_id, bool connected,
static void client_connect_cback(tGATT_IF, const RawAddress& bda, tCONN_ID conn_id, bool connected,
                                 tGATT_DISCONN_REASON /* reason */, tBT_TRANSPORT) {
  tGAP_CLCB* p_clcb = find_clcb_by_bd_addr(bda);
  if (p_clcb == NULL) {
@@ -336,7 +334,7 @@ void client_connect_cback(tGATT_IF, const RawAddress& bda, tCONN_ID conn_id, boo
}

/** Client operation complete callback */
void client_cmpl_cback(tCONN_ID conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
static void client_cmpl_cback(tCONN_ID conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
                              tGATT_CL_COMPLETE* p_data) {
  tGAP_CLCB* p_clcb = ble_find_clcb_by_conn_id(conn_id);
  uint16_t op_type;
@@ -396,7 +394,7 @@ void client_cmpl_cback(tCONN_ID conn_id, tGATTC_OPTYPE op, tGATT_STATUS status,
  }
}

bool accept_client_operation(const RawAddress& peer_bda, uint16_t uuid,
static bool accept_client_operation(const RawAddress& peer_bda, uint16_t uuid,
                                    tGAP_BLE_CMPL_CBACK* p_cback) {
  if (p_cback == NULL && uuid != GATT_UUID_GAP_PREF_CONN_PARAM) {
    return false;
+2 −6
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <string.h>

#include "gap_api.h"
#include "gap_int.h"
#include "hci/controller_interface.h"
#include "internal_include/bt_target.h"
#include "main/shim/entry.h"
@@ -34,9 +35,6 @@
#include "types/bt_transport.h"
#include "types/raw_address.h"

// TODO(b/369381361) Enfore -Wmissing-prototypes
#pragma GCC diagnostic ignored "-Wmissing-prototypes"

using namespace bluetooth;

/* Define the GAP Connection Control Block */
@@ -117,7 +115,7 @@ static void gap_checks_con_flags(tGAP_CCB* p_ccb);
 * Returns          void
 *
 ******************************************************************************/
void gap_conn_init(void) {
static void gap_conn_init(void) {
  memset(&conn, 0, sizeof(tGAP_CONN));
  conn.reg_info.pL2CA_ConnectInd_Cb = gap_connect_ind;
  conn.reg_info.pL2CA_ConnectCfm_Cb = gap_connect_cfm;
@@ -1050,8 +1048,6 @@ static void gap_release_ccb(tGAP_CCB* p_ccb) {
  }
}

void gap_attr_db_init(void);

/*
 * This routine should not be called except once per stack invocation.
 */
Loading