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

Commit 8521a143 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "L2CAP: Delete more unused API"

parents fc3c11e4 8404ef9c
Loading
Loading
Loading
Loading
+2 −35
Original line number Diff line number Diff line
@@ -209,26 +209,9 @@ bool bluetooth::shim::L2CA_SetConnectionCallbacks(
  return false;
}

uint8_t bluetooth::shim::L2CA_DataWriteEx(uint16_t cid, BT_HDR* bt_hdr,
                                          uint16_t flags) {
  bool write_success = false;
  switch (flags) {
    case L2CAP_FLUSHABLE_CH_BASED:
      write_success = shim_l2cap.Write(cid, bt_hdr);
      break;
    case L2CAP_FLUSHABLE_PKT:
      write_success = shim_l2cap.WriteFlushable(cid, bt_hdr);
      break;
    case L2CAP_NON_FLUSHABLE_PKT:
      write_success = shim_l2cap.WriteNonFlushable(cid, bt_hdr);
      break;
  }
  return write_success ? L2CAP_DW_SUCCESS : L2CAP_DW_FAILED;
}

uint8_t bluetooth::shim::L2CA_DataWrite(uint16_t cid, BT_HDR* p_data) {
  return bluetooth::shim::L2CA_DataWriteEx(cid, p_data,
                                           L2CAP_FLUSHABLE_CH_BASED);
  bool write_success = shim_l2cap.Write(cid, p_data);
  return write_success ? L2CAP_DW_SUCCESS : L2CAP_DW_FAILED;
}

/**
@@ -365,13 +348,6 @@ bool bluetooth::shim::L2CA_SetTxPriority(uint16_t cid,
  return false;
}

bool bluetooth::shim::L2CA_SetChnlDataRate(uint16_t cid,
                                           tL2CAP_CHNL_DATA_RATE tx,
                                           tL2CAP_CHNL_DATA_RATE rx) {
  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
  return false;
}

uint8_t bluetooth::shim::L2CA_GetChnlFcrMode(uint16_t lcid) {
  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
  return 0;
@@ -395,12 +371,3 @@ uint16_t bluetooth::shim::L2CA_FlushChannel(uint16_t lcid,
  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
  return 0;
}

/**
 * Misc APIs
 */
bool bluetooth::shim::L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb,
                                         const RawAddress& p_bda) {
  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
  return false;
}
+0 −134
Original line number Diff line number Diff line
@@ -440,32 +440,6 @@ bool L2CA_SendTestSFrame(uint16_t cid, uint8_t sup_type, uint8_t back_track);
 ******************************************************************************/
bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority);

/*******************************************************************************
 *
 * Function         L2CA_RegForNoCPEvt
 *
 * Description      Register callback for Number of Completed Packets event.
 *
 * Input Param      p_cb - callback for Number of completed packets event
 *                  p_bda - BT address of remote device
 *
 * Returns
 *
 ******************************************************************************/
bool L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, const RawAddress& p_bda);

/*******************************************************************************
 *
 * Function         L2CA_SetChnlDataRate
 *
 * Description      Sets the tx/rx data rate for a channel.
 *
 * Returns          true if a valid channel, else false
 *
 ******************************************************************************/
bool L2CA_SetChnlDataRate(uint16_t cid, tL2CAP_CHNL_DATA_RATE tx,
                          tL2CAP_CHNL_DATA_RATE rx);

typedef void(tL2CA_RESERVE_CMPL_CBACK)(void);

/*******************************************************************************
@@ -494,24 +468,6 @@ typedef void(tL2CA_RESERVE_CMPL_CBACK)(void);
 ******************************************************************************/
bool L2CA_SetFlushTimeout(const RawAddress& bd_addr, uint16_t flush_tout);

/*******************************************************************************
 *
 * Function         L2CA_DataWriteEx
 *
 * Description      Higher layers call this function to write data with extended
 *                  flags.
 *                  flags : L2CAP_FLUSHABLE_CH_BASED
 *                          L2CAP_FLUSHABLE_PKT
 *                          L2CAP_NON_FLUSHABLE_PKT
 *
 * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
 *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
 *                                      congested
 *                  L2CAP_DW_FAILED, if error
 *
 ******************************************************************************/
uint8_t L2CA_DataWriteEx(uint16_t cid, BT_HDR* p_data, uint16_t flags);

/*******************************************************************************
 *
 * Function         L2CA_SetChnlFlushability
@@ -566,96 +522,6 @@ bool L2CA_GetBDAddrbyHandle(uint16_t handle, RawAddress& bd_addr);
 ******************************************************************************/
uint8_t L2CA_GetChnlFcrMode(uint16_t lcid);

/*******************************************************************************
 *
 *  Function        L2CA_UcdRegister
 *
 *  Description     Register PSM on UCD.
 *
 *  Parameters:     tL2CAP_UCD_CB_INFO
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
bool L2CA_UcdRegister(uint16_t psm, tL2CAP_UCD_CB_INFO* p_cb_info);

/*******************************************************************************
 *
 *  Function        L2CA_UcdDeregister
 *
 *  Description     Deregister PSM on UCD.
 *
 *  Parameters:     PSM
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
bool L2CA_UcdDeregister(uint16_t psm);

/*******************************************************************************
 *
 *  Function        L2CA_UcdDiscover
 *
 *  Description     Discover UCD of remote device.
 *
 *  Parameters:     PSM
 *                  BD_ADDR of remote device
 *                  info_type : L2CAP_UCD_INFO_TYPE_RECEPTION
 *                              L2CAP_UCD_INFO_TYPE_MTU
 *
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
bool L2CA_UcdDiscover(uint16_t psm, const RawAddress& rem_bda,
                      uint8_t info_type);

/*******************************************************************************
 *
 *  Function        L2CA_UcdDataWrite
 *
 *  Description     Send UCD to remote device
 *
 *  Parameters:     PSM
 *                  BD Address of remote
 *                  Pointer to buffer of type BT_HDR
 *                  flags : L2CAP_FLUSHABLE_CH_BASED
 *                          L2CAP_FLUSHABLE_PKT
 *                          L2CAP_NON_FLUSHABLE_PKT
 *
 * Return value     L2CAP_DW_SUCCESS, if data accepted
 *                  L2CAP_DW_FAILED,  if error
 *
 ******************************************************************************/
uint16_t L2CA_UcdDataWrite(uint16_t psm, const RawAddress& rem_bda,
                           BT_HDR* p_buf, uint16_t flags);

/*******************************************************************************
 *
 *  Function        L2CA_UcdSetIdleTimeout
 *
 *  Description     Set UCD Idle timeout.
 *
 *  Parameters:     BD Addr
 *                  Timeout in second
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
bool L2CA_UcdSetIdleTimeout(const RawAddress& rem_bda, uint16_t timeout);

/*******************************************************************************
 *
 * Function         L2CA_UCDSetTxPriority
 *
 * Description      Sets the transmission priority for a connectionless channel.
 *
 * Returns          true if a valid channel, else false
 *
 ******************************************************************************/
bool L2CA_UCDSetTxPriority(const RawAddress& rem_bda,
                           tL2CAP_CHNL_PRIORITY priority);

/*******************************************************************************
 *
 *  Function        L2CA_RegisterFixedChannel
+0 −172
Original line number Diff line number Diff line
@@ -766,32 +766,6 @@ extern bool L2CA_SendTestSFrame(uint16_t cid, uint8_t sup_type,
 ******************************************************************************/
extern bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority);

/*******************************************************************************
 *
 * Function         L2CA_RegForNoCPEvt
 *
 * Description      Register callback for Number of Completed Packets event.
 *
 * Input Param      p_cb - callback for Number of completed packets event
 *                  p_bda - BT address of remote device
 *
 * Returns
 *
 ******************************************************************************/
extern bool L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, const RawAddress& p_bda);

/*******************************************************************************
 *
 * Function         L2CA_SetChnlDataRate
 *
 * Description      Sets the tx/rx data rate for a channel.
 *
 * Returns          true if a valid channel, else false
 *
 ******************************************************************************/
extern bool L2CA_SetChnlDataRate(uint16_t cid, tL2CAP_CHNL_DATA_RATE tx,
                                 tL2CAP_CHNL_DATA_RATE rx);

typedef void(tL2CA_RESERVE_CMPL_CBACK)(void);

/*******************************************************************************
@@ -821,24 +795,6 @@ typedef void(tL2CA_RESERVE_CMPL_CBACK)(void);
extern bool L2CA_SetFlushTimeout(const RawAddress& bd_addr,
                                 uint16_t flush_tout);

/*******************************************************************************
 *
 * Function         L2CA_DataWriteEx
 *
 * Description      Higher layers call this function to write data with extended
 *                  flags.
 *                  flags : L2CAP_FLUSHABLE_CH_BASED
 *                          L2CAP_FLUSHABLE_PKT
 *                          L2CAP_NON_FLUSHABLE_PKT
 *
 * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
 *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
 *                                      congested
 *                  L2CAP_DW_FAILED, if error
 *
 ******************************************************************************/
extern uint8_t L2CA_DataWriteEx(uint16_t cid, BT_HDR* p_data, uint16_t flags);

/*******************************************************************************
 *
 * Function         L2CA_SetChnlFlushability
@@ -893,134 +849,6 @@ extern bool L2CA_GetBDAddrbyHandle(uint16_t handle, RawAddress& bd_addr);
 ******************************************************************************/
extern uint8_t L2CA_GetChnlFcrMode(uint16_t lcid);

/*******************************************************************************
 *
 *                      UCD callback prototypes
 *
 ******************************************************************************/

/* UCD discovery. Parameters are
 *      BD Address of remote
 *      Data Type
 *      Data
 */
#define L2CAP_UCD_INFO_TYPE_RECEPTION 0x01
#define L2CAP_UCD_INFO_TYPE_MTU 0x02

typedef void(tL2CA_UCD_DISCOVER_CB)(const RawAddress&, uint8_t, uint32_t);

/* UCD data received. Parameters are
 *      BD Address of remote
 *      Pointer to buffer with data
 */
typedef void(tL2CA_UCD_DATA_CB)(const RawAddress&, BT_HDR*);

/* Congestion status callback protype. This callback is optional. If
 * an application tries to send data when the transmit queue is full,
 * the data will anyways be dropped. The parameter is:
 *              remote BD_ADDR
 *              true if congested, false if uncongested
 */
typedef void(tL2CA_UCD_CONGESTION_STATUS_CB)(const RawAddress&, bool);

/* UCD registration info (the callback addresses and PSM)
 */
typedef struct {
  tL2CA_UCD_DISCOVER_CB* pL2CA_UCD_Discover_Cb;
  tL2CA_UCD_DATA_CB* pL2CA_UCD_Data_Cb;
  tL2CA_UCD_CONGESTION_STATUS_CB* pL2CA_UCD_Congestion_Status_Cb;
} tL2CAP_UCD_CB_INFO;

/*******************************************************************************
 *
 *  Function        L2CA_UcdRegister
 *
 *  Description     Register PSM on UCD.
 *
 *  Parameters:     tL2CAP_UCD_CB_INFO
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
extern bool L2CA_UcdRegister(uint16_t psm, tL2CAP_UCD_CB_INFO* p_cb_info);

/*******************************************************************************
 *
 *  Function        L2CA_UcdDeregister
 *
 *  Description     Deregister PSM on UCD.
 *
 *  Parameters:     PSM
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
extern bool L2CA_UcdDeregister(uint16_t psm);

/*******************************************************************************
 *
 *  Function        L2CA_UcdDiscover
 *
 *  Description     Discover UCD of remote device.
 *
 *  Parameters:     PSM
 *                  BD_ADDR of remote device
 *                  info_type : L2CAP_UCD_INFO_TYPE_RECEPTION
 *                              L2CAP_UCD_INFO_TYPE_MTU
 *
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
extern bool L2CA_UcdDiscover(uint16_t psm, const RawAddress& rem_bda,
                             uint8_t info_type);

/*******************************************************************************
 *
 *  Function        L2CA_UcdDataWrite
 *
 *  Description     Send UCD to remote device
 *
 *  Parameters:     PSM
 *                  BD Address of remote
 *                  Pointer to buffer of type BT_HDR
 *                  flags : L2CAP_FLUSHABLE_CH_BASED
 *                          L2CAP_FLUSHABLE_PKT
 *                          L2CAP_NON_FLUSHABLE_PKT
 *
 * Return value     L2CAP_DW_SUCCESS, if data accepted
 *                  L2CAP_DW_FAILED,  if error
 *
 ******************************************************************************/
extern uint16_t L2CA_UcdDataWrite(uint16_t psm, const RawAddress& rem_bda,
                                  BT_HDR* p_buf, uint16_t flags);

/*******************************************************************************
 *
 *  Function        L2CA_UcdSetIdleTimeout
 *
 *  Description     Set UCD Idle timeout.
 *
 *  Parameters:     BD Addr
 *                  Timeout in second
 *
 *  Return value:   true if successs
 *
 ******************************************************************************/
extern bool L2CA_UcdSetIdleTimeout(const RawAddress& rem_bda, uint16_t timeout);

/*******************************************************************************
 *
 * Function         L2CA_UCDSetTxPriority
 *
 * Description      Sets the transmission priority for a connectionless channel.
 *
 * Returns          true if a valid channel, else false
 *
 ******************************************************************************/
extern bool L2CA_UCDSetTxPriority(const RawAddress& rem_bda,
                                  tL2CAP_CHNL_PRIORITY priority);

/*******************************************************************************
 *
 *                      Fixed Channel callback prototypes
+0 −93
Original line number Diff line number Diff line
@@ -1409,43 +1409,6 @@ bool L2CA_SetTxPriority(uint16_t cid, tL2CAP_CHNL_PRIORITY priority) {
  return (true);
}

/*******************************************************************************
 *
 * Function         L2CA_SetChnlDataRate
 *
 * Description      Sets the tx/rx data rate for a channel.
 *
 * Returns          true if a valid channel, else false
 *
 ******************************************************************************/
bool L2CA_SetChnlDataRate(uint16_t cid, tL2CAP_CHNL_DATA_RATE tx,
                          tL2CAP_CHNL_DATA_RATE rx) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::L2CA_SetChnlDataRate(cid, tx, rx);
  }

  tL2C_CCB* p_ccb;

  L2CAP_TRACE_API("L2CA_SetChnlDataRate()  CID: 0x%04x, tx:%d, rx:%d", cid, tx,
                  rx);

  /* Find the channel control block. We don't know the link it is on. */
  p_ccb = l2cu_find_ccb_by_cid(NULL, cid);
  if (p_ccb == NULL) {
    L2CAP_TRACE_WARNING("L2CAP - no CCB for L2CA_SetChnlDataRate, CID: %d",
                        cid);
    return (false);
  }

  p_ccb->tx_data_rate = tx;
  p_ccb->rx_data_rate = rx;

  /* Adjust channel buffer allocation */
  l2c_link_adjust_chnl_allocation();

  return (true);
}

/*******************************************************************************
 *
 * Function         L2CA_SetFlushTimeout
@@ -2121,36 +2084,6 @@ bool L2CA_GetConnectionConfig(uint16_t lcid, uint16_t* mtu, uint16_t* rcid,
  return false;
}

/*******************************************************************************
 *
 * Function         L2CA_RegForNoCPEvt
 *
 * Description      Register callback for Number of Completed Packets event.
 *
 * Input Param      p_cb - callback for Number of completed packets event
 *                  p_bda - BT address of remote device
 *
 * Returns          true if registered OK, else false
 *
 ******************************************************************************/
bool L2CA_RegForNoCPEvt(tL2CA_NOCP_CB* p_cb, const RawAddress& p_bda) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::L2CA_RegForNoCPEvt(p_cb, p_bda);
  }

  tL2C_LCB* p_lcb;

  /* Find the link that is associated with this remote bdaddr */
  p_lcb = l2cu_find_lcb_by_bd_addr(p_bda, BT_TRANSPORT_BR_EDR);

  /* If no link for this handle, nothing to do. */
  if (!p_lcb) return false;

  p_lcb->p_nocp_cb = p_cb;

  return true;
}

/*******************************************************************************
 *
 * Function         L2CA_DataWrite
@@ -2208,32 +2141,6 @@ bool L2CA_SetChnlFlushability(uint16_t cid, bool is_flushable) {
  return (true);
}

/*******************************************************************************
 *
 * Function         L2CA_DataWriteEx
 *
 * Description      Higher layers call this function to write data with extended
 *                  flags.
 *                  flags : L2CAP_FLUSHABLE_CH_BASED
 *                          L2CAP_FLUSHABLE_PKT
 *                          L2CAP_NON_FLUSHABLE_PKT
 *
 * Returns          L2CAP_DW_SUCCESS, if data accepted, else false
 *                  L2CAP_DW_CONGESTED, if data accepted and the channel is
 *                                      congested
 *                  L2CAP_DW_FAILED, if error
 *
 ******************************************************************************/
uint8_t L2CA_DataWriteEx(uint16_t cid, BT_HDR* p_data, uint16_t flags) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::L2CA_DataWriteEx(cid, p_data, flags);
  }

  L2CAP_TRACE_API("L2CA_DataWriteEx()  CID: 0x%04x  Len: %d Flags:0x%04X", cid,
                  p_data->len, flags);
  return l2c_data_write(cid, p_data, flags);
}

/*******************************************************************************
 *
 * Function     L2CA_FlushChannel