am_event_handler_vr.cc

来自「Motorola synergy audio component」· CC 代码 · 共 1,114 行 · 第 1/3 页

CC
1,114
字号
{    UINT8 size = 0;    // VA/VR command in progress    AM_VA_VR_COMMAND_TYPE command_in_progress =                          am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO);    if ((command_in_progress != AM_VA_VR_ABORT_CMD) ||        (command_in_progress != AM_VA_VR_DO_NOTHING_CMD))    {              // AUDSCM_SDSR_Complete_Ind_RX audscm_sdsr_complete_prim(*((TD_Primitive_Header_RX*)msg));        AUDSCM_SDSR_COMPLETE_IND * sdsr_complete_ind = (AUDSCM_SDSR_COMPLETE_IND *)msg;        if ((sdsr_complete_ind->word_array[1] == INVALID_MODEL_ID_1) ||             (sdsr_complete_ind->word_array[1] == INVALID_MODEL_ID_2))        {           size = 1;        }        else        {            size = ((sdsr_complete_ind->header.stamp_n_length & AUD_DSP_REPLY_MSG_LENGTH_MASK) - 1);        }        //For rainbow dsp, returned model index is zero-based. #if (AUDIO_RAINBOW == TRUE)        sdsr_complete_ind->word_array[0]++;        sdsr_complete_ind->word_array[1]++;#endif        // Add code to condition the audscm complete        am_event_va_vr_server.condition_audscm_recognize_complete(msg);        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);         // disable recognition command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR);        // build and send primitive to MMI to indicate the result of voice recognition        Send2DeviceLayer_SDVR_Complete_Ind(sdsr_complete_ind->error_code,                                           size,                                            sdsr_complete_ind->word_array);    }}/* DESCRIPTION:       This function handles an incoming audscm_sdvr_delete_complete       primitive, it asks the logic processor in application layer to       turn off the voice tag deletion.        The SDVR Model Deletion Completion is sent by the Speech Coder to       indicate the result of voice tag deletion.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/voidAM_Event_Handler::handle_audscm_sdsr_delete_complete(void *msg){    AUDSCM_SDSR_DELETE_COMPLETE_IND * audscm_sdsr_delete_complete = (AUDSCM_SDSR_DELETE_COMPLETE_IND *)msg;    // reset va/vr database    am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);    // disable voice tag deletion command    am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_DELETE);    // build and send primitive to MMI to indicate the result of voice tag deletion    Send2DeviceLayer_SDVR_Delete_Complete_Ind( audscm_sdsr_delete_complete->error_code,                                                am_event_va_vr_server.get_vr_group());}/* DESCRIPTION:       This function handles an incoming audscm_sdvr_model_id       primitive, it asks the logic processor in application layer to       turn off the model retrieval.       The SDVR Model ID Completion is sent by the Speech Coder to       indicate what models are stored in the DSP flash.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/voidAM_Event_Handler::handle_audscm_sdsr_model_id(void *msg){    AUDSCM_SDSR_MODEL_ID_IND * audscm_sdsr_model_id = (AUDSCM_SDSR_MODEL_ID_IND *)msg;    // reset va/vr database    am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);    // disable voice tag deletion command    am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_GET_MODELS);        UINT8 size = (audscm_sdsr_model_id->header.stamp_n_length & AUD_DSP_REPLY_MSG_LENGTH_MASK) - 1;        // build and send primitive to MMI to indicate what models are stored in the flash.    Send2DeviceLayer_SDVR_Model_ID_Ind(audscm_sdsr_model_id->error_code,                                       am_event_va_vr_server.get_vr_group(),                                       size,                                       audscm_sdsr_model_id->active_bit_array);}/* DESCRIPTION:       This function handles an incoming audscm_sdvr_train_complete       primitive, it asks the logic processor in application layer to       turn off the model training.       The SDVR Model Training Completion is sent by the Speech Coder to       indicate model training is done.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/voidAM_Event_Handler::handle_audscm_sdsr_train_complete(void *msg){    UINT8 returned_error_code;    UINT16 returned_model_id;    // VA/VR command in progress    AM_VA_VR_COMMAND_TYPE command_in_progress =                          am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO);    if ((command_in_progress != AM_VA_VR_ABORT_CMD) ||        (command_in_progress != AM_VA_VR_DO_NOTHING_CMD))    {        AUDSCM_SDSR_TRAIN_COMPLETE_IND * train_complete_ind  =  (AUDSCM_SDSR_TRAIN_COMPLETE_IND *)msg;        // reset va/vr database        am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);        // disable training command        am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_SDVR_TRAIN);        returned_model_id = am_event_va_vr_server.condition_audscm_train_complete(msg);        returned_error_code = train_complete_ind->error_code;        if ((returned_model_id == TD_VR_INVALID_MODEL_ID)&&( returned_error_code == TD_VR_SUCCESS))        {            returned_error_code = TD_VR_TR_GROUP_FULL;        }        // build and send primitive to MMI to indicate the result of model training        Send2DeviceLayer_SDVR_Train_Complete_Ind(train_complete_ind->warning_code,                                                 returned_error_code,                                                 returned_model_id);    }}/* DESCRIPTION:       This function handles an incoming audscm_voice_tag_complete       primitive, it asks the logic processor in application layer to       turn off the voice tag playback.       The Voice Tag Completion is sent by the Speech Coder to indicate       voice tag playback is done.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/voidAM_Event_Handler::handle_audscm_voice_tag_complete(void *msg){    // reset va/vr database    am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);    // disable voice tag playback command    am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VOICE_TAG);    // build and send primitive to MMI to indicate voice tag playback is done    Send2DeviceLayer_SDVR_Voice_Tag_Complete_Ind(TD_VR_SUCCESS);}#endif#if ((AUDIO_DIGITAL_VOICE_ANNOTATOR == TRUE) ||\     (AUDIO_SPEAKER_DEPENDENT_VR == TRUE))/* DESCRIPTION:       This function handles an incoming aud_reformat_flash_req primitive,       it asks the logic processor in application layer to reformat       the DSP flash entirely. All voicenotes and voice tags are deleted       as the result of this request.       The DSP flash reformat Request is sent by the MMI task to       reformat (ie. erase all information) the DSP flash.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid when the conditional          compilation flag of either speaker dependent voice recognition          or digital voice annotation is set to TRUE.*/voidAM_Event_Handler::handle_aud_reformat_flash_req(void *msg){    AM_VA_VR_COMMAND_TYPE command_in_progress =                          am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO);    if ((command_in_progress == AM_VA_VR_ABORT_CMD) ||        (command_in_progress == AM_VA_VR_DO_NOTHING_CMD))    {        // set vr command in the VR server        am_event_va_vr_server.set_command(AM_VA_VR_REFORMAT_FLASH_CMD);        // generate DSP flash reformat command        am_event_logic_processor.generate_va_vr_command(DL_AUDIO_TONE_TYPE_VA_VR_REFORMAT);    }    else    {       // build and send primitive to MMI to indicate DSP flash reformat        Send2DeviceLayer_AUD_Reformat_Flash_Ind(TD_DSP_FLASH_BUSY);    }}/* DESCRIPTION:       This function handles an incoming audscm_reformat_flash_complete       primitive, it asks the logic processor in application layer to       turn off the DSP flash reformat.       The DSP flash reformat Completion is sent by the Speech Coder to       indicate the flash reformat is done.   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid when the conditional          compilation flag of either speaker dependent voice recognition          or digital voice annotation is set to TRUE.*/voidAM_Event_Handler::handle_audscm_reformat_flash_complete(void *msg){    AUDSCM_REFORMAT_FLASH_COMPLETE_IND * audscm_reformat_flash_complete = (AUDSCM_REFORMAT_FLASH_COMPLETE_IND*)msg;    // reset va/vr database    am_event_va_vr_server.set_command(AM_VA_VR_DO_NOTHING_CMD);    // disable DSP flash reformat command    am_event_logic_processor.disable_va_vr_command(DL_AUDIO_TONE_TYPE_VA_VR_REFORMAT);    Send2DeviceLayer_AUD_Reformat_Flash_Ind(audscm_reformat_flash_complete->error_code);}#endif /* DESCRIPTION:       This kills the active VR session, we are being pre-empted by a voice call   INPUTS:       incoming primitive   OUTPUTS:       None   IMPORTANT NOTES:*/voidAM_Event_Handler::handle_aud_abort_all_vr(void *msg){   UINT16 no_data[8];   AM_VA_VR_COMMAND_TYPE command_in_progress;   if (aud_is_vr_active() == FALSE)   {       Send2DeviceLayer_vr_message(AM_VR_UNAVAILABLE_IND, 0);       am_timer_handler.Start(&am_check_avail_timer);       return;   }    command_in_progress =      am_event_va_vr_server.get_command(AM_AUDIO_PATH_ID_VA_VR_NON_AUDIO);   if(command_in_progress == AM_SDVR_START_CAPTURE_CMD)   {       Send2DeviceLayer_SDVR_Capture_Complete_Ind(TD_DSP_FLASH_BUSY);   }   else if(command_in_progress == AM_SDVR_START_TRAIN_CMD)   {       Send2DeviceLayer_SDVR_Train_Complete_Ind(TD_VR_COMPLETE_DO_NOTHING, TD_DSP_FLASH_BUSY, 0);   }   else if(command_in_progress == AM_SDVR_START_RECOG_CMD)   {       Send2DeviceLayer_SDVR_Complete_Ind(TD_VR_COMPLETE_DO_NOTHING, 0, no_data);   }   Send2DeviceLayer_vr_message(AM_VR_UNAVAILABLE_IND, 0);   handle_aud_vr_stop_nomsg();   am_event_logic_processor.update_audio();   handle_aud_vr_disable_req_noresp();   am_event_logic_processor.update_audio();   am_send_log_data(0x82666, (char *)no_data, 1);   am_timer_handler.Start(&am_check_avail_timer);}/* DESCRIPTION:       This function handles an incoming primitive to check if VR is available yet.       If VR was aborted by an incoming call, we send the UNAVAILABLE_IND to DL but       we need to make it AVAILABLE if no call is in progress.                             INPUTS:       incoming primitive        OUTPUTS:       None   IMPORTANT NOTES:       1. This function definition is valid only when conditional compilation          flag of speaker dependent voice recognition is set to TRUE.*/void AM_Event_Handler::handle_aud_sdvr_check_avail(void *msg){#if (AUDIO_SPEAKER_DEPENDENT_VR == TRUE)   UINT8 in_call = relay_layer.is_incall();   char no_data[2];   if ( FALSE == in_call )   {      Send2DeviceLayer_vr_message(AM_VR_AVAILABLE_IND, 0);    }   am_send_log_data(0x83666, (char *)no_data, 1);#endif}

⌨️ 快捷键说明

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