public class SerialDriver extends AbstractSerialDriver implements ExitCleaning
stella.CalibStaticLockUnit.CalibUnit and
MotorController| Modifier and Type | Class and Description |
|---|---|
static class |
SerialDriver.Debug
Reads the properties from a file, open the port and writes a command
to it.
|
static class |
SerialDriver.Scan
Scans the comunication busses for available ports.
|
AbstractSerialDriver.Available| Modifier and Type | Field and Description |
|---|---|
private static long |
DEFDELAY
The default reading delay in ms.
|
private static long |
DEFRWCOOLDOWN
The default reading delay in ms.
|
private static boolean |
DEFSTATICLOCK
The default locking behaviour.
|
private BufferedReader |
input
Wrapped around the input stream.
|
static String |
KEY_DELAY
The key to the reading delay in msec.
|
static String |
KEY_RWCOOLDOWN
The key to the reading cooldown in msec.
|
static String |
KEY_STATICLOCK
If true, we lock on the static lock.
|
inport, KEY_BAUDRATE, KEY_CLOSETIMEOUT, KEY_DATABIT, KEY_FLOWCONTROL, KEY_INBUFFER, KEY_NOTIFYCOOLDOWN, KEY_OUTBUFFER, KEY_PARITYBIT, KEY_PORTNAME, KEY_RECEIVEFRAMING, KEY_RECEIVETHRESHOLD, KEY_RECEIVETIMEOUT, KEY_STOPBIT, KEY_TIMEOUT, LOCK, outport, STATICLOCKKEY_DRIVERNAMEKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASS| Constructor and Description |
|---|
SerialDriver(Map<String,String> info)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
close()
Additionally closes the input buffered reader.
|
private String |
doReadWriteCycle(String cmd)
Does a clear-line, write command, read-line cycle.
|
void |
exit()
Closes the port.
|
boolean |
open()
Initializes the serial port and wraps a buffered reader around the input
stream.
|
String |
readString()
Reads a string from the serial line.
|
protected String |
readString(long timeout)
Get the response from the controller.
|
String |
writeCommand(String cmd)
Writes a command and returns the result.
|
String |
writeString(String cmd)
Writes a string to the serial port.
|
createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, init, isOpen, registerSoleEventListener, resetOriginalParameterscreateDriver, equals, hashCodeaugment, augment, augment, augment, augment, clone, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, initProperties, isNew, parseObject, parseObject, reload, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringpublic static final String KEY_STATICLOCK
public static final String KEY_DELAY
public static final String KEY_RWCOOLDOWN
private static final boolean DEFSTATICLOCK
private static final long DEFDELAY
private static final long DEFRWCOOLDOWN
private BufferedReader input
public boolean open()
throws IOException
open in interface Driveropen in class AbstractSerialDriverIOExceptionpublic void exit()
exit in interface ExitCleaningpublic String writeString(String cmd) throws IOException
writeString in class AbstractSerialDriverIOExceptionpublic String readString() throws IOException
readString in class AbstractSerialDriverIOExceptionpublic String writeCommand(String cmd) throws IOException
KEY_STATICLOCK is true, otherwise
we lock on this. Releases the
lock after reading.writeCommand in class AbstractSerialDriverIOExceptionprivate String doReadWriteCycle(String cmd) throws IOException
IOExceptionpublic boolean close()
throws IOException
close in interface Driverclose in class AbstractSerialDriverIOExceptionprotected String readString(long timeout) throws IOException
timeout - Maximum time the
program should wait for the controller's response in ms.
It is useful to set it if response is expected
with some delay from the controller.IOException