The following sample code demonstrates the implementation and capabilities of the Class WaveLinkTerminal and its associated methods.
Java Sample
/**
* This source code is for demonstration purposes only and should be treated as such.
*
* This application demonstrates the use of the various WaveLinkTerminal methods.
*/
package samplecode;
import com.wavelink.clientui.*;
import java.io.*;
public class JavaTerminalDemo extends WaveLinkApplication {
public void WaveLinkMain(String[] args)
{
WaveLinkIO ioIface = new WaveLinkIO();
String strBuffer;
// The following lines clear the display and output the app title in reverse video.
try {
WaveLinkTerminal termIface = new WaveLinkTerminal();
ioIface.RFPrint(0, 0, " Welcome To The ", WaveLinkIO.WLCLEAR | WaveLinkIO.WLREVERSE);
ioIface.RFPrint(0, 1, " Java Terminal 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();
// When designing RF applications, it is often not possible to know which types of devices are
// going to be used by the end user. The WaveLinkTerminal object accesses
// accurate information about the user's device. Simply creating a WaveLinkTerminal object
// acquires the terminal's information, but for demonstration purposes, we explicitly
// request the current setting from the device.
termIface.ReadTerminalInfo();
ioIface.RFPrint(0, 0, "Terminal information", WaveLinkIO.WLREVERSE | WaveLinkIO.WLCLEAR);
//Display the terminal's screen dimensions
strBuffer = "Screen Size (" + Integer.toString(termIface.TerminalWidth()) + ", " + String.valueOf(termIface.TerminalHeight()) + ")";
ioIface.RFPrint(0, 1, strBuffer, WaveLinkIO.WLNORMAL);
//Display the WaveLink Client version
ioIface.RFPrint(0, 3, "WaveLink Version:", WaveLinkIO.WLNORMAL);
ioIface.RFPrint(0, 4, termIface.WaveLinkVersion(), WaveLinkIO.WLNORMAL);
//Display the Terminal's ID
ioIface.RFPrint(0, 6, "Terminal ID:", WaveLinkIO.WLNORMAL);
ioIface.RFPrint(0, 7, termIface.TerminalID(), WaveLinkIO.WLNORMAL);
ioIface.RFPrint(0, 20, "", WaveLinkIO.WLNORMAL);
ioIface.GetEvent();
ioIface.RFPrint(0, 0, " Setting Cursor To ", WaveLinkIO.WLCLEAR | WaveLinkIO.WLREVERSE);
ioIface.RFPrint(0, 1, " Software Mode ", WaveLinkIO.WLREVERSE);
ioIface.RFPrint(0, 3, "SW Curser -> ", WaveLinkIO.WLFLUSHOUTPUT);
termIface.CursorMode (WaveLinkTerminal.SOFTWARECURSOR);
termIface.SetTerminalInfo();
ioIface.GetEvent();
ioIface.RFPrint(0, 0, " Resetting Cursor To ", WaveLinkIO.WLCLEAR | WaveLinkIO.WLREVERSE);
ioIface.RFPrint(0, 1, " Hardware Mode ", WaveLinkIO.WLREVERSE | WaveLinkIO.WLFLUSHOUTPUT);
ioIface.RFPrint(0, 3, "HW Curser -> ", WaveLinkIO.WLFLUSHOUTPUT);
termIface.CursorMode (WaveLinkTerminal.HARDWARECURSOR);
termIface.SetTerminalInfo();
ioIface.GetEvent();
}
catch ( WaveLinkError wlErr ) {
//Do error handling
}
}
}
Was this article useful?
The topic was:
Inaccurate
Incomplete
Not what I expected
Other