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,
int param)
Opens connection to a device.
|
void |
open(org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
String ident,
int baud,
Ascii.DataBits dbits,
Ascii.StopBits sbits,
Ascii.Parity parity,
Ascii.FlowCtrl flow)
Opens connection to a device with serial data characteristics.
|
void |
openFtdi(String serial,
int baud)
Opens connection to an FTDI device.
|
void |
openNet(String host,
int port)
Opens connection to a network device.
|
void |
openSerial(String devc,
int baud)
Opens connection to a serial device.
|
String |
read()
Reads a response.
|
String |
read(String command)
Writes a command and reads the response.
|
void |
setCmndTerm(Ascii.Terminator term)
Sets the command terminator.
|
void |
setRespTerm(Ascii.Terminator term)
Sets the response terminator.
|
void |
setTerminator(Ascii.Terminator term)
Sets both the command and response terminators.
|
void |
setTimeout(double time)
Sets 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(name="open",
description="Open connection to general device")
public void open(@Argument(name="type",description="Connection type: net, serial or ftdi")
org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
@Argument(name="ident",description="Device identifier")
String ident,
@Argument(name="param",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(name="open",
description="Open connection with serial data characteristics")
public void open(@Argument(name="type",description="Connection type: serial or ftdi")
org.lsst.ccs.drivers.commons.DriverConstants.ConnType type,
@Argument(name="ident",description="Device identifier")
String ident,
@Argument(name="baud",description="Baud rate")
int baud,
@Argument(name="dbits",description="The number of data bits")
Ascii.DataBits dbits,
@Argument(name="sbits",description="The number of stop bits")
Ascii.StopBits sbits,
@Argument(name="parity",description="The parity")
Ascii.Parity parity,
@Argument(name="flow",description="The flow control")
Ascii.FlowCtrl flow)
throws org.lsst.ccs.drivers.commons.DriverException
type - The connection type (serial or ftdi)ident - The device identification (device name or USB serial no.)baud - 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(name="opennet",
description="Open connection to network device")
public void openNet(@Argument(name="host",description="Host name")
String host,
@Argument(name="port",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(name="openserial",
description="Open connection to serial device")
public void openSerial(@Argument(name="devc",description="Device name")
String devc,
@Argument(name="baud",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(name="openftdi",
description="Open connection to FTDI device")
public void openFtdi(@Argument(name="serial",description="USB serial number")
String serial,
@Argument(name="baud",description="Baud rate")
int baud)
throws org.lsst.ccs.drivers.commons.DriverException
serial - The USB serial numberbaud - The baud rateorg.lsst.ccs.drivers.commons.DriverException@Command(name="close",
description="Close connection to device")
public void close()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="write",
description="Write command to device")
public void write(@Argument(name="command",description="Command word")
String command,
@Argument(name="args",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(name="read",
description="Read response from device")
public String read()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException@Command(name="read",
description="Write command and read response")
public String read(@Argument(name="command",description="Command to send")
String command)
throws org.lsst.ccs.drivers.commons.DriverException
command - The command to sendorg.lsst.ccs.drivers.commons.DriverException@Command(name="settimeout",
description="Set read response timeout")
public void setTimeout(@Argument(name="time",description="Timeout value (sec)")
double time)
throws org.lsst.ccs.drivers.commons.DriverException
time - The timeout (secs); 0 means no timeoutorg.lsst.ccs.drivers.commons.DriverException@Command(name="setcmndterm",
description="Set command terminator")
public void setCmndTerm(@Argument(name="term",description="Terminator enum")
Ascii.Terminator term)
term - The terminator to set@Command(name="setrespterm",
description="Set response terminator")
public void setRespTerm(@Argument(name="term",description="Terminator enum")
Ascii.Terminator term)
term - The terminator to set@Command(name="setterm",
description="Set both terminators")
public void setTerminator(@Argument(name="term",description="Terminator enum")
Ascii.Terminator term)
term - The terminator to setCopyright © 2017 LSST. All rights reserved.