WaveLinkTone Samples

The following sample code demonstrates the implementation and capabilities of the Class WaveLinkTone and its associated methods.

Java Sample

/**

* This source code is for demonstration purposes only and should be treated as such.

* NOTE: For this demo, we are assuming a 20x8 display area.

*/

package samplecode;

import com.wavelink.clientui.*;

import java.io.*;

public class JavaToneDemo extends WaveLinkApplication {

public void WaveLinkMain(String[] args)

{

WaveLinkIO ioIface = new WaveLinkIO();

WaveLinkTone toneIface = new WaveLinkTone();

// This application demonstrates the use of the various WaveLinkTone methods.

// It assumes a display area of 20x8. In practice, use a WaveLinkTerminal object to format output to fit

// the current device. The following lines clear the display and output the app title in reverse video.

try {

ioIface.RFPrint(0, 0, " Welcome To The ", WaveLinkIO.WLCLEAR | WaveLinkIO.WLREVERSE);

ioIface.RFPrint(0, 1, " WaveLinkTone Demo ", WaveLinkIO.WLREVERSE);

ioIface.RFPrint(0, 3, "Hit a key to proceed", WaveLinkIO.WLNORMAL);

// Hide the cursor for a cleaner display

ioIface.RFPrint(0, 20, "", WaveLinkIO.WLNORMAL);

ioIface.GetEvent();

// An RF application can respond to user input in 3 ways: not at all, through the display, or through

// the speaker. Each has its benefits and drawbacks. By using the device's speaker, an application

// can quickly respond to user input with a simple acknowledgement. Tones can also be used to denote

// error conditions, status reports, and application progress.

// This application demonstrates the methods for creating, storing, using, and deleting

// tones from a device. Add some notes to the WaveLinkTone object.

for ( int lcv = 0; lcv < 9; lcv++ )

toneIface.AddTone(440 + (lcv * 100), 200);

toneIface.StoreTone("ToneDemo");

toneIface.PlayTone("ToneDemo");

//Cleanup

toneIface.DeleteToneFile("ToneDemo");

}

catch ( WaveLinkError wlErr ) {

//Do error handling

}

}

}

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

Privacy and Legal