
Description | Cautions | Example | Errors | See Also
Name: |
int dt_tstcom(devh,tmo) | |
Inputs: |
int devh |
|
int tmo |
| |
Returns: |
Digital Network Interface return code | |
Includes: |
srllib.h | |
Category: |
Diagnostic | |
Mode: |
synchronous/asynchronous | |
The dt_tstcom( ) function tests the ability of a Digital Network Interface device to communicate with the host PC. This function can operate in either synchronous (blocking) or asynchronous (non-blocking) mode.
Please note the following guidelines when using this function:
Parameter |
Description |
devh: |
Specifies the valid Digital Network Interface logical board device handle returned by a call to dt_open( ) |
tmo: |
Specifies the maximum amount of time in seconds that the function will block while waiting for a response from the Digital Network Interface. If a response is not returned within tmo seconds, an error is returned |
Synchronous Mode
To run this function in synchronous (blocking) mode, set tmo to the length of time, in seconds, to await a return. If a response is not returned within tmo seconds, an error is returned. A suggested tmo setting for this function is 5.
Asynchronous Mode
To operate this function in asynchronous (non-blocking) mode, specify 0 for tmo. This allows the application to continue processing while awaiting a completion event. If event handling is set up properly for your application, DTEV_COMRSP will be returned by the sr_getevttype( ) function included in the SRL when the test is successfully completed. See Appendix A - Standard Runtime Library for information on event handling.
#include <windows.h> /* For Windows applications only */
#include <srllib.h>
#include <dtilib.h>
#include <errno.h>
main()
{
int devh; /* Board device handle */
/*
* Open board 1 device
*/
if ( ( devh = dt_open( "dtiB1", 0 ) ) == -1 ) {
printf( "Cannot open board dtiB1. errno = %d", errno );
exit( 1 );
}
/*
* Test the board's ability to communicate with the system. Give it 5
* seconds to complete.
*/
if ( dt_tstcom( devh, 5 ) == -1 ) {
printf( "Error message = %s.",ATDV_ERRMSGP( devh ) );
exit( 1 );
}
.
.
.
}
If the function returns -1, use the SRL Standard Attribute function ATDV_LASTERR( ) to obtain the error code or use ATDV_ERRMSGP( ) to obtain a descriptive error message. See Appendix A - Standard Runtime Library for more information on SRL functions. The error codes returned by ATDV_LASTERR( ) are:
Error defines can be found in the file dtilib.h.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation