Package jmri.jmrix.loconet.streamport
Class LnStreamPortPacketizer
java.lang.Object
jmri.jmrix.loconet.LnTrafficController
jmri.jmrix.loconet.LnPacketizer
jmri.jmrix.loconet.streamport.LnStreamPortPacketizer
- All Implemented Interfaces:
LocoNetInterface
- Direct Known Subclasses:
Z21LnStreamPortPacketizer
Converts Stream-based I/O to/from LocoNet messages. The "LocoNetInterface"
side sends/receives LocoNetMessage objects. The connection to a
LnPortController is via a pair of *Streams, which then carry sequences of
characters for transmission.
Messages come to this via the main GUI thread, and are forwarded back to listeners in that same thread. Reception and transmission are handled in dedicated threads by RcvHandler and XmtHandler objects. Those are internal classes defined here. The thread priorities are:
- RcvHandler - at highest available priority
- XmtHandler - down one, which is assumed to be above the GUI
- (everything else)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classCaptive class to handle transmissionNested classes/interfaces inherited from class jmri.jmrix.loconet.LnPacketizer
LnPacketizer.RcvHandler -
Field Summary
FieldsFields inherited from class jmri.jmrix.loconet.LnPacketizer
controller, echo, istream, ostream, rcvHandler, rcvThread, threadStopRequest, xmtHandler, xmtList, xmtThreadFields inherited from class jmri.jmrix.loconet.LnTrafficController
listeners, receivedByteCount, receivedMsgCount, transmittedMsgCountFields inherited from interface jmri.jmrix.loconet.LocoNetInterface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMake connection to existing LnPortController object.voidBreak connection to existing LnPortController object.booleanImplement abstract method to signal if there's a backlog of information waiting to be sent.voidInvoked at startup to start the threads needed here.Methods inherited from class jmri.jmrix.loconet.LnPacketizer
connectPort, disconnectPort, dispose, messageTransmitted, readByteProtected, sendLocoNetMessage, status, terminateThreadsMethods inherited from class jmri.jmrix.loconet.LnTrafficController
addLocoNetListener, getReceivedByteCount, getReceivedMsgCount, getSystemConnectionMemo, getTransmittedMsgCount, notify, removeLocoNetListener, resetStatistics, setSystemConnectionMemo
-
Field Details
-
streamController
-
-
Constructor Details
-
LnStreamPortPacketizer
-
-
Method Details
-
isXmtBusy
Description copied from class:LnPacketizerImplement abstract method to signal if there's a backlog of information waiting to be sent.- Overrides:
isXmtBusyin classLnPacketizer- Returns:
- true if busy, false if nothing waiting to send
-
connectPort
Make connection to existing LnPortController object.- Parameters:
p- Port controller to connect to. Save this for a later disconnect call
-
disconnectPort
Break connection to existing LnPortController object. Once broken, attempts to send via "message" member will fail.- Parameters:
p- previously connected port
-
startThreads
Invoked at startup to start the threads needed here.- Overrides:
startThreadsin classLnPacketizer
-