jmri.jmrix.loconet
Class LnTurnoutManager

Show UML class diagram
java.lang.Object
  extended by jmri.managers.AbstractManager
      extended by jmri.managers.AbstractTurnoutManager
          extended by jmri.jmrix.loconet.LnTurnoutManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, LocoNetListener, Manager, TurnoutManager

public class LnTurnoutManager
extends AbstractTurnoutManager
implements LocoNetListener

LnTurnoutManager implements the TurnoutManager.

System names are "LTnnn", where nnn is the turnout number without padding.

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.

Since LocoNet messages requesting turnout operations can arrive faster than the command station can send them on the rails, the command station has a short queue of messages. When that gets full, it sends a LACK, indicating that the request was not forwarded on the rails. In that case, this class goes into a tight loop, resending the last turnout message seen until it's received without a LACK reply. Note two things about this:

In the end, this implementation is OK, but not great. An improvement would be to control JMRI turnout operations centrally, so that retransmissions can controlled.

Description: Implement turnout manager for loconet


Field Summary
(package private)  LocoNetInterface fastcontroller
           
(package private)  LocoNetMessage lastSWREQ
           
(package private) static org.slf4j.Logger log
           
(package private)  boolean mTurnoutNoRetry
           
(package private)  String prefix
           
(package private)  LocoNetInterface throttledcontroller
           
 
Fields inherited from class jmri.managers.AbstractManager
_tsys, _tuser
 
Fields inherited from interface jmri.Manager
AUDIO, BLOCKBOSS, BLOCKS, CONDITIONALS, ENTRYEXIT, IDTAGS, LAYOUTBLOCKS, LIGHTS, LOGIXS, MEMORIES, OBLOCKS, PANELFILES, REPORTERS, ROUTES, SECTIONS, SENSORGROUPS, SENSORS, SIGNALGROUPS, SIGNALHEADS, SIGNALMASTLOGICS, SIGNALMASTS, TIMEBASE, TRANSITS, TURNOUTS, WARRANTS
 
Constructor Summary
LnTurnoutManager(LocoNetInterface fastcontroller, LocoNetInterface throttledcontroller, String prefix, boolean mTurnoutNoRetry)
           
 
Method Summary
 Turnout createNewTurnout(String systemName, String userName)
          Internal method to invoke the factory, after all the logic for returning an existing method has been invoked.
 void dispose()
          Free resources when no longer used.
 String getSystemPrefix()
          Provides access to the system prefix string.
 void message(LocoNetMessage l)
          Member function that will be invoked by a LocoNetInterface implementation to forward a LocoNet message from the layout.
 
Methods inherited from class jmri.managers.AbstractTurnoutManager
allowMultipleAdditions, askControlType, askNumControlBits, createSystemName, getBySystemName, getByUserName, getClosedText, getDefaultClosedSpeed, getDefaultThrownSpeed, getNextValidAddress, getThrownText, getTurnout, getValidOperationTypes, getXMLOrder, isControlTypeSupported, isNumControlBitsSupported, newTurnout, provideTurnout, setDefaultClosedSpeed, setDefaultThrownSpeed, typeLetter
 
Methods inherited from class jmri.managers.AbstractManager
addPropertyChangeListener, deregister, firePropertyChange, getBeanBySystemName, getBeanByUserName, getInstanceBySystemName, getInstanceByUserName, getNamedBean, getNamedBeanList, getSystemNameArray, getSystemNameList, makeSystemName, propertyChange, register, registerSelf, removePropertyChangeListener, systemLetter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.TurnoutManager
getSystemNameList
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, getBeanBySystemName, getBeanByUserName, getNamedBean, getNamedBeanList, getSystemNameArray, makeSystemName, register, removePropertyChangeListener, systemLetter
 

Field Detail

fastcontroller

LocoNetInterface fastcontroller

throttledcontroller

LocoNetInterface throttledcontroller

mTurnoutNoRetry

boolean mTurnoutNoRetry

prefix

String prefix

lastSWREQ

LocoNetMessage lastSWREQ

log

static org.slf4j.Logger log
Constructor Detail

LnTurnoutManager

public LnTurnoutManager(LocoNetInterface fastcontroller,
                        LocoNetInterface throttledcontroller,
                        String prefix,
                        boolean mTurnoutNoRetry)
Method Detail

getSystemPrefix

public String getSystemPrefix()
Description copied from interface: Manager
Provides access to the system prefix string. This was previously called the "System letter"

Specified by:
getSystemPrefix in interface Manager

dispose

public void dispose()
Description copied from interface: Manager
Free resources when no longer used. Specifically, remove all references to and from this object, so it can be garbage-collected.

Specified by:
dispose in interface Manager
Overrides:
dispose in class AbstractManager

createNewTurnout

public Turnout createNewTurnout(String systemName,
                                String userName)
Description copied from class: AbstractTurnoutManager
Internal method to invoke the factory, after all the logic for returning an existing method has been invoked.

Specified by:
createNewTurnout in class AbstractTurnoutManager
Returns:
never null

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.


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