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

Commit cae44b5d authored by Rongxuan Liu's avatar Rongxuan Liu
Browse files

Add support to connect LE Gatt with address type (2/2)

Bug: 266449499
Tag: #feature
Test: atest BluetoothInstrumentationTests;
      manual testing with LE device
Change-Id: I4da9d9c78287312b611ca66dd3fe2ef556f9d4cb
parent 4d6863f3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1477,8 +1477,8 @@ static void gattClientConnectNative(JNIEnv* env, jobject object, jint clientif,
                                    jint initiating_phys) {
  if (!sGattIf) return;

  sGattIf->client->connect(clientif, str2addr(env, address), isDirect,
                           transport, opportunistic, initiating_phys);
  sGattIf->client->connect(clientif, str2addr(env, address), addressType,
                           isDirect, transport, opportunistic, initiating_phys);
}

static void gattClientDisconnectNative(JNIEnv* env, jobject object,
+1 −0
Original line number Diff line number Diff line
@@ -390,6 +390,7 @@ void bta_gattc_open(tBTA_GATTC_CLCB* p_clcb, const tBTA_GATTC_DATA* p_data) {

  /* open/hold a connection */
  if (!GATT_Connect(p_clcb->p_rcb->client_if, p_data->api_conn.remote_bda,
                    p_data->api_conn.remote_addr_type,
                    BTM_BLE_DIRECT_CONNECTION, p_data->api_conn.transport,
                    p_data->api_conn.opportunistic,
                    p_data->api_conn.initiating_phys)) {
+9 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
}

void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                    tBLE_ADDR_TYPE addr_type,
                    tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport,
                    bool opportunistic, uint8_t initiating_phys) {
  tBTA_GATTC_DATA data = {
@@ -145,6 +146,7 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                      .event = BTA_GATTC_API_OPEN_EVT,
                  },
              .remote_bda = remote_bda,
              .remote_addr_type = addr_type,
              .client_if = client_if,
              .connection_type = connection_type,
              .transport = transport,
@@ -156,6 +158,13 @@ void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
  post_on_bt_main([data]() { bta_gattc_process_api_open(&data); });
}

void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                    tBTM_BLE_CONN_TYPE connection_type, tBT_TRANSPORT transport,
                    bool opportunistic, uint8_t initiating_phys) {
  BTA_GATTC_Open(client_if, remote_bda, BLE_ADDR_PUBLIC, connection_type,
                 BT_TRANSPORT_LE, opportunistic, initiating_phys);
}

/*******************************************************************************
 *
 * Function         BTA_GATTC_CancelOpen
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ typedef struct {
  tBT_TRANSPORT transport;
  uint8_t initiating_phys;
  bool opportunistic;
  tBT_DEVICE_TYPE remote_addr_type;
} tBTA_GATTC_API_OPEN;

typedef struct {
+5 −0
Original line number Diff line number Diff line
@@ -481,6 +481,11 @@ extern void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                           tBTM_BLE_CONN_TYPE connection_type,
                           tBT_TRANSPORT transport, bool opportunistic,
                           uint8_t initiating_phys);
extern void BTA_GATTC_Open(tGATT_IF client_if, const RawAddress& remote_bda,
                           tBLE_ADDR_TYPE addr_type,
                           tBTM_BLE_CONN_TYPE connection_type,
                           tBT_TRANSPORT transport, bool opportunistic,
                           uint8_t initiating_phys);

/*******************************************************************************
 *
Loading