
Description | Cautions | Example | Errors | See Also
Name: |
int dx_TxRxIottData(chdev, lpTxIott, lpTxTerminations, lpRxIott, lpRxTerminations. wType, lpParams, mode) | |
Inputs: |
int chdev |
|
DX_IOTT *lpTxIott |
| |
DV_TPT *lpTxTerminations |
| |
DX_IOTT *lpRxIott |
| |
DV_TPT *lpRxTerminations |
| |
int wType |
| |
LPVOID lpParams |
| |
int mode |
| |
Returns: |
0 if successful -1 if error | |
Includes: |
dxxxlib.h srlib.h | |
Mode: |
Synchronous/asynchronous | |
The dx_TxRxIottData( ) function is used to start a transmit-initiated reception of data (two-way ADSI), where faster remote terminal device (CPE) turnaround occurs, typically within 100 msec. Faster turnaround is required for two-way FSK so that the receive data is not missed while the application turns the channel around after the last sample of FSK transmission is sent.
The wType parameter specifies the type of data that will be transmitted and received, i.e., two-way ADSI. The transmitted data may come from and the received data may be directed to any combination of data files, memory, or custom devices. The data is transmitted and received on a specified channel.
The lpTxIott parameter specifies the location of the messages to be transmitted. The destination for the retrieved messages is specified by lpRxIott.
The transmit portion of the dx_TxRxIottData( ) function will continue until one of the following occurs:
The receive portion of the dx_TxRxIottData( ) function will continue until one of the following occurs:
If the channel detects end of FSK data during the receive portion, the function is terminated and ATDX_TERMMSK( ) will return TM_EOD as the cause of termination.
Upon asynchronous completion of the transmit portion of the function, a TDX_TXDATA event is generated. Upon asynchronous completion of the receive portion of the function, a TDX_RXDATA event is generated.
Parameter |
Description |
chdev: |
The valid Dialogic channel device handle. |
lpTxIott: |
The pointer to the I/O Transfer Table. lpTxIott specifies the source of the messages to be transmitted. This is the same DX_IOTT structure used in dx_playiottdata( ) and dx_reciottdata( ). |
lpTxTerminations: |
The pointer to the Termination Parameter Table for transmission. |
lpRxIott: |
The pointer to the I/O Transfer Table structure. lpRxIott specifies the destination of the messages to be received. This is the same DX_IOTT structure used in dx_playiottdata( ) and dx_reciottdata( ). |
lpRxTerminations: |
The pointer to Termination Parameter Table for reception. |
wType: |
Specifies the type of data to be received. To receive ADSI data, set wType to DT_ADSI.
|
lpParams: |
The pointer to a structure that specifies additional information about the data that is to be sent and received. The structure type is determined by the data type (ADSI) specified by wType. For ADSI data, set lpParams to point to an ADSI_XFERSTRUC parameter block structure. |
mode: |
Specifies how the function should execute, either EV_ASYNC (asynchronous) or EV_SYNC (synchronous). |
Library level data is buffered when it is received. Applications can adjust the size of the buffers to address buffering delay. The DXCH_RXDATABUFSIZE channel parameter can be used with the dx_setparm( ) and dx_getparm( ) functions to adjust the buffer size.
// Synchronous transmit initiated receive ADSI data
DX_IOTT TxIott = {0};
DX_IOTT RxIott = {0};
DV_TPT tpt;
char *devnamep = "dxxxB1C1";
char buffer[16];
ADSI_XFERSTRUC adsimode;
int chdev;
.
.
.
sprintf(buffer, "MENU.ADSI");
if ((TxIott.io_fhandle = dx_fileopen(buffer, _O_RDONLY|O_BINARY)) == -1) {
/* Perform system error processing */
exit(1);
}
sprintf(buffer, "RECEIVE.ADSI");
if ((RxIott.io_fhandle = dx_fileopen(buffer, O_BINARY)) == -1) {
/* Perform system error processing */
dx_fileclose(TxIott.io_fhandle);
exit(2);
}
if ((chdev = dx_open(devnamep, 0)) == -1) {
fprintf(stderr, "Error opening channel %s\n",devnamep);
dx_fileclose(TxIott.io_fhandle);
dx_fileclose(RxIott.io_fhandle);
exit(1);
}
.
.
.
// source is a file
TxIott.io_type = IO_DEV|IO_EOT;
TxIott.io_bufp = 0;
TxIott.io_offset = 0;
TxIott.io_length = -1;
// destination is a file
RxIott.io_type = IO_DEV|IO_EOT;
RxIott.io_bufp = 0;
RxIott.io_offset = 0;
RxIott.io_length = -1;
adsimode.cbSize = sizeof(adsimode);
adsimode.dwTxDataMode = ADSI_ALERT;
adsimode.dwRxDataMode = ADSI_NOALERT;
// Specify maximum time termination condition in the TPT for the
// receive portion of the function. Application specific value is
// used to terminate dx_TxRxIottData( ) if end of data is not
// detected over a specified duration.
tpt.tp_type = IO_EOT;
if (dx_clrtpt(&tpt, 1) == -1) {
// Process error
}
tpt.tp_termno = DX_MAXTIME;
tpt.tp_length = 1000;
tpt.tp_flags = TF_MAXTIME;
printf("Waiting for incoming ring\n");
dx_wtring(chdev, 2, DX_OFFHOOK, -1);
if (dx_TxRxIottData(chdev, &TxIott, NULL, &RxIott, &tpt, DT_ADSI,
&adsimode, EV_SYNC) < 0) {
fprintf(stderr, "ERROR: dx_TxIottData failed on Channel %s; error:
%s\n", ATDV_NAMEP(chdev), ATDV_ERRMSGP(chdev));
}
.
.
.
If the function returns -1 to indicate an error, use the SRL Standard Attribute function ATDV_LASTERR( ) to obtain the error code or you can use ATDV_ERRMSGP( ) to obtain a descriptive error message.
Possible error codes from the dx_TxRxIottData( ) function include the following:
Error Code |
Description |
EDX_BADPARM |
Invalid data mode |
EDX_BADIOTT |
Invalid DX_IOTT (pointer to I/O transfer table) |
EDX_BUSY |
Channel already executing I/O function |
EDX_SYSTEM |
Error from operating system; use dx_fileerrno( ) to obtain error value |
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation