
Description | Cautions | Example | Errors | See also
Name: |
int dt_listen (devh, sc_tsinfop) | |
Inputs: |
int devh |
|
|
SC_TSINFO *sc_tsinfop |
|
Returns: |
0 on success |
|
|
-1 on error |
|
Includes: |
srllib.h |
|
|
dtilib.h | |
Category: |
SCbus Routing | |
Mode: |
Synchronous | |
The dt_listen( ) function connects digital receive channel to SCbus time slot. This function uses the information stored in the SC_TSINFO structure to connect the digital receive (listen) channel (T-1/E-1 time slot) to an SCbus time slot. This functon sets up a half-duplex connection. For a full-duplex connection, the receive (listen) channel of the other device must be connected to the digital transmit channel.
Parameter |
Description |
devh: |
Specifies a digital network interface time slot device handle returned by a call to dt_open( ). |
sc_tsinfop: |
Specifies the pointer to the SC_TSINFO data structure. |
The SC_TSINFO structure is declared as follows:
typedef struct {
unsigned long sc_numts;
long *sc_tsarrayp;
} SC_TSINFO;
The sc_numts field of the SC_TSINFO structure must be set to 1. The sc_tsarrayp field of the SC_TSINFO structure must be initialized with a pointer to a valid array. The first element of this array must contain a valid SCbus time slot number (between 0 and 1023) which was obtained by issuing an xx_getxmitslot( ) function (xx = ag, dt, dx or fx). Upon return from the dt_listen( ) function, the digital receive channel will be connected to this time slot.
Although multiple SCbus device channels may listen (be connected) to the same SCbus time slot, a digital receive (listen) channel can connect to only one SCbus time slot.
This function will fail when:
#include <windows.h>
#include <srllib.h>
#include <dtilib.h>
#include <errno.h>
main( )
{
int voxh; /* Voice channel device handle */
int dtih; /* Digital channel (time slot) device handle */
SC_TSINFO sc_tsinfo; /* Time slot information structure */
long scts; /* SCbus time slot */
/* Open board 1 channel 1 device */
if ((voxh = dx_open("dxxxB1C1", 0)) == -1) {
printf("Cannot open channel dxxxB1C1. errno = %d", errno);
exit(1);
}
/* Fill in the SCbus time slot information */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/* Get SCbus time slot connected to transmit of voice channel 1 on board 1 */
if (dx_getxmitslot(voxh, &sc_tsinfo) == -1) {
printf("Error message = %s", ATDV_ERRMSGP(voxh));
exit(1);
}
/* Open board 1 time slot 1 on digital interface device */
if ((dtih = dt_open("dtiB1T1", 0)) == -1) {
printf("Cannot open time slot dtiB1T1. errno = %d", errno);
xit(1);
}
/* Connect the receive of digital channel (time slot) 1 on board 1 to SCbus transmit
time slot of voice channel 1*/
if (dt_listen(dtih, &sc_tsinfo) == -1) {
printf("Error message = %s", ATDV_ERRMSGP(dtih));
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. The error codes returned by ATDV_LASTERR( ) are:
Equate |
Returned When |
EDT_BADBRDERR |
Board missing or defective |
EDT_BADCMDERR |
Invalid command parameter to driver |
EDT_FWERR |
Firmware returned an error |
EDT_INVTS |
Invalid time slot device handle |
EDT_INVMSG |
Invalid message |
EDT_SH_BADLCLTS |
Invalid local time slot number |
EDT_SH_BADEXTTS |
External time slot unsupported at current clock rate |
EDT_SH_BADINDX |
Invalid Switch Handler library index number |
EDT_SH_BADMODE |
Invalid Switch Handler bus configuration |
EDT_SH_BADTYPE |
Invalid local time slot type |
EDT_SH_LCLTSCNCT |
Local time slot is already connected to SCbus |
EDT_SH_LIBBSY |
Switch Handler library busy |
EDT_SH_LIBNOTINIT |
Switch Handler library is uninitialized |
EDT_SH_MISSING |
Switch Handler is not present |
EDT_SH_NOCLK |
Switch Handler clock fallback failed |
EDT_SYSTEM |
Windows system error |
EDT_TMOERR |
Timed out waiting for reply from firmware |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation