
Description | Cautions | Example | Errors | See Also
Name: |
int dt_tstdat(devh,tmo) | |
Inputs: |
int devh |
|
unsigned int tmo |
| |
Returns: |
0 on success | |
Includes: |
srllib.h | |
Category: |
Diagnostic | |
Mode: |
synchronous/asynchronous | |
The dt_tstdat( ) function performs a test that verifies the integrity of the Digital Network Interface I/O interface to the PC. The data test is performed by sending a series of bytes to the Digital Network Interface and checking the integrity of the bytes returned.
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 awaiting a response from the Digital Network Interface |
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_DATRSP 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.
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.
#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 );
}
/*
* Perform a data integrity test between the board and PC. Give it 5
* seconds to complete.
*/
if ( dt_tstdat( 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