예제 #1
0
/*******************************************************************************
**
** Function         avdt_ccb_clear_cmds
**
** Description      This function is called when the signaling channel is
**                  closed to clean up any pending commands.  For each pending
**                  command in the command queue, it frees the command and
**                  calls the application callback function indicating failure.
**                  Certain CCB variables are also initialized.
**
**
** Returns          void.
**
*******************************************************************************/
void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
{
    int             i;
    tAVDT_SCB       *p_scb = &avdt_cb.scb[0];
    UINT8           err_code = AVDT_ERR_CONNECT;
    UNUSED(p_data);

    /* clear the ccb */
    avdt_ccb_clear_ccb(p_ccb);

    /* clear out command queue; this is a little tricky here; we need
    ** to handle the case where there is a command on deck in p_curr_cmd,
    ** plus we need to clear out the queue
    */
    do
    {
        /* we know p_curr_cmd = NULL after this */
        avdt_ccb_cmd_fail(p_ccb, (tAVDT_CCB_EVT *) &err_code);

        /* set up next message */
        p_ccb->p_curr_cmd = (BT_HDR *) GKI_dequeue(&p_ccb->cmd_q);

    } while (p_ccb->p_curr_cmd != NULL);

    /* send a CC_CLOSE_EVT any active scbs associated with this ccb */
    for (i = 0; i < AVDT_NUM_SEPS; i++, p_scb++)
    {
        if ((p_scb->allocated) && (p_scb->p_ccb == p_ccb))
        {
            avdt_scb_event(p_scb, AVDT_SCB_CC_CLOSE_EVT, NULL);
        }
    }
}
예제 #2
0
파일: avdt_ccb_act.c 프로젝트: tve/esp-idf
/*******************************************************************************
**
** Function         avdt_ccb_chk_reconn
**
** Description      This function is called to check if a reconnect attempt
**                  is enabled.  If enabled, it sends an AVDT_CCB_UL_OPEN_EVT
**                  to the CCB.  If disabled, the CCB is deallocated.
**
**
** Returns          void.
**
*******************************************************************************/
void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data)
{
    UINT8   err_code = AVDT_ERR_CONNECT;
    UNUSED(p_data);

    if (p_ccb->reconn) {
        p_ccb->reconn = FALSE;

        /* clear out ccb */
        avdt_ccb_clear_ccb(p_ccb);

        /* clear out current command, if any */
        avdt_ccb_cmd_fail(p_ccb, (tAVDT_CCB_EVT *) &err_code);

        /* reopen the signaling channel */
        avdt_ccb_event(p_ccb, AVDT_CCB_UL_OPEN_EVT, NULL);
    } else {
        avdt_ccb_ll_closed(p_ccb, NULL);
    }
}