
Description | Cautions | Example | Errors | See also
Name: |
int fx_listen(dev,sc_tsinfop) | |
Inputs: |
int dev |
|
|
SC_TSINFO *sc_tsinfop |
|
Returns: |
0 on success |
|
|
-1 on failure |
|
Includes: |
srllib.h |
|
|
dxxxlib.h | |
|
faxlib.h | |
Category: |
SCbus Routing | |
Mode: |
synchronous | |
The fx_listen( ) function connects FAX listen channel to SCbus time slot. This function uses the information stored in the SC_TSINFO structure to connect the FAX receive (listen) channel to an SCbus time slot. This function sets up a half-duplex connection. For a full-duplex connection, the receive (listen) channel of the other device must be connected to the FAX transmit channel.
Parameter |
Description |
dev: |
Specifies the valid FAX channel device handle obtained when the channel was opened using fx_open( ). |
sc_tsinfop: |
Specifies a pointer to the data structure SC_TSINFO. |
The SC_TSINFO structure is declared as follows:
typedef struct {
unsigned long sc_numts;
long *sc_tsarrayp;
} SC_TSINFO;
The sc_numts member 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 a xx_getxmitslot( ) function (xx = ag, dl, dt or fx). Upon return from the fx_listen( ) function, the FAX receive channel will be connected to this time slot.
Although multiple SCbus device channels may listen (be connected) to the same SCbus time slot, the FAX receive (listen) channel can connect to only one SCbus time slot.
This function will fail when:
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <faxlib.h>
#include <errno.h>
main( )
{
int voxdev; /* Voice channel device handle. */
int dev; /* Fax channel device handle. */
SC_TSINFO sc_tsinfo; /* SCbus time slot information structure. */
long scts; /* SCbus time slot. */
.
.
/* Open the FAX channel device. */
if ((dev = fx_open("dxxxB7C1", NULL)) == -1) {
/* Error opening device. */
printf("Error opening channel, errno = %d\n", errno);
exit(1);
}
/* Open the VOICE channel device on the D/160SC-LS. */
if ((voxdev = dx_open("dxxxB1C1", NULL)) == -1) {
/* Error opening device. */
printf("Error opening channel, errno = %d\n", errno);
exit(1);
}
.
.
/*
* Break the full-duplex connection between the Voice
* channel device and the Network analog device.
* Use the SCbus routing cconvenience function nr_scunroute( ).
*/
if (nr_scunroute(voxdev, SC_VOX, voxdev, SC_LSI, SC_FULLDUP)== -1) {
/* Error during SCbus unroute. */
printf("Error unrouting channel\n");
printf("Error - %s (error code %d)\n",
ATDV_ERRMSGP(voxdev), ATDV_LASTERR(voxdev));
if (ATDV_LASTERR(voxdev) == EDX_SYSTEM) {
printf("errno = %d\n", errno);
}
}
/*
* Set full-duplex connection between the FAX
* channel device and the Network analog device.
*/
/* Fill in the SC_TSINFO structure time slot information. */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarray = &scts; /* Get Network analog device's SCbus transmit time slot. */ if (ag_getxmitslot(voxdev, &sc_tsinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(voxdev)); exit(1); } /* * Connect the FAX channel to "listen" to the Network * channel's SCbus transmit time slot. Pass the time slot * information in the SC_TSINFO structure to fx_listen( ). */ if (fx_listen(dev, &sc_tsinfo) == -1) { printf("Error message = %s", ATDV_ERRMSGP(dev)); exit(1); } . . /* Complete full-duplex connection between the FAX channel device * and the Network channel device using fx_getxmitslot( ) * and ag_listen( ). */ . . /* Call FAX API functions for FAX transfers. */ . .
If this function returns -1, use ATDV_LASTERR( ) and ATDV_ERRMSGP( ) to retrieve one of the following error reasons (see the Voice Software Reference - Features Guide for error message information):
Equate |
Returned When |
EDX_BADPARM |
Parameter error |
EDX_SH_BADCMD |
Command is not supported in current bus configuration |
EDX_SH_BADEXTTS |
SCbus time slot is not supported at current clock rate |
EDX_SH_BADINDX |
Invalid Switch Handler index number |
EDX_SH_BADLCLTS |
Invalid channel number |
EDX_SH_BADMODE |
Function not supported in current bus configuration |
EDX_SH_CMDBLOCK |
Blocking command is in progress |
EDX_SH_LCLTSCNCT |
Channel is already connected to SCbus |
EDX_SH_LIBBSY |
Switch Handler library busy |
EDX_SH_LIBNOTINIT |
Switch Handler library uninitialized |
EDX_SH_MISSING |
Switch Handler is not present |
EDX_SH_NOCLK |
Switch Handler clock fallback failed |
EDX_SYSTEM |
Windows System Error |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation