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

📄 hfp_headset_voice.c

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

FILE NAME
    hfp_headset_voice.c

DESCRIPTION
    

NOTES

*/


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

#include <hfp.h>


/****************************************************************************
NAME    
    hfpHeadsetHandleVoiceRecognitionInd
    
DESCRIPTION
    Handle indication of the change in the state of the AG's voice recognition.

RETURNS
    void
*/
void hfpHeadsetHandleVoiceRecognitionInd(headsetTaskData *app, const HFP_VOICE_RECOGNITION_IND_T *ind)
{
    /* TODO: B-4373 should this flag be on a per AG basis - but we can't have voice reco enabled at two AGs at the same time! */

    /* Update the local flag */
    app->voice_recognition_enabled = ind->enable;
}


/****************************************************************************
NAME    
    hfpHeadsetVoiceRecognitionEnable
    
DESCRIPTION
    Enable/ disable voice recognition at the AG.

RETURNS
    void
*/
void hfpHeadsetVoiceRecognitionEnable(headsetTaskData *app, uint16 enable)
{
    /* 
        Check the current status of the voice recognition and change it 
        Here, we're working under the assumption that the cmd succeeds so 
        we update the flag before we've received the cfm.
    */
    if (app->voice_recognition_enabled != enable)
    {
        /* Update the local flag */
        app->voice_recognition_enabled = enable;

        /* Send the cmd to the AG */
        HfpVoiceRecognitionEnable(app->hfp, enable);
    }   
    /* else the voice recognition is already in that state */
}


/****************************************************************************
NAME    
    hfpHeadsetHandleVoiceRecognitionCfm
    
DESCRIPTION
    Received a cfm in response to a request from the headset that the AG 
    enable /disable its voice recognition engine.

RETURNS
    void
*/
void hfpHeadsetHandleVoiceRecognitionCfm(headsetTaskData *app, const HFP_VOICE_RECOGNITION_ENABLE_CFM_T *cfm)
{
    /* If the cmd succeeds we've got the flag set to the right state anyway */
    if (cfm->status == hfp_fail)
    {
        /* Voice recognition cmd not accepted - change the state to what it was */
        if (app->voice_recognition_enabled)
            app->voice_recognition_enabled = 0;
        else
            app->voice_recognition_enabled = 1;     
    }
}

⌨️ 快捷键说明

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