Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All this code can be found in the attached source 

View file
name1081_Code.zip

TestCPAToneChange()

Code Block
TestCPAToneChange() function
int result;
TONE_DATA tonedata;
int brdhdl;
if ((brdhdl = dx_open("brdB1",0)) == -1)
{
printf("Cannot open board\n");
/* Perform system error processing */
exit(1);
}
/* NOTE if done ASYNC When running in asynchronous mode, this function returns 0 to indicate that it initiated
successfully and generates the TDX_QUERYTONE event to indicate completion or
TDX_QUERYTONE_FAIL to indicate failure. The TONE_DATA structure should remain in
scope until the application receives these events. */
Log(API,cpaindex,"Querying for TID_BUSY1");
if ((result = dx_querytone(brdhdl, TID_BUSY1, &tonedata, EV_SYNC)) == -1)
{
printf("Cannot obtain tone information for TID_BUSY1 \n");
/* Perform system error processing */
exit(1);
}
Log(API,cpaindex,"Deleting TID_BUSY1");
if ((result = dx_deletetone(brdhdl, TID_BUSY1, EV_SYNC)) == -1)
{
printf("Cannot delete the TID_BUSY1 tone \n");
/* Perform system error processing */
exit(1);
}
/* Change call progress default Busy tone */
  
tonedata.structver = 0;
tonedata.numofseg = 1; /* Single segment tone */
tonedata.tn_rep_cnt = 4;
tonedata.toneseg[0].structver = 0;
tonedata.toneseg[0].tn_dflag = 0; /* 0=single, 1=Dual tone */
tonedata.toneseg[0].tn1_min = 425; /* Min. Frequency for Tone 1 (in Hz) */
tonedata.toneseg[0].tn1_max = 490; /* Max. Frequency for Tone 1 (in Hz) */
tonedata.toneseg[0].tn2_min = 0; /* Min. Frequency for Tone 2 (in Hz) */
tonedata.toneseg[0].tn2_max = 0; /* Max. Frequency for Tone 2 (in Hz) */
tonedata.toneseg[0].tn_twinmin = 0;
tonedata.toneseg[0].tn_twinmax = 0;
tonedata.toneseg[0].tnon_min = 40; /* Debounce Min. ON Time  In 10ms units*/
tonedata.toneseg[0].tnon_max = 55; /* Debounce Max. ON Time */
tonedata.toneseg[0].tnoff_min = 40; /* Debounce Min. OFF Time */
tonedata.toneseg[0].tnoff_max = 55; /* Debounce Max. OFF Time */
  
Log(API,cpaindex,"Creating New TID_BUSY1");
if ((result = dx_createtone(brdhdl, TID_BUSY1, &tonedata, EV_SYNC)) == -1) {
printf("create tone for TID_BUSY1 failed\n");
/* Perform system error processing */
exit(1);
}

...