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

📄 hfp_headset_init.c

📁 CSR蓝牙芯片 无线蓝牙耳机的语音网关程序 蓝牙耳机程序已经上传
💻 C
字号:
/****************************************************************************
Copyright (C) Cambridge Silicon Radio Ltd. 2004

FILE NAME
    hfp_headset_init.c

DESCRIPTION
    

NOTES

*/


/****************************************************************************
    Header files
*/
#include "headset_private.h"
#include "hfp_headset_init.h"

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


/****************************************************************************
NAME    
    hfpHeadsetHfpInit
    
DESCRIPTION
    Initialise an instance of the hands free profile.

RETURNS
    void
*/
void hfpHeadsetHfpInit(void)
{
    hfp_init_params init;
    
    uint16 supp_features = (HFP_VOICE_RECOGNITION | 
                            HFP_REMOTE_VOL_CONTROL);

    /* Initialise an HFP profile instance */
    init.supported_profile = hfp_handsfree_profile;
    init.supported_features = supp_features;
    init.size_service_record = 0;
    init.service_record = 0;
    init.priority = 255;

    HfpInit(getAppTask(), &init);

    /* Initialise an HSP profile instance */
    init.supported_profile = hfp_headset_profile;
    init.supported_features = 0;
    init.size_service_record = 0;
    init.service_record = 0;
    init.priority = 255;
    
    HfpInit(getAppTask(), &init);
}


/****************************************************************************
NAME    
    hfpHeadsetInitComplete
    
DESCRIPTION
    Headset initialisation has completed. 

RETURNS
    void
*/
void hfpHeadsetInitComplete(headsetTaskData *app, const HFP_INIT_CFM_T *cfm)
{
    /* Make sure the profile instance initialisation succeeded. */
    if (cfm->status == hfp_init_success)
    {
        /* Check for an hfp instance, that's registered first */
        if (!app->hfp)
        {
            /* This must be the hfp instance */ 
            app->hfp = cfm->hfp;
        }
        else
        {
            /* Its not HFP so must be HSP */
            app->hsp = cfm->hfp;

            /* Set the class of device to indicate this is a headset */
            ConnectionWriteClassOfDevice(AUDIO_MAJOR_SERV_CLASS | AV_COD_RENDER | AV_MAJOR_DEVICE_CLASS | AV_MINOR_HEADSET);
    
            /* Disable SDP security  */
            ConnectionSmSetSdpSecurityIn(TRUE);

            /* Send an internal message to indicate init has completed */
            MessageSend(getAppTask(), APP_HEADSET_INIT_CFM, 0);
        }
    }
    else
        /* If the profile initialisation has failed then things are bad so panic. */
        Panic();
}

⌨️ 快捷键说明

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