Intel 05-1832-002 IP Phone User Manual


 
Voice API for Windows Operating Systems Library Reference — November 2003 363
receive data on a specified channel — dx_RxIottData( )
EDX_BUSY
Channel already executing I/O function
EDX_SYSTEM
Error from operating system; use dx_fileerrno( ) to obtain error value
!
!!
! Example
This example illustrates how to use dx_RxIottData( ) in synchronous mode.
// Synchronous receive ADSI data
#include "srllib.h"
#include "dxxxlib.h"
main()
{
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;
printf("Waiting for incoming ring\n");
dx_wtring(chdev, 2, DX_OFFHOOK, -1);
// 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
}