
Description | Cautions | Example | Errors
Name: |
long ATDX_TONEID(chdev) | |
Inputs: |
int chdev |
|
Returns: |
channel's last termination bitmap if successful | |
Includes: |
srllib.h | |
Category: |
Extended Attribute | |
The ATDX_TONEID( ) function returns user-defined tone ID that terminated I/O function. Use this function to determine which tone occurred when ATDX_TERMMSK( ) returns DX_TONE to indicate that an I/O function terminated due to the occurrence of a user-defined tone.
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( ). |
None.
#include <stdio.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <windows.h>
#define TID_1 101
main()
{
TN_GEN tngen;
DV_TPT tpt[ 5 ];
int chdev;
/*
* Open the D/xxx Channel Device and Enable a Handler
*/
if ( ( chdev = dx_open( "dxxxB1C1", NULL ) ) == -1 ) {
perror( "dxxxB1C1" );
exit( 1 );
}
/*
* Describe a Simple Dual Tone Frequency Tone of 950-
* 1050 Hz and 475-525 Hz using leading edge detection.
*/
if ( dx_blddt( TID_1, 1000, 50, 500, 25, TN_LEADING )== -1 ) {
printf( "Unable to build a Dual Tone Template\n" );
}
/*
* Add the Tone to the Channel
*/
if ( dx_addtone( chdev, NULL, 0 ) == -1 ) {
printf( "Unable to Add the Tone %d\n", TID_1 );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( chdev ), ATDV_ERRMSGP( chdev ) );
dx_close( chdev );
exit( 1 );
}
/*
* Build a Tone Generation Template.
* This template has Frequency1 = 1140,
* Frequency2 = 1020, amplitute at -10dB for
* both frequencies and duration of 100 * 10 msecs.
*/
dx_bldtngen( &tngen, 1140, 1020, -10, -10, 100 );
/*
* Set up the Terminating Conditions
*/
tpt[0].tp_type = IO_CONT;
tpt[0].tp_termno = DX_TONE;
tpt[0].tp_length = TID_1;
tpt[0].tp_flags = TF_TONE;
tpt[0].tp_data = DX_TONEON;
tpt[1].tp_type = IO_CONT;
tpt[1].tp_termno = DX_TONE;
tpt[1].tp_length = TID_1;
tpt[1].tp_flags = TF_TONE;
tpt[1].tp_data = DX_TONEOFF;
tpt[2].tp_type = IO_EOT;
tpt[2].tp_termno = DX_MAXTIME;
tpt[2].tp_length = 6000;
tpt[2].tp_flags = TF_MAXTIME;
if (dx_playtone( chdev, &tngen, tpt, EV_SYNC ) == -1 ){
printf( "Unable to Play the Tone\n" );
printf( "Lasterror = %d Err Msg = %s\n",
ATDV_LASTERR( chdev ), ATDV_ERRMSGP( chdev ) );
dx_close( chdev );
exit( 1 );
}
if ( ATDX_TERMMSK( chdev ) & TM_TONE ) {
printf( "Terminated by Tone Id = %d\n", ATDX_TONEID( chdev ) );
}
/*
* Continue Processing
* .
* .
* .
*/
/*
* Close the opened D/xxx Channel Device
*/
if ( dx_close( chdev ) != 0 ) {
perror( "close" );
}
/* Terminate the Program */
exit( 0 );
}
This function will fail and return AT_FAILURE if an invalid channel device handle is specified in chdev.
Click here to contact Dialogic Customer Engineering
Copyright 2002, Dialogic Corporation