mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
hfp: add voice recognition on/off commands. start audio connection if needed
This commit is contained in:
parent
6602462385
commit
c331da9e60
@ -399,7 +399,7 @@ static int hfp_ag_cmd_suggest_codec(uint16_t cid, uint8_t codec){
|
||||
|
||||
static int hfp_ag_activate_voice_recognition_cmd(uint16_t cid, uint8_t activate_voice_recognition){
|
||||
char buffer[30];
|
||||
sprintf(buffer, "\r\n%s:%d\r\n", HFP_ACTIVATE_VOICE_RECOGNITION, activate_voice_recognition);
|
||||
sprintf(buffer, "\r\n%s: %d\r\n", HFP_ACTIVATE_VOICE_RECOGNITION, activate_voice_recognition);
|
||||
return send_str_over_rfcomm(cid, buffer);
|
||||
}
|
||||
|
||||
@ -1679,6 +1679,10 @@ void hfp_ag_activate_voice_recognition(bd_addr_t bd_addr, int activate){
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
if (connection->ag_activate_voice_recognition == activate) return;
|
||||
|
||||
if (activate){
|
||||
hfp_ag_establish_audio_connection(bd_addr);
|
||||
}
|
||||
|
||||
connection->ag_activate_voice_recognition = activate;
|
||||
connection->command = HFP_CMD_AG_ACTIVATE_VOICE_RECOGNITION;
|
||||
hfp_run_for_context(connection);
|
||||
|
@ -152,6 +152,9 @@ static void show_usage(void){
|
||||
printf("m - simulate incoming call from 7654321\n");
|
||||
// printf("M - simulate call from 7654321 dropped\n");
|
||||
|
||||
printf("n - Disable Voice Regocnition\n");
|
||||
printf("N - Enable Voice Recognition\n");
|
||||
|
||||
printf("t - terminate connection\n");
|
||||
|
||||
printf("---\n");
|
||||
@ -270,6 +273,14 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Last dialed number set\n");
|
||||
last_number_exists = 1;
|
||||
break;
|
||||
case 'n':
|
||||
printf("Disable Voice Recognition\n");
|
||||
hfp_ag_activate_voice_recognition(device_addr, 0);
|
||||
break;
|
||||
case 'N':
|
||||
printf("Enable Voice Recognition\n");
|
||||
hfp_ag_activate_voice_recognition(device_addr, 1);
|
||||
break;
|
||||
case 'R':
|
||||
printf("Enable in-band ring tone\n");
|
||||
hfp_ag_set_use_in_band_ring_tone(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user