Intel 05-2342-002 Computer Accessories User Manual


 
30 Voice API for Linux Demo Guide — June 2005
Demo Details
*/
rspentry=(DL_MNUOPTS *)gt_data(digbuf,cur_menu->me_validfnc,cur_menu->me_prompt,
cur_menu->me_retry, cur_menu->me_error,cur_menu->me_data);
/*
* Execute the appropriate actions for the last response
*/
/* If a function is required execute it */
if(rspentry->mo_fcnt != NULL) {
(void) (*rspentry->mo_fcnt)();
}
/*
* If a new menu has been specified then switch to next menu
* else switch to the default menu
*/
if(rspentry->mo_nxtmenu != NULL) {
/*
* Make the current menu previous
* and the previous menu current
*/
pre_menu = cur_menu;
cur_menu = rspentry->mo_nxtmenu;
} else {
/* Switch to the default menu */
switch((int)cur_menu->me_defmenu) {
case NULL:
fprintf(stderr,"Missing default menu. Menu system error");
exit(1);
case (int)DM_PREV:
/* Swap the current menu with the previous menu */
tmp = pre_menu;
pre_menu = cur_menu;
cur_menu = tmp;
break;
case (int)DM_CURR:
break;
default:
pre_menu = cur_menu;
cur_menu = cur_menu->me_defmenu;
break;
}
}
}
}
In the while-loop, the first function call is to the system routine gt_data( ) (see the next section).
The gt_data( ) function plays the voice prompt of the current menu, gets the caller's response, and
returns the response as a DL_MENUOPTS structure. The gt_data( ) function validates the
response and plays any error messages if the response is wrong. The value returned is guaranteed to
be a valid response.
The menu_engine( ) function checks the mo_fcnt field of the returned structure for a value and
calls the function if one exists.