jmri.jmrix.loconet
Class LnTurnout

java.lang.Object
  extended by jmri.implementation.AbstractNamedBean
      extended by jmri.implementation.AbstractTurnout
          extended by jmri.jmrix.loconet.LnTurnout
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, LocoNetListener, NamedBean, Turnout

public class LnTurnout
extends AbstractTurnout
implements LocoNetListener

Extend jmri.AbstractTurnout for LocoNet layouts

This implementation implements the "SENT" feedback, where LocoNet messages originating on the layout can change both KnownState and CommandedState. We change both because we consider a LocoNet message to reflect how the turnout should be, even if its a readback status message. E.g. if you use a DS54 local input to change the state, resulting in a status message, we still consider that to be a commanded state change.

Adds several additional feedback modes:

Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.

Author:
Bob Jacobsen Copyright (C) 2001
See Also:
Serialized Form

Field Summary
static int METERINTERVAL
           
 
Fields inherited from class jmri.implementation.AbstractTurnout
_activeFeedbackType, _cabLockout, _decoderName, _enableCabLockout, _enablePushButtonLockout, _inverted, _pushButtonLockout, _reportLocked, _validDecoderNames, _validFeedbackModes, _validFeedbackNames, _validFeedbackTypes, inhibitOperation, myOperator, myTurnoutOperation
 
Fields inherited from interface jmri.Turnout
CABLOCKOUT, CLOSED, DIRECT, EXACT, INDIRECT, LOCKED, MONITORING, ONESENSOR, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
LnTurnout(int number, LocoNetInterface controller)
           
 
Method Summary
 boolean canInvert()
          Determine if the turnouts can be inverted.
 void dispose()
          Deactivate this object, so that it releases as many resources as possible and no longer effects others.
protected  void forwardCommandChangeToLayout(int s)
          Handle a request to change state, typically by sending a message to the layout in some child class.
 int getNumber()
           
 void message(LocoNetMessage l)
          Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.
protected  void turnoutPushbuttonLockout(boolean _pushButtonLockout)
           
 
Methods inherited from class jmri.implementation.AbstractTurnout
canLock, enableLockOperation, forwardCommandChangeToLayout, getCommandedState, getControlType, getCurrentOperator, getDecoderName, getFeedbackMode, getFeedbackModeForOperation, getFeedbackModeName, getFirstSensor, getInhibitOperation, getInverted, getKnownState, getLocked, getNumberOutputBits, getReportLocked, getSecondSensor, getState, getTurnoutOperation, getTurnoutOperator, getValidDecoderNames, getValidFeedbackNames, getValidFeedbackTypes, isConsistentState, newCommandedState, newKnownState, operationPropertyChange, propertyChange, provideFirstFeedbackSensor, provideSecondFeedbackSensor, sensorPropertyChange, setCommandedState, setControlType, setDecoderName, setFeedbackMode, setFeedbackMode, setInhibitOperation, setInitialKnownStateFromFeedback, setInverted, setLocked, setNumberOutputBits, setReportLocked, setState, setTurnoutOperation, turnoutPushbuttonLockout
 
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, firePropertyChange, getComment, getNumPropertyChangeListeners, getSystemName, getUserName, removePropertyChangeListener, setComment, setUserName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, getComment, getNumPropertyChangeListeners, getSystemName, getUserName, removePropertyChangeListener, setComment, setUserName
 

Field Detail

METERINTERVAL

public static int METERINTERVAL
Constructor Detail

LnTurnout

public LnTurnout(int number,
                 LocoNetInterface controller)
Method Detail

getNumber

public int getNumber()

forwardCommandChangeToLayout

protected void forwardCommandChangeToLayout(int s)
Description copied from class: AbstractTurnout
Handle a request to change state, typically by sending a message to the layout in some child class. Public version (used by TurnoutOperator) sends the current commanded state without changing it.

Specified by:
forwardCommandChangeToLayout in class AbstractTurnout
Parameters:
s - new state value

message

public void message(LocoNetMessage l)
Description copied from interface: LocoNetListener
Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.

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

turnoutPushbuttonLockout

protected void turnoutPushbuttonLockout(boolean _pushButtonLockout)
Specified by:
turnoutPushbuttonLockout in class AbstractTurnout

dispose

public void dispose()
Description copied from interface: NamedBean
Deactivate this object, so that it releases as many resources as possible and no longer effects others.

For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.

It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.

Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.

Specified by:
dispose in interface NamedBean
Overrides:
dispose in class AbstractTurnout

canInvert

public boolean canInvert()
Description copied from class: AbstractTurnout
Determine if the turnouts can be inverted. If true inverted turnouts supported.

Specified by:
canInvert in interface Turnout
Overrides:
canInvert in class AbstractTurnout


Copyright © 1997 - 2009 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