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

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

?? hfp_slc.c

?? bluelab 3.52 里面的立體聲程序源代碼
?? C
字號:
    /****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.5.2-release

FILE NAME
    hfp_slc.c

DESCRIPTION
    Handles the HFP Connection.

*/


/****************************************************************************
    Header files
*/
#include "headset_private.h"
#include "av_stream_control.h"
#include "hfp_audio.h"
#include "headset_common.h"
#include "headset_power.h"
#include "hfp_ring.h"
#include "hfp_slc.h"
#include "headset_tones.h"

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


static void playConnectTone(headsetTaskData* app)
{
    headsetPlayTone(app, tone_type_connect);
}

static void playErrorTone(headsetTaskData* app)
{
    headsetPlayTone(app, tone_type_error);
}

static void slcConnectFail(headsetTaskData *app, bool play_tone)
{
    /* Update the app state */
    setHfpState(app, headsetReady);

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

    /* Cancel the queued button presses */
    (void) MessageCancelAll(&app->task, BUTTON_MFB_SHORT);    
    (void) MessageCancelAll(&app->task, BUTTON_MFB_LONG_RELEASE);

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

        /* Play an error tone to indicate the connect attempt failed. */
        if (play_tone)
            playErrorTone(app);

        /* Restart music if streaming */
        if (app->av_stream_stopped)
            MessageSend(getAppTask(), APP_MUSIC_RESTART_IND, 0);
    }
}


/****************************************************************************
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 */   
    if (app->profile_connected == hfp_no_profile)
    {
        HfpSlcConnectResponse(ind->hfp, 1, &ind->addr, 0);
        
        /* Update the app state */
        setHfpState(app, 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)
{
    /* 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)
            setHfpState(app, headsetConnected);
        
        /* Play connect tone */
        playConnectTone(app);
		
		/*End pairing mode*/
        MessageSend(getAppTask(), APP_PAIR_MODE_END_IND, 0);
        
		(void) MessageCancelAll(getAppTask(), APP_HFP_SLC_TIMEOUT_IND);
		app->headset_connecting_hfp = 0;

		/* 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);    
        
        /* Inform AG of the current gain settings */
        if (app->profile_connected == hfp_handsfree_profile)
        {
            HfpSendSpeakerVolume(app->hfp, (uint16)app->speaker_volume.hfp_volume);
            HfpSendMicrophoneVolume(app->hfp , app->mic_volume);
        }
    }
    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, 1);
        }
        else
            /* Unknown profile instance */
            Panic();
    }
    else if (cfm->status == hfp_connect_failed)
    {
        /* Something failed during SLC establishment, check we're not trying to disconnect */
        if (app->headset_power_state == power_state_powering_down)
        {
            slcConnectFail(app, 0);
            headsetCheckPowerDownStatus(app);
        }
        else
            slcConnectFail(app, 1);
    }
    else
    {
        /* Update local state to reflect this */
        slcConnectFail(app, 1);
    }
}


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

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

    /* Retrieve the address of the last used AG from PS */
    if (!PsRetrieve(LAST_USED_AG, &addr, sizeof(bdaddr)))
    {
		if (!PsRetrieve(LAST_PAIRED_DEVICE, &addr, sizeof(bdaddr)))
		{
			slcConnectFail(app, 1);
			return;
		}
        /* Play an error tone to indicate we don't have a valid address */
        playErrorTone(app);
    }
    
    /* Update the app state */
    setHfpState(app, 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)
    {
        headsetRestartAV(app);
    }

    /* Update the app state */
    setHfpState(app, headsetReady);
    
    /* Connection disconnected */
    app->profile_connected = hfp_no_profile;
    app->voice.voice_recognition_enabled = 0;
    app->voice.old_voice_recognition_enabled = 0;
    
    /* Cancel a voice request that could be in progress after connection */
    (void) MessageCancelAll(getAppTask(), BUTTON_MFB_SHORT);

    /* 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.
        */
        (void) MessageCancelAll(getAppTask(), APP_MUSIC_RESTART_IND);
        MessageSendLater(getAppTask(), APP_MUSIC_RESTART_IND, 0, SLC_CONNECT_TIMEOUT + 1000);
        if (app->a2dp_state == avHeadsetA2dpStreaming)
        {
            avHeadsetAvStreamStop(app, TRUE);    
        }

		/* Send a reconnect attempt */
        app->headset_connecting_hfp = 2;
        MessageSend(getAppTask(), APP_HFP_SLC_REQ, 0);
        
        /* Set the connect attempt timeout. */
        MessageSendLater(getAppTask(), APP_HFP_SLC_TIMEOUT_IND, 0, (uint32) SLC_CONNECT_TIMEOUT);
    }
    
    /* If we're ready to power down don't wait any longer */
    headsetCheckPowerDownStatus(app);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
综合欧美一区二区三区| 91尤物视频在线观看| 日韩欧美成人一区二区| 视频一区二区三区中文字幕| 欧美日韩中字一区| 亚洲风情在线资源站| 91精品免费观看| 国产曰批免费观看久久久| 久久影视一区二区| www.欧美精品一二区| 亚洲综合999| 日韩精品一区二区三区中文精品| 紧缚捆绑精品一区二区| 欧美激情在线观看视频免费| 色又黄又爽网站www久久| 五月激情综合色| 久久亚洲精精品中文字幕早川悠里| 国产成a人亚洲| 亚洲精品高清视频在线观看| 制服丝袜一区二区三区| 国产suv一区二区三区88区| 中文字幕日本乱码精品影院| 欧美日韩国产bt| 国产精品一级片| 亚洲综合一区在线| 欧美变态tickle挠乳网站| av色综合久久天堂av综合| 天天操天天综合网| 国产欧美日本一区视频| 欧美羞羞免费网站| 国产麻豆视频一区二区| 一区二区三区欧美日| 久久婷婷国产综合精品青草| 91丨九色丨黑人外教| 日韩av不卡一区二区| 国产精品激情偷乱一区二区∴| 欧美精品三级日韩久久| 成人动漫一区二区三区| 蜜芽一区二区三区| 亚洲天堂免费看| 欧美成人精品1314www| 一本一本大道香蕉久在线精品 | 国产日韩精品一区二区三区在线| 色婷婷精品大在线视频| 国产一区二区三区观看| 爽爽淫人综合网网站| 亚洲欧美一区二区不卡| 2021久久国产精品不只是精品| 91官网在线观看| 成人av免费观看| 国产在线观看免费一区| 婷婷亚洲久悠悠色悠在线播放| 国产精品欧美一区二区三区| 精品乱码亚洲一区二区不卡| 欧美日本视频在线| 一本色道久久综合亚洲91| 国产精品一区在线观看乱码| 日韩有码一区二区三区| 依依成人精品视频| 亚洲伦理在线免费看| 国产精品久久夜| 国产欧美精品一区| 2023国产精华国产精品| 日韩女优毛片在线| 欧美一区二区三区精品| 欧美精品在欧美一区二区少妇 | 91蜜桃免费观看视频| 国产原创一区二区| 精品一区二区三区av| 理论片日本一区| 免费不卡在线观看| 老汉av免费一区二区三区 | 精品一区二区三区不卡 | 欧美性极品少妇| 日本乱码高清不卡字幕| 91影视在线播放| 色狠狠色狠狠综合| 欧美日韩精品一区二区在线播放| 91黄视频在线| 欧美日韩午夜在线| 在线播放日韩导航| 日韩欧美国产一区二区三区| 欧美成人女星排名| 国产亚洲一区二区三区四区| 国产日韩欧美精品在线| 中文一区一区三区高中清不卡| 国产日韩欧美精品一区| 国产精品国产三级国产aⅴ中文| 国产精品素人一区二区| 亚洲欧美偷拍卡通变态| 亚洲电影中文字幕在线观看| 午夜av电影一区| 九一九一国产精品| 国产乱码精品一区二区三区av | 美女一区二区视频| 黄页网站大全一区二区| 国产尤物一区二区| 极品少妇一区二区三区精品视频| 国产精品综合久久| www.亚洲色图| 欧美中文字幕亚洲一区二区va在线| 欧美日韩国产一区| 日韩欧美久久久| 国产精品久久免费看| 亚洲在线成人精品| 精东粉嫩av免费一区二区三区| 国产成人无遮挡在线视频| 99在线精品免费| 91麻豆精品国产91久久久资源速度| 日韩一区二区免费高清| 国产欧美日产一区| 亚洲国产色一区| 国产一区二区三区精品视频| 99精品欧美一区| 欧美一区二区三区爱爱| 国产欧美精品一区| 亚洲成人av福利| 国产精品中文字幕日韩精品| 91麻豆免费看| 91精品国产91久久综合桃花 | 91精品国产91久久综合桃花 | 欧美影院午夜播放| 久久久久国产精品人| 亚洲一区二区在线观看视频| 激情av综合网| 欧美日韩国产一区| 国产精品麻豆视频| 日本在线观看不卡视频| 97久久精品人人做人人爽 | 成人午夜视频福利| 欧美乱妇23p| 亚洲视频免费观看| 国产一区二区在线免费观看| 欧美探花视频资源| 亚洲欧洲韩国日本视频| 久久国产夜色精品鲁鲁99| 在线观看视频91| 国产视频不卡一区| 另类小说欧美激情| 欧美日韩成人综合| 亚洲欧美综合色| 国产精品99久久久久久久女警| 欧美日韩日日夜夜| 一色桃子久久精品亚洲| 国产麻豆午夜三级精品| 91精品国产91久久久久久一区二区| 亚洲欧美偷拍三级| 成av人片一区二区| www久久精品| 美女在线一区二区| 欧美精品第1页| 亚洲电影激情视频网站| 色综合色综合色综合色综合色综合| 久久婷婷国产综合精品青草| 麻豆91免费观看| 91精品国产综合久久香蕉的特点| 亚洲人午夜精品天堂一二香蕉| 国产成人免费视频| 久久精品亚洲精品国产欧美 | 日韩综合一区二区| 色婷婷久久久久swag精品| 亚洲三级免费观看| 成人高清免费观看| 亚洲欧洲av在线| 色综合天天综合给合国产| 亚洲视频在线一区二区| 91蝌蚪国产九色| 亚洲欧美一区二区三区孕妇| 91日韩在线专区| 亚洲精品免费视频| 欧美视频在线播放| 日韩专区中文字幕一区二区| 欧美精品成人一区二区三区四区| 日韩高清不卡一区二区三区| 欧美一区二区三区四区五区 | 成人午夜激情影院| 国产欧美在线观看一区| 国产成人高清视频| 中文字幕亚洲欧美在线不卡| 97aⅴ精品视频一二三区| 一区二区三区在线观看网站| 欧美在线免费视屏| 国产精品蜜臀在线观看| 99精品视频在线免费观看| 亚洲激情综合网| 这里只有精品电影| 国产一区二区三区在线观看免费| 日本一区二区三区国色天香 | 日本高清视频一区二区| 亚洲国产wwwccc36天堂| 制服丝袜中文字幕亚洲| 国精产品一区一区三区mba视频 | 久久综合色鬼综合色| 国产黄色成人av| 一区二区三区在线观看欧美| 欧美一级一级性生活免费录像| 国产麻豆视频精品| 亚洲男帅同性gay1069| 欧美群妇大交群的观看方式| 国产麻豆成人传媒免费观看|