|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.qsi.QsiTrafficController
public class QsiTrafficController
Converts Stream-based I/O to/from QSI messages. The "QsiInterface" side sends/receives message objects. The connection to a QsiPortController is via a pair of *Streams, which then carry sequences of characters for transmission. Note that this processing is handled in an independent thread.
Messages to and from the programmer are in a packet format. In both directions, every message starts with 'S' and ends with 'E'. These are handled automatically, and are not included in the QsiMessage and QsiReply content.
| Field Summary | |
|---|---|
protected Vector<QsiListener> |
cmdListeners
|
(package private) DataInputStream |
istream
|
(package private) QsiListener |
lastSender
|
(package private) static org.slf4j.Logger |
log
|
static int |
NORMAL
|
(package private) OutputStream |
ostream
|
protected static QsiTrafficController |
self
|
static int |
SIIBOOTMODE
|
static int |
V4BOOTMODE
|
| Constructor Summary | |
|---|---|
QsiTrafficController()
|
|
| Method Summary | |
|---|---|
void |
addQsiListener(QsiListener l)
|
void |
connectPort(QsiPortController p)
Make connection to existing PortController object. |
void |
disconnectPort(QsiPortController p)
Break connection to existing QsiPortController object. |
(package private) boolean |
endNormalReply(QsiReply msg)
|
(package private) boolean |
endReply(QsiReply msg)
|
int |
getQsiState()
|
(package private) void |
handleOneIncomingReply()
|
static QsiTrafficController |
instance()
static function returning the QsiTrafficController instance to use. |
boolean |
isNormalMode()
|
boolean |
isSIIBootMode()
|
boolean |
isV4BootMode()
|
protected void |
notifyMessage(QsiMessage m,
QsiListener notMe)
Forward a QsiMessage to all registered QsiInterface listeners. |
protected void |
notifyReply(QsiReply r)
|
void |
removeQsiListener(QsiListener l)
|
void |
run()
Handle incoming characters. |
void |
sendQsiMessage(QsiMessage m,
QsiListener reply)
Forward a preformatted message to the actual interface. |
void |
setQsiState(int s)
|
boolean |
status()
Test operational status of interface. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Vector<QsiListener> cmdListeners
QsiListener lastSender
public static final int NORMAL
public static final int SIIBOOTMODE
public static final int V4BOOTMODE
protected static volatile QsiTrafficController self
DataInputStream istream
OutputStream ostream
static org.slf4j.Logger log
| Constructor Detail |
|---|
public QsiTrafficController()
| Method Detail |
|---|
public boolean status()
QsiInterface
status in interface QsiInterfacepublic void addQsiListener(QsiListener l)
addQsiListener in interface QsiInterfacepublic void removeQsiListener(QsiListener l)
removeQsiListener in interface QsiInterface
protected void notifyMessage(QsiMessage m,
QsiListener notMe)
public int getQsiState()
public void setQsiState(int s)
public boolean isNormalMode()
public boolean isSIIBootMode()
public boolean isV4BootMode()
protected void notifyReply(QsiReply r)
public void sendQsiMessage(QsiMessage m,
QsiListener reply)
sendQsiMessage in interface QsiInterfacem - Message to be sent.reply - Listener to be notified of reply.public void connectPort(QsiPortController p)
public void disconnectPort(QsiPortController p)
public static QsiTrafficController instance()
public void run()
connectPort.
Terminates with the input stream breaking out of the try block.
run in interface Runnable
void handleOneIncomingReply()
throws IOException
IOExceptionboolean endReply(QsiReply msg)
boolean endNormalReply(QsiReply msg)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||