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

Models: E4406A VSA

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

Programming Examples

Using Java Programming Over Socket LAN

//Clear the error queue before starting the thread

//in case if there’s any error messages from the previous actions while ( str.indexOf("No error") == -1 ) {

sck.ScpiWriteLine("syst:err?"); str = sck.ScpiReadLine();

}

//Start receiving response or error messages

while(true) {

str = sck.ScpiReadLine(); if ( str != null ) {

//If response messages is "No error", do no display it,

//replace it with "OK" instead.

if ( str.equals("+0,\"No error\"") ) { str = "OK";

}

//Display any response messages in the Response panel scpiResponse.appendText(str+"\n");

}

}

}

//Set up and open the SCPI sockets private void SetupSockets() {

// Get server url

appletBase = (URL)getCodeBase(); // Open the sockets

sck = new Socks(appletBase);

}

//Set up the SCPI command and response panels private void SetupPanels() {

//Set up SCPI command panel southPanel.setLayout(new GridLayout(1, 1)); p = new Panel();

p.setLayout(new BorderLayout());

174

Chapter 3

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