Package jmri.jmrit.withrottle
Class MultiThrottleController
- java.lang.Object
-
- jmri.jmrit.withrottle.ThrottleController
-
- jmri.jmrit.withrottle.MultiThrottleController
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener,java.util.EventListener,ThrottleListener
public class MultiThrottleController extends ThrottleController
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.ThrottleListener
ThrottleListener.DecisionType
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisStealAddress-
Fields inherited from class jmri.jmrit.withrottle.ThrottleController
controllerListeners, functionThrottle, isAddressSet, isMomF2, lastSentSpeed, leadAddress, leadLocoF, listeners, locoKey, newSpeed, rosterLoco, speedMultiplier, throttle, useLeadLocoF, whichThrottle
-
-
Constructor Summary
Constructors Constructor Description MultiThrottleController(char id, java.lang.String key, ThrottleControllerListener tcl, ControllerInterface ci)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringbuildPacketWithChar(char chr)Builds a header to send to the wi-fi device for use in a message.voidnotifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)A decision is required for Throttle creation to continue.voidpropertyChange(java.beans.PropertyChangeEvent event)voidsendAddress()A + indicates the address was acquired, - indicates releasedvoidsendAllFunctionStates(DccThrottle t)This replaces the previous method of sending a string of function states, and now sends them individually, the same as a property change would.protected voidsendAllMomentaryStates(DccThrottle t)protected voidsendCurrentDirection(DccThrottle t)protected voidsendCurrentSpeed(DccThrottle t)voidsendFunctionLabels(RosterEntry re)This replaces the previous method of sending a string of function labels.protected voidsendSpeedStepMode(DccThrottle t)voidsendStealAddress()Send a message to a device that steal is needed.protected voidsetAddress(int number, boolean isLong)Add option to not silently share ("steal") the requested address-
Methods inherited from class jmri.jmrit.withrottle.ThrottleController
addControllerListener, addressDispatch, addressRelease, addThrottleControllerListener, buildFStatesHeader, eStop, findRosterEntry, forceFunction, getCurrentAddress, getCurrentAddressString, getCurrentRosterIdString, getFunctionThrottle, getThrottle, handleFunction, handleMomentary, handleRequest, handleSpeedStepMode, idle, notifyFailedThrottleRequest, notifyThrottleFound, removeControllerListener, removeThrottleControllerListener, requestEntryFromID, setDirection, setFunctionThrottle, setLocoForConsistFunctions, setRosterLocoForConsistFunctions, setSpeed, setWhichThrottle, shutdownThrottle, sort, syncThrottleFunctions
-
-
-
-
Field Detail
-
isStealAddress
protected boolean isStealAddress
-
-
Constructor Detail
-
MultiThrottleController
public MultiThrottleController(char id, java.lang.String key, ThrottleControllerListener tcl, ControllerInterface ci)
-
-
Method Detail
-
buildPacketWithChar
public java.lang.String buildPacketWithChar(char chr)
Builds a header to send to the wi-fi device for use in a message. Includes a separator - <;>- Parameters:
chr- the character indicating what action is performed- Returns:
- a pre-assembled header for this DccThrottle
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent event)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener- Overrides:
propertyChangein classThrottleController
-
sendFunctionLabels
public void sendFunctionLabels(RosterEntry re)
This replaces the previous method of sending a string of function labels. Checks for labels across all possible functions of this roster entry. Example:MTLL1234<;>]\[Light]\[Bell]\[Horn]\[]\[]\[]\[]\[]\[Mute]\[]\[]\[]\[etc.- Overrides:
sendFunctionLabelsin classThrottleController- Parameters:
re- The roster entry to get the labels from.
-
sendAllFunctionStates
public void sendAllFunctionStates(DccThrottle t)
This replaces the previous method of sending a string of function states, and now sends them individually, the same as a property change would.- Overrides:
sendAllFunctionStatesin classThrottleController- Parameters:
t- the throttle to send the states of.
-
sendCurrentSpeed
protected void sendCurrentSpeed(DccThrottle t)
- Overrides:
sendCurrentSpeedin classThrottleController
-
sendCurrentDirection
protected void sendCurrentDirection(DccThrottle t)
- Overrides:
sendCurrentDirectionin classThrottleController
-
sendSpeedStepMode
protected void sendSpeedStepMode(DccThrottle t)
- Overrides:
sendSpeedStepModein classThrottleController
-
sendAllMomentaryStates
protected void sendAllMomentaryStates(DccThrottle t)
- Overrides:
sendAllMomentaryStatesin classThrottleController
-
sendAddress
public void sendAddress()
A + indicates the address was acquired, - indicates released- Overrides:
sendAddressin classThrottleController
-
sendStealAddress
public void sendStealAddress()
Send a message to a device that steal is needed. This message can be sent back to JMRI verbatim to complete a steal.
-
notifyDecisionRequired
public void notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
A decision is required for Throttle creation to continue.Steal / Cancel, Share / Cancel, or Steal / Share Cancel
Callback of a request for an address that is in use. Will initiate a steal only if this MTC is flagged to do so. Otherwise, it will remove the request for the address. calls notifyFailedThrottleRequest, Steal Required
Get notification that a throttle request is in use by another device, and a "steal", "share", or "steal/share" decision may be required.
- Specified by:
notifyDecisionRequiredin interfaceThrottleListener- Overrides:
notifyDecisionRequiredin classThrottleController- Parameters:
address- The LocoAddress that needs the decision.question- The question being asked, steal / cancel, share / cancel, steal / share / cancel
-
setAddress
protected void setAddress(int number, boolean isLong)
Add option to not silently share ("steal") the requested address- Overrides:
setAddressin classThrottleController
-
-