
Description | Cautions | Errors | Example | See Also
Name: |
void lm_clrdesc(tn_descp) | |
Inputs: |
TN_DESC *tn_descp |
|
Outputs: |
none | |
Returns: |
none | |
Includes: |
srllib.h dxxxlib.h lmodelib.h | |
Mode: |
synchronous | |
Category: |
learn mode | |
Platform: |
Springware | |
The lm_clrdesc( ) function clears the tone description structure (TN_DESC), including the associated tone frequency structure (TN_FREQ) and tone duration structure (TN_DUR). The function initializes all fields in the structure to their default value.
Call this function to clear lm_LearnTone( ) function tn_rangep and tn_tonep parameters.
Parameter |
Description |
tn_descp |
Points to the TN_DESC structure that is to be cleared. |
None.
For a list of error codes, see Section 5.2. Learn Mode Error Codes.
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include "srllib.h"
#include "dxxxlib.h"
#include "lmodelib.h"
#define DEVICE "dxxxB1C1"
#define ERR -1
int lrn_Learn(int lrnDev);
int main()
{
int i,rc;
int Caller;
/* learn the dial tone here */
/* Prepare the scenario for dial tone */
if ((Caller = dx_open(DEVICE,(int)NULL)) == ERR)
{
//Error occurred in opening DEVICE
//Handle the error here and return
//error
return(ERR);
}
if ( dx_sethook(Caller, DX_OFFHOOK, EV_SYNC) == ERR)
{
//Error to set off hook
return(ERR);
}
printf("Start learning...............\n");
if ((rc = lrn_Learn(Caller)) != ERR)
{
printf("Finish learning...............\n");
}
else
{
printf("Error in Learning...\n");
}
//reset the channel
return 0;
}
int lrn_Learn(int Dev)
{
LM_PARM parm;
TN_AMP amp;
TN_DESC desc;
short flagDual;
int ret = -1;
lm_clrparm(&parm);
lm_clramp(&);
lm_clrdesc(&desc);
flagDual = 0; //Unknown
//set necessary fields of lm_parm
parm.lm_frames = 10;
parm.lm_qualid = QT_LMMID;
parm.lm_cadflag = 0;
/* min duration for tone to qualify as continuous */
parm.lm_cnt_min = 400;
parm.lm_method = 2;
ret = lm_LearnTone(Dev, &parm, &, &flagDual, NULL, &desc, NULL, EV_SYNC, NULL);
if( ret == ERR )
{
//Learning failed so process and return error
return(ERR):
}
/*process tone ( frequency and cadence) information returned in desc structure. */
return(ret);
}
Click here to contact Telecom Support Resources
Copyright 2003, Intel Corporation