
Description | Cautions | Example | Errors | See Also
Name: |
long ATDX_TERMMSK(chdev) | |
Inputs: |
int chdev |
|
Returns: |
channel's last termination bitmap if successful | |
Includes: |
srllib.h | |
Category: |
Extended Attribute | |
The ATDX_TERMMSK( ) function returns the reason for the last I/O function termination on the channel chdev. The bitmap is reset when an I/O function terminates.
The function parameter is defined as follows:
Parameter |
Description |
chdev |
specifies the valid channel device handle obtained when the channel was opened using dx_open( ). |
Possible return values are the following:
| |
If several termination conditions are met at the same time, several bits will be set in the termination bitmap.
#include <stdio.h>
#include <fcntl.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
main()
{
int chdev;
long term;
DX_IOTT iott;
DV_TPT tpt[4];
/* Open the channel device */
if ((chdev = dx_open("dxxxB1C1",NULL)) == -1) {
/* Process error */
}
/* Record a voice file. Terminate on receiving a digit, silence, loop
* current drop, max time, or reaching a byte count of 50000 bytes.
*/
/* set up DX_IOTT */
iott.io_type = IO_DEV|IO_EOT;
iott.io_bufp = 0;
iott.io_offset = 0;
iott.io_length = 50000;
if((iott.io_fhandle = dx_fileopen("file.vox", O_RDWR)) == -1) {
/* process error */
}
/* set up DV_TPTs for the required terminating conditions */
dx_clrtpt(tpt,4);
tpt[0].tp_type = IO_CONT;
tpt[0].tp_termno = DX_MAXDTMF; /* Maximum digits */
tpt[0].tp_length = 1; * terminate on the first digit */
tpt[0].tp_flags = TF_MAXDTMF; /* Use the default flags */
tpt[1].tp_type = IO_CONT;
tpt[1].tp_termno = DX_MAXTIME; /* Maximum time */
tpt[1].tp_length = 100; /* terminate after 10 secs */
tpt[1].tp_flags = TF_MAXTIME; /* Use the default flags */
tpt[2].tp_type = IO_CONT;
tpt[2].tp_termno = DX_MAXSIL; /* Maximum Silence */
tpt[2].tp_length = 30; /* terminate on 3 sec silence */
tpt[2].tp_flags = TF_MAXSIL; /* Use the default flags */
tpt[3].tp_type = IO_EOT; /* last entry in the table */
tpt[3].tp_termno = DX_LCOFF; /* terminate on loop current drop */
tpt[3].tp_length = 10; /* terminate on 1 sec silence */
tpt[3].tp_flags = TF_LCOFF; /* Use the default flags */
/* Now record to the file */
if (dx_rec(chdev,&iott,tpt,EV_SYNC) == -1) {
/* process error */
}
/* Examine bitmap to determine if digits caused termination */
if((term = ATDX_TERMMSK(chdev)) == AT_FAILURE) {
/* Process error */
}
if(term & TM_MAXDTMF) {
printf("Terminated on digits\n");
.
.
}
}
This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev.
Setting Termination Conditions:
Retrieving Termination Events - asynchronously:
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation