Package jmri.jmrix.mrc
Class MrcTrafficController
- java.lang.Object
-
- jmri.jmrix.mrc.MrcTrafficController
-
- All Implemented Interfaces:
MrcInterface
- Direct Known Subclasses:
MrcPacketizer
public abstract class MrcTrafficController extends java.lang.Object implements MrcInterface
Converts Stream-based I/O to/from MRC messages. The "MrcInterface" side sends/receives message objects.The connection to a MrcPortController is via a pair of *Streams, which then carry sequences of characters for transmission. Note that this processing is handled in an independent thread.
This handles the state transitions, based on the necessary state in each message.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) MrcSystemConnectionMemoadaptermemo(package private) intcabAddressprotected intreceivedByteCountprotected intreceivedMsgCountprotected java.util.Vector<MrcTrafficListenerFilter>trafficListenersprotected inttransmittedMsgCount-
Fields inherited from interface jmri.jmrix.mrc.MrcInterface
ALL, CLOCK, POLL, POWER, PROGRAMMING, SENSORS, THROTTLEINFO, TURNOUTS
-
-
Constructor Summary
Constructors Constructor Description MrcTrafficController()Create a new MrcTrafficController instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddTrafficListener(int mask, MrcTrafficListener l)voidchangeTrafficListener(int mask, MrcTrafficListener l)MrcSystemConnectionMemogetAdapterMemo()intgetCabNumber()intgetReceivedByteCount()Monitor the number of bytes in MRC messaages received across the interface.intgetReceivedMsgCount()Monitor the number of MRC messaages received across the interface.java.lang.StringgetSystemPrefix()intgetTransmittedMsgCount()Monitor the number of MRC messages transmitted across the interface.java.lang.StringgetUserName()abstract booleanisXmtBusy()Is there a backlog of information for the outbound link?voidnotifyRcv(java.util.Date timestamp, MrcMessage m)voidnotifyXmit(java.util.Date timestamp, MrcMessage m)voidremoveTrafficListener(int mask, MrcTrafficListener l)voidresetStatistics()Reset statistics (received message count, transmitted message count, received byte count).abstract voidsendMrcMessage(MrcMessage m)voidsetAdapterMemo(MrcSystemConnectionMemo memo)voidsetCabNumber(int x)abstract booleanstatus()
-
-
-
Field Detail
-
cabAddress
int cabAddress
-
trafficListeners
protected java.util.Vector<MrcTrafficListenerFilter> trafficListeners
-
receivedMsgCount
protected int receivedMsgCount
-
receivedByteCount
protected int receivedByteCount
-
transmittedMsgCount
protected int transmittedMsgCount
-
adaptermemo
MrcSystemConnectionMemo adaptermemo
-
-
Constructor Detail
-
MrcTrafficController
public MrcTrafficController()
Create a new MrcTrafficController instance. Simple implementation.
-
-
Method Detail
-
setCabNumber
public void setCabNumber(int x)
-
getCabNumber
public int getCabNumber()
-
status
public abstract boolean status()
- Specified by:
statusin interfaceMrcInterface
-
sendMrcMessage
public abstract void sendMrcMessage(MrcMessage m)
- Specified by:
sendMrcMessagein interfaceMrcInterface
-
addTrafficListener
public void addTrafficListener(int mask, MrcTrafficListener l)
- Specified by:
addTrafficListenerin interfaceMrcInterface
-
removeTrafficListener
public void removeTrafficListener(int mask, MrcTrafficListener l)
- Specified by:
removeTrafficListenerin interfaceMrcInterface
-
changeTrafficListener
public void changeTrafficListener(int mask, MrcTrafficListener l)
- Specified by:
changeTrafficListenerin interfaceMrcInterface
-
notifyRcv
public void notifyRcv(java.util.Date timestamp, MrcMessage m)
-
notifyXmit
public void notifyXmit(java.util.Date timestamp, MrcMessage m)
-
isXmtBusy
public abstract boolean isXmtBusy()
Is there a backlog of information for the outbound link? This includes both in the program (e.g. the outbound queue) and in the command station interface (e.g. flow control from the port).- Returns:
- true if busy, false if nothing waiting to send
-
resetStatistics
public void resetStatistics()
Reset statistics (received message count, transmitted message count, received byte count).
-
getReceivedMsgCount
public int getReceivedMsgCount()
Monitor the number of MRC messaages received across the interface. This includes the messages this client has sent.- Returns:
- count of messages received
-
getReceivedByteCount
public int getReceivedByteCount()
Monitor the number of bytes in MRC messaages received across the interface. This includes the messages this client has sent.- Returns:
- count of bytes in received messages
-
getTransmittedMsgCount
public int getTransmittedMsgCount()
Monitor the number of MRC messages transmitted across the interface.- Returns:
- count of messages sent
-
getAdapterMemo
public MrcSystemConnectionMemo getAdapterMemo()
-
setAdapterMemo
public void setAdapterMemo(MrcSystemConnectionMemo memo)
-
getUserName
public java.lang.String getUserName()
-
getSystemPrefix
public java.lang.String getSystemPrefix()
-
-