Agilent Technologies E4406A VSA Programming Examples, Using Java Programming Over Socket LAN

Models: E4406A VSA

1 406
Download 406 pages 63.49 Kb
Page 173
Image 173
Manual background

Programming Examples

Using Java Programming Over Socket LAN

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);

String tempStr = str.toLowerCase();

//If command str is "syst:err?", don’t need to send another one. if ( (tempStr.indexOf("syst") == -1)

(tempStr.indexOf("err") == -1) ) {

//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

Chapter 3

173

Page 173
Image 173
Agilent Technologies E4406A VSA manual Programming Examples, Using Java Programming Over Socket LAN, Chapter