Package jmri.jmrix.bidib
Class BiDiBThrottleManager
- java.lang.Object
-
- jmri.jmrix.AbstractThrottleManager
-
- jmri.jmrix.bidib.BiDiBThrottleManager
-
- All Implemented Interfaces:
ThrottleManager
public class BiDiBThrottleManager extends AbstractThrottleManager
BiDiB implementation of a ThrottleManager.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
prefix
(package private) BiDiBTrafficController
tc
protected java.util.HashMap<LocoAddress,BiDiBThrottle>
throttles
-
Fields inherited from class jmri.jmrix.AbstractThrottleManager
adapterMemo, userName
-
-
Constructor Summary
Constructors Constructor Description BiDiBThrottleManager(BiDiBSystemConnectionMemo memo)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addressTypeUnique()
Are there any ambiguous addresses (short vs long) on this system?boolean
canBeLongAddress(int address)
Addresses 0-10239 can be longboolean
canBeShortAddress(int address)
The short addresses 1-127 are availablevoid
dispatchThrottle(DccThrottle t, ThrottleListener l)
The throttle listener has finished with the specific Throttle and is is available for reuse/reallocation by somebody else.boolean
disposeThrottle(DccThrottle t, ThrottleListener l)
Not for general use, seereleaseThrottle
anddispatchThrottle
.void
releaseThrottle(DccThrottle t, ThrottleListener l)
The specified Throttle Listener has finished using a given throttle and no longer requires access to it.void
requestThrottleSetup(LocoAddress a, boolean control)
Abstract member to actually do the work of configuring a new throttle, usually via interaction with the DCC system.protected boolean
singleUse()
Does this DCC system allow a Throttle (e.g. an address) to be used by only one user at a time?java.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, dispose, enablePrefSilentShareOption, enablePrefSilentStealOption, failedThrottleRequest, forceDisposeThrottle, getAddress, getAddress, getAddressProtocolTypes, getAddressTypes, getAddressTypeString, getProtocolFromString, getThrottleInfo, getThrottleUsageCount, getThrottleUsageCount, getThrottleUsageCount, getThrottleUsageCount, getUserName, hasDispatchFunction, hideStealNotifications, makeHardwareDecision, notifyDecisionRequest, notifyThrottleKnown, removeListener, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottleSetup, responseThrottleDecision, responseThrottleDecision, responseThrottleDecision, showSessionCancelDialogue, updateNumUsers
-
-
-
-
Field Detail
-
throttles
protected java.util.HashMap<LocoAddress,BiDiBThrottle> throttles
-
prefix
java.lang.String prefix
-
-
Constructor Detail
-
BiDiBThrottleManager
public BiDiBThrottleManager(BiDiBSystemConnectionMemo memo)
Constructor.- Parameters:
memo
- system connection memo
-
-
Method Detail
-
requestThrottleSetup
public void requestThrottleSetup(LocoAddress a, 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 classAbstractThrottleManager
- Parameters:
a
- addresscontrol
- false - read only.
-
singleUse
protected boolean singleUse()
Description copied from class:AbstractThrottleManager
Does this DCC system allow a Throttle (e.g. an address) to be used by only one user at a time?- Overrides:
singleUse
in classAbstractThrottleManager
- Returns:
- true or false
-
canBeLongAddress
public boolean canBeLongAddress(int address)
Addresses 0-10239 can be long- Parameters:
address
- address number to test- Returns:
- true if address can be long; false otherwise
-
canBeShortAddress
public boolean canBeShortAddress(int address)
The short addresses 1-127 are available- 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?- Returns:
- true if ambiguous addresses are not allowed; false otherwise
-
supportedSpeedModes
public java.util.EnumSet<SpeedStepMode> 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 interfaceThrottleManager
- Overrides:
supportedSpeedModes
in classAbstractThrottleManager
- Returns:
- an XOR of the possible modes specified in the throttle interface
-
dispatchThrottle
public void dispatchThrottle(DccThrottle t, ThrottleListener l)
Description copied from class:AbstractThrottleManager
The throttle listener has finished with the specific Throttle and is is available for reuse/reallocation by somebody else. If possible, tell the layout that this locomotive has been dispatched to another user. Not all layouts will implement this, in which case it is synomous with release();Normally, dispatch ends with a call to dispose.
- Specified by:
dispatchThrottle
in interfaceThrottleManager
- Overrides:
dispatchThrottle
in classAbstractThrottleManager
- Parameters:
t
- Throttle being releasedl
- Throttle Listener releasing the throttle
-
releaseThrottle
public void releaseThrottle(DccThrottle t, ThrottleListener l)
Description copied from class:AbstractThrottleManager
The specified Throttle Listener has finished using a given throttle and no longer requires access to it.After releasing the throttle, the manager will perform further checks to see if it is in use by any other listeners or if there are any PropertyChangeListeners attached. If there are no other uses of the throttle then it is disposed of.
Normally, release ends with a call to dispose.
- Specified by:
releaseThrottle
in interfaceThrottleManager
- Overrides:
releaseThrottle
in classAbstractThrottleManager
- Parameters:
t
- Throttle being releasedl
- Throttle Listener releasing the throttle
-
disposeThrottle
public boolean disposeThrottle(DccThrottle t, ThrottleListener l)
Not for general use, seereleaseThrottle
anddispatchThrottle
.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 interfaceThrottleManager
- Overrides:
disposeThrottle
in classAbstractThrottleManager
- Parameters:
t
- Throttle being releasedl
- Throttle Listener releasing the throttle- Returns:
- true if the throttle has been disposed of.
-
-