
Description | Cautions | Example | Errors | See also
Name: |
int ag_listen (chdev, sc_tsinfop) | |
Inputs: |
int chdev |
|
|
SC_TSINFO *sc_tsinfop |
|
Returns: |
0 on success |
|
|
-1 on error |
|
Includes: |
dxxxlib.h |
|
Category: |
SCbus Routing | |
Mode: |
Synchronous | |
The ag_listen( ) function connects analog receive channel to SCbus time slot. This function uses the information stored in the SC_TSINFO structure to connect the analog 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 analog transmit channel
Due to analog signal processing on voice boards with on-board analog devices, a voice device and its corresponding analog device (analog device 1 to voice device 1, etc.) comprise a single channel. At system initialization, default SCbus routing is to connect these devices in full-duplex communications. See the SCbus Routing Guide for more information.
Parameter |
Description |
chdev: |
Specifies the valid analog channel handle obtained when the channel was opened using dx_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 initialized with the number 1. The sc_tsarrayp member of the SC_TSINFO structure must be initialized with a pointer to a valid array that contains a valid SCbus time slot number in its first array element. Upon return from the function, the analog receive channel will be connected to this SCbus time slot.
The SCbus time slot number contained in the array pointed to by sc_tsarrayp must be obtained, prior to calling ag_listen( ), by calling the appropriate xx_getxmitslot( ) function.
Although multiple D/41ESC, D/160SC-LS, LSI/81SC, LSI/161SC, or VFX/40ESC channels may listen (be connected) to the same SCbus time slot, the analog 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 <errno.h>
main( )
{
int chdev; /* Channel device handle */
SC_TSINFO sc_tsinfo; /* Time slot information structure */
long scts; /* SCbus time slot */
/* Open board 1 channel 1 devices */
if ((chdev = 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(chdev, &sc_tsinfo) == -1) {
printf("Error message = %s", ATDV_ERRMSGP(chdev));
exit(1);
}
/* Connect the receive of analog channel 1 on board 1 to SCbus
time slot of voice channel 1 */
if (ag_listen(chdev, &sc_tsinfo) == -1) {
printf("Error message = %s", ATDV_ERRMSGP(chdev));
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. One of the following error codes may be returned:
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_BADTYPE |
Invalid channel local time slot type (voice, analog, etc.) |
EDX_SH_CMDBLOCK |
Blocking command is in progress |
EDX_SH_LCLTSCNCT |
Channel is already connected to SCbus time slot |
EDX_SH_LIBBSY |
Switch Handler library busy |
EDX_SH_LIBNOTINIT |
Switch Handler library uninitialized |
EDX_SH_NOCLK |
Switch Handler clock fallback failed |
EDX_SYSTEM |
Windows system error |
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation