|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
io.AbstractDriver
io.AbstractSerialDriver
io.SerialDriver
public class SerialDriver
A simple serial driver for use in stella.calib.CalibUnit and
MotorController
| Nested Class Summary | |
|---|---|
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. |
| Nested classes/interfaces inherited from class io.AbstractSerialDriver |
|---|
AbstractSerialDriver.Available |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
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. |
| Fields inherited from class io.AbstractSerialDriver |
|---|
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, outport, staticlock |
| Fields inherited from class io.AbstractDriver |
|---|
KEY_DRIVERNAME |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
SerialDriver(Map info)
Constructor. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class io.AbstractSerialDriver |
|---|
createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, isOpen, registerSoleEventListener, resetOriginalParameters |
| Methods inherited from class io.AbstractDriver |
|---|
createDriver, equals, hashCode |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, init, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, 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, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.Initializable |
|---|
init |
| Field Detail |
|---|
public 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
| Constructor Detail |
|---|
public SerialDriver(Map info)
| Method Detail |
|---|
public boolean open()
throws IOException
open in interface Driveropen in class AbstractSerialDriverIOExceptionpublic void exit()
exit in interface ExitCleaning
public String writeString(String cmd)
throws IOException
writeString in class AbstractSerialDriverIOException
public String readString()
throws IOException
readString in class AbstractSerialDriverIOException
public String writeCommand(String cmd)
throws IOException
KEY_STATICLOCK is true, otherwise
we lock on this. Releases the
lock after reading.
writeCommand in class AbstractSerialDriverIOException
private String doReadWriteCycle(String cmd)
throws IOException
IOException
public boolean close()
throws IOException
close in interface Driverclose in class AbstractSerialDriverIOException
protected 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||