Package jmri.jmrix.direct
Class ThrottleManager
- java.lang.Object
-
- jmri.jmrix.AbstractThrottleManager
-
- jmri.jmrix.direct.ThrottleManager
-
- All Implemented Interfaces:
ThrottleManager
public class ThrottleManager extends AbstractThrottleManager
Direct DCC implementation of a ThrottleManager.When the traffic manager doesn't have anything else to do, it comes here to get a command to send.
This is a partial implementation, which can only handle one Throttle at a time. It also is missing logic to alternate sending speed and function commands; right now it only sends the first group of function packets.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.AbstractThrottleManager
AbstractThrottleManager.Addresses
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Throttle
currentThrottle
-
Fields inherited from class jmri.jmrix.AbstractThrottleManager
adapterMemo, userName
-
-
Constructor Summary
Constructors Constructor Description ThrottleManager(DirectSystemConnectionMemo memo)
Constructor for a Direct ThrottleManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addressTypeUnique()
Test if ambiguous addresses (short vs long) are not allowed on this system.boolean
canBeLongAddress(int a)
Test if a specific number is a valid long address on this system.boolean
canBeShortAddress(int a)
Test if a specific number is a valid short address on this system.boolean
disposeThrottle(DccThrottle t, ThrottleListener l)
Invoked when a throttle is released, this updates the local data structures.void
requestThrottleSetup(LocoAddress address, boolean control)
Create throttle data structures.-
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, getAddressProtocolTypes, getAddressTypes, getAddressTypeString, getProtocolFromString, getThrottleInfo, getThrottleUsageCount, getThrottleUsageCount, getThrottleUsageCount, getThrottleUsageCount, getUserName, hasDispatchFunction, hideStealNotifications, makeHardwareDecision, notifyDecisionRequest, notifyThrottleKnown, releaseThrottle, removeListener, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottle, requestThrottleSetup, responseThrottleDecision, responseThrottleDecision, responseThrottleDecision, showSessionCancelDialogue, singleUse, supportedSpeedModes, updateNumUsers
-
-
-
-
Field Detail
-
currentThrottle
Throttle currentThrottle
-
-
Constructor Detail
-
ThrottleManager
public ThrottleManager(DirectSystemConnectionMemo memo)
Constructor for a Direct ThrottleManager.- Parameters:
memo
- system connection.
-
-
Method Detail
-
requestThrottleSetup
public void requestThrottleSetup(LocoAddress address, boolean control)
Create throttle data structures.- Specified by:
requestThrottleSetup
in classAbstractThrottleManager
- Parameters:
address
- addresscontrol
- false - read only.
-
addressTypeUnique
public boolean addressTypeUnique()
Description copied from interface:ThrottleManager
Test if ambiguous addresses (short vs long) are not allowed on this system. Also indicates support for multi-protocol decoders.- Returns:
- true if ambiguous addresses are not allowed; false otherwise
-
canBeShortAddress
public boolean canBeShortAddress(int a)
Description copied from interface:ThrottleManager
Test if a specific number is a valid short address on this system.- Parameters:
a
- address number to test- Returns:
- true if address can be short; false otherwise
-
canBeLongAddress
public boolean canBeLongAddress(int a)
Description copied from interface:ThrottleManager
Test if a specific number is a valid long address on this system.- Parameters:
a
- address number to test- Returns:
- true if address can be long; false otherwise
-
disposeThrottle
public boolean disposeThrottle(DccThrottle t, ThrottleListener l)
Invoked when a throttle is released, this updates the local data structures.- 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.
-
-