hfp: rename VRA events to match the API functions

This commit is contained in:
Milanka Ringwald 2021-08-18 00:24:17 +02:00
parent e83f1be7ee
commit a9e632e913
5 changed files with 38 additions and 35 deletions

View File

@ -109,7 +109,7 @@ static hfp_generic_status_indicator_t hf_indicators[] = {
}; };
static hfp_voice_recognition_message_t msg = { static hfp_voice_recognition_message_t msg = {
0xABCD, HFP_TEXT_TYPE_MESSAGE_FROM_AG, HFP_TEXT_OPERATION_REPLACE, "test message" 0xABCD, HFP_TEXT_TYPE_MESSAGE_FROM_AG, HFP_TEXT_OPERATION_REPLACE, "The temperature in Munich"
}; };
#define INQUIRY_INTERVAL 5 #define INQUIRY_INTERVAL 5
@ -595,30 +595,30 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
hfp_ag_send_dtmf_code_done(acl_handle); hfp_ag_send_dtmf_code_done(acl_handle);
break; break;
case HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED: case HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED:
status = hfp_subevent_voice_recognition_enabled_get_status(event); status = hfp_subevent_voice_recognition_activated_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("Voice Recognition Enable command failed\n"); printf("Voice Recognition Activate command failed\n");
break; break;
} }
switch (hfp_subevent_voice_recognition_enabled_get_enhanced(event)){ switch (hfp_subevent_voice_recognition_activated_get_enhanced(event)){
case 1: case 1:
printf("\nVoice recognition status ENABLED\n\n"); printf("\nVoice recognition ACTVATED\n\n");
break; break;
default: default:
printf("\nEnhanced voice recognition status ENABLED\n\n"); printf("\nEnhanced voice recognition ACTVATED\n\n");
break; break;
} }
break; break;
case HFP_SUBEVENT_VOICE_RECOGNITION_DISABLED: case HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED:
status = hfp_subevent_voice_recognition_disabled_get_status(event); status = hfp_subevent_voice_recognition_deactivated_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("Voice Recognition Disable command failed\n"); printf("Voice Recognition Deactivate command failed\n");
break; break;
} }
printf("Voice Recognition DISABLED\n"); printf("Voice Recognition DEACTIVATED\n");
break; break;
case HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_HF_READY_FOR_AUDIO: case HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_HF_READY_FOR_AUDIO:
@ -717,6 +717,7 @@ int btstack_main(int argc, const char * argv[]){
(1<<HFP_AGSF_IN_BAND_RING_TONE) | (1<<HFP_AGSF_IN_BAND_RING_TONE) |
(1<<HFP_AGSF_VOICE_RECOGNITION_FUNCTION) | (1<<HFP_AGSF_VOICE_RECOGNITION_FUNCTION) |
(1<<HFP_AGSF_ENHANCED_VOICE_RECOGNITION_STATUS) | (1<<HFP_AGSF_ENHANCED_VOICE_RECOGNITION_STATUS) |
(1<<HFP_AGSF_VOICE_RECOGNITION_TEXT) |
(1<<HFP_AGSF_EC_NR_FUNCTION) | (1<<HFP_AGSF_EC_NR_FUNCTION) |
(1<<HFP_AGSF_THREE_WAY_CALLING); (1<<HFP_AGSF_THREE_WAY_CALLING);
int wide_band_speech = 1; int wide_band_speech = 1;

View File

@ -592,30 +592,30 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
printf(" - number : %s \n", hfp_subevent_enhanced_call_status_get_bnip_number(event)); printf(" - number : %s \n", hfp_subevent_enhanced_call_status_get_bnip_number(event));
break; break;
case HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED: case HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED:
status = hfp_subevent_voice_recognition_enabled_get_status(event); status = hfp_subevent_voice_recognition_activated_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("Voice Recognition command failed\n"); printf("Voice Recognition Activate command failed\n");
break; break;
} }
switch (hfp_subevent_voice_recognition_enabled_get_enhanced(event)){ switch (hfp_subevent_voice_recognition_activated_get_enhanced(event)){
case 1: case 1:
printf("\nVoice recognition status ENABLED\n\n"); printf("\nVoice recognition ACTIVATED\n\n");
break; break;
default: default:
printf("\nEnhanced voice recognition status ENABLED\n\n"); printf("\nEnhanced voice recognition ACTIVATED\n\n");
break; break;
} }
break; break;
case HFP_SUBEVENT_VOICE_RECOGNITION_DISABLED: case HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED:
status = hfp_subevent_voice_recognition_disabled_get_status(event); status = hfp_subevent_voice_recognition_deactivated_get_status(event);
if (status != ERROR_CODE_SUCCESS){ if (status != ERROR_CODE_SUCCESS){
printf("Voice Recognition Disable command failed\n"); printf("Voice Recognition Deactivate command failed\n");
break; break;
} }
printf("Voice Recognition DISABLED\n"); printf("Voice Recognition DEACTIVATED\n");
break; break;
case HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_HF_READY_FOR_AUDIO: case HFP_SUBEVENT_ENHANCED_VOICE_RECOGNITION_HF_READY_FOR_AUDIO:
@ -689,6 +689,7 @@ int btstack_main(int argc, const char * argv[]){
(1<<HFP_HFSF_ENHANCED_CALL_STATUS) | (1<<HFP_HFSF_ENHANCED_CALL_STATUS) |
(1<<HFP_HFSF_VOICE_RECOGNITION_FUNCTION) | (1<<HFP_HFSF_VOICE_RECOGNITION_FUNCTION) |
(1<<HFP_HFSF_ENHANCED_VOICE_RECOGNITION_STATUS) | (1<<HFP_HFSF_ENHANCED_VOICE_RECOGNITION_STATUS) |
(1<<HFP_HFSF_VOICE_RECOGNITION_TEXT) |
(1<<HFP_HFSF_EC_NR_FUNCTION) | (1<<HFP_HFSF_EC_NR_FUNCTION) |
(1<<HFP_HFSF_REMOTE_VOLUME_CONTROL); (1<<HFP_HFSF_REMOTE_VOLUME_CONTROL);
int wide_band_speech = 1; int wide_band_speech = 1;

View File

@ -1786,7 +1786,7 @@ typedef uint8_t sm_key_t[16];
* @param status // 0-success * @param status // 0-success
* @param enhanced // 0-legacy, 1-enhanced * @param enhanced // 0-legacy, 1-enhanced
*/ */
#define HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED 0x1E #define HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED 0x1E
/** /**
* @format 1H1 * @format 1H1
@ -1794,7 +1794,7 @@ typedef uint8_t sm_key_t[16];
* @param acl_handle * @param acl_handle
* @param status // 0-success * @param status // 0-success
*/ */
#define HFP_SUBEVENT_VOICE_RECOGNITION_DISABLED 0x1F #define HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED 0x1F
/** /**
* @format 1H1 * @format 1H1

View File

@ -4718,49 +4718,49 @@ static inline uint8_t hfp_subevent_in_band_ring_tone_get_status(const uint8_t *
} }
/** /**
* @brief Get field acl_handle from event HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED * @brief Get field acl_handle from event HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED
* @param event packet * @param event packet
* @return acl_handle * @return acl_handle
* @note: btstack_type H * @note: btstack_type H
*/ */
static inline hci_con_handle_t hfp_subevent_voice_recognition_enabled_get_acl_handle(const uint8_t * event){ static inline hci_con_handle_t hfp_subevent_voice_recognition_activated_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3); return little_endian_read_16(event, 3);
} }
/** /**
* @brief Get field status from event HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED * @brief Get field status from event HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED
* @param event packet * @param event packet
* @return status * @return status
* @note: btstack_type 1 * @note: btstack_type 1
*/ */
static inline uint8_t hfp_subevent_voice_recognition_enabled_get_status(const uint8_t * event){ static inline uint8_t hfp_subevent_voice_recognition_activated_get_status(const uint8_t * event){
return event[5]; return event[5];
} }
/** /**
* @brief Get field enhanced from event HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED * @brief Get field enhanced from event HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED
* @param event packet * @param event packet
* @return enhanced * @return enhanced
* @note: btstack_type 1 * @note: btstack_type 1
*/ */
static inline uint8_t hfp_subevent_voice_recognition_enabled_get_enhanced(const uint8_t * event){ static inline uint8_t hfp_subevent_voice_recognition_activated_get_enhanced(const uint8_t * event){
return event[6]; return event[6];
} }
/** /**
* @brief Get field acl_handle from event HFP_SUBEVENT_VOICE_RECOGNITION_DISABLED * @brief Get field acl_handle from event HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED
* @param event packet * @param event packet
* @return acl_handle * @return acl_handle
* @note: btstack_type H * @note: btstack_type H
*/ */
static inline hci_con_handle_t hfp_subevent_voice_recognition_disabled_get_acl_handle(const uint8_t * event){ static inline hci_con_handle_t hfp_subevent_voice_recognition_deactivated_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3); return little_endian_read_16(event, 3);
} }
/** /**
* @brief Get field status from event HFP_SUBEVENT_VOICE_RECOGNITION_DISABLED * @brief Get field status from event HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED
* @param event packet * @param event packet
* @return status * @return status
* @note: btstack_type 1 * @note: btstack_type 1
*/ */
static inline uint8_t hfp_subevent_voice_recognition_disabled_get_status(const uint8_t * event){ static inline uint8_t hfp_subevent_voice_recognition_deactivated_get_status(const uint8_t * event){
return event[5]; return event[5];
} }

View File

@ -359,7 +359,7 @@ void hfp_emit_voice_recognition_enabled(hfp_connection_t * hfp_connection, uint8
uint8_t event[7]; uint8_t event[7];
event[0] = HCI_EVENT_HFP_META; event[0] = HCI_EVENT_HFP_META;
event[1] = sizeof(event) - 2; event[1] = sizeof(event) - 2;
event[2] = HFP_SUBEVENT_VOICE_RECOGNITION_ENABLED; event[2] = HFP_SUBEVENT_VOICE_RECOGNITION_ACTIVATED;
little_endian_store_16(event, 3, hfp_connection->acl_handle); little_endian_store_16(event, 3, hfp_connection->acl_handle);
event[5] = status; // 0:success event[5] = status; // 0:success
@ -373,7 +373,7 @@ void hfp_emit_voice_recognition_disabled(hfp_connection_t * hfp_connection, uint
uint8_t event[6]; uint8_t event[6];
event[0] = HCI_EVENT_HFP_META; event[0] = HCI_EVENT_HFP_META;
event[1] = sizeof(event) - 2; event[1] = sizeof(event) - 2;
event[2] = HFP_SUBEVENT_VOICE_RECOGNITION_DISABLED; event[2] = HFP_SUBEVENT_VOICE_RECOGNITION_DEACTIVATED;
little_endian_store_16(event, 3, hfp_connection->acl_handle); little_endian_store_16(event, 3, hfp_connection->acl_handle);
event[5] = status; // 0:success event[5] = status; // 0:success
@ -1703,6 +1703,7 @@ static void parse_sequence(hfp_connection_t * hfp_connection){
break; break;
case 5: case 5:
hfp_connection->ag_vra_msg_length = hfp_connection->line_size; hfp_connection->ag_vra_msg_length = hfp_connection->line_size;
log_info("VRA message of length %d", hfp_connection->ag_vra_msg_length);
break; break;
default: default:
break; break;