
Description | Cautions | Example | Errors | See Also
Name: |
long sr_dishdlr(dev, evt_type, handler) | |
Inputs: |
long dev |
|
|
long evt_type |
|
|
long (*handler)(unsigned long parm) |
|
Returns: |
0 if success | |
|
-1 if failure | |
Includes: |
srllib.h | |
Type: |
Event Handling function | |
The sr_dishdlr( ) function disables the handler function, handler( ), that was previously enabled using sr_enbhdlr( ) on a device/event type/handler triplet. The sr_dishdlr( ) function can be called from within a handler even if the same handler is being disabled.
The function parameters are described as follows:
Parameter |
Description |
dev |
Specifies the valid device handle obtained when the device was opened using an xx_open( ) function, where xx is the prefix identifying the device to be opened. Specify EV_ANYDEV to be notified of an event on any device. |
evt_type |
Specifies the event for which the application is waiting, for example: |
|
|
handler |
Points to an application-defined event handler that processes the event. See sr_enbhdlr( ) for more information on the application-defined event handlers. |
Only one handler is disabled by this function; the handler must be disabled under the same conditions as it was enabled. To disable device non-specific and/or event non-specific handlers specify EV_ANYDEV for the device, and/or EV_ANYEVT for the event type.
Handlers cannot be used with the SRL Extended Asynchronous Programming model.
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
long int dx_handler(unsigned long evhandle)
{
printf( "dx_handler() called, event is 0x%x\n", sr_getevttype(evhandle));
return( 0 ); /* tell SRL to dispose of the event */
}
main()
{
int dxxxdev;
int mode = SR_POLLMODE;
/* open dxxx channel device */
if(( dxxxdev = dx_open( "dxxxB1C1", 0 )) == -1 ){
printf( "dx_open failed\n" );
exit( 1 );
}
/* enable handler dx_handler on device dxxxdev ..... */
if( sr_enbhdlr( dxxxdev, EV_ANYEVT, dx_handler ) == -1 ){
printf( "Error: could not enable handler\n" );
exit( 1 );
}
/* Disable the handler */
if( sr_dishdlr( dxxxdev, EV_ANYEVT, dx_handler ) == -1 ){
printf( "Error: could not disable handler\n" );
exit( 1 );
}
}
If this function returns -1 to indicate failure, obtain the reason for the error by calling the SRL standard attribute function ATDV_LASTERR(SRL_DEVICE) or ATDV_ERRMSGP(SRL_DEVICE) to retrieve either the error code or a pointer to the error description, respectively. One of the following errors may be returned:
ESR_SYS |
|
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation