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 boolean
isStealAddress
-
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.String
buildPacketWithChar(char chr)
Builds a header to send to the wi-fi device for use in a message.void
notifyDecisionRequired(LocoAddress address, ThrottleListener.DecisionType question)
A decision is required for Throttle creation to continue.void
propertyChange(java.beans.PropertyChangeEvent event)
void
sendAddress()
A + indicates the address was acquired, - indicates releasedvoid
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.protected void
sendAllMomentaryStates(DccThrottle t)
protected void
sendCurrentDirection(DccThrottle t)
protected void
sendCurrentSpeed(DccThrottle t)
void
sendFunctionLabels(RosterEntry re)
This replaces the previous method of sending a string of function labels.protected void
sendSpeedStepMode(DccThrottle t)
void
sendStealAddress()
Send a message to a device that steal is needed.protected void
setAddress(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:
propertyChange
in interfacejava.beans.PropertyChangeListener
- Overrides:
propertyChange
in 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:
sendFunctionLabels
in 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:
sendAllFunctionStates
in classThrottleController
- Parameters:
t
- the throttle to send the states of.
-
sendCurrentSpeed
protected void sendCurrentSpeed(DccThrottle t)
- Overrides:
sendCurrentSpeed
in classThrottleController
-
sendCurrentDirection
protected void sendCurrentDirection(DccThrottle t)
- Overrides:
sendCurrentDirection
in classThrottleController
-
sendSpeedStepMode
protected void sendSpeedStepMode(DccThrottle t)
- Overrides:
sendSpeedStepMode
in classThrottleController
-
sendAllMomentaryStates
protected void sendAllMomentaryStates(DccThrottle t)
- Overrides:
sendAllMomentaryStates
in classThrottleController
-
sendAddress
public void sendAddress()
A + indicates the address was acquired, - indicates released- Overrides:
sendAddress
in 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:
notifyDecisionRequired
in interfaceThrottleListener
- Overrides:
notifyDecisionRequired
in 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:
setAddress
in classThrottleController
-
-