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

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

?? hfp_slc.c

?? BLUETOOTH Stereo Headset Source Code,含CVC(噪音消除,回聲抵消),可用于開發藍牙立體聲耳機,藍牙車載,經過測試.
?? C
字號:
    /****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.6.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 "a2dp_handler.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);
	
	/* Cancel voice dial messages that may be queued */
	(void) MessageCancelAll(&app->task, APP_VOICE_DIAL);
	app->voice_recognition_enabled = FALSE;

    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)
        {
            (void) MessageCancelAll(getAppTask(), APP_MUSIC_RESTART_IND);
            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)
{
/*	Now we have tried to reconnect HFP, try AV*/
	if (app->connect_av == 1) 
	{	
       	avHeadsetHandleAvConnectRequest(app);
		app->connect_av =0;
	}
    /* Check the status of the SLC attempt */
    if (cfm->status == hfp_connect_success)
    {
		bdaddr ag_addr;
        
        app->slc_sink = cfm->sink;

        /* 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)
    {
		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)
{
    
    app->slc_sink = 0;
    
	/*	
        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_recognition_enabled = FALSE;
     
    /* 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);
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品一区二区三区在线| 亚洲一区二区三区在线看| 国产又黄又大久久| 国产午夜亚洲精品羞羞网站| 色狠狠综合天天综合综合| 五月天激情综合| 欧美激情在线观看视频免费| 色悠久久久久综合欧美99| 成人免费毛片a| 欧美α欧美αv大片| 不卡一区中文字幕| 美女脱光内衣内裤视频久久影院| 中文字幕日本乱码精品影院| 日韩欧美中文一区| 欧美影院午夜播放| av资源网一区| 成人黄色小视频| 日本亚洲免费观看| 一区二区三区在线不卡| 国产精品私人影院| 国产欧美日韩综合精品一区二区| 欧美一区二区三区视频免费播放| 在线亚洲一区观看| 一本久久综合亚洲鲁鲁五月天 | 日韩免费高清视频| 91精品在线免费| 在线综合亚洲欧美在线视频| 欧美肥妇毛茸茸| 欧美一区二区视频在线观看| 日韩亚洲欧美在线| 日韩视频免费观看高清完整版在线观看| 欧美日韩亚洲综合一区二区三区 | 国产麻豆午夜三级精品| 国产精品自在在线| 国产不卡免费视频| 99久久久久久| 在线成人小视频| 久久免费美女视频| 亚洲免费在线视频一区 二区| 亚洲人成精品久久久久久| 午夜视频久久久久久| 蜜桃一区二区三区在线观看| 国产盗摄精品一区二区三区在线| 粉嫩绯色av一区二区在线观看| 91福利在线播放| 久久久久久**毛片大全| 国产精品国产三级国产普通话三级| 国产精品日日摸夜夜摸av| 夜夜嗨av一区二区三区四季av| 三级亚洲高清视频| 99免费精品视频| 欧美成人精品3d动漫h| 亚洲男人的天堂网| 国产一区在线视频| 欧美日韩免费一区二区三区视频| 精品国产伦理网| 三级久久三级久久久| 色综合久久综合| 国产精品理伦片| 国产91丝袜在线观看| 日韩欧美国产wwwww| 亚洲在线中文字幕| 欧美亚洲综合网| 午夜精品久久久久| 欧美日韩精品欧美日韩精品一| 亚洲最快最全在线视频| 色综合一个色综合亚洲| 一区二区三区不卡在线观看| 91色婷婷久久久久合中文| 国产精品私人自拍| 在线看不卡av| 亚洲一区二区三区小说| 欧美在线观看18| 毛片一区二区三区| 久久久亚洲高清| 99国内精品久久| 日本在线不卡视频一二三区| 欧美一级黄色大片| 国产不卡在线播放| 亚洲一区二三区| 欧美大片在线观看一区| 国产精品 日产精品 欧美精品| 中文字幕免费不卡在线| 欧美三级视频在线| 久久 天天综合| 一区二区三区美女视频| 精品福利av导航| 在线观看日产精品| 国产永久精品大片wwwapp| 亚洲欧洲综合另类| 精品成人私密视频| 欧美色网一区二区| 91美女在线观看| 日韩电影免费一区| 亚洲午夜日本在线观看| 国产蜜臀av在线一区二区三区| 欧美视频日韩视频在线观看| thepron国产精品| 九一久久久久久| 麻豆精品精品国产自在97香蕉| 亚洲人成在线观看一区二区| 久久久精品一品道一区| 欧美精选在线播放| 色婷婷亚洲婷婷| 色综合咪咪久久| 成人国产精品免费观看| 国内精品免费在线观看| 日本三级亚洲精品| 蜜臀91精品一区二区三区| 婷婷久久综合九色国产成人| 亚洲午夜免费电影| 亚洲成人免费电影| 亚洲福利视频三区| 亚洲国产精品尤物yw在线观看| 亚洲小说春色综合另类电影| 一区二区三区高清| 天天做天天摸天天爽国产一区| 亚洲第一av色| 美女久久久精品| 国产福利一区二区| 91网站最新地址| 欧美一区二区在线视频| 26uuu亚洲综合色欧美| 国产精品久久久久三级| 一区二区三区高清不卡| 男男gaygay亚洲| 强制捆绑调教一区二区| 99久久国产综合精品麻豆| 五月天欧美精品| 国产久卡久卡久卡久卡视频精品| 国产麻豆日韩欧美久久| 一本一本久久a久久精品综合麻豆| 豆国产96在线|亚洲| 91久久人澡人人添人人爽欧美| 91精品国产色综合久久不卡电影 | 精品一区二区在线免费观看| 99久久综合精品| 欧美一级生活片| 亚洲一区成人在线| 大尺度一区二区| 日韩视频免费观看高清完整版 | 韩国av一区二区三区在线观看| 不卡的av网站| 26uuu色噜噜精品一区| 一区二区三区四区乱视频| 国产电影精品久久禁18| 3d动漫精品啪啪1区2区免费 | 亚洲免费观看视频| 激情深爱一区二区| 日韩三级高清在线| 午夜精品久久一牛影视| 欧美午夜不卡视频| 午夜精品久久久久久久蜜桃app| 国产成人免费视频网站高清观看视频| 91精品国产综合久久精品| 天使萌一区二区三区免费观看| 白白色亚洲国产精品| 国产精品美女久久久久久2018| 国产一区二区三区| 国产精品国产精品国产专区不蜜| 激情久久五月天| 精品国产a毛片| 不卡电影一区二区三区| 亚洲精品欧美激情| 欧美视频一区二区三区在线观看| 欧美bbbbb| 欧美激情在线看| 色视频欧美一区二区三区| 亚洲一区二区四区蜜桃| 日韩亚洲欧美在线| 成人h动漫精品一区二| 亚洲天天做日日做天天谢日日欢| 在线视频你懂得一区二区三区| 一区二区三区不卡视频在线观看| 欧美日韩国产首页| 国产成人在线看| 天堂成人国产精品一区| 久久蜜桃一区二区| 欧美三电影在线| 国产成人精品影视| 奇米色777欧美一区二区| 国产精品久久久一区麻豆最新章节| 欧美视频你懂的| 成人综合在线观看| 免费高清不卡av| 亚洲自拍偷拍图区| 国产精品传媒视频| 国产欧美日韩一区二区三区在线观看 | 色综合色狠狠天天综合色| 国内成人精品2018免费看| 欧美a级一区二区| 免费看黄色91| 日本aⅴ亚洲精品中文乱码| 亚洲精品欧美综合四区| 亚洲免费在线视频一区 二区| 久久影院午夜论| 中文子幕无线码一区tr| 成人欧美一区二区三区黑人麻豆| 欧美一级xxx| 久久久久9999亚洲精品|