hfp: check HF features before enabling voice recognition

This commit is contained in:
Matthias Ringwald 2015-11-23 23:16:41 +01:00
parent c331da9e60
commit 3a3f6a068a
2 changed files with 7 additions and 3 deletions

View File

@ -66,8 +66,9 @@ extern "C" {
9: eSCO S4 (and T2) Settings Supported
10-31: Reserved for future definition
*/
#define HFP_HFSF_THREE_WAY_CALLING 1
#define HFP_HFSF_EC_NR_FUNCTION 0
#define HFP_HFSF_THREE_WAY_CALLING 1
#define HFP_HFSF_VOICE_RECOGNITION_FUNCTION 3
#define HFP_HFSF_CODEC_NEGOTIATION 7
#define HFP_HFSF_HF_INDICATORS 8
#define HFP_HFSF_ESCO 9

View File

@ -1675,9 +1675,12 @@ void hfp_ag_set_battery_level(int level){
*/
void hfp_ag_activate_voice_recognition(bd_addr_t bd_addr, int activate){
if (!get_bit(hfp_supported_features, HFP_AGSF_VOICE_RECOGNITION_FUNCTION)) return;
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
if (connection->ag_activate_voice_recognition == activate) return;
if (!get_bit(connection->remote_supported_features, HFP_HFSF_VOICE_RECOGNITION_FUNCTION)) {
printf("AG cannot acivate voice recognition - not supported by HF\n");
return;
}
if (activate){
hfp_ag_establish_audio_connection(bd_addr);