jmri.jmrix.direct
Class ThrottleManager

java.lang.Object
  extended by jmri.jmrix.AbstractThrottleManager
      extended by jmri.jmrix.direct.ThrottleManager
All Implemented Interfaces:
ThrottleManager

public class ThrottleManager
extends AbstractThrottleManager

Direct DCC implementation of a ThrottleManager.

When the traffic manager doesn't have anything else to do, it comes here to get a command to send.

This is a partial implementation, which can only handle one Throttle at a time. It also is missing logic to alternate sending speed and function commands; right now it only sends the first group of function packets.

Author:
Bob Jacobsen Copyright (C) 2004

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
 
Constructor Summary
ThrottleManager()
          Constructor.
 
Method Summary
 boolean addressTypeUnique()
          Are there not any ambiguous addresses (short vs long) on this system?
 boolean canBeLongAddress(int a)
          Check to see if a specific number is a valid long address on this system
 boolean canBeShortAddress(int a)
          Check to see if a specific number is a valid short address on this system
 boolean disposeThrottle(DccThrottle t, ThrottleListener l)
          Invoked when a throttle is released, this updates the local data structures
static ThrottleManager instance()
           
 void requestThrottleSetup(LocoAddress address, boolean control)
          Create throttle data structures.
 
Methods inherited from class jmri.jmrix.AbstractThrottleManager
addressReleased, addressStillRequired, attachListener, cancelThrottleRequest, cancelThrottleRequest, dispatchThrottle, failedThrottleRequest, getThrottleInfo, hasDispatchFunction, notifyThrottleKnown, releaseThrottle, removeListener, requestThrottle, requestThrottle, requestThrottle, requestThrottleSetup, singleUse, supportedSpeedModes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThrottleManager

public ThrottleManager()
Constructor.

Method Detail

instance

public static ThrottleManager instance()

requestThrottleSetup

public void requestThrottleSetup(LocoAddress address,
                                 boolean control)
Create throttle data structures.

Specified by:
requestThrottleSetup in class AbstractThrottleManager

addressTypeUnique

public boolean addressTypeUnique()
Description copied from interface: ThrottleManager
Are there not any ambiguous addresses (short vs long) on this system?


canBeShortAddress

public boolean canBeShortAddress(int a)
Description copied from interface: ThrottleManager
Check to see if a specific number is a valid short address on this system


canBeLongAddress

public boolean canBeLongAddress(int a)
Description copied from interface: ThrottleManager
Check to see if a specific number is a valid long address on this system


disposeThrottle

public boolean disposeThrottle(DccThrottle t,
                               ThrottleListener l)
Invoked when a throttle is released, this updates the local data structures

Specified by:
disposeThrottle in interface ThrottleManager
Overrides:
disposeThrottle in class AbstractThrottleManager
Parameters:
t - Throttle being released
l - Throttle Listener releasing the throttle
Returns:
true if the throttle has been disposed of.


Copyright © 1997 - 2011 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