
Description | Cautions | Applications | Example | See Also
Name: |
long sr_getevtdev(ehandle) | |
Inputs: |
unsigned long ehandle |
· event handle returned by sr_waitevtEx( ), or zero if sr_waitevt( ) is used |
Returns: |
Dialogic device handle if successful | |
|
-1 if no current event | |
Includes: |
srllib.h | |
Type: |
Event Data Retrieval function | |
The sr_getevtdev( ) function returns the Dialogic device handle associated with the current event. If a timeout occurs while waiting for an event, this function returns SRL_DEVICE.
Using sr_waitevt( )Pass a 0 (zero) parameter:
sr_getevtdev(0).
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
long chdev[MAXDEVS];
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