asrp_module_interface

The prompt module interface.

Synopsis:

struct asrp_module_interface asrp_module_interface_t {
    const char * name ;
    const char * version ;
    int(* init )(void *module_data, cfg_item_t *asr_config);
    int(* rate )(asrp_prompt_info_t *prompt_info, int *visual_rating, int *audio_rating, void *module_data);
    int(* unrate )(void *module_data);
    asrp_processing_flags_t(* start )(asrp_prompt_info_t *prompt_info, void *module_data);
    asrp_processing_flags_t(* stop )(void *module_data);
    void(* step )(asr_step_t step, void *module_data);
};

Data:

const char * name
The name of the prompt module.
const char * version
The version of the prompt module.
int(* init)(void *module_data, cfg_item_t *asr_config)
Initialize the prompt module.

This function initializes the prompt module. Among other actions it may take, it should open the PPS control object for monitoring.

Arguments
  • module_data A pointer to any data the prompt module requires for initialization.
  • asr_config Configuration settings for the module.
Returns
  • 0 on success; -1 on error
int(* rate)(asrp_prompt_info_t *prompt_info, int *visual_rating, int *audio_rating, void *module_data)
Set a rating for this prompt module.

The rate() function sets a rating for the prompt interface handled by this module. Higher quality, interactive interfaces (such as the HMI) generally receive higher ratings than less interactive interfaces (such as the console).

Arguments
  • prompt_info Identifying information about the prompt.
  • visual_rating The visual rating is returned in this parameter.
  • audio_rating The audio rating is returned in this parameter.
  • module_data Optional data relating to the module.
Returns
  • 0 on success; -1 on error
int(* unrate)(void *module_data)
Remove ratings for this prompt module.

The unrate() function removes ratings for this module.

Arguments
  • module_data Optional data relating to the module.
Returns
  • 0 on success; -1 on error
asrp_processing_flags_t(* start)(asrp_prompt_info_t *prompt_info, void *module_data)
Start the prompt module.

The start() function starts the prompt module.

Arguments
  • prompt_info Information to pass to the prompt module.
  • module_data Optional data relating to the module.
Returns
  • Flags to indicate which, if any, prompts were rendered.
asrp_processing_flags_t(* stop)(void *module_data)
Stop the prompt module.

The stop() function stops the prompt module.

Arguments
  • module_data Optional data relating to the module.
Returns
  • ASRP_NO_PROMPTS on success.
void(* step)(asr_step_t step, void *module_data)
Handle a step.

The step() function handles a step. The action taken depends on the step specified.

Arguments
  • step The step to handle.
  • module_data Optional data relating to the module.

Library:

libasr

Description:

This structure defines the interface from io-asr to the prompt module. The prompt module's constructor function passes this structure to asrp_connect(). The io-asr service invokes the member callback functions depending on the state of the module.