jmri.jmrix.loconet
Class LocoNetThrottledTransmitter

java.lang.Object
  extended by jmri.jmrix.loconet.LocoNetThrottledTransmitter
All Implemented Interfaces:
LocoNetInterface

public class LocoNetThrottledTransmitter
extends Object
implements LocoNetInterface

Delay LocoNet messages that need to be throttled.

A LocoNetThrottledTransmitter object sits in front of a LocoNetInterface (e.g. TrafficHandler) and meters out specific LocoNet messages.

The internal Memo class is used to hold the pending message and the time it's to be sent. Time computations are in units of milliseconds, as that's all the accuracy that's needed here.

Author:
Bob Jacobsen Copyright (C) 2009

Field Summary
 
Fields inherited from interface jmri.jmrix.loconet.LocoNetInterface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS
 
Constructor Summary
LocoNetThrottledTransmitter(LocoNetInterface controller)
           
 
Method Summary
 void addLocoNetListener(int mask, LocoNetListener listener)
          Request notification of things happening on the LocoNet.
 void dispose()
          Cease operation, no more messages can be sent
 void removeLocoNetListener(int mask, LocoNetListener listener)
           
 void sendLocoNetMessage(LocoNetMessage msg)
          Accept a message to be sent after suitable delay.
 boolean status()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocoNetThrottledTransmitter

public LocoNetThrottledTransmitter(LocoNetInterface controller)
Method Detail

dispose

public void dispose()
Cease operation, no more messages can be sent


addLocoNetListener

public void addLocoNetListener(int mask,
                               LocoNetListener listener)
Description copied from interface: LocoNetInterface
Request notification of things happening on the LocoNet.

The 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.

Specified by:
addLocoNetListener in interface LocoNetInterface
Parameters:
mask - The OR of the key values of messages to be reported (to reduce traffic, provide for listeners interested in different things)
listener - Object to be notified of new messages as they arrive.

removeLocoNetListener

public void removeLocoNetListener(int mask,
                                  LocoNetListener listener)
Specified by:
removeLocoNetListener in interface LocoNetInterface

status

public boolean status()
Specified by:
status in interface LocoNetInterface

sendLocoNetMessage

public void sendLocoNetMessage(LocoNetMessage msg)
Accept a message to be sent after suitable delay.

Specified by:
sendLocoNetMessage in interface LocoNetInterface


Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads