
Description | Cautions | Example | Errors | See Also
Name: |
int dx_getevt(chdev,eblkp,timeout) | |
Inputs: |
int chdev |
|
DX_EBLK *eblkp |
| |
int timeout |
| |
Returns: |
0 if success | |
-1 if failure | ||
Includes: |
srllib.h | |
dxxxlib.h | ||
Category: |
Call Status Transition Event | |
The dx_getevt( ) function monitors channel events synchronously for possible call status transition events in conjunction with dx_setevtmsk( ). dx_getevt( ) blocks and returns control to the program after one of the events set by dx_setevtmsk( ) occurs on the channel specified in the chdev parameter. The DX_EBLK structure contains the event that ended the blocking.
The function parameters are defined as follows:
Parameter |
Description | |
chdev |
specifies the valid channel device handle obtained when the channel was opened using dx_open( ). | |
eblkp |
points to the Event Block Structure DX_EBLK, which will contain the event that ended the blocking. | |
timeout |
specifies the maximum amount of time in seconds to wait for an event to occur. timeout can have one of the following values: | |
# of seconds: |
maximum length of time dx_getevt( ) will wait for an event. When the time specified has elapsed, the function will terminate and return an error. | |
-1: |
dx_getevt( ) will block until an event occurs; it will not time out. | |
|
0: |
The function will return -1 immediately if no event is present. | |
We recommend enabling only one process per channel. The event that dx_getevt( ) is waiting for may change if another process sets a different event for that channel. See dx_setevtmsk( ) for more details.
#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");
break;
}
.
.
}
If this function returns -1 to indicate failure, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons:
|
EDX_BADPARM |
|
EDX_SYSTEM |
|
EDX_TIMEOUT |
|
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation