Package jmri.jmrix.roco.z21
Class Z21LocoNetTunnel
- java.lang.Object
-
- jmri.jmrix.roco.z21.Z21LocoNetTunnel
-
- All Implemented Interfaces:
java.lang.Runnable
,java.util.EventListener
,AbstractMRListener
,LocoNetListener
,Z21Listener
public class Z21LocoNetTunnel extends java.lang.Object implements Z21Listener, LocoNetListener, java.lang.Runnable
Interface between z21 messages and an LocoNet 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) LnStreamPortController
lsc
-
Constructor Summary
Constructors Constructor Description Z21LocoNetTunnel(Z21SystemConnectionMemo memo)
Build a new LocoNet tunnel.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
(package private) LnStreamPortController
getStreamPortController()
Package protected method to retrieve the stream port controller associated with this tunnel.void
message(LocoNetMessage msg)
Member function that will be invoked by a LocoNet Interface implementation to forward a LocoNet message sent to 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
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(LnStreamPortController x)
Package protected method to set the stream port controller associated with this tunnel.
-
-
-
Constructor Detail
-
Z21LocoNetTunnel
public Z21LocoNetTunnel(Z21SystemConnectionMemo memo)
Build a new LocoNet 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(LocoNetMessage msg)
Member function that will be invoked by a LocoNet Interface implementation to forward a LocoNet message sent to the layout. Normally, this function will do nothing.- Specified by:
message
in interfaceLocoNetListener
- Parameters:
msg
- The received LocoNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
getStreamPortController
LnStreamPortController getStreamPortController()
Package protected method to retrieve the stream port controller associated with this tunnel.- Returns:
- PortController for this connection
-
setStreamPortController
void setStreamPortController(LnStreamPortController x)
Package protected method to set the stream port controller associated with this tunnel.- Parameters:
x
- PortController for this connection
-
dispose
public void dispose()
-
-