jmri.jmrix.lenz
Class XNetThrottle

java.lang.Object
  extended by jmri.jmrix.AbstractThrottle
      extended by jmri.jmrix.lenz.XNetThrottle
All Implemented Interfaces:
EventListener, DccThrottle, AbstractMRListener, XNetListener, Throttle
Direct Known Subclasses:
EliteXNetThrottle

public class XNetThrottle
extends AbstractThrottle
implements XNetListener

An implementation of DccThrottle with code specific to a XpressnetNet connection.

Author:
Paul Bender (C) 2002-2010, Giorgio Terdina (C) 2007

Nested Class Summary
protected static class XNetThrottle.RequestMessage
           
 
Field Summary
protected  int address
           
protected  boolean isAvailable
           
protected  LinkedBlockingQueue<XNetThrottle.RequestMessage> requestList
           
 int requestState
           
protected static int statTimeoutValue
           
protected  TimerTask statusTask
           
protected  XNetTrafficController tc
           
protected static int THROTTLEFUNCSENT
           
protected static int THROTTLEIDLE
           
protected static int THROTTLESPEEDSENT
           
protected static int THROTTLESTATSENT
           
 
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
XNetThrottle(LocoAddress address, XNetTrafficController controller)
          Constructor
XNetThrottle(XNetTrafficController controller)
          Constructor
 
Method Summary
 int getDccAddress()
           
protected  int getDccAddressHigh()
           
protected  int getDccAddressLow()
           
 LocoAddress getLocoAddress()
          Locomotive address.
 float getSpeedIncrement()
          to handle quantized speed.
 void message(XNetMessage l)
          Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout.
 void message(XNetReply l)
          Member function that will be invoked by a XNetInterface implementation to forward a XNet message from the layout.
 void notifyTimeout(XNetMessage msg)
          Member function invoked by an XNetInterface implementation to notify * a sender that an outgoing message timed out and was dropped from the * queue.
protected  void parseFunctionHighInformation(int b3, int b4)
           
protected  void parseFunctionHighMomentaryInformation(int b3, int b4)
           
protected  void parseFunctionInformation(int b3, int b4)
           
protected  void parseFunctionMomentaryInformation(int b3, int b4)
           
protected  void parseSpeedandAvailability(int b1)
           
protected  void parseSpeedandDirection(int b2)
           
protected  void queueMessage(XNetMessage m, int s)
           
protected  void sendEmergencyStop()
           
protected  void sendFunctionGroup1()
          Send the XpressNet message 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 sendFunctionHighInformationRequest()
           
protected  void sendFunctionHighMomentaryStatusRequest()
           
protected  void sendFunctionStatusInformationRequest()
           
protected  void sendMomentaryFunctionGroup1()
          Send the XpressNet message to set the Momentary state of locomotive functions F0, F1, F2, F3, F4
protected  void sendMomentaryFunctionGroup2()
          Send the XpressNet message to set the momentary state of functions F5, F6, F7, F8
protected  void sendMomentaryFunctionGroup3()
          Send the XpressNet message to set the momentary state of functions F9, F10, F11, F12
protected  void sendMomentaryFunctionGroup4()
          Send the XpressNet message to set the momentary state of functions F13, F14, F15, F16 F17 F18 F19 F20
protected  void sendMomentaryFunctionGroup5()
          Send the XpressNet message to set the momentary state of functions F21, F22, F23, F24 F25 F26 F27 F28
protected  void sendQueuedMessage()
           
protected  void sendStatusInformationRequest()
           
 int setDccAddress(int newaddress)
           
protected  void setIsAvailable(boolean Available)
           
 void setIsForward(boolean forward)
           
 void setSpeedSetting(float speed)
           
 void setSpeedStepMode(int Mode)
           
 void setXNetTrafficController(XNetTrafficController controller)
           
protected  void startStatusTimer()
           
protected  void stopStatusTimer()
           
protected  void throttleDispose()
          Dispose when finished with this object.
 
Methods inherited from class jmri.jmrix.AbstractThrottle
addPropertyChangeListener, dispatch, dispose, 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, getIsForward, getListeners, getSpeedSetting, getSpeedStepMode, notifyPropertyChangeListener, release, removePropertyChangeListener, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isAvailable

protected boolean isAvailable

statusTask

protected TimerTask statusTask

statTimeoutValue

protected static final int statTimeoutValue
See Also:
Constant Field Values

tc

protected XNetTrafficController tc

THROTTLEIDLE

protected static final int THROTTLEIDLE
See Also:
Constant Field Values

THROTTLESTATSENT

protected static final int THROTTLESTATSENT
See Also:
Constant Field Values

THROTTLESPEEDSENT

protected static final int THROTTLESPEEDSENT
See Also:
Constant Field Values

THROTTLEFUNCSENT

protected static final int THROTTLEFUNCSENT
See Also:
Constant Field Values

requestState

public int requestState

address

protected int address

requestList

protected LinkedBlockingQueue<XNetThrottle.RequestMessage> requestList
Constructor Detail

XNetThrottle

public XNetThrottle(XNetTrafficController controller)
Constructor


XNetThrottle

public XNetThrottle(LocoAddress address,
                    XNetTrafficController controller)
Constructor

Method Detail

setXNetTrafficController

public void setXNetTrafficController(XNetTrafficController controller)

sendFunctionGroup1

protected void sendFunctionGroup1()
Send the XpressNet message to set the state of locomotive direction and functions F0, F1, F2, F3, F4

Overrides:
sendFunctionGroup1 in class AbstractThrottle

sendFunctionGroup2

protected void sendFunctionGroup2()
Send the XpressNet message to set the state of functions F5, F6, F7, F8

Overrides:
sendFunctionGroup2 in class AbstractThrottle

sendFunctionGroup3

protected void sendFunctionGroup3()
Send the XpressNet message to set the state of functions F9, F10, F11, F12

Overrides:
sendFunctionGroup3 in class AbstractThrottle

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 class AbstractThrottle

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 class AbstractThrottle

sendMomentaryFunctionGroup1

protected void sendMomentaryFunctionGroup1()
Send the XpressNet message to set the Momentary state of locomotive functions F0, F1, F2, F3, F4

Overrides:
sendMomentaryFunctionGroup1 in class AbstractThrottle

sendMomentaryFunctionGroup2

protected void sendMomentaryFunctionGroup2()
Send the XpressNet message to set the momentary state of functions F5, F6, F7, F8

Overrides:
sendMomentaryFunctionGroup2 in class AbstractThrottle

sendMomentaryFunctionGroup3

protected void sendMomentaryFunctionGroup3()
Send the XpressNet message to set the momentary state of functions F9, F10, F11, F12

Overrides:
sendMomentaryFunctionGroup3 in class AbstractThrottle

sendMomentaryFunctionGroup4

protected void sendMomentaryFunctionGroup4()
Send the XpressNet message to set the momentary state of functions F13, F14, F15, F16 F17 F18 F19 F20

Overrides:
sendMomentaryFunctionGroup4 in class AbstractThrottle

sendMomentaryFunctionGroup5

protected void sendMomentaryFunctionGroup5()
Send the XpressNet message to set the momentary state of functions F21, F22, F23, F24 F25 F26 F27 F28

Overrides:
sendMomentaryFunctionGroup5 in class AbstractThrottle

setSpeedSetting

public void setSpeedSetting(float speed)
Specified by:
setSpeedSetting in interface Throttle
Overrides:
setSpeedSetting in class AbstractThrottle

sendEmergencyStop

protected void sendEmergencyStop()

setIsForward

public void setIsForward(boolean forward)
Specified by:
setIsForward in interface Throttle
Overrides:
setIsForward in class AbstractThrottle

setSpeedStepMode

public void setSpeedStepMode(int Mode)
Specified by:
setSpeedStepMode in interface DccThrottle
Overrides:
setSpeedStepMode in class AbstractThrottle

throttleDispose

protected 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.

Specified by:
throttleDispose in class AbstractThrottle

setDccAddress

public int setDccAddress(int newaddress)

getDccAddress

public int getDccAddress()

getDccAddressHigh

protected int getDccAddressHigh()

getDccAddressLow

protected int getDccAddressLow()

sendStatusInformationRequest

protected void sendStatusInformationRequest()

sendFunctionStatusInformationRequest

protected void sendFunctionStatusInformationRequest()

sendFunctionHighInformationRequest

protected void sendFunctionHighInformationRequest()

sendFunctionHighMomentaryStatusRequest

protected void sendFunctionHighMomentaryStatusRequest()

getSpeedIncrement

public float getSpeedIncrement()
Description copied from class: AbstractThrottle
to handle quantized speed. Note this can change! Valued returned is always positive.

Specified by:
getSpeedIncrement in interface DccThrottle
Overrides:
getSpeedIncrement in class AbstractThrottle

message

public void message(XNetReply l)
Description copied from interface: XNetListener
Member function that will be invoked by a XNetInterface implementation to forward a XNet message from the layout.

Specified by:
message in interface XNetListener
Parameters:
l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.

message

public void message(XNetMessage l)
Description copied from interface: XNetListener
Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout. Normally, this function will do nothing.

Specified by:
message in interface XNetListener
Parameters:
l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.

notifyTimeout

public void notifyTimeout(XNetMessage msg)
Description copied from interface: XNetListener
Member function invoked by an XNetInterface implementation to notify * a sender that an outgoing message timed out and was dropped from the * queue.

Specified by:
notifyTimeout in interface XNetListener

parseSpeedandAvailability

protected void parseSpeedandAvailability(int b1)

parseSpeedandDirection

protected void parseSpeedandDirection(int b2)

parseFunctionInformation

protected void parseFunctionInformation(int b3,
                                        int b4)

parseFunctionHighInformation

protected void parseFunctionHighInformation(int b3,
                                            int b4)

parseFunctionMomentaryInformation

protected void parseFunctionMomentaryInformation(int b3,
                                                 int b4)

parseFunctionHighMomentaryInformation

protected void parseFunctionHighMomentaryInformation(int b3,
                                                     int b4)

setIsAvailable

protected void setIsAvailable(boolean Available)

startStatusTimer

protected void startStatusTimer()

stopStatusTimer

protected void stopStatusTimer()

getLocoAddress

public LocoAddress getLocoAddress()
Description copied from interface: Throttle
Locomotive address. The exact format is defined by the specific implementation, as subclasses of LocoAddress will contain different information. This is an unbound property.

Specified by:
getLocoAddress in interface Throttle

sendQueuedMessage

protected void sendQueuedMessage()

queueMessage

protected void queueMessage(XNetMessage m,
                            int s)


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads