Package jmri.jmrix.loconet
Class LnTrafficRouter
- java.lang.Object
-
- jmri.jmrix.loconet.LnTrafficController
-
- jmri.jmrix.loconet.LnTrafficRouter
-
- All Implemented Interfaces:
java.util.EventListener
,LocoNetInterface
,LocoNetListener
public class LnTrafficRouter extends LnTrafficController implements LocoNetListener
Implements a LocoNetInterface by doing a scatter-gather to another, simpler implementation.This is intended for remote operation, where only one copy of each message should go to/from another node. By putting an LnTrafficRouter implementation at the remote node, all of the routing of messages to multiple consumers can be done without traffic over the connection.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
connected
-
Fields inherited from class jmri.jmrix.loconet.LnTrafficController
listeners, memo, receivedByteCount, receivedMsgCount, transmittedMsgCount
-
Fields inherited from interface jmri.jmrix.loconet.LocoNetInterface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS
-
-
Constructor Summary
Constructors Constructor Description LnTrafficRouter(LocoNetSystemConnectionMemo m)
Create a default instance connected to a given SystemConnectionMemo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connect(LocoNetInterface i)
Make connection to existing LocoNetInterface object for upstream communication.void
disconnectPort(LocoNetInterface i)
Break connection to upstream LocoNetInterface object.boolean
isXmtBusy()
Implement abstract method to signal if there's a backlog of information waiting to be sent.void
message(LocoNetMessage m)
Receive a LocoNet message from upstream and forward it to all the local clients.void
sendLocoNetMessage(LocoNetMessage m)
Forward a preformatted LocoNetMessage to the actual interface.boolean
status()
Check whether an implementation is operational.-
Methods inherited from class jmri.jmrix.loconet.LnTrafficController
addLocoNetListener, dispose, getReceivedByteCount, getReceivedMsgCount, getSystemConnectionMemo, getTransmittedMsgCount, notify, removeLocoNetListener, resetStatistics, setSystemConnectionMemo
-
-
-
-
Field Detail
-
connected
boolean connected
-
-
Constructor Detail
-
LnTrafficRouter
public LnTrafficRouter(LocoNetSystemConnectionMemo m)
Create a default instance connected to a given SystemConnectionMemo.- Parameters:
m
- the connected LocoNetSystemConnectionMemo- Since:
- 4.11.6
-
-
Method Detail
-
status
public boolean status()
Description copied from class:LnTrafficController
Check whether an implementation is operational. Returns true if operational.- Specified by:
status
in interfaceLocoNetInterface
- Specified by:
status
in classLnTrafficController
- Returns:
- true if implementation is operational.
-
sendLocoNetMessage
public void sendLocoNetMessage(LocoNetMessage m)
Forward a preformatted LocoNetMessage to the actual interface.- Specified by:
sendLocoNetMessage
in interfaceLocoNetInterface
- Specified by:
sendLocoNetMessage
in classLnTrafficController
- Parameters:
m
- Message to send; will be updated with CRC
-
message
public void message(LocoNetMessage m)
Receive a LocoNet message from upstream and forward it to all the local clients.- Specified by:
message
in interfaceLocoNetListener
- Parameters:
m
- The received LocoNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
connect
public void connect(LocoNetInterface i)
Make connection to existing LocoNetInterface object for upstream communication.- Parameters:
i
- Interface to be connected
-
disconnectPort
public void disconnectPort(LocoNetInterface i)
Break connection to upstream LocoNetInterface object. Once broken, attempts to send via "message" member will fail.- Parameters:
i
- previously connected interface
-
isXmtBusy
public boolean isXmtBusy()
Implement abstract method to signal if there's a backlog of information waiting to be sent.- Specified by:
isXmtBusy
in classLnTrafficController
- Returns:
- true if busy, false if nothing waiting to send
-
-