jmri.jmrix.can.cbus
Class CbusThrottleManager

java.lang.Object
  extended by jmri.jmrix.AbstractThrottleManager
      extended by jmri.jmrix.can.cbus.CbusThrottleManager
All Implemented Interfaces:
EventListener, AbstractMRListener, CanListener, ThrottleManager

public class CbusThrottleManager
extends AbstractThrottleManager
implements ThrottleManager, CanListener

CBUS implementation of a ThrottleManager.

Author:
Bob Jacobsen Copyright (C) 2001, Andrew Crosland Copyright (C) 2009

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
 
Constructor Summary
CbusThrottleManager()
          Constructor.
 
Method Summary
 boolean addressTypeUnique()
          Are there any ambiguous addresses (short vs long) on this system?
 boolean canBeLongAddress(int address)
          Address 128 and above is a long address
 boolean canBeShortAddress(int address)
          Address 127 and below is a short address
 boolean disposeThrottle(DccThrottle t, ThrottleListener l)
          Not for general use, see releaseThrottle and dispatchThrottle.
 boolean hasDispatchFunction()
          CBUS does not have a Dispatch function
 void message(CanMessage m)
           
 void reply(CanReply m)
           
 void requestThrottleSetup(LocoAddress address, boolean control)
          Request a new throttle object be created for the address
protected  boolean singleUse()
          CBUS allows only one throttle per address
protected  void startThrottleRequestTimer()
          Start timer to wait for command station to respond to RLOC
 int supportedSpeedModes()
          What speed modes are supported by this system?
protected  void timeout()
          Internal routine to notify failed throttle request a timeout
 
Methods inherited from class jmri.jmrix.AbstractThrottleManager
addressReleased, addressStillRequired, attachListener, cancelThrottleRequest, cancelThrottleRequest, dispatchThrottle, failedThrottleRequest, getThrottleInfo, notifyThrottleKnown, releaseThrottle, removeListener, requestThrottle, requestThrottle, requestThrottle, requestThrottleSetup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.ThrottleManager
addressStillRequired, attachListener, cancelThrottleRequest, cancelThrottleRequest, dispatchThrottle, getThrottleInfo, releaseThrottle, removeListener, requestThrottle, requestThrottle, requestThrottle
 

Constructor Detail

CbusThrottleManager

public CbusThrottleManager()
Constructor. Gets a reference to the Cbus CommandStation.

Method Detail

singleUse

protected boolean singleUse()
CBUS allows only one throttle per address

Overrides:
singleUse in class AbstractThrottleManager

requestThrottleSetup

public void requestThrottleSetup(LocoAddress address,
                                 boolean control)
Request a new throttle object be created for the address

Specified by:
requestThrottleSetup in class AbstractThrottleManager

message

public void message(CanMessage m)
Specified by:
message in interface CanListener

reply

public void reply(CanReply m)
Specified by:
reply in interface CanListener

hasDispatchFunction

public boolean hasDispatchFunction()
CBUS does not have a Dispatch function

Specified by:
hasDispatchFunction in interface ThrottleManager
Overrides:
hasDispatchFunction in class AbstractThrottleManager

canBeLongAddress

public boolean canBeLongAddress(int address)
Address 128 and above is a long address

Specified by:
canBeLongAddress in interface ThrottleManager

canBeShortAddress

public boolean canBeShortAddress(int address)
Address 127 and below is a short address

Specified by:
canBeShortAddress in interface ThrottleManager

addressTypeUnique

public boolean addressTypeUnique()
Are there any ambiguous addresses (short vs long) on this system?

Specified by:
addressTypeUnique in interface ThrottleManager

startThrottleRequestTimer

protected void startThrottleRequestTimer()
Start timer to wait for command station to respond to RLOC


timeout

protected void timeout()
Internal routine to notify failed throttle request a timeout


supportedSpeedModes

public int supportedSpeedModes()
What speed modes are supported by this system? value should be xor of possible modes specifed by the DccThrottle interface

Specified by:
supportedSpeedModes in interface ThrottleManager
Overrides:
supportedSpeedModes in class AbstractThrottleManager

disposeThrottle

public boolean disposeThrottle(DccThrottle t,
                               ThrottleListener l)
Description copied from interface: ThrottleManager
Not for general use, see releaseThrottle and dispatchThrottle.

Dispose of object when finished it. This will free up hardware resource

Used for handling certain internal error conditions, where the object still exists but hardware is not associated with it.

After this, further usage of this Throttle object will result in a JmriException.

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