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

Commit b8230277 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

L2CAP: Remove unused l2cap_client am: 0ed66c46 am: d17556d5

Change-Id: Ie2e2d1ccd46b17cb1e2940bea104824a1a3664b6
parents dd24b4db d17556d5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -138,7 +138,6 @@ cc_library_static {
        "l2cap/l2c_link.cc",
        "l2cap/l2c_main.cc",
        "l2cap/l2c_utils.cc",
        "l2cap/l2cap_client.cc",
        "pan/pan_api.cc",
        "pan/pan_main.cc",
        "pan/pan_utils.cc",
+0 −1
Original line number Diff line number Diff line
@@ -122,7 +122,6 @@ static_library("stack") {
    "l2cap/l2c_link.cc",
    "l2cap/l2c_main.cc",
    "l2cap/l2c_utils.cc",
    "l2cap/l2cap_client.cc",
    "pan/pan_api.cc",
    "pan/pan_main.cc",
    "pan/pan_utils.cc",
+0 −8
Original line number Diff line number Diff line
@@ -489,14 +489,6 @@ extern bool L2CA_ConnectLECocRsp(const RawAddress& p_bd_addr, uint8_t id,
extern bool L2CA_GetPeerLECocConfig(uint16_t lcid,
                                    tL2CAP_LE_CFG_INFO* peer_cfg);

// This function sets the callback routines for the L2CAP connection referred to
// by |local_cid|. The callback routines can only be modified for outgoing
// connections established by |L2CA_ConnectReq| or accepted incoming
// connections. |callbacks| must not be NULL. This function returns true if the
// callbacks could be updated, false if not (e.g. |local_cid| was not found).
bool L2CA_SetConnectionCallbacks(uint16_t local_cid,
                                 const tL2CAP_APPL_INFO* callbacks);

/*******************************************************************************
 *
 * Function         L2CA_ErtmConnectRsp
+0 −79
Original line number Diff line number Diff line
/******************************************************************************
 *
 *  Copyright 2014 Google, Inc.
 *
 *  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>
#include <stdbool.h>
#include <stdint.h>

typedef struct buffer_t buffer_t;
typedef struct l2cap_client_t l2cap_client_t;

typedef struct {
  void (*connected)(l2cap_client_t* client, void* context);
  void (*disconnected)(l2cap_client_t* client, void* context);
  void (*read_ready)(l2cap_client_t* client, buffer_t* packet, void* context);
  void (*write_ready)(l2cap_client_t* client, void* context);
} l2cap_client_callbacks_t;

// Returns a new buffer with enough space for |size| bytes of L2CAP payload.
// |size| must be greater than zero. This function returns NULL if the buffer
// could not be allocated. The returned buffer must be freed with |buffer_free|
// when it is no longer needed.
buffer_t* l2cap_buffer_new(size_t size);

// Creates and returns a new L2CAP client object. |callbacks| must not be NULL
// and must specify a set of functions that should be called back when events
// occur on the L2CAP connection. |context| may be NULL and will be passed as
// the argument to all callbacks in |l2cap_client_callbacks_t|. The returned
// object must be freed with |l2cap_client_free|.
l2cap_client_t* l2cap_client_new(const l2cap_client_callbacks_t* callbacks,
                                 void* context);

// Frees the L2CAP client object allocated with |l2cap_client_new|. |client| may
// be NULL.
void l2cap_client_free(l2cap_client_t* client);

// Attempts to connect the |client| to a peer device specified by
// |remote_bdaddr| using the |psm| protocol specifier. This function returns
// true if the connect operation could be started and will indicate completion
// with either a 'connected' callback (success) or a 'disconnected' callback
// (failure).
//
// This function must not be called while a connect operation is in progress or
// while |l2cap_client_is_connected|. |client| and |remote_bdaddr| must not be
// NULL. |psm| must be greater than zero.
bool l2cap_client_connect(l2cap_client_t* client,
                          const RawAddress& remote_bdaddr, uint16_t psm);

// Disconnects a connected |client|. This function is asynchronous and
// idempotent. It will indicate completion with a 'disconnected' callback.
// |client| must not be NULL.
void l2cap_client_disconnect(l2cap_client_t* client);

// Returns true if |client| is connected and is ready to accept data written
// to it. |client| must not be NULL.
bool l2cap_client_is_connected(const l2cap_client_t* client);

// Writes data contained in |packet| to a connected |client|. This function
// returns true if the packet was successfully queued for delivery, false if the
// client cannot accept more data at this time. If this function returns false,
// the caller must wait for the 'write_ready' callback to write additional data
// to the client. Neither |client| nor |packet| may be NULL.
bool l2cap_client_write(l2cap_client_t* client, buffer_t* packet);
+0 −42
Original line number Diff line number Diff line
@@ -721,48 +721,6 @@ bool L2CA_GetPeerLECocConfig(uint16_t lcid, tL2CAP_LE_CFG_INFO* peer_cfg) {
  return true;
}

bool L2CA_SetConnectionCallbacks(uint16_t local_cid,
                                 const tL2CAP_APPL_INFO* callbacks) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::L2CA_SetConnectionCallbacks(local_cid, callbacks);
  }

  CHECK(callbacks != NULL);
  CHECK(callbacks->pL2CA_ConnectInd_Cb == NULL);
  CHECK(callbacks->pL2CA_ConnectCfm_Cb != NULL);
  CHECK(callbacks->pL2CA_ConfigInd_Cb != NULL);
  CHECK(callbacks->pL2CA_ConfigCfm_Cb != NULL);
  CHECK(callbacks->pL2CA_DisconnectInd_Cb != NULL);
  CHECK(callbacks->pL2CA_DisconnectCfm_Cb != NULL);
  CHECK(callbacks->pL2CA_CongestionStatus_Cb != NULL);
  CHECK(callbacks->pL2CA_DataInd_Cb != NULL);
  CHECK(callbacks->pL2CA_TxComplete_Cb != NULL);

  tL2C_CCB* channel_control_block = l2cu_find_ccb_by_cid(NULL, local_cid);
  if (!channel_control_block) {
    LOG_ERROR(LOG_TAG,
              "%s no channel control block found for L2CAP LCID=0x%04x.",
              __func__, local_cid);
    return false;
  }

  // We're making a connection-specific registration control block so we check
  // if we already have a private one allocated to us on the heap. If not, we
  // make a new allocation, mark it as heap-allocated, and inherit the fields
  // from the old control block.
  tL2C_RCB* registration_control_block = channel_control_block->p_rcb;
  if (!channel_control_block->should_free_rcb) {
    registration_control_block = (tL2C_RCB*)osi_calloc(sizeof(tL2C_RCB));

    *registration_control_block = *channel_control_block->p_rcb;
    channel_control_block->p_rcb = registration_control_block;
    channel_control_block->should_free_rcb = true;
  }

  registration_control_block->api = *callbacks;
  return true;
}

/*******************************************************************************
 *
 * Function         L2CA_ConnectRsp
Loading