Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 235
monitor channel events synchronously — dx_getevt( )
!
!!
! Errors
If the function returns -1, use the Standard Runtime Library (SRL) Standard Attribute function
ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive
error message. One of the following error codes may be returned:
EDX_BADPARM
Invalid parameter
EDX_SYSTEM
Error from operating system; use dx_fileerrno( ) to obtain error value
EDX_TIMEOUT
Timeout time limit is reached
!
!!
! Example
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int chdev; /* channel descriptor */
int timeout; /* timeout for function */
DX_EBLK eblk; /* Event Block Structure */
.
.
.
/* Open Channel */
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* process error */
}
/* Set RINGS or WINK as events to wait on */
if (dx_setevtmsk(chdev,DM_RINGS|DM_WINK) == -1) {
/* process error */
}
/* Set timeout to 5 seconds */
timeout = 5;
if (
dx_getevt(chdev,&eblk,timeout)
== -1){
/* process error */
if (ATDV_LASTERR(chdev) == EDX_TIMEOUT) { /* check if timed out */
printf("Timed out waiting for event.\n");
}
else {
/* further error processing */
.
.
}
}
switch (eblk.ev_event) {
case DE_RINGS:
printf("Ring event occurred.\n");
break;
case DE_WINK:
printf("Wink event occurred.\n");