Class LnOverTcpPacketizer
- java.lang.Object
-
- jmri.jmrix.loconet.LnTrafficController
-
- jmri.jmrix.loconet.LnPacketizer
-
- jmri.jmrix.loconet.loconetovertcp.LnOverTcpPacketizer
-
- All Implemented Interfaces:
LocoNetInterface
public class LnOverTcpPacketizer extends LnPacketizer
Converts Stream-based I/O over the LocoNetOverTcp system network connection to/from LocoNet messages. The "LocoNetInterface" side sends/receives LocoNetMessage objects. The connection to a LnPortnetworkController 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 Classes Modifier and Type Class Description (package private) class
LnOverTcpPacketizer.RcvHandler
Captive class to handle incoming characters.(package private) class
LnOverTcpPacketizer.XmtHandler
Captive class to handle transmission.
-
Field Summary
Fields Modifier and Type Field Description LnNetworkPortController
networkController
(package private) static java.lang.String
RECEIVE_PREFIX
(package private) static java.lang.String
SEND_PREFIX
-
Fields inherited from class jmri.jmrix.loconet.LnPacketizer
controller, echo, istream, ostream, rcvHandler, rcvThread, threadStopRequest, xmtHandler, xmtList, xmtThread
-
Fields inherited from class jmri.jmrix.loconet.LnTrafficController
listeners, receivedByteCount, receivedMsgCount, transmittedMsgCount
-
Fields inherited from interface jmri.jmrix.loconet.LocoNetInterface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS
-
-
Constructor Summary
Constructors Constructor Description LnOverTcpPacketizer(LocoNetSystemConnectionMemo m)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connectPort(LnNetworkPortController p)
Make connection to an existing LnPortnetworkController object.void
disconnectPort(LnNetworkPortController p)
Break connection to existing LnPortnetworkController object.boolean
isXmtBusy()
Implement abstract method to signal if there's a backlog of information waiting to be sent.-
Methods inherited from class jmri.jmrix.loconet.LnPacketizer
connectPort, disconnectPort, dispose, messageTransmitted, readByteProtected, sendLocoNetMessage, startThreads, status, terminateThreads
-
Methods inherited from class jmri.jmrix.loconet.LnTrafficController
addLocoNetListener, getReceivedByteCount, getReceivedMsgCount, getSystemConnectionMemo, getTransmittedMsgCount, notify, removeLocoNetListener, resetStatistics, setSystemConnectionMemo
-
-
-
-
Field Detail
-
RECEIVE_PREFIX
static final java.lang.String RECEIVE_PREFIX
- See Also:
- Constant Field Values
-
SEND_PREFIX
static final java.lang.String SEND_PREFIX
- See Also:
- Constant Field Values
-
networkController
public LnNetworkPortController networkController
-
-
Constructor Detail
-
LnOverTcpPacketizer
public LnOverTcpPacketizer(LocoNetSystemConnectionMemo m)
-
-
Method Detail
-
isXmtBusy
public boolean isXmtBusy()
Description copied from class:LnPacketizer
Implement abstract method to signal if there's a backlog of information waiting to be sent.- Overrides:
isXmtBusy
in classLnPacketizer
- Returns:
- true if busy, false if nothing waiting to send
-
connectPort
public void connectPort(LnNetworkPortController p)
Make connection to an existing LnPortnetworkController object.- Parameters:
p
- Port networkController for connected. Save this for a later disconnect call
-
disconnectPort
public void disconnectPort(LnNetworkPortController p)
Break connection to existing LnPortnetworkController object. Once broken, attempts to send via "message" member will fail.- Parameters:
p
- previously connected port
-
-