|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.AbstractThrottle
jmri.jmrix.loconet.Pr2Throttle
public class Pr2Throttle
An implementation of DccThrottle via AbstractThrottle with code specific to a PR2 connection.
Speed in the Throttle interfaces and AbstractThrottle is a float, but in LocoNet is an int with values from 0 to 127.
| Field Summary |
|---|
| Fields inherited from class jmri.jmrix.AbstractThrottle |
|---|
active, 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, SPEED_STEP_128_INCREMENT, SPEED_STEP_14_INCREMENT, SPEED_STEP_27_INCREMENT, SPEED_STEP_28_INCREMENT, speedIncrement, speedSetting, speedStepMode |
| Fields inherited from interface jmri.DccThrottle |
|---|
SpeedStepMode128, SpeedStepMode14, SpeedStepMode27, SpeedStepMode28 |
| Constructor Summary | |
|---|---|
Pr2Throttle(DccLocoAddress address)
Constructor |
|
| Method Summary | |
|---|---|
void |
dispatch()
Dispatch the loco from this throttle, then clean up the object. |
void |
dispose()
Dispose when finished with this object. |
protected float |
floatSpeed(int lSpeed)
Convert a LocoNet speed integer to a float speed value |
LocoAddress |
getLocoAddress()
Locomotive address. |
protected int |
intSpeed(float fSpeed)
Convert a float speed value to a LocoNet speed integer |
void |
release()
Release the loco from this throttle, then clean up the object. |
protected void |
sendFunctionGroup1()
Send the LocoNet message to set the state of locomotive direction and functions F0, F1, F2, F3, F4. |
protected void |
sendFunctionGroup2()
Send the LocoNet message to set the state of functions F5, F6, F7, F8. |
protected void |
sendFunctionGroup3()
Send the message to set the state of functions F9, F10, F11, F12 This is used in the setFn implementations provided in this class, but a real implementation needs to be provided. |
void |
setIsForward(boolean forward)
LocoNet actually puts forward and backward in the same message as the first function group. |
void |
setSpeedSetting(float speed)
Set the speed. |
protected void |
throttleDispose()
|
String |
toString()
|
void |
writeData()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Pr2Throttle(DccLocoAddress address)
| Method Detail |
|---|
protected float floatSpeed(int lSpeed)
protected int intSpeed(float fSpeed)
public void writeData()
protected void sendFunctionGroup1()
sendFunctionGroup1 in class AbstractThrottleprotected void sendFunctionGroup2()
sendFunctionGroup2 in class AbstractThrottleprotected void sendFunctionGroup3()
AbstractThrottleThis is used in the setFn implementations provided in this class, but a real implementation needs to be provided.
sendFunctionGroup3 in class AbstractThrottlepublic void setSpeedSetting(float speed)
This intentionally skips the emergency stop value of 1.
setSpeedSetting in interface ThrottlesetSpeedSetting in class AbstractThrottlespeed - Number from 0 to 1; less than zero is emergency stoppublic void setIsForward(boolean forward)
setIsForward in interface ThrottlesetIsForward in class AbstractThrottlepublic void release()
release in interface Throttlerelease in class AbstractThrottlepublic void dispatch()
dispatch in interface Throttledispatch in class AbstractThrottlepublic String toString()
toString in class Objectpublic void dispose()
dispose in interface Throttledispose in class AbstractThrottlepublic LocoAddress getLocoAddress()
Throttle
protected void throttleDispose()
throttleDispose in class AbstractThrottle
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||