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

Commit b8faa0f3 authored by Liang Li's avatar Liang Li Committed by Automerger Merge Worker
Browse files

Notify offloaded LE COC socket channel info to socket hal am: 73d8ba1e

parents f0fa7c03 73d8ba1e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -260,6 +260,11 @@ typedef struct {
  int32_t tx_mtu;        /* The transmit MTU */
  uint16_t local_cid;    /* The local CID */
  uint16_t remote_cid;   /* The remote CID */
  uint16_t local_coc_mps;     /* The local COC MPS */
  uint16_t remote_coc_mps;    /* The remote COC MPS */
  uint16_t local_coc_credit;  /* The local COC credit */
  uint16_t remote_coc_credit; /* The remote COC credit */
  uint16_t acl_handle;        /* The ACL handle */
} tBTA_JV_L2CAP_OPEN;

/* data associated with BTA_JV_L2CAP_OPEN_EVT for LE sockets */
+50 −10
Original line number Diff line number Diff line
@@ -982,12 +982,32 @@ static void bta_jv_l2cap_client_cback(uint16_t gap_handle, uint16_t event, tGAP_

  switch (event) {
    case GAP_EVT_CONN_OPENED:
      if (!com::android::bluetooth::flags::socket_settings_api() ||
          !GAP_IsTransportLe(gap_handle)) {
        evt_data.l2c_open.rem_bda = *GAP_ConnGetRemoteAddr(gap_handle);
        evt_data.l2c_open.tx_mtu = GAP_ConnGetRemMtuSize(gap_handle);
        if (data != nullptr) {
          evt_data.l2c_open.local_cid = data->l2cap_cids.local_cid;
          evt_data.l2c_open.remote_cid = data->l2cap_cids.remote_cid;
        }
      } else {
        uint16_t remote_mtu, local_mps, remote_mps, local_credit, remote_credit;
        uint16_t local_cid, remote_cid, acl_handle;
        evt_data.l2c_open.rem_bda = *GAP_ConnGetRemoteAddr(gap_handle);
        if (GAP_GetLeChannelInfo(gap_handle, &remote_mtu, &local_mps, &remote_mps, &local_credit,
                                 &remote_credit, &local_cid, &remote_cid,
                                 &acl_handle) != PORT_SUCCESS) {
          log::warn("Unable to get GAP channel info handle:{}", gap_handle);
        }
        evt_data.l2c_open.tx_mtu = remote_mtu;
        evt_data.l2c_open.local_coc_mps = local_mps;
        evt_data.l2c_open.remote_coc_mps = remote_mps;
        evt_data.l2c_open.local_coc_credit = local_credit;
        evt_data.l2c_open.remote_coc_credit = remote_credit;
        evt_data.l2c_open.local_cid = local_cid;
        evt_data.l2c_open.remote_cid = remote_cid;
        evt_data.l2c_open.acl_handle = acl_handle;
      }
      p_cb->state = BTA_JV_ST_CL_OPEN;
      p_cb->p_cback(BTA_JV_L2CAP_OPEN_EVT, &evt_data, p_cb->l2cap_socket_id);
      break;
@@ -1142,12 +1162,32 @@ static void bta_jv_l2cap_server_cback(uint16_t gap_handle, uint16_t event, tGAP_

  switch (event) {
    case GAP_EVT_CONN_OPENED:
      if (!com::android::bluetooth::flags::socket_settings_api() ||
          !GAP_IsTransportLe(gap_handle)) {
        evt_data.l2c_open.rem_bda = *GAP_ConnGetRemoteAddr(gap_handle);
        evt_data.l2c_open.tx_mtu = GAP_ConnGetRemMtuSize(gap_handle);
        if (data != nullptr) {
          evt_data.l2c_open.local_cid = data->l2cap_cids.local_cid;
          evt_data.l2c_open.remote_cid = data->l2cap_cids.remote_cid;
        }
      } else {
        uint16_t remote_mtu, local_mps, remote_mps, local_credit, remote_credit;
        uint16_t local_cid, remote_cid, acl_handle;
        evt_data.l2c_open.rem_bda = *GAP_ConnGetRemoteAddr(gap_handle);
        if (GAP_GetLeChannelInfo(gap_handle, &remote_mtu, &local_mps, &remote_mps, &local_credit,
                                 &remote_credit, &local_cid, &remote_cid,
                                 &acl_handle) != PORT_SUCCESS) {
          log::warn("Unable to get GAP channel info handle:{}", gap_handle);
        }
        evt_data.l2c_open.tx_mtu = remote_mtu;
        evt_data.l2c_open.local_coc_mps = local_mps;
        evt_data.l2c_open.remote_coc_mps = remote_mps;
        evt_data.l2c_open.local_coc_credit = local_credit;
        evt_data.l2c_open.remote_coc_credit = remote_credit;
        evt_data.l2c_open.local_cid = local_cid;
        evt_data.l2c_open.remote_cid = remote_cid;
        evt_data.l2c_open.acl_handle = acl_handle;
      }
      p_cb->state = BTA_JV_ST_SR_OPEN;
      p_cb->p_cback(BTA_JV_L2CAP_OPEN_EVT, &evt_data, p_cb->l2cap_socket_id);
      break;
+1 −0
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ cc_library_static {
        "src/btif_sdp.cc",
        "src/btif_sdp_server.cc",
        "src/btif_sock.cc",
        "src/btif_sock_hal.cc",
        "src/btif_sock_l2cap.cc",
        "src/btif_sock_logging.cc",
        "src/btif_sock_rfc.cc",
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ static_library("btif") {
    "src/btif_sdp.cc",
    "src/btif_sdp_server.cc",
    "src/btif_sock.cc",
    "src/btif_sock_hal.cc",
    "src/btif_sock_l2cap.cc",
    "src/btif_sock_logging.cc",
    "src/btif_sock_rfc.cc",
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <hardware/bluetooth.h>

bt_status_t btsock_hal_init();
Loading