
Description | Cautions | Example | See Also
Name: |
void *sr_getevtdatap(ehandle) | |
Inputs: |
unsigned long ehandle |
· event handle returned by sr_waitevtEx( ), or zero if sr_waitevt( ) is used |
Returns: |
Address of variable data block | |
|
NULL if no variable data | |
Includes: |
srllib.h | |
Type: |
Event Data Retrieval function | |
The sr_getevtdatap( ) function returns the address of the variable data block associated with the current event. Use this data pointer and the event length sr_getevtlen( ) to extract the event data. The function returns a value of NULL if no additional data is associated with the current event.
For applications using sr_waitevt( ), pass a 0 parameter; for example:
sr_getevtdatap(0).
#include <windows.h>
#include <srllib.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);
int *datap;
switch(sr_getevttype(ehandle)) {
case TDX_CST:
*datap = (int *) sr_getevtdatap(ehandle);
if (datap->csd_data == DE_RINGS)
{
.
.
}
break;
case TDX_PLAY:
.
break;
}
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation