Exemplo n.º 1
0
/****************************************************************************
NAME
    hfpHandleDisconnectRequest

DESCRIPTION
    We're in the right state and have received a disconnect request, 
    handle it here.

RETURNS
    void
*/
void hfpHandleDisconnectRequest(hfp_link_data* link)
{
    if (link->audio_sink)
    {
        MAKE_HFP_MESSAGE(HFP_INTERNAL_SLC_DISCONNECT_REQ);
        message->link = link;
        /* If we have a SCO/eSCO active need to tear that down first */
        hfpHandleAudioDisconnectReq(link);
        /* Queue up the SLC disconnect message */
        MessageSendConditionally(&theHfp->task, HFP_INTERNAL_SLC_DISCONNECT_REQ, message, (uint16 *) &link->audio_sink);    /*lint !e740 */
    }
    else 
    {
        /* If recovering from link loss or timed out we need to be sure to force disconnect */
        if (link->ag_link_loss_state == hfp_link_loss_recovery || link->ag_link_loss_state == hfp_link_loss_timeout)
        {
            /* Link was recovering from link loss, stop the procedure */
            MessageId message_id = hfpGetLinkTimeoutMessage(link, HFP_RFCOMM_LINK_LOSS_TIMEOUT_LINK_0_IND);
            MessageCancelFirst(&theHfp->task, message_id);
            hfpHandleRfcommLinkLossAbort(link, TRUE);
        }
        /* Either no link loss or we aborted link loss recovery. Now bring down the link. */
        else
        {
            /* Can only get here from searching/outgoing/incoming/connected/complete */
            if(link->ag_slc_state == hfp_slc_searching)
            {
                /* Notify application of connection failure (link will be reset so SDP results ignored) */
                hfpSendSlcConnectCfmToApp(link, NULL, hfp_connect_sdp_fail);
            }
            else
            {
                /* Request the connection lib aborts/disconnects the RFCOMM connection */
                ConnectionRfcommDisconnectRequest(&theHfp->task, hfpGetLinkSink(link));
            }
        }
    }
}
Exemplo n.º 2
0
/****************************************************************************
NAME	
	hfpHandleRfcommDisconnectRequest

DESCRIPTION
	Issue an RFCOMM disconnect to the connection lib.

RETURNS
	void
*/
void hfpHandleRfcommDisconnectRequest(HFP *hfp)
{
	/* Request the connection lib disconnects the RFCOMM connection */
	ConnectionRfcommDisconnectRequest(&hfp->task, hfp->sink);
}
Exemplo n.º 3
0
/****************************************************************************
	Issue an RFCOMM disconnect to the connection lib.
*/
void aghfpHandleRfcommDisconnectRequest(AGHFP *aghfp)
{
	/* Request the connection lib disconnects the RFCOMM connection */
	ConnectionRfcommDisconnectRequest(&aghfp->task, aghfp->rfcomm_sink);
}