Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 229
collect digits from a channel digit buffer — dx_getdig( )
* 10 msec resolution */
tpt[2].tp_type = IO_EOT;
tpt[2].tp_termno = DX_MAXTIME; /* Function Time */
tpt[2].tp_length = 100; /* 10 seconds (100 msec resolution timer) */
tpt[2].tp_flags = TF_MAXTIME; /* Edge-triggered */
/* clear previously entered digits */
if (dx_clrdigbuf(chdev) == -1) {
/* process error */
}
if ((numdigs =
dx_getdig(chdev,tpt, &digp, EV_SYNC)
) == -1) {
/* process error */
}
for (cnt=0; cnt < numdigs; cnt++) {
printf("\nDigit received = %c, digit type = %d",
digp.dg_value[cnt], digp.dg_type[cnt]);
}
/* go to next state */
.
.
}
!
!!
! Example 2
This example illustrates how to use dx_getdig( ) in asynchronous mode.
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
#define MAXCHAN 24
int digit_handler();
DV_TPT stpt[3];
DV_DIGIT digp[256];
main()
{
int i, chdev[MAXCHAN];
char *chnamep;
int srlmode;
/* Set SRL to run in polled mode. */
srlmode = SR_POLLMODE;
if (sr_setparm(SRL_DEVICE, SR_MODEID, (void *)&srlmode) == -1) {
/* process error */
}
for (i=0; i<MAXCHAN; i++) {
/* Set chnamep to the channel name - e.g., dxxxB1C1 */
/* open the channel with dx_open( ). Obtain channel device
* descriptor in chdev[i]
*/
if ((chdev[i] = dx_open(chnamep,NULL)) == -1) {
/* process error */
}
/* Using sr_enbhdlr(), set up handler function to handle dx_getdig()
* completion events on this channel.
*/
if (sr_enbhdlr(chdev[i], TDX_GETDIG, digit_handler) == -1) {