|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.loconet.LnTrafficController
public abstract class LnTrafficController
Abstract base class for implementations of LocoNetInterface.
This provides just the basic interface, plus the "" static method for locating the local implementation and some statistics support.
| Field Summary | |
|---|---|
protected Vector<LocoNetListener> |
listeners
|
protected int |
receivedByteCount
|
protected int |
receivedMsgCount
|
protected static LnTrafficController |
self
|
protected int |
transmittedMsgCount
|
| Fields inherited from interface jmri.jmrix.loconet.LocoNetInterface |
|---|
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS |
| Constructor Summary | |
|---|---|
LnTrafficController()
|
|
| Method Summary | |
|---|---|
void |
addLocoNetListener(int mask,
LocoNetListener l)
Request notification of things happening on the LocoNet. |
int |
getReceivedByteCount()
Monitor the number of bytes in LocoNet messaages received across the interface. |
int |
getReceivedMsgCount()
Monitor the number of LocoNet messaages received across the interface. |
int |
getTransmittedMsgCount()
Monitor the number of LocoNet messaages transmitted across the interface. |
static LnTrafficController |
instance()
static function returning the LnTrafficController instance to use. |
abstract boolean |
isXmtBusy()
Is there a backlog of information for the outbound link? |
void |
notify(LocoNetMessage m)
Forward a LocoNetMessage to all registered listeners. |
void |
removeLocoNetListener(int mask,
LocoNetListener l)
|
void |
resetStatistics()
Reset statistics (received message count, transmitted message count, received byte count) |
abstract void |
sendLocoNetMessage(LocoNetMessage m)
Forward a preformatted LocoNetMessage to the actual interface. |
abstract boolean |
status()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static LnTrafficController self
protected Vector<LocoNetListener> listeners
protected int receivedMsgCount
protected int receivedByteCount
protected int transmittedMsgCount
| Constructor Detail |
|---|
public LnTrafficController()
| Method Detail |
|---|
public static LnTrafficController instance()
public abstract boolean status()
status in interface LocoNetInterfacepublic abstract void sendLocoNetMessage(LocoNetMessage m)
Implementations should update the transmit count statistic.
sendLocoNetMessage in interface LocoNetInterfacem - Message to send; will be updated with CRC
public void addLocoNetListener(int mask,
LocoNetListener l)
LocoNetInterfaceThe same listener can register multiple times with different masks. (Multiple registrations with a single mask value are equivalent to a single registration) Mask values are defined as class constants. Note that these are bit masks, and should be OR'd, not added, if multiple values are desired.
The event notification contains the received message as source, not this object, so that we can notify of an incoming message to multiple places and then move on.
addLocoNetListener in interface LocoNetInterfacemask - The OR of the key values of messages to be reported (to reduce traffic,
provide for listeners interested in different things)l - Object to be notified of new messages as they arrive.
public void removeLocoNetListener(int mask,
LocoNetListener l)
removeLocoNetListener in interface LocoNetInterfacepublic void notify(LocoNetMessage m)
this needs to have public access, as
LnOverTcpPacketizer
and
IBLnPacketizer invoke it,
but don't inherit from it
m - Message to forward. Listeners should not modify it!public abstract boolean isXmtBusy()
public void resetStatistics()
public int getReceivedMsgCount()
public int getReceivedByteCount()
public int getTransmittedMsgCount()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||