LAN Interface Supplement 6-35
Controlling the Analyzer via the LAN
Controlling the Analyzer with a Java™ Applet
// This routine is called whenever a command is received from the
// SCPI command panel.
public boolean action(Event evt, Object what) {
// If this is the correct target
if (evt.target == scpiCommand) {
// Get the scpi command
String str = scpiCommand.getText();
// Send it out to the Scpi socket
sck.ScpiWriteLine(str);
// Query for any error
sck.ScpiWriteLine("syst:err?");
return true;
}
return false;
}
// Start/Stop a Response thread to display the response strings
private void StartResponseThread(boolean start) {
if (start) {
// Start a response thread
responseThread = new Thread(this);
responseThread.start();
}
else {
// Kill the response thread
responseThread = null;
}
}
// Response thread running
public void run() {
String str = ""; // Initialize str to null