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

Commit 174d0f87 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov Committed by Andre Eisenbach
Browse files

Removed unused functions

Removed unused functions and defines that are not needed:
 - l2c_bcst_msg()
 - GAP_ConnBTWrite()
 - gap_proc_btu_event()
 - AVDT_WriteDataReq()
 - L2CAP_BCST_MIN_OFFSET
 - L2CAP_BCST_OVERHEAD
 - AVDT_MAX_MEDIA_SIZE
 - LOG_NDDEBUG in btif/src/bluetooth.c

Bug: 28068134
Change-Id: If0edda2bf86caf83027db2c897537c82a0d80667
parent 231fe7e6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
 *
 ***********************************************************************************/

#define LOG_NDDEBUG 0
#define LOG_TAG "bt_btif"

#include <assert.h>
+0 −82
Original line number Diff line number Diff line
@@ -1127,88 +1127,6 @@ UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr)
    return (lcid);
}

#if AVDT_MULTIPLEXING == TRUE
/*******************************************************************************
**
** Function         AVDT_WriteDataReq
**
** Description      Send a media packet to the peer device.  The stream must
**                  be started before this function is called.  Also, this
**                  function can only be called if the stream is a SRC.
**
**                  When AVDTP has sent the media packet and is ready for the
**                  next packet, an AVDT_WRITE_CFM_EVT is sent to the
**                  application via the control callback.  The application must
**                  wait for the AVDT_WRITE_CFM_EVT before it makes the next
**                  call to AVDT_WriteDataReq().  If the applications calls
**                  AVDT_WriteDataReq() before it receives the event the packet
**                  will not be sent.  The application may make its first call
**                  to AVDT_WriteDataReq() after it receives an
**                  AVDT_START_CFM_EVT or AVDT_START_IND_EVT.
**
** Returns          AVDT_SUCCESS if successful, otherwise error.
**
*******************************************************************************/
extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
                                UINT32 time_stamp, UINT8 m_pt, UINT8 marker)
{

    tAVDT_SCB       *p_scb;
    tAVDT_SCB_EVT   evt;
    UINT16          result = AVDT_SUCCESS;

    do
    {
        /* check length of media frame */
        if(data_len > AVDT_MAX_MEDIA_SIZE)
        {
            result = AVDT_BAD_PARAMS;
            break;
        }
        /* map handle to scb */
        if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
        {
            result = AVDT_BAD_HANDLE;
            break;
        }
        AVDT_TRACE_WARNING("mux_tsid_media:%d", p_scb->curr_cfg.mux_tsid_media);

        if (p_scb->p_pkt != NULL
            || p_scb->p_ccb == NULL
            || !fixed_queue_is_empty(p_scb->frag_q)
            || p_scb->frag_off != 0
            || p_scb->curr_cfg.mux_tsid_media == 0)
        {
            result = AVDT_ERR_BAD_STATE;
            AVDT_TRACE_WARNING("p_scb->p_pkt=%x, p_scb->p_ccb=%x, IsQueueEmpty=%x, p_scb->frag_off=%x",
                p_scb->p_pkt, p_scb->p_ccb,
                fixed_queue_is_empty(p_scb->frag_q), p_scb->frag_off);
            break;
        }
        evt.apiwrite.p_buf = 0; /* it will indicate using of fragments queue frag_q */

        /* compose fragments from media payload and put fragments into gueue */
        avdt_scb_queue_frags(p_scb, &p_data, &data_len);

        evt.apiwrite.data_len = data_len;
        evt.apiwrite.p_data = p_data;

        /* process the fragments queue */
        evt.apiwrite.time_stamp = time_stamp;
        evt.apiwrite.m_pt = m_pt | (marker<<7);
        avdt_scb_event(p_scb, AVDT_SCB_API_WRITE_REQ_EVT, &evt);
    } while (0);

#if (BT_USE_TRACES == TRUE)
    if(result != AVDT_SUCCESS)
    {
        AVDT_TRACE_WARNING("*** AVDT_WriteDataReq failed result=%d",result);
    }
#endif
    return result;
}
#endif

#if AVDT_MULTIPLEXING == TRUE
/*******************************************************************************
**
+0 −111
Original line number Diff line number Diff line
@@ -466,71 +466,6 @@ UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf)
    }
}


/*******************************************************************************
**
** Function         GAP_ConnBTWrite
**
** Description      Bluetooth Aware applications can call this function to write data.
**
** Parameters:      handle      - Handle of the connection returned in the Open
**                  p_buf      - pointer to address of buffer with data,
**
** Returns          BT_PASS                 - data read
**                  GAP_ERR_BAD_HANDLE      - invalid handle
**                  GAP_ERR_BAD_STATE       - connection not established
**                  GAP_INVALID_BUF_OFFSET  - buffer offset is invalid
*******************************************************************************/
UINT16 GAP_ConnBTWrite (UINT16 gap_handle, BT_HDR *p_buf)
{
    tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);

    if (!p_ccb)
    {
        osi_free(p_buf);
        return (GAP_ERR_BAD_HANDLE);
    }

    if (p_ccb->con_state != GAP_CCB_STATE_CONNECTED)
    {
        osi_free(p_buf);
        return (GAP_ERR_BAD_STATE);
    }

    if (p_buf->offset < L2CAP_MIN_OFFSET)
    {
        osi_free(p_buf);
        return (GAP_ERR_BUF_OFFSET);
    }

    fixed_queue_enqueue(p_ccb->tx_queue, p_buf);

    if (p_ccb->is_congested)
    {
        return (BT_PASS);
    }

    /* Send the buffer through L2CAP */
#if (GAP_CONN_POST_EVT_INCLUDED == TRUE)
    gap_send_event (gap_handle);
#else
    while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->tx_queue)) != NULL)
    {
        UINT8 status = L2CA_DATA_WRITE (p_ccb->connection_id, p_buf);

        if (status == L2CAP_DW_CONGESTED)
        {
            p_ccb->is_congested = TRUE;
            break;
        }
        else if (status != L2CAP_DW_SUCCESS)
            return (GAP_ERR_BAD_STATE);
    }
#endif
    return (BT_PASS);
}


/*******************************************************************************
**
** Function         GAP_ConnWriteData
@@ -1321,51 +1256,5 @@ void gap_send_event (UINT16 gap_handle)
    GKI_send_msg(BTU_TASK, BTU_HCI_RCV_MBOX, p_msg);
}

/*******************************************************************************
**
** Function     gap_proc_btu_event
**
** Description  Event handler for BT_EVT_TO_GAP_MSG event from BTU task
**
** Returns      None
**
*******************************************************************************/
void gap_proc_btu_event(BT_HDR *p_msg)
{
    tGAP_CCB   *p_ccb = gap_find_ccb_by_handle (p_msg->layer_specific);
    UINT8       status;
    BT_HDR     *p_buf;

    if (!p_ccb)
    {
        return;
    }

    if (p_ccb->con_state != GAP_CCB_STATE_CONNECTED)
    {
        return;
    }

    if (p_ccb->is_congested)
    {
        return;
    }

    /* Send the buffer through L2CAP */

    while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(&p_ccb->tx_queue)) != NULL)
    {
        status = L2CA_DATA_WRITE (p_ccb->connection_id, p_buf);

        if (status == L2CAP_DW_CONGESTED)
        {
            p_ccb->is_congested = TRUE;
            break;
        }
        else if (status != L2CAP_DW_SUCCESS)
            break;
    }

}
#endif /* (GAP_CONN_POST_EVT_INCLUDED == TRUE) */
#endif  /* GAP_CONN_INCLUDED */
+0 −29
Original line number Diff line number Diff line
@@ -53,11 +53,6 @@
/* The size in bytes of a media packet header. */
#define AVDT_MEDIA_HDR_SIZE         12

/* AVDTP 7.5.3 Adaptation Layer Fragmentation
 * original length of the un-fragmented transport packet should be specified by
 * two bytes length field of Adaptation Layer Header  */
#define AVDT_MAX_MEDIA_SIZE         (0xFFFF - AVDT_MEDIA_HDR_SIZE)

/* The handle is used when reporting MULTI_AV specific events */
#define AVDT_MULTI_AV_HANDLE        0xFF

@@ -899,30 +894,6 @@ extern UINT16 AVDT_GetL2CapChannel(UINT8 handle);
*******************************************************************************/
extern UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr);

/*******************************************************************************
**
** Function         AVDT_WriteDataReq
**
** Description      Send a media packet to the peer device.  The stream must
**                  be started before this function is called.  Also, this
**                  function can only be called if the stream is a SRC.
**
**                  When AVDTP has sent the media packet and is ready for the
**                  next packet, an AVDT_WRITE_CFM_EVT is sent to the
**                  application via the control callback.  The application must
**                  wait for the AVDT_WRITE_CFM_EVT before it makes the next
**                  call to AVDT_WriteDataReq().  If the applications calls
**                  AVDT_WriteDataReq() before it receives the event the packet
**                  will not be sent.  The application may make its first call
**                  to AVDT_WriteDataReq() after it receives an
**                  AVDT_START_CFM_EVT or AVDT_START_IND_EVT.
**
** Returns          AVDT_SUCCESS if successful, otherwise error.
**
*******************************************************************************/
extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
                                UINT32 time_stamp, UINT8 m_pt, UINT8 marker);

/*******************************************************************************
**
** Function         AVDT_SetMediaBuf
+0 −14
Original line number Diff line number Diff line
@@ -206,20 +206,6 @@ extern int GAP_GetRxQueueCnt (UINT16 handle, UINT32 *p_rx_queue_count);
*******************************************************************************/
extern UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf);

/*******************************************************************************
**
** Function         GAP_ConnBTWrite
**
** Description      GKI buffer aware applications can call this function to write data
**                  by passing a pointer to the GKI buffer of data.
**
** Returns          BT_PASS                 - data read
**                  GAP_ERR_BAD_HANDLE      - invalid handle
**                  GAP_ERR_BAD_STATE       - connection not established
**                  GAP_INVALID_BUF_OFFSET  - buffer offset is invalid
*******************************************************************************/
extern UINT16 GAP_ConnBTWrite (UINT16 gap_handle, BT_HDR *p_buf);

/*******************************************************************************
**
** Function         GAP_ConnWriteData
Loading