⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hfp_ring.c

📁 针对bluelab3.42的handsfree车载蓝牙的参考
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006
Part of BlueLab 3.4.2-release

FILE NAME
    hfp_ring.c

DESCRIPTION
    Deals with incoming rings sent from the AG.

*/


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

#include <hfp.h>


#ifdef DEBUG_RING
#define RING_DEBUG(x) DEBUG(x)
#else
#define RING_DEBUG(x) 
#endif


/*****************************************************************************/
void hfpHeadsetHandleRingInd(headsetTaskData *app, const HFP_RING_IND_T *ind)
{
    ind = ind;
    
    /* If in HSP mode use rings as indication of incoming call */
    if (app->profile_connected == hfp_headset_profile)
    {
        if (app->hfp_state == headsetConnected)
        {
            setHfpState(app, headsetIncomingCallEstablish);
            app->active_profile = hfp_active;
        }
        MessageCancelAll(getAppTask(), APP_RING_TIMEOUT_IND);
        MessageSendLater(getAppTask(), APP_RING_TIMEOUT_IND, 0, 5000);
    }

    /* Check to see if we should be playing a ring tone and if so play it */
    if (!app->in_band_ring_enabled)
    {
        RING_DEBUG(("RING: In band not enabled\n"));
        headsetPlayTone(app, tone_type_ring);
    }
    else
    {
        /* in band ring enabled at the AG - don't play local ring */
        if (app->a2dp_state == avHeadsetA2dpStreaming)
        {
            /* If the AV audio has not already been stopped then stop it now */
            avHeadsetAvStreamStop(app, TRUE);
        }
    }
}


/*****************************************************************************/
void hfpHeadsetHandleInBandRingInd(headsetTaskData *app, const HFP_IN_BAND_RING_IND_T *ind)
{
    /* Update the local flag */
    app->in_band_ring_enabled = ind->ring_enabled;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -