
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 |
| |
USHORT mode |
| |
Returns: |
0 if successful -1 if error | |
Includes: |
dxxxlib.h srllib.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 is to 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 continues until one of the following occurs:
The receive portion of the dx_TxRxIottData( ) function continues until one of the following occurs:
If the channel detects end of FSK data during the receive portion, the function is terminated. Use ATDX_TERMMSK( ) to return the cause of termination. Possible return values are:
TM_MAXTIME |
Maximum function time exceeded |
TM_USRSTOP |
Function stopped by user |
TM_EOD |
End of FSK data detected on receive |
TM_MAXDATA |
Maximum data reached |
TM_ERROR |
I/O device error |
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 DV_TPT Termination Parameter Table that sets the termination conditions for the device handle. Supported values are:
|
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 the DV_TPT Termination Parameter Table that sets the termination conditions for the device handle. Supported values are:
|
wType |
Specifies the type of data to be transmitted and received. To transmit and 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. The buffer size is 255, which is the default buffer size used by the library.
// 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;
// Wait for inbound call
if (dx_TxRxIottData(chdev, &TxIott, NULL, &RxIott, &tpt, DT_ADSI,
&adsimode, EV_SYNC) < 0) {
fprintf(stderr, "ERROR: dx_TxRxIottData 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, Intel Corporation