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

Commit 3066fb63 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Automerger Merge Worker
Browse files

stack/l2c: Add support for credit based connection oriented channels am: 648dd98e

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

Change-Id: I1bb2dfbb0c69aac353921cc144a6602b67a0f5fe
parents 405a1c7e 648dd98e
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -148,6 +148,29 @@ bool bluetooth::shim::L2CA_GetPeerLECocConfig(uint16_t lcid,
  return false;
}

bool bluetooth::shim::L2CA_ReconfigCreditBasedConnsReq(
    const RawAddress& bd_addr, std::vector<uint16_t>& lcids,
    tL2CAP_LE_CFG_INFO* p_cfg) {
  LOG_INFO("UNIMPLEMENTED %s addr: %s cfg:%p", __func__,
           bd_addr.ToString().c_str(), p_cfg);
  return false;
}

std::vector<uint16_t> bluetooth::shim::L2CA_ConnectCreditBasedReq(
    uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg) {
  LOG_INFO("UNIMPLEMENTED %s addr:%s", __func__, p_bd_addr.ToString().c_str());
  std::vector<uint16_t> result;
  return result;
}

bool bluetooth::shim::L2CA_ConnectCreditBasedRsp(
    const RawAddress& bd_addr, uint8_t id,
    std::vector<uint16_t>& accepted_lcids, uint16_t result,
    tL2CAP_LE_CFG_INFO* p_cfg) {
  LOG_INFO("UNIMPLEMENTED %s addr:%s", __func__, bd_addr.ToString().c_str());
  return false;
}

uint8_t bluetooth::shim::L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
  bool write_success = shim_l2cap.Write(cid, p_data);
  return write_success ? L2CAP_DW_SUCCESS : L2CAP_DW_FAILED;
+48 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <set>
#include <unordered_map>
#include <vector>

#include "stack/include/l2c_api.h"

@@ -174,6 +175,53 @@ bool L2CA_ConnectLECocRsp(const RawAddress& p_bd_addr, uint8_t id,
 ******************************************************************************/
bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg);

/*******************************************************************************
 *
 *  Function         L2CA_ReconfigCreditBasedConnsReq
 *
 *  Description      Start reconfigure procedure on Credit Based Connection Oriented
 *                   Channels.
 *
 *  Return value:    true if peer is connected
 *
 ******************************************************************************/

bool L2CA_ReconfigCreditBasedConnsReq(const RawAddress& bd_addr,
                                      std::vector<uint16_t>& lcids,
                                      tL2CAP_LE_CFG_INFO* p_cfg);

/*******************************************************************************
 *
 *  Function         L2CA_ConnectCreditBasedReq
 *
 *  Description      With this function L2CAP will initiate setup of up to 5 credit
 *                   based connections for given psm using provided configuration.
 *                   L2CAP will notify user on the connection result, by calling
 *                   pL2CA_CreditBasedConnectCfm_Cb for each cid with a result.
 *
 *  Return value: vector of allocated local cids for the connection
 *
 ******************************************************************************/

extern std::vector<uint16_t> L2CA_ConnectCreditBasedReq(
    uint16_t psm, const RawAddress& p_bd_addr, tL2CAP_LE_CFG_INFO* p_cfg);

/*******************************************************************************
 *
 *  Function         L2CA_ConnectCreditBasedRsp
 *
 *  Description      Response for the pL2CA_CreditBasedConnectInd_Cb which is the
 *                   indication for peer requesting credit based connection.
 *
 *  Return value:    true if peer is connected
 *
 ******************************************************************************/

extern bool L2CA_ConnectCreditBasedRsp(const RawAddress& p_bd_addr, uint8_t id,
                                       std::vector<uint16_t>& accepted_lcids,
                                       uint16_t result,
                                       tL2CAP_LE_CFG_INFO* p_cfg);

/*******************************************************************************
 *
 * Function         L2CA_DisconnectReq
+2 −1
Original line number Diff line number Diff line
@@ -48,7 +48,8 @@ const tL2CAP_APPL_INFO avct_l2c_appl = {
    avct_l2c_config_ind_cback,     avct_l2c_config_cfm_cback,
    avct_l2c_disconnect_ind_cback, avct_l2c_data_ind_cback,
    avct_l2c_congestion_ind_cback, NULL,
    avct_on_l2cap_error,
    avct_on_l2cap_error,           NULL,
    NULL,                          NULL,
};

/*******************************************************************************
+2 −1
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ const tL2CAP_APPL_INFO avct_l2c_br_appl = {
    avct_l2c_br_config_ind_cback,     avct_l2c_br_config_cfm_cback,
    avct_l2c_br_disconnect_ind_cback, avct_l2c_br_data_ind_cback,
    avct_l2c_br_congestion_ind_cback, NULL,
    avct_br_on_l2cap_error,
    avct_br_on_l2cap_error,           NULL,
    NULL,                             NULL
};

/*******************************************************************************
+2 −1
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ const tL2CAP_APPL_INFO avdt_l2c_appl = {
    avdt_l2c_config_ind_cback,     avdt_l2c_config_cfm_cback,
    avdt_l2c_disconnect_ind_cback, avdt_l2c_data_ind_cback,
    avdt_l2c_congestion_ind_cback, NULL,
    avdt_on_l2cap_error,
    avdt_on_l2cap_error,           NULL,
    NULL,                          NULL
};

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