
Description | Cautions | Example | See Also
Name: |
long sr_getevttype(ehandle) | |
Inputs: |
unsigned long ehandle |
· event handle returned by sr_waitevtEx( ), or zero if sr_waitevt( ) is used |
Returns: |
Event type if successful | |
|
-1 if no current event | |
Includes: |
srllib.h | |
Type: |
Event Data Retrieval function | |
The sr_getevttype( ) function returns the event type for the current event. If a timeout occurs while waiting for an event this function returns SR_TIMEOUTEVT.
This function is called differently when used with sr_waitevt( ) or sr_waitevtEx( ).
For applications using sr_waitevt( ), pass a 0 parameter:
sr_getevttype(0). Do not use the event descriptor handle parameter, ehandle.
#include <windows.h>
#include <dsrllib.h>
#include <dxxxlib.h>
long chdev[MAXDEVS];
unsigned long evt_handle;
main( ... )
{
char channel_name[12];
int ch;
for (ch = 0; ch < MAXDEVS; ch++) {
/* Build the channel name for each channel */
if ( (chdev[ch] = dx_open(channel_name, 0) ) == -1 ) {
printf("dx_open failed\n");
exit(1);
}
}
/*
* Now initialize each device setting up the event masks and then issue
* the command asynchronously to start off the state machine.
*/
for (ch = 0; ch < MAXDEVS; ch++) {
/* Set up the event masks and other initialization */
/* set the channel onhook asynchronously */
if (dx_sethook( chdev[ch]. DX_ONHOOK, EV_ASYNC) == -1) {
/* sethook failed, handle the error */
}
}
/* This is the main loop to control the Voice hardware */
while (FOREVER) {
/* wait for the event */
sr_waitevtEx( chdev, MAXDEVS, -1, &evt_handle);
process_event( evt_handle);
}
int process_event( ehandle)
unsigned long ehandle;
{
int voxhandle = sr_getevtdev(ehandle);
switch(sr_getevttype(ehandle)) {
case TDX_CST:
.
break;
case TDX_PLAY:
.
break;
}
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation