Package jmri.jmrix.loconet
Class LnTrafficRouter
java.lang.Object
jmri.jmrix.loconet.LnTrafficController
jmri.jmrix.loconet.LnTrafficRouter
- All Implemented Interfaces:
EventListener,LocoNetInterface,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
FieldsFields inherited from class jmri.jmrix.loconet.LnTrafficController
listeners, memo, receivedByteCount, receivedMsgCount, transmittedMsgCountFields inherited from interface jmri.jmrix.loconet.LocoNetInterface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS -
Constructor Summary
ConstructorsConstructorDescriptionCreate a default instance connected to a given SystemConnectionMemo. -
Method Summary
Modifier and TypeMethodDescriptionvoidMake connection to existing LocoNetInterface object for upstream communication.voidBreak connection to upstream LocoNetInterface object.booleanImplement abstract method to signal if there's a backlog of information waiting to be sent.voidReceive a LocoNet message from upstream and forward it to all the local clients.voidForward a preformatted LocoNetMessage to the actual interface.booleanstatus()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 Details
-
connected
boolean connected
-
-
Constructor Details
-
LnTrafficRouter
Create a default instance connected to a given SystemConnectionMemo.- Parameters:
m- the connected LocoNetSystemConnectionMemo- Since:
- 4.11.6
-
-
Method Details
-
status
Description copied from class:LnTrafficControllerCheck whether an implementation is operational. Returns true if operational.- Specified by:
statusin interfaceLocoNetInterface- Specified by:
statusin classLnTrafficController- Returns:
- true if implementation is operational.
-
sendLocoNetMessage
Forward a preformatted LocoNetMessage to the actual interface.- Specified by:
sendLocoNetMessagein interfaceLocoNetInterface- Specified by:
sendLocoNetMessagein classLnTrafficController- Parameters:
m- Message to send; will be updated with CRC
-
message
Receive a LocoNet message from upstream and forward it to all the local clients.- Specified by:
messagein 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
Make connection to existing LocoNetInterface object for upstream communication.- Parameters:
i- Interface to be connected
-
disconnectPort
Break connection to upstream LocoNetInterface object. Once broken, attempts to send via "message" member will fail.- Parameters:
i- previously connected interface
-
isXmtBusy
Implement abstract method to signal if there's a backlog of information waiting to be sent.- Specified by:
isXmtBusyin classLnTrafficController- Returns:
- true if busy, false if nothing waiting to send
-