Package jmri.jmrix.roco.z21
Class Z21XNetThrottle
- java.lang.Object
-
- jmri.beans.PropertyChangeSupport
-
- jmri.jmrix.AbstractThrottle
-
- jmri.jmrix.lenz.XNetThrottle
-
- jmri.jmrix.roco.RocoXNetThrottle
-
- jmri.jmrix.roco.z21.Z21XNetThrottle
-
- All Implemented Interfaces:
java.util.EventListener
,PropertyChangeFirer
,PropertyChangeProvider
,DccThrottle
,AbstractMRListener
,XNetListener
,Throttle
public class Z21XNetThrottle extends RocoXNetThrottle
An implementation of DccThrottle with code specific to a z21 XpressNet connection.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrix.lenz.XNetThrottle
XNetThrottle.RequestMessage
-
-
Field Summary
-
Fields inherited from class jmri.jmrix.lenz.XNetThrottle
address, isAvailable, requestList, requestState, statTimeoutValue, statusTask, tc, THROTTLEFUNCSENT, THROTTLEHIGHMOMSTATSENT, THROTTLEHIGHSTATSENT, THROTTLEIDLE, THROTTLEMOMSTATSENT, THROTTLESPEEDSENT, THROTTLESTATSENT
-
Fields inherited from class jmri.jmrix.AbstractThrottle
active, adapterMemo, FUNCTION_GROUPS, isForward, speedSetting, speedStepMode, start
-
Fields inherited from class jmri.beans.PropertyChangeSupport
propertyChangeSupport
-
Fields inherited from interface jmri.Throttle
F0, F0Momentary, F1, F10, F10Momentary, F11, F11Momentary, F12, F12Momentary, F13, F13Momentary, F14, F14Momentary, F15, F15Momentary, F16, F16Momentary, F17, F17Momentary, F18, F18Momentary, F19, F19Momentary, F1Momentary, F2, F20, F20Momentary, F21, F21Momentary, F22, F22Momentary, F23, F23Momentary, F24, F24Momentary, F25, F25Momentary, F26, F26Momentary, F27, F27Momentary, F28, F28Momentary, F2Momentary, F3, F3Momentary, F4, F4Momentary, F5, F5Momentary, F6, F6Momentary, F7, F7Momentary, F8, F8Momentary, F9, F9Momentary, ISFORWARD, SPEEDINCREMENT, SPEEDSETTING, SPEEDSTEPMODE, SPEEDSTEPS
-
-
Constructor Summary
Constructors Constructor Description Z21XNetThrottle(XNetSystemConnectionMemo memo, XNetTrafficController controller)
Constructor.Z21XNetThrottle(XNetSystemConnectionMemo memo, LocoAddress address, XNetTrafficController controller)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
message(XNetReply l)
Member function that will be invoked by an XNetInterface implementation to forward an XNet message from the layout.protected void
sendEmergencyStop()
Since XpressNet has a seperate Opcode for emergency stop, we're setting this up as a seperate protected function.protected void
sendFunctionGroup1()
Send the XpressNet messages to set the state of locomotive direction and functions F0, F1, F2, F3, F4.protected void
sendFunctionGroup2()
Send the XpressNet message to set the state of functions F5, F6, F7, F8.protected void
sendFunctionGroup3()
Send the XpressNet message to set the state of functions F9, F10, F11, F12.protected void
sendFunctionGroup4()
Send the XpressNet message to set the state of functions F13, F14, F15, F16, F17, F18, F19, F20.protected void
sendFunctionGroup5()
Send the XpressNet message to set the state of functions F21, F22, F23, F24, F25, F26, F27, F28.protected void
sendStatusInformationRequest()
Send a request to get the speed, direction and function status from the command station.void
setSpeedSetting(float speed)
Notify listeners and send the new speed to the command station.void
setSpeedSetting(float speed, boolean allowDuplicates, boolean allowDuplicatesOnStop)
setSpeedSetting - Implementations should override this method only if they normally suppress messages to the system if, as far as JMRI can tell, the new message would make no difference to the system state (eg.void
throttleDispose()
Dispose when finished with this object.-
Methods inherited from class jmri.jmrix.roco.RocoXNetThrottle
sendFunctionHighMomentaryStatusRequest, sendFunctionStatusInformationRequest, sendMomentaryFunctionGroup1, sendMomentaryFunctionGroup2, sendMomentaryFunctionGroup3, sendMomentaryFunctionGroup4, sendMomentaryFunctionGroup5
-
Methods inherited from class jmri.jmrix.lenz.XNetThrottle
checkForFunctionMomentaryValueChange, csVersionSupportFn13to28, csVersionSupportFn29to68, getDccAddress, getDccAddressHigh, getDccAddressLow, getLocoAddress, message, notifyNewDirection, notifyNewSpeedStepMode, notifyTimeout, parseFunctionHighInformation, parseFunctionHighMomentaryInformation, parseFunctionInformation, parseFunctionMomentaryInformation, parseSpeedAndAvailability, parseSpeedAndDirection, queueMessage, sendFunctionGroup10, sendFunctionGroup6, sendFunctionGroup7, sendFunctionGroup8, sendFunctionGroup9, sendFunctionHighInformationRequest, sendMomentaryFunctionGroup10, sendMomentaryFunctionGroup6, sendMomentaryFunctionGroup7, sendMomentaryFunctionGroup8, sendMomentaryFunctionGroup9, sendQueuedMessage, setDccAddress, setIsAvailable, setIsForward, setSpeedStepMode, setXNetTrafficController, startStatusTimer, stopStatusTimer
-
Methods inherited from class jmri.jmrix.AbstractThrottle
addPropertyChangeListener, dispatch, dispose, finishRecord, getFunction, getFunctionMomentary, getFunctionMomentaryNoWarn, getFunctionNoWarn, getFunctions, getFunctionsMomentary, getIsForward, getRosterEntry, getSpeedIncrement, getSpeedSetting, getSpeedStepMode, intSpeed, intSpeed, notifyThrottleDisconnect, notifyThrottleDispatchEnabled, notifyThrottleReleaseEnabled, record, release, removePropertyChangeListener, sendFunctionGroup, setFunction, setFunctionMomentary, setRosterEntry, setSpeedSettingAgain, startClock, updateFunction, updateFunctionMomentary
-
Methods inherited from class jmri.beans.PropertyChangeSupport
addPropertyChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener
-
Methods inherited from interface jmri.Throttle
getF0, getF0Momentary, getF1, getF10, getF10Momentary, getF11, getF11Momentary, getF12, getF12Momentary, getF13, getF13Momentary, getF14, getF14Momentary, getF15, getF15Momentary, getF16, getF16Momentary, getF17, getF17Momentary, getF18, getF18Momentary, getF19, getF19Momentary, getF1Momentary, getF2, getF20, getF20Momentary, getF21, getF21Momentary, getF22, getF22Momentary, getF23, getF23Momentary, getF24, getF24Momentary, getF25, getF25Momentary, getF26, getF26Momentary, getF27, getF27Momentary, getF28, getF28Momentary, getF2Momentary, getF3, getF3Momentary, getF4, getF4Momentary, getF5, getF5Momentary, getF6, getF6Momentary, getF7, getF7Momentary, getF8, getF8Momentary, getF9, getF9Momentary, setF0, setF0Momentary, setF1, setF10, setF10Momentary, setF11, setF11Momentary, setF12, setF12Momentary, setF13, setF13Momentary, setF14, setF14Momentary, setF15, setF15Momentary, setF16, setF16Momentary, setF17, setF17Momentary, setF18, setF18Momentary, setF19, setF19Momentary, setF1Momentary, setF2, setF20, setF20Momentary, setF21, setF21Momentary, setF22, setF22Momentary, setF23, setF23Momentary, setF24, setF24Momentary, setF25, setF25Momentary, setF26, setF26Momentary, setF27, setF27Momentary, setF28, setF28Momentary, setF2Momentary, setF3, setF3Momentary, setF4, setF4Momentary, setF5, setF5Momentary, setF6, setF6Momentary, setF7, setF7Momentary, setF8, setF8Momentary, setF9, setF9Momentary
-
-
-
-
Constructor Detail
-
Z21XNetThrottle
public Z21XNetThrottle(XNetSystemConnectionMemo memo, XNetTrafficController controller)
Constructor.- Parameters:
memo
- system connection.controller
- traffic controller.
-
Z21XNetThrottle
public Z21XNetThrottle(XNetSystemConnectionMemo memo, LocoAddress address, XNetTrafficController controller)
Constructor.- Parameters:
memo
- system connection.address
- loco address.controller
- traffic controller.
-
-
Method Detail
-
setSpeedSetting
public void setSpeedSetting(float speed)
Notify listeners and send the new speed to the command station.- Specified by:
setSpeedSetting
in interfaceThrottle
- Overrides:
setSpeedSetting
in classXNetThrottle
- Parameters:
speed
- the speed as a 0.0 -> 1.0. fraction of maximum possible speed or -1 for emergency stop.
-
setSpeedSetting
public void setSpeedSetting(float speed, boolean allowDuplicates, boolean allowDuplicatesOnStop)
setSpeedSetting - Implementations should override this method only if they normally suppress messages to the system if, as far as JMRI can tell, the new message would make no difference to the system state (eg. the speed is the same, or effectivly the same, as the existing speed). Then, the boolean options can affect this behaviour.- Specified by:
setSpeedSetting
in interfaceThrottle
- Overrides:
setSpeedSetting
in classAbstractThrottle
- Parameters:
speed
- the new speedallowDuplicates
- don't suppress messagesallowDuplicatesOnStop
- don't suppress messages if the new speed is 'stop'
-
sendStatusInformationRequest
protected void sendStatusInformationRequest()
Send a request to get the speed, direction and function status from the command station.- Overrides:
sendStatusInformationRequest
in classXNetThrottle
-
sendFunctionGroup1
protected void sendFunctionGroup1()
Send the XpressNet messages to set the state of locomotive direction and functions F0, F1, F2, F3, F4.- Overrides:
sendFunctionGroup1
in classXNetThrottle
-
sendFunctionGroup2
protected void sendFunctionGroup2()
Send the XpressNet message to set the state of functions F5, F6, F7, F8.- Overrides:
sendFunctionGroup2
in classXNetThrottle
-
sendFunctionGroup3
protected void sendFunctionGroup3()
Send the XpressNet message to set the state of functions F9, F10, F11, F12.- Overrides:
sendFunctionGroup3
in classXNetThrottle
-
sendFunctionGroup4
protected void sendFunctionGroup4()
Send the XpressNet message to set the state of functions F13, F14, F15, F16, F17, F18, F19, F20.- Overrides:
sendFunctionGroup4
in classXNetThrottle
-
sendFunctionGroup5
protected void sendFunctionGroup5()
Send the XpressNet message to set the state of functions F21, F22, F23, F24, F25, F26, F27, F28.- Overrides:
sendFunctionGroup5
in classXNetThrottle
-
sendEmergencyStop
protected void sendEmergencyStop()
Description copied from class:XNetThrottle
Since XpressNet has a seperate Opcode for emergency stop, we're setting this up as a seperate protected function.- Overrides:
sendEmergencyStop
in classRocoXNetThrottle
-
message
public void message(XNetReply l)
Description copied from interface:XNetListener
Member function that will be invoked by an XNetInterface implementation to forward an XNet message from the layout.- Specified by:
message
in interfaceXNetListener
- Overrides:
message
in classXNetThrottle
- Parameters:
l
- The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
throttleDispose
public void throttleDispose()
Dispose when finished with this object. After this, further usage of this Throttle object will result in a JmriException.This is quite problematic, because a using object doesn't know when it's the last user.
- Overrides:
throttleDispose
in classRocoXNetThrottle
-
-