jmri.jmrix.ecos
Class EcosDccThrottleManager

Show UML class diagram
java.lang.Object
  extended by jmri.jmrix.AbstractThrottleManager
      extended by jmri.jmrix.ecos.EcosDccThrottleManager
All Implemented Interfaces:
EventListener, AbstractMRListener, EcosListener, ThrottleManager

public class EcosDccThrottleManager
extends AbstractThrottleManager
implements EcosListener

EcosDCC implementation of a ThrottleManager.

Based on early NCE code.


Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
 
Field Summary
(package private) static org.slf4j.Logger log
           
 
Fields inherited from class jmri.jmrix.AbstractThrottleManager
adapterMemo, userName
 
Constructor Summary
EcosDccThrottleManager(EcosSystemConnectionMemo memo)
          Constructor.
 
Method Summary
 boolean addressTypeUnique()
          Are there any ambiguous addresses (short vs long) on this system?
 boolean canBeLongAddress(int address)
          Address 100 and above is a long address
 boolean canBeShortAddress(int address)
          Address 99 and below is a short address
 boolean disposeThrottle(DccThrottle t, ThrottleListener l)
          Not for general use, see releaseThrottle and dispatchThrottle.
 LocoAddress.Protocol[] getAddressProtocolTypes()
          returns an Integer list of different protocols that are supported by system, to include short vs long or DCC vs Selectrix vs Motorola
 String[] getAddressTypes()
          By default, only DCC in this implementation
 boolean hasDispatchFunction()
          Check to see if the Dispatch Button should be enabled or not Default to true, override if necessary
static EcosDccThrottleManager instance()
           
(package private) static boolean isLongAddress(int num)
           
 void message(EcosMessage m)
           
 void reply(EcosReply m)
           
 void requestThrottleSetup(LocoAddress address, boolean control)
          Abstract member to actually do the work of configuring a new throttle, usually via interaction with the DCC system
 int supportedSpeedModes()
          What speed modes are supported by this system?
 void throttleSetup(EcosDccThrottle throttle, LocoAddress address, boolean result)
           
 
Methods inherited from class jmri.jmrix.AbstractThrottleManager
addressReleased, addressStillRequired, attachListener, attachListener, attachListener, cancelThrottleRequest, cancelThrottleRequest, cancelThrottleRequest, dispatchThrottle, failedThrottleRequest, getAddress, getAddress, getAddressTypeString, getProtocolFromString, getThrottleInfo, getUserName, notifyThrottleKnown, releaseThrottle, removeListener, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottleSetup, singleUse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.slf4j.Logger log
Constructor Detail

EcosDccThrottleManager

public EcosDccThrottleManager(EcosSystemConnectionMemo memo)
Constructor.

Method Detail

instance

public static EcosDccThrottleManager instance()

reply

public void reply(EcosReply m)
Specified by:
reply in interface EcosListener

message

public void message(EcosMessage m)
Specified by:
message in interface EcosListener

requestThrottleSetup

public void requestThrottleSetup(LocoAddress address,
                                 boolean control)
Description copied from class: AbstractThrottleManager
Abstract member to actually do the work of configuring a new throttle, usually via interaction with the DCC system

Specified by:
requestThrottleSetup in class AbstractThrottleManager

hasDispatchFunction

public boolean hasDispatchFunction()
Description copied from class: AbstractThrottleManager
Check to see if the Dispatch Button should be enabled or not Default to true, override if necessary

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

canBeLongAddress

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

Specified by:
canBeLongAddress in interface ThrottleManager

canBeShortAddress

public boolean canBeShortAddress(int address)
Address 99 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

getAddressTypes

public String[] getAddressTypes()
Description copied from class: AbstractThrottleManager
By default, only DCC in this implementation

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

getAddressProtocolTypes

public LocoAddress.Protocol[] getAddressProtocolTypes()
Description copied from interface: ThrottleManager
returns an Integer list of different protocols that are supported by system, to include short vs long or DCC vs Selectrix vs Motorola

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

isLongAddress

static boolean isLongAddress(int num)

supportedSpeedModes

public int supportedSpeedModes()
Description copied from class: AbstractThrottleManager
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

throttleSetup

public void throttleSetup(EcosDccThrottle throttle,
                          LocoAddress address,
                          boolean result)

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-2013 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