
Description | Cautions | Example | Errors | See Also
Name: |
int dx_RxIottData(chdev, iottp, lpTerminations, wType, lpParams, mode) | |
Inputs: |
int chdev |
|
DX_IOTT *iottp |
| |
DV_TPT *lpTerminations |
| |
int wType |
| |
LPVOID lpParams |
| |
USHORT mode |
| |
Returns: |
0 if successful -1 if error | |
Includes: |
dxxxlib.h srllib.h | |
Mode: |
Synchronous/asynchronous | |
The dx_RxIottData( ) function is used to receive data on a specified channel. The data may be directed to any combination of data files, memory, or custom devices. The wType parameter specifies the type of data to be received, for example ADSI data.
After dx_RxIottData( ) is called, data reception continues until one of the following occurs:
If the channel detects end of FSK data, 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 |
To obtain the total length of FSK data received (in bytes), call ATDX_TRCOUNT( ) after dx_RxIottData( ) has completed successfully.
Upon asynchronous completion of dx_RxIottData( ), the TDX_RXDATA event is posted.
Parameter |
Description |
chdev |
The valid Dialogic channel device handle. |
iottp |
The pointer to the I/O Transfer Table. The iottp parameter specifies the destination for the received data. This is the same DX_IOTT structure used in dx_playiottdata( ) and dx_reciottdata( ). |
lpTerminations |
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 received. To receive ADSI data, set wType to DT_ADSI. |
lpParams |
The pointer to information specific to the data type specified in wType. The format of the parameter block depends on wType. For ADSI data, set lpParams to point to an ADSI_XFERSTRUC 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 receive ADSI data
DX_IOTT iott = {0};
char *devnamep = "dxxxB1C1";
char buffer[16];
ADSI_XFERSTRUC adsimode;
DV_TPT tpt;
int chdev;
.
.
.
sprintf(buffer, "RECEIVE.ADSI");
if ((iott.io_fhandle = dx_fileopen(buffer, O_BINARY)) == -1) {
/* Perform system error processing */
exit(2);
}
if ((chdev = dx_open(devnamep, 0)) == -1) {
fprintf(stderr, "Error opening channel %s\n",devnamep);
dx_fileclose(iott.io_fhandle);
exit(1);
}
.
.
.
// destination is a file
iott.io_type = IO_DEV|IO_EOT;
iott.io_bufp = 0;
iott.io_offset = 0;
iott.io_length = -1;
adsimode.cbSize = sizeof(adsimode);
adsimode.dwRxDataMode = ADSI_NOALERT;
// Wait for inbound call.
// Specify maximum time termination condition in the TPT.
// Application specific value is used to terminate dx_RxIottData( )
// 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;
if (dx_RxIottData(chdev, &iott, &tpt, DT_ADSI, &adsimode, EV_SYNC) < 0) {
fprintf(stderr, "ERROR: dx_RxIottData 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_RxIottData( ) 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