public class Ascii extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Ascii.DataBits
Data characteristics - number of data bits
|
static class |
Ascii.FlowCtrl
Data characteristics - flow control
|
static class |
Ascii.Parity
Data characteristics - parity
|
static class |
Ascii.StopBits
Data characteristics - number of stop bits
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CONN_TYPE_FTDI
Connection type - serial via FTDI chip
|
static int |
CONN_TYPE_NETWORK
Connection type - network
|
static int |
CONN_TYPE_SERIAL
Connection type - serial via serial port
|
| Constructor and Description |
|---|
Ascii() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the device connection.
|
boolean |
closeSilent()
Closes the device connection silently.
|
void |
flush()
Flushes any unread data.
|
int |
makeDataCharacteristics(Ascii.DataBits dataBits,
Ascii.StopBits stopBits,
Ascii.Parity parity,
Ascii.FlowCtrl flowCtrl)
Generates the serial data characteristics parameter.
|
void |
open(int type,
String ident,
int parm)
Opens a connection to the device.
|
void |
open(int type,
String ident,
int parm1,
int parm2)
Opens a connection to the device.
|
String |
read()
Reads a response.
|
String |
read(String command)
Reads a response after writing a command.
|
void |
setTerminator(String term)
Sets the command terminator.
|
void |
setTimeout(double time)
Sets the read timeout.
|
void |
write(String command)
Writes a command.
|
public static final int CONN_TYPE_NETWORK
public static final int CONN_TYPE_FTDI
public static final int CONN_TYPE_SERIAL
public void open(int type,
String ident,
int parm)
throws org.lsst.ccs.drivers.commons.DriverException
type - The type of connection to makeident - The device identifier:
host name or IP address for network;
serial number for FTDI device;
device name for serialparm - The device parameter:
port number for network;
baud rate for FTDI or serialorg.lsst.ccs.drivers.commons.DriverExceptionpublic void open(int type,
String ident,
int parm1,
int parm2)
throws org.lsst.ccs.drivers.commons.DriverException
type - The type of connection to makeident - The device identifier:
host name or IP address for network;
serial number for FTDI device;
device name for serialparm1 - The first device parameter:
port number for network;
baud rate for FTDI or serialparm2 - The second device parameter:
unused for network;
encoded data characteristics for FTDI or serial:
0 sets 8-bit, no parity, 1 stop bit, no flow ctrlorg.lsst.ccs.drivers.commons.DriverExceptionpublic int makeDataCharacteristics(Ascii.DataBits dataBits, Ascii.StopBits stopBits, Ascii.Parity parity, Ascii.FlowCtrl flowCtrl)
dataBits - The enumerated number of data bitsstopBits - The enumerated number of stop bitsparity - The enumerated parityflowCtrl - The enumerated flow controlpublic void close()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionpublic boolean closeSilent()
public void write(String command) throws org.lsst.ccs.drivers.commons.DriverException
command - The command to write, excluding terminatororg.lsst.ccs.drivers.commons.DriverExceptionpublic String read() throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionorg.lsst.ccs.drivers.commons.DriverTimeoutExceptionpublic String read(String command) throws org.lsst.ccs.drivers.commons.DriverException
command - The command to write, excluding terminatororg.lsst.ccs.drivers.commons.DriverExceptionorg.lsst.ccs.drivers.commons.DriverTimeoutExceptionpublic void flush()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionpublic void setTerminator(String term)
term - The terminator to be appended to each sent commandpublic void setTimeout(double time)
throws org.lsst.ccs.drivers.commons.DriverException
time - The read timeout (sec). 0 means no timeout.org.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2014 LSST. All rights reserved.