
Description | Cautions | Errors | Example
Name: |
void lm_clramp(tn_amplp) | |
Inputs: |
TN_AMP *tn_amplp |
|
Outputs: |
none | |
Returns: |
none | |
Includes: |
srllib.h dxxxlib.h lmodelib.h | |
Mode: |
synchronous | |
Category: |
learn mode | |
Platform: |
Springware | |
The lm_clramp( ) function clears the tone amplitude structure (TN_AMP). The function initializes all fields in the structure to their default value.
Call this function before setting values in the lm_LearnTone( ) function tn_amplp parameter.
Parameter |
Description |
tn_amplp |
Points to the TN_AMP 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