hfp_headset_voice.c
来自「CSR蓝牙芯片 无线蓝牙耳机的语音网关程序 蓝牙耳机程序已经上传」· C语言 代码 · 共 95 行
C
95 行
/****************************************************************************
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 + =
减小字号Ctrl + -
显示快捷键?