public class TestAscii extends Object
| Constructor and Description |
|---|
TestAscii()
Constructor.
|
TestAscii(Ascii dev)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes connection to a device.
|
protected static String |
makeCommandString(String command,
String... args)
Makes a command string.
|
void |
open(org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
String ident)
Opens connection to a device with default parameters.
|
void |
open(org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
String ident,
int param)
Opens connection to a device.
|
void |
openNet(String host)
Opens connection to a network device with default port.
|
void |
openNet(String host,
int port)
Opens connection to a network device.
|
void |
openSerial(String devc)
Opens connection to a serial device with default baud rate.
|
void |
openSerial(String devc,
int baud)
Opens connection to a serial device.
|
void |
openSerial(String devc,
int baud,
Ascii.DataBits dbits,
Ascii.StopBits sbits,
Ascii.Parity parity,
Ascii.FlowCtrl flow)
Opens connection to a serial device.
|
String |
read()
Reads a response.
|
String |
read(String command,
String... args)
Writes a command and reads the response.
|
void |
setCommandTerm(Ascii.Terminator term)
Sets the command terminator.
|
void |
setConnTimeout(int time)
Sets the network connection timeout.
|
void |
setDefaultBaud(int baud)
Sets default baud rate
|
void |
setDefaultPort(int port)
Sets default network port
|
void |
setOptions(Ascii.Option option)
Sets device options.
|
void |
setResponseTerm(Ascii.Terminator term)
Sets the response terminator.
|
void |
setTerminator(Ascii.Terminator term)
Sets both the command and response terminators.
|
void |
setTimeout(int time)
Sets the response timeout.
|
int |
showConnTimeout()
Shows the network connection timeout.
|
int |
showTimeout()
Shows the response timeout.
|
void |
write(String command,
String... args)
Writes a command.
|
protected final Ascii dev
public TestAscii()
public TestAscii(Ascii dev)
dev - The device to use@Command(description="Set options")
public void setOptions(@Argument(description="Device options")
Ascii.Option option)
option - The options enum@Command(description="Set default baud rate")
public void setDefaultBaud(@Argument(description="Default baud rsate")
int baud)
baud - The default baud rate@Command(description="Set default network port")
public void setDefaultPort(@Argument(description="Default parameter")
int port)
port - The default network port@Command(description="Open connection to general device")
public void open(@Argument(description="Connection type: net or serial")
org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
@Argument(description="Device identifier")
String ident,
@Argument(description="Device parameter")
int param)
throws org.lsst.ccs.drivers.commons.DriverException
type - The connection typeident - The device identificationparam - The device parameterorg.lsst.ccs.drivers.commons.DriverException@Command(description="Open connection to general device")
public void open(@Argument(description="Connection type: net or serial")
org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
@Argument(description="Device identifier")
String ident)
throws org.lsst.ccs.drivers.commons.DriverException
type - The connection typeident - The device identificationorg.lsst.ccs.drivers.commons.DriverException@Command(description="Open connection to network device")
public void openNet(@Argument(description="Host name")
String host,
@Argument(description="Port number")
int port)
throws org.lsst.ccs.drivers.commons.DriverException
host - The host nameport - The port numberorg.lsst.ccs.drivers.commons.DriverException@Command(description="Open connection to network device")
public void openNet(@Argument(description="Host name")
String host)
throws org.lsst.ccs.drivers.commons.DriverException
host - The host nameorg.lsst.ccs.drivers.commons.DriverException@Command(description="Open connection to serial device")
public void openSerial(@Argument(description="Device name")
String devc,
@Argument(description="Baud rate")
int baud,
@Argument(description="The number of data bits")
Ascii.DataBits dbits,
@Argument(description="The number of stop bits")
Ascii.StopBits sbits,
@Argument(description="The parity")
Ascii.Parity parity,
@Argument(description="The flow control")
Ascii.FlowCtrl flow)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device namebaud - The baud ratedbits - The number of data bits (eight or seven)sbits - The number of stop bits (one or two)parity - The parity (none, odd, even, mark or space)flow - The flow control (none, xon, rts or dtr)org.lsst.ccs.drivers.commons.DriverException@Command(description="Open connection to serial device")
public void openSerial(@Argument(description="Device name")
String devc,
@Argument(description="Baud rate")
int baud)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device namebaud - The baud rateorg.lsst.ccs.drivers.commons.DriverException@Command(description="Open connection to serial device")
public void openSerial(@Argument(description="Device name")
String devc)
throws org.lsst.ccs.drivers.commons.DriverException
devc - The device nameorg.lsst.ccs.drivers.commons.DriverException@Command(description="Close connection to device")
public void close()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(description="Write command to device")
public void write(@Argument(description="Command word")
String command,
@Argument(description="Arguments")
String... args)
throws org.lsst.ccs.drivers.commons.DriverException
command - The command word to sendargs - The argumentsorg.lsst.ccs.drivers.commons.DriverException@Command(description="Read response from device") public String read() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(description="Write command and read response") public String read(@Argument(description="Command word") String command, @Argument(description="Arguments") String... args) throws org.lsst.ccs.drivers.commons.DriverException
command - The command word to sendargs - The argumentsorg.lsst.ccs.drivers.commons.DriverException@Command(description="Set read response timeout")
public void setTimeout(@Argument(description="Timeout value (msec)")
int time)
throws org.lsst.ccs.drivers.commons.DriverException
time - The timeout (msec); 0 means no timeoutorg.lsst.ccs.drivers.commons.DriverException@Command(description="Show read response timeout (msec)") public int showTimeout()
@Command(description="Set network connection timeout")
public void setConnTimeout(@Argument(description="Timeout value (msec)")
int time)
time - The timeout (msec); 0 means no timeout@Command(description="Show network connection timeout (msec)") public int showConnTimeout()
@Command(description="Set command terminator")
public void setCommandTerm(@Argument(description="Terminator enum")
Ascii.Terminator term)
term - The terminator to set@Command(description="Set response terminator")
public void setResponseTerm(@Argument(description="Terminator enum")
Ascii.Terminator term)
term - The terminator to set@Command(description="Set both terminators")
public void setTerminator(@Argument(description="Terminator enum")
Ascii.Terminator term)
term - The terminator to setCopyright © 2023 LSST. All rights reserved.