Package jmri.jmrix.roco.z21
Class Z21XPressNetTunnel
- java.lang.Object
-
- jmri.jmrix.roco.z21.Z21XPressNetTunnel
-
- All Implemented Interfaces:
java.lang.Runnable
,java.util.EventListener
,AbstractMRListener
,XNetListener
,Z21Listener
public class Z21XPressNetTunnel extends java.lang.Object implements Z21Listener, XNetListener, java.lang.Runnable
Interface between z21 messages and an XpressNet stream.Parts of this code are derived from the jmri.jmrix.lenz.xnetsimulator.XNetSimulatorAdapter class.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) XNetStreamPortController
xsc
-
Constructor Summary
Constructors Constructor Description Z21XPressNetTunnel(Z21SystemConnectionMemo memo)
Build a new XpressNet tunnel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
(package private) XNetStreamPortController
getStreamPortController()
Package protected method to retrieve the stream port controller associated with this tunnel.void
message(XNetMessage msg)
Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout.void
message(XNetReply msg)
Member function that will be invoked by a XNetInterface implementation to forward a XNet message from the layout.void
message(Z21Message msg)
Member function that will be invoked by a z21Interface implementation to forward a z21 message sent to the layout.void
notifyTimeout(XNetMessage msg)
Member function invoked by an XNetInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.void
reply(Z21Reply msg)
Member function that will be invoked by a z21Interface implementation to forward a z21 message from the layout.void
run()
(package private) void
setStreamPortController(XNetStreamPortController x)
Package protected method to set the stream port controller associated with this tunnel.
-
-
-
Constructor Detail
-
Z21XPressNetTunnel
public Z21XPressNetTunnel(Z21SystemConnectionMemo memo)
Build a new XpressNet tunnel.- Parameters:
memo
- system connection.
-
-
Method Detail
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
reply
public void reply(Z21Reply msg)
Member function that will be invoked by a z21Interface implementation to forward a z21 message from the layout.- Specified by:
reply
in interfaceZ21Listener
- Parameters:
msg
- The received z21 message. Note that this same object may be presented to multiple users. It should not be modified here.
-
message
public void message(Z21Message msg)
Member function that will be invoked by a z21Interface implementation to forward a z21 message sent to the layout. Normally, this function will do nothing.- Specified by:
message
in interfaceZ21Listener
- Parameters:
msg
- The received z21 message. Note that this same object may be presented to multiple users. It should not be modified here.
-
message
public void message(XNetReply msg)
Member function that will be invoked by a XNetInterface implementation to forward a XNet message from the layout.- Specified by:
message
in interfaceXNetListener
- Parameters:
msg
- The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
message
public void message(XNetMessage msg)
Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout. Normally, this function will do nothing.- Specified by:
message
in interfaceXNetListener
- Parameters:
msg
- The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
notifyTimeout
public void notifyTimeout(XNetMessage msg)
Member function invoked by an XNetInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.- Specified by:
notifyTimeout
in interfaceXNetListener
- Parameters:
msg
- message which has timed out.
-
getStreamPortController
XNetStreamPortController getStreamPortController()
Package protected method to retrieve the stream port controller associated with this tunnel.- Returns:
- controller in use
-
setStreamPortController
void setStreamPortController(XNetStreamPortController x)
Package protected method to set the stream port controller associated with this tunnel.- Parameters:
x
- controller to retain
-
dispose
public void dispose()
-
-