|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
stella.io.RS485ReadWriteServer.ReadWrite
protected class RS485ReadWriteServer.ReadWrite
A cancelable thread that does the following things on run.
RS485ReadWriteServer#lock object.RS485ReadWriteServer.writeString(java.lang.String) method to write the
command it was constructed with to the serial port.RS485ReadWriteServer.KEY_CR
character is read or the number of bytes to read is reached.RS485ReadWriteServer.interpretString(java.lang.String) method.#lock object and dies.getResult() method.cancel flag to true. This allows
the thread to die prematurely. In this case, the serial line is
cleared of any remaining bytes. These bytes are copied to the
getResult() method. The correct execution of the thread can be
queired with the isCancel() method.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
Thread.State, Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
private boolean |
busy
The bsuy flag indicating that a read/write cycle is in progress. |
private boolean |
cancel
The cancel flag. |
private String |
command
The command to write to the serial line. |
private String |
result
The result read-in from the serial line. |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
protected |
RS485ReadWriteServer.ReadWrite(String cmd)
Constructs a new, self-starting read/write thread. |
| Method Summary | |
|---|---|
String |
getResult()
Returns the result of the read associated with this thread. |
boolean |
isBusy()
Returns the status of the busy flag. |
boolean |
isCancel()
Returns the status of the cancel flag. |
void |
run()
The run command. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private boolean cancel
private String command
private String result
private boolean busy
| Constructor Detail |
|---|
protected RS485ReadWriteServer.ReadWrite(String cmd)
| Method Detail |
|---|
public void run()
cancel variable.
run in interface Runnablerun in class Threadpublic String getResult()
If this method is called while the reading thread is still alive,
we join on the read thread for a maximum of RS485ReadWriteServer.KEY_RESPONDTIME
ms. If the thread is still alife after that period, the read thread
is canceld, and we join again on the thread until it really dies.
public boolean isCancel()
getResult() method received a time-out during waiting
for the retrieval of the data. If this method is called
prior to the getResult() method it will always return
false.
public boolean isBusy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||