Package jmri.jmrix.marklin
Class MarklinThrottleManager
- java.lang.Object
-
- jmri.jmrix.AbstractThrottleManager
-
- jmri.jmrix.marklin.MarklinThrottleManager
-
- All Implemented Interfaces:
java.util.EventListener,AbstractMRListener,MarklinListener,ThrottleManager
public class MarklinThrottleManager extends AbstractThrottleManager implements MarklinListener
MarklinDCC implementation of a ThrottleManager.Based on early NCE code and on work by Bob Jacobsen.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.AbstractThrottleManager
adapterMemo, userName
-
-
Constructor Summary
Constructors Constructor Description MarklinThrottleManager(MarklinSystemConnectionMemo memo)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddressTypeUnique()Are there any ambiguous addresses (short vs long) on this system?booleancanBeLongAddress(int address)Address 100 and above is a long addressbooleancanBeShortAddress(int address)Address 99 and below is a short addressbooleandisposeThrottle(DccThrottle t, ThrottleListener l)Not for general use, seereleaseThrottleanddispatchThrottle.LocoAddress.Protocol[]getAddressProtocolTypes()Get a list of different protocols supported by the system, to include short vs long or DCC vs Selectrix vs Motorola.java.lang.String[]getAddressTypes()By default, only DCC in this implementationbooleanhasDispatchFunction()Check to see if the Dispatch Button should be enabled or not Default to true, override if necessary(package private) static booleanisLongAddress(int num)voidmessage(MarklinMessage m)voidreply(MarklinReply m)voidrequestThrottleSetup(LocoAddress address, boolean control)Abstract member to actually do the work of configuring a new throttle, usually via interaction with the DCC system.protected booleansingleUse()Returns falsejava.util.EnumSet<SpeedStepMode>supportedSpeedModes()What speed modes are supported by this system?-
Methods inherited from class jmri.jmrix.AbstractThrottleManager
addressReleased, addressStillRequired, addressStillRequired, addressStillRequired, addressStillRequired, attachListener, cancelThrottleRequest, cancelThrottleRequest, cancelThrottleRequest, cancelThrottleRequest, dispatchThrottle, dispose, enablePrefSilentShareOption, enablePrefSilentStealOption, failedThrottleRequest, forceDisposeThrottle, getAddress, getAddress, getAddressTypeString, getProtocolFromString, getThrottleInfo, getThrottleUsageCount, getThrottleUsageCount, getThrottleUsageCount, getThrottleUsageCount, getUserName, hideStealNotifications, makeHardwareDecision, notifyDecisionRequest, notifyThrottleKnown, releaseThrottle, removeListener, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottleSetup, responseThrottleDecision, responseThrottleDecision, responseThrottleDecision, showSessionCancelDialogue, updateNumUsers
-
-
-
-
Constructor Detail
-
MarklinThrottleManager
public MarklinThrottleManager(MarklinSystemConnectionMemo memo)
Constructor.- Parameters:
memo- system connection.
-
-
Method Detail
-
reply
public void reply(MarklinReply m)
- Specified by:
replyin interfaceMarklinListener
-
message
public void message(MarklinMessage m)
- Specified by:
messagein interfaceMarklinListener
-
requestThrottleSetup
public void requestThrottleSetup(LocoAddress address, boolean control)
Description copied from class:AbstractThrottleManagerAbstract member to actually do the work of configuring a new throttle, usually via interaction with the DCC system.- Specified by:
requestThrottleSetupin classAbstractThrottleManager- Parameters:
address- addresscontrol- false - read only.
-
hasDispatchFunction
public boolean hasDispatchFunction()
Description copied from class:AbstractThrottleManagerCheck to see if the Dispatch Button should be enabled or not Default to true, override if necessary- Specified by:
hasDispatchFunctionin interfaceThrottleManager- Overrides:
hasDispatchFunctionin classAbstractThrottleManager- Returns:
- true if dispatch is possible; false otherwise
-
canBeLongAddress
public boolean canBeLongAddress(int address)
Address 100 and above is a long address- Specified by:
canBeLongAddressin interfaceThrottleManager- Parameters:
address- address number to test- Returns:
- true if address can be long; false otherwise
-
canBeShortAddress
public boolean canBeShortAddress(int address)
Address 99 and below is a short address- Specified by:
canBeShortAddressin interfaceThrottleManager- Parameters:
address- address number to test- Returns:
- true if address can be short; false otherwise
-
addressTypeUnique
public boolean addressTypeUnique()
Are there any ambiguous addresses (short vs long) on this system?- Specified by:
addressTypeUniquein interfaceThrottleManager- Returns:
- true if ambiguous addresses are not allowed; false otherwise
-
singleUse
protected boolean singleUse()
Returns falseDoes this DCC system allow a Throttle (e.g. an address) to be used by only one user at a time?
- Overrides:
singleUsein classAbstractThrottleManager- Returns:
- true or false
-
getAddressTypes
public java.lang.String[] getAddressTypes()
Description copied from class:AbstractThrottleManagerBy default, only DCC in this implementation- Specified by:
getAddressTypesin interfaceThrottleManager- Overrides:
getAddressTypesin classAbstractThrottleManager- Returns:
- the list of supported address protocols
-
getAddressProtocolTypes
public LocoAddress.Protocol[] getAddressProtocolTypes()
Description copied from class:AbstractThrottleManagerGet a list of different protocols supported by the system, to include short vs long or DCC vs Selectrix vs Motorola.- Specified by:
getAddressProtocolTypesin interfaceThrottleManager- Overrides:
getAddressProtocolTypesin classAbstractThrottleManager- Returns:
- a list of supported address protocols
-
isLongAddress
static boolean isLongAddress(int num)
-
supportedSpeedModes
public java.util.EnumSet<SpeedStepMode> supportedSpeedModes()
Description copied from class:AbstractThrottleManagerWhat speed modes are supported by this system? value should be xor of possible modes specifed by the DccThrottle interface- Specified by:
supportedSpeedModesin interfaceThrottleManager- Overrides:
supportedSpeedModesin classAbstractThrottleManager- Returns:
- an XOR of the possible modes specified in the throttle interface
-
disposeThrottle
public boolean disposeThrottle(DccThrottle t, ThrottleListener l)
Description copied from class:AbstractThrottleManagerNot for general use, seereleaseThrottleanddispatchThrottle.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:
disposeThrottlein interfaceThrottleManager- Overrides:
disposeThrottlein classAbstractThrottleManager- Parameters:
t- Throttle being releasedl- Throttle Listener releasing the throttle- Returns:
- true if the throttle has been disposed of.
-
-