public class Multidrop extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Multidrop.ConnType
Connection type
|
static class |
Multidrop.Option
Operation options
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
address |
| Constructor and Description |
|---|
Multidrop() |
| 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.
|
Object |
getSyncObject()
Gets the synchronization object.
|
boolean |
isOpen()
Tests whether the device connection is open.
|
void |
open(Multidrop.ConnType type,
String ident,
int addr)
Opens a connection to the device with default parameters.
|
void |
open(Multidrop.ConnType type,
String ident,
int baudRate,
int addr)
Opens a connection to the device with default data characteristics.
|
void |
open(Multidrop.ConnType type,
String ident,
int baudRate,
int dataChar,
int addr)
Opens a connection to the device.
|
void |
openFtdi(String serialNo,
int addr)
Opens a connection to an FTDI device with default parameters.
|
void |
openFtdi(String serialNo,
int baudRate,
int addr)
Opens a connection to an FTDI device with default data characteristics.
|
void |
openFtdi(String serialNo,
int baudRate,
int dataChar,
int addr)
Opens a connection to an FTDI device.
|
void |
openSerial(String devcName,
int addr)
Opens a connection to a serial device with default parameters.
|
void |
openSerial(String devcName,
int baudRate,
int addr)
Opens a connection to a serial device with default data characteristic.
|
void |
openSerial(String devcName,
int baudRate,
int dataChar,
int addr)
Opens a connection to a serial device.
|
String |
read()
Reads a terminated response.
|
String |
read(String command)
Reads a response after writing a command.
|
int |
readBytes(byte[] buff,
int offset)
Reads available response data as bytes.
|
int |
readBytes(byte[] buff,
int offset,
int leng)
Reads available response data as bytes.
|
void |
setCommandTerm(Ascii.Terminator term)
Sets the command terminator.
|
void |
setDefaultAddress(int addr)
Sets the default multi-drop address.
|
void |
setDefaultBaud(int baud)
Sets the default baud rate.
|
void |
setOptions(Multidrop.Option option)
Sets the options.
|
void |
setResponseTerm(Ascii.Terminator term)
Sets the response terminator.
|
void |
setTerminator(Ascii.Terminator term)
Sets both the command & response terminators.
|
void |
setTimeout(double time)
Sets the read timeout.
|
void |
setTimeout(int time)
Sets the read timeout.
|
void |
write(String command)
Writes a command.
|
void |
writeBytes(byte[] command)
Writes a command as bytes.
|
void |
writeBytes(byte[] command,
int offset,
int leng)
Writes a command as bytes.
|
public void setOptions(Multidrop.Option option)
option - Various optionspublic void setDefaultBaud(int baud)
baud - Default baud ratepublic void setDefaultAddress(int addr)
addr - Default baud ratepublic void open(Multidrop.ConnType type, String ident, int baudRate, int dataChar, int addr) throws org.lsst.ccs.drivers.commons.DriverException
type - The enumerated type of connection to makeident - The device identifier:
serial number for FTDI device;
device name for serialbaudRate - The baud ratedataChar - The encoded data characteristics:
0 sets 8-bit, no parity, 1 stop bit, no flow controladdr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void open(Multidrop.ConnType type, String ident, int baudRate, int addr) throws org.lsst.ccs.drivers.commons.DriverException
type - The enumerated type of connection to makeident - The device identifier:
serial number for FTDI device;
device name for serialbaudRate - The baud rateaddr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void open(Multidrop.ConnType type, String ident, int addr) throws org.lsst.ccs.drivers.commons.DriverException
type - The enumerated type of connection to makeident - The device identifier:
serial number for FTDI device;
device name for serialaddr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void openSerial(String devcName, int baudRate, int dataChar, int addr) throws org.lsst.ccs.drivers.commons.DriverException
devcName - The device namebaudRate - The baud ratedataChar - The encoded data characteristics:
0 sets 8-bit, no parity, 1 stop bit, no flow ctrladdr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void openSerial(String devcName, int baudRate, int addr) throws org.lsst.ccs.drivers.commons.DriverException
devcName - The device namebaudRate - The baud rateaddr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void openSerial(String devcName, int addr) throws org.lsst.ccs.drivers.commons.DriverException
devcName - The device nameaddr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void openFtdi(String serialNo, int baudRate, int dataChar, int addr) throws org.lsst.ccs.drivers.commons.DriverException
serialNo - The USB serial numberbaudRate - The baud ratedataChar - The encoded data characteristics:
0 sets 8-bit, no parity, 1 stop bit, no flow ctrladdr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void openFtdi(String serialNo, int baudRate, int addr) throws org.lsst.ccs.drivers.commons.DriverException
serialNo - The USB serial numberbaudRate - The baud rateaddr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void openFtdi(String serialNo, int addr) throws org.lsst.ccs.drivers.commons.DriverException
serialNo - The USB serial numberaddr - The multi-drop addressorg.lsst.ccs.drivers.commons.DriverExceptionpublic void close()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverExceptionpublic boolean closeSilent()
public boolean isOpen()
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 writeBytes(byte[] command)
throws org.lsst.ccs.drivers.commons.DriverException
command - The command to write, including any terminatororg.lsst.ccs.drivers.commons.DriverExceptionpublic void writeBytes(byte[] command,
int offset,
int leng)
throws org.lsst.ccs.drivers.commons.DriverException
command - The command to write, including any terminatoroffset - The offset to the first byte to writeleng - The number of bytes to writeorg.lsst.ccs.drivers.commons.DriverExceptionpublic int readBytes(byte[] buff,
int offset)
throws org.lsst.ccs.drivers.commons.DriverException
buff - The buffer to receive the response dataoffset - The offset to the first available byte in the bufferorg.lsst.ccs.drivers.commons.DriverExceptionorg.lsst.ccs.drivers.commons.DriverTimeoutExceptionpublic int readBytes(byte[] buff,
int offset,
int leng)
throws org.lsst.ccs.drivers.commons.DriverException
buff - The buffer to receive the response dataoffset - The offset to the first available byte in the bufferleng - The maximum number of bytes to readorg.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 setResponseTerm(Ascii.Terminator term)
term - The expected terminator for a response (CR, LF or CRLF)public void setCommandTerm(Ascii.Terminator term)
term - The terminator to be appended to each command (CR, LF or CRLF)public void setTerminator(Ascii.Terminator term)
term - The terminator to be usedpublic 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.DriverExceptionpublic void setTimeout(int time)
throws org.lsst.ccs.drivers.commons.DriverException
time - The read timeout (msec). 0 means no timeout.org.lsst.ccs.drivers.commons.DriverExceptionpublic Object getSyncObject()
Copyright © 2020 LSST. All rights reserved.