亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hfp_headset_slc.c

?? CSR藍牙芯片 無線藍牙耳機的語音網關程序 藍牙耳機程序已經上傳
?? C
字號:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004

FILE NAME
    hfp_headset_slc.c

DESCRIPTION
    

NOTES

*/


/****************************************************************************
    Header files
*/
#include "headset_private.h"
#include "headset_scan.h"
#include "hfp_headset_sco.h"
#include "hfp_headset_slc.h"
#include "hfp_headset_ring.h"
#include "av_headset_controls.h"
#include "av_headset_kalimba.h"

#include <connection.h>
#include <hfp.h>
#include <panic.h>
#include <ps.h>


static void slcConnectFail(headsetTaskData *app)
{
    /* Update the app state */
    app->hfp_state = headsetReady;

    /* No connection */
    app->profile_connected = hfp_no_profile;

	/* Cancel button presses */
	(void) MessageCancelAll(&app->task, BUTTON_PLAY_PAUSE_LONG);
	(void) MessageCancelAll(&app->task, BUTTON_STOP_LONG);

    if (app->button_action_pending_lock > 1)
    {
        MessageSend(getAppTask(), APP_HFP_SLC_REQ, 0);
    }
    else
    {
        (void) MessageCancelAll(getAppTask(), APP_HFP_SLC_TIMEOUT_IND);
		app->button_action_pending_lock = 0;
    }

	if (app->av_stream_stopped && !app->sco_sink)
	{
		hfpHeadsetPlayRingTone(app, error_tone);
	}
}


/****************************************************************************
NAME    

    hfpHeadsetHandleSlcConnectInd
    
DESCRIPTION
    Handle a request to establish an SLC from the AG.

RETURNS
    void
*/
void hfpHeadsetHandleSlcConnectInd(headsetTaskData *app, const HFP_SLC_CONNECT_IND_T *ind)
{
    /* We support more than one HFP so check which one this request is for */   
    /* 
        TODO B-4373 we probably want to be a bit more fussy here but for now accept 
        the connection for whichever profile instance is specified in the message 
    */
    
    if (app->profile_connected == hfp_no_profile)
    {
        HfpSlcConnectResponse(ind->hfp, 1, &ind->addr, 0);
        
        /* Update the app state */
        app->hfp_state = headsetConnecting;

        /* See whether we are connecting as HSP or HFP */
        if (ind->hfp == app->hfp)
            app->profile_connected = hfp_handsfree_profile;
        else if (ind->hfp == app->hsp)
            app->profile_connected = hfp_headset_profile;
        else
            /* Something is wrong we should be either hfp or hsp */
            Panic();
    }
    else
    {
        /* Reject the connect attempt we're already connected */
        HfpSlcConnectResponse(ind->hfp, 0, &ind->addr, 0);
    }
}


/****************************************************************************
NAME    
    hfpHeadsetHandleSlcConnectCfm
    
DESCRIPTION
    Confirmation that the SLC has been established (or not).

RETURNS
    void
*/
void hfpHeadsetHandleSlcConnectCfm(headsetTaskData *app, const HFP_SLC_CONNECT_CFM_T *cfm)
{
    /* TODO: B-4373 how do we support multiple instances */

    /* Check the status of the SLC attempt */
    if (cfm->status == hfp_connect_success)
    {
		bdaddr ag_addr;

        /* Update the app state */
        if (app->hfp_state == headsetConnecting)
            app->hfp_state = headsetConnected;
        
        (void) MessageCancelAll(getAppTask(), APP_HFP_SLC_TIMEOUT_IND);
		app->button_action_pending_lock = 0;
        
        headsetTestForConnectablilty(app);

		/* Read the remote supported features of the AG */
		ConnectionReadRemoteSuppFeatures(getAppTask(), cfm->sink);

		/* Store the address as the last used AG which can be obtained from the sink */
		if (SinkGetBdAddr(cfm->sink, &ag_addr))
			(void) PsStore(LAST_USED_AG, &ag_addr, sizeof(bdaddr)); 
        
        /* If there is a pending APP_MUSIC_RESTART_IND message then it must have
           been sent because there was HFP link-loss and the AV stream was suspended 
           while the headset tried to reconnect back to the AG, to stop any AV stuttering.
           As the HFP connect has been a success, the AV can be restarted now.
        */
        if (MessageCancelAll(getAppTask(), APP_MUSIC_RESTART_IND))
            MessageSend(getAppTask(), APP_MUSIC_RESTART_IND, 0);
        
        /* 
            The sink is no longer valid, this could happen if the device connects 
            and disconnects very quickly. For now ignore, the disconnect message 
            should arrive shortly.
        */
    }
    else if (cfm->status == hfp_connect_sdp_fail)
    {
        /* We failed to find the requested profile */
        if (cfm->hfp == app->hfp)
        {
            /* Didn't find HFP so try HSP */
            hfpHeadsetHandleSlcConnectRequest(app, hfp_headset_profile);
        }
        else if (cfm->hfp == app->hsp)
        {
            /* We try the HSP after we've tried HFP so this AG supports neither, give up */
            slcConnectFail(app);
        }
        else
            /* Unknown profile instance */
            Panic();
    }
    else
    {
        /* Update local state to reflect this */
        slcConnectFail(app);
    }
}


/****************************************************************************
NAME    
    hfpHeadsetHandleSlcConnectRequest
    
DESCRIPTION
    Request to create a connection to a remote AG.

RETURNS
    void
*/
void hfpHeadsetHandleSlcConnectRequest(headsetTaskData *app, hfp_profile profile)
{
    bdaddr addr;    

    /* Set up the extra indicator config 
    const char *inds = "roam\rbattchg\rchargerconnected\rflobber\r"; */

    /* Retrieve the address of the last used AG from PS */
    if (!PsRetrieve(LAST_USED_AG, &addr, sizeof(bdaddr)))
    {
        /* Play an error tone to indicate we don't have a valid address */
		slcConnectFail(app);
		return;
    }
    
    /* Update the app state */
    app->hfp_state = headsetConnecting;

    if (profile == hfp_handsfree_profile)
    {
        app->profile_connected = hfp_handsfree_profile;

        /* Issue a connect request for HFP */
        HfpSlcConnect(app->hfp, &addr, 0);
    }
    else if (profile == hfp_headset_profile)
    {
        app->profile_connected = hfp_headset_profile;

        /* Issue a connect request for HFP */
        HfpSlcConnect(app->hsp, &addr, 0);
    }
    else
        /* The app should know what profile it wants to connect as */
        Panic();
}


/****************************************************************************
NAME    
    hfpHeadsetDisconnectSlc
    
DESCRIPTION
    Disconnect the SLC associated with this profile instance.

RETURNS
    void
*/
void hfpHeadsetDisconnectSlc(const headsetTaskData *app)
{
    /* Issue the disconnect request and let the HFP lib do the rest */
    HfpSlcDisconnect(app->hfp);
}


/****************************************************************************
NAME    
    hfpHeadsetHandleSlcDisconnectInd
    
DESCRIPTION
    Indication that the SLC has been released.

RETURNS
    void
*/
void hfpHeadsetHandleSlcDisconnectInd(headsetTaskData *app, const HFP_SLC_DISCONNECT_IND_T *ind)
{
	/*	Handle the case where an incoming call is rejected using the headset profile.
		As we get no indicator info, the AV must be restarted on a SLC disconnect.
	*/
	if ((app->profile_connected == hfp_headset_profile) && app->av_stream_stopped)
	{
		(void) MessageCancelAll(getAppTask(), APP_MUSIC_RESTART_IND);
        MessageSendLater(getAppTask(), APP_MUSIC_RESTART_IND, 0, (uint32) MUSIC_RESTART_DELAY);
	}

    /* Update the app state */
    app->hfp_state = headsetReady;
    
    /* Connection disconnected */
    app->profile_connected = hfp_no_profile;
    
    headsetTestForConnectablilty(app);
    
    /* Store the latest volume setting */
    (void) PsStore(VOLUME_LEVEL, &app->speaker_volume, sizeof(app->speaker_volume));
    
    /* Procedure for abnormal link-loss */
    if (ind->status == hfp_disconnect_link_loss)
    {
        /* If AV is streaming then Suspend it as the HFP reconnect will 
           cause interruptions in the audio.
        */
        if (app->a2dp_state == avHeadsetA2dpStreaming)
        {
            avHeadsetAvStreamStop(app, TRUE);
            (void) MessageCancelAll(getAppTask(), APP_MUSIC_RESTART_IND);
            MessageSendLater(getAppTask(), APP_MUSIC_RESTART_IND, 0, SLC_CONNECT_TIMEOUT + 2);
        }
		/* Send a reconnect attempt */
        app->button_action_pending_lock = 2;
        MessageSend(getAppTask(), APP_HFP_SLC_REQ, 0);
        /* Set the connect attempt timeout. */
        MessageSendLater(getAppTask(), APP_HFP_SLC_TIMEOUT_IND, 0, SLC_CONNECT_TIMEOUT);
    }

}


/****************************************************************************
NAME    
    headsetHandleRemoteSuppFeatures
    
DESCRIPTION
    Supported features of the remote device contained in the message if the 
    read succeeded. 

RETURNS
    void
*/
void headsetHandleRemoteSuppFeatures(headsetTaskData *app, const CL_DM_REMOTE_FEATURES_CFM_T *cfm)
{
    /* 
        If the read request succeeded then store the first work of the supported features 
        We should in theory store all four words but currently we only need the info in 
        the first word so for the sake of efficiency for the moment only store that.
    */
    if (cfm->status == hci_success)
	{
        app->supp_features_0 = cfm->features[0];

		/* 
			If we have a SCO open when we get this then we probably tried to 
			change the pkt type to HV1 so go and check the remote supported 
			features again to see if we can change to HV3. 
		*/
		if (app->sco_sink)
			ConnectionScoChangePktType(app->sco_sink, hfpGetBestScoPktType(app));
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲天堂a在线| 欧美国产日产图区| 日本电影亚洲天堂一区| 国产福利91精品| 国产91丝袜在线播放九色| 国产乱码精品一品二品| 国产呦精品一区二区三区网站| 另类小说综合欧美亚洲| 日韩电影免费一区| 国内精品国产三级国产a久久| 美日韩一区二区三区| 蜜臀av一区二区在线免费观看| 日韩电影在线观看网站| 极品少妇xxxx偷拍精品少妇| 国产在线国偷精品免费看| 国精产品一区一区三区mba视频 | 国产精品盗摄一区二区三区| 国产午夜亚洲精品午夜鲁丝片| 久久精品男人天堂av| 国产精品久久久久一区二区三区共| 国产精品久99| 亚洲欧美日韩系列| 日韩不卡一二三区| 久久99国产精品久久| 丁香啪啪综合成人亚洲小说 | 91在线免费视频观看| 欧洲精品中文字幕| 欧美群妇大交群的观看方式| 欧美一区日韩一区| 欧美韩国日本综合| 性做久久久久久| 国产成人在线观看免费网站| 一本大道久久a久久综合婷婷| 欧美猛男超大videosgay| 26uuu精品一区二区在线观看| 亚洲欧美一区二区视频| 日本成人中文字幕在线视频| 成人免费电影视频| 91精品国产日韩91久久久久久| 久久久亚洲欧洲日产国码αv| 亚洲综合色成人| 国产一区不卡精品| 欧美视频精品在线| 国产精品久久久一本精品 | 日韩成人一级大片| 99久久精品国产麻豆演员表| 91精品久久久久久蜜臀| 最近日韩中文字幕| 国产精品白丝jk黑袜喷水| 91福利社在线观看| 欧美激情一区三区| 国产一区二区三区不卡在线观看| 欧美日韩在线播| 亚洲欧洲日产国码二区| 国产麻豆精品视频| 欧美一激情一区二区三区| 亚洲精品高清在线| 不卡视频一二三| 国产欧美一二三区| 国产一区二区久久| 日韩三级视频在线看| 亚洲国产精品久久人人爱蜜臀| 国产.欧美.日韩| 久久久久久久久岛国免费| 日韩av中文字幕一区二区三区| 99久久久精品| 国产精品久久久久久久久晋中| 国产在线精品免费av| 日韩美女天天操| 美腿丝袜亚洲综合| 日韩美女视频在线| 精品一区二区在线看| 欧美一区二区私人影院日本| 亚洲成av人片一区二区三区| 色天天综合久久久久综合片| 亚洲免费在线观看视频| 色综合咪咪久久| 亚洲精品国久久99热| 91久久国产综合久久| 亚洲精品伦理在线| 在线精品视频小说1| 亚洲一区二区视频在线观看| 91成人免费电影| 亚洲二区视频在线| 欧美精三区欧美精三区| 日韩不卡免费视频| 亚洲精品一区二区在线观看| 韩国女主播一区二区三区| 久久网这里都是精品| 国产乱国产乱300精品| 国产精品久久久久影院老司| 91麻豆成人久久精品二区三区| 亚洲精品一二三四区| 欧美顶级少妇做爰| 国内精品视频一区二区三区八戒 | 成人手机在线视频| 欧美高清在线视频| 色综合色狠狠天天综合色| 无码av免费一区二区三区试看| 欧美一区二区三区四区视频 | 国产精品乱人伦| 91香蕉视频在线| 亚洲一区二区三区四区在线免费观看 | 在线电影欧美成精品| 日韩va欧美va亚洲va久久| 久久综合视频网| 91在线视频观看| 免费日韩伦理电影| 中文字幕免费不卡在线| 欧美三级日本三级少妇99| 精品一区二区在线免费观看| 亚洲色图制服诱惑| 国产精品久久久久四虎| 欧美日韩一区二区不卡| 国产一区二区在线电影| 亚洲伦在线观看| 精品国产不卡一区二区三区| 91一区二区在线观看| 久久国产精品99精品国产| 亚洲精品乱码久久久久| 久久日韩精品一区二区五区| 欧美亚洲高清一区| 国产成人久久精品77777最新版本| 一区二区三区久久久| 久久嫩草精品久久久久| 欧美精品乱码久久久久久按摩| 风流少妇一区二区| 秋霞电影网一区二区| 亚洲乱码中文字幕| 国产精品美女久久久久久久| 日韩美女主播在线视频一区二区三区| 色天天综合久久久久综合片| 成人一区在线观看| 国产在线观看免费一区| 免播放器亚洲一区| 亚洲bdsm女犯bdsm网站| 日韩理论电影院| 国产精品电影一区二区| 国产三级精品视频| 久久久午夜精品| 精品国产91久久久久久久妲己| 欧美精品高清视频| 欧美日韩午夜在线| 欧美三级日韩三级国产三级| 在线视频你懂得一区| 91在线精品一区二区| 99re这里都是精品| 97久久人人超碰| 99这里都是精品| www.欧美色图| 91在线国产福利| 91蜜桃网址入口| 91在线视频播放地址| 一本色道久久综合亚洲91| a级精品国产片在线观看| 成人高清免费观看| thepron国产精品| 91影院在线观看| 91丨porny丨最新| 91国偷自产一区二区三区成为亚洲经典 | 色综合天天在线| 色爱区综合激月婷婷| 在线观看中文字幕不卡| 欧美三级在线看| 日韩一区二区三区高清免费看看| 91精品在线观看入口| 日韩欧美不卡一区| 久久久久久久电影| 亚洲特黄一级片| 亚洲成av人片在线观看无码| 美国精品在线观看| 国产成人自拍高清视频在线免费播放| 粉嫩av亚洲一区二区图片| 成人99免费视频| 在线观看日韩一区| 日韩欧美在线观看一区二区三区| 日韩午夜在线影院| 国产精品人成在线观看免费 | 日本不卡视频一二三区| 精品在线观看免费| 91免费国产在线| 91精品国产91热久久久做人人| 精品嫩草影院久久| 亚洲视频一区二区在线| 午夜精品福利一区二区三区蜜桃| 麻豆国产精品777777在线| av毛片久久久久**hd| 欧美剧在线免费观看网站| 久久久久久久久免费| 亚洲精品国产一区二区三区四区在线 | av电影一区二区| 91精品国产欧美一区二区成人| 久久久精品国产免大香伊| 夜夜精品浪潮av一区二区三区| 蜜臀久久久久久久| 91久久线看在观草草青青| 久久免费国产精品| 偷拍自拍另类欧美| eeuss国产一区二区三区| 欧美大胆一级视频|