Package jmri.jmrix.loconet
Class LnPr2ThrottleManager
- java.lang.Object
-
- jmri.jmrix.AbstractThrottleManager
-
- jmri.jmrix.loconet.LnPr2ThrottleManager
-
- All Implemented Interfaces:
ThrottleManager
public class LnPr2ThrottleManager extends AbstractThrottleManager
LocoNet implementation of a ThrottleManager for the PR2.Does direct "push" writes to the extended slot in the PR2.
The PR2 only allows a single locomotive address to be active, because it implements a single-slot command station.
- See Also:
AbstractThrottleManager
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
-
-
Field Summary
Fields Modifier and Type Field Description (package private) DccLocoAddress
activeAddress
-
Fields inherited from class jmri.jmrix.AbstractThrottleManager
adapterMemo, userName
-
-
Constructor Summary
Constructors Constructor Description LnPr2ThrottleManager(LocoNetSystemConnectionMemo memo)
Constructor, works via superclass.
-
Method Summary
All Methods Static 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)
Address 128 and above is a long addressboolean
canBeShortAddress(int address)
Address 127 and below is a short addressDccLocoAddress
getActiveAddress()
Make the active address available to the power manager, which needs it to turn on and off "neutral mode" in the locomotiveboolean
hasDispatchFunction()
PR2 does not have a Dispatch function(package private) static boolean
isLongAddress(int num)
void
requestThrottleSetup(LocoAddress address, boolean control)
Get a new Throttle object.protected boolean
singleUse()
PR2 allows only one throttle-
Methods inherited from class jmri.jmrix.AbstractThrottleManager
addressReleased, addressStillRequired, addressStillRequired, addressStillRequired, addressStillRequired, attachListener, cancelThrottleRequest, cancelThrottleRequest, cancelThrottleRequest, cancelThrottleRequest, dispatchThrottle, dispose, disposeThrottle, enablePrefSilentShareOption, enablePrefSilentStealOption, failedThrottleRequest, forceDisposeThrottle, getAddress, getAddress, getAddressProtocolTypes, getAddressTypes, 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, supportedSpeedModes, updateNumUsers
-
-
-
-
Field Detail
-
activeAddress
DccLocoAddress activeAddress
-
-
Constructor Detail
-
LnPr2ThrottleManager
public LnPr2ThrottleManager(LocoNetSystemConnectionMemo memo)
Constructor, works via superclass.- Parameters:
memo
- the LocoNetSystemConnectionMemo
-
-
Method Detail
-
singleUse
protected boolean singleUse()
PR2 allows only one throttleDoes 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
-
requestThrottleSetup
public void requestThrottleSetup(LocoAddress address, boolean control)
Get a new Throttle object. This immediately invokes the callback with the a new throttle object.- Specified by:
requestThrottleSetup
in classAbstractThrottleManager
- Parameters:
address
- addresscontrol
- false - read only.
-
hasDispatchFunction
public boolean hasDispatchFunction()
PR2 does not have a Dispatch function- Specified by:
hasDispatchFunction
in interfaceThrottleManager
- Overrides:
hasDispatchFunction
in classAbstractThrottleManager
- Returns:
- true if dispatch is possible; false otherwise
-
canBeLongAddress
public boolean canBeLongAddress(int address)
Address 128 and above is a long address- Parameters:
address
- address number to test- Returns:
- true if address can be long; false otherwise
-
canBeShortAddress
public boolean canBeShortAddress(int address)
Address 127 and below is a short address- 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
-
isLongAddress
static boolean isLongAddress(int num)
-
getActiveAddress
public DccLocoAddress getActiveAddress()
Make the active address available to the power manager, which needs it to turn on and off "neutral mode" in the locomotive- Returns:
- a DccLocoAddress
-
-