jmri.jmrix.cmri.serial
Class SerialTurnoutManager

java.lang.Object
  extended by jmri.implementation.AbstractManager
      extended by jmri.managers.AbstractTurnoutManager
          extended by jmri.jmrix.cmri.serial.SerialTurnoutManager
All Implemented Interfaces:
PropertyChangeListener, EventListener, Manager, TurnoutManager

public class SerialTurnoutManager
extends AbstractTurnoutManager

Implement turnout manager for CMRI serial systems

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

Author:
Bob Jacobsen Copyright (C) 2003

Field Summary
 
Fields inherited from class jmri.implementation.AbstractManager
_tsys, _tuser
 
Constructor Summary
SerialTurnoutManager()
           
 
Method Summary
 int askControlType(String systemName)
          Get from the user, the type of output to be used bits to control a turnout.
 int askNumControlBits(String systemName)
          Get from the user, the number of addressed bits used to control a turnout.
 Turnout createNewTurnout(String systemName, String userName)
          Internal method to invoke the factory, after all the logic for returning an existing method has been invoked.
static SerialTurnoutManager instance()
           
 void notifySecondBitConflict(String conflict, int bitNum)
          Public method to notify user when the second bit of a proposed two output bit turnout has a conflict with another assigned bit
 void notifyTurnoutCreationError(String conflict, int bitNum)
          Public method to notify user of Turnout creation error.
 int selectNumberOfControlBits()
          Public method to allow user to specify one or two output bits for turnout control Note: This method returns 1 or 2 if the user selected, or 0 if the user cancelled without selecting.
 int selectOutputType()
          Public method to allow user to specify pulsed or steady state for two output bits for turnout control Note: This method returns 1 for steady state or 2 for pulsed if the user selected, or 0 if the user cancelled without selecting.
 char systemLetter()
           
 
Methods inherited from class jmri.managers.AbstractTurnoutManager
getBySystemName, getByUserName, getClosedText, getThrownText, getTurnout, getValidOperationTypes, newTurnout, provideTurnout, typeLetter
 
Methods inherited from class jmri.implementation.AbstractManager
addPropertyChangeListener, deregister, dispose, firePropertyChange, getInstanceBySystemName, getInstanceByUserName, getSystemNameArray, getSystemNameList, makeSystemName, propertyChange, register, registerSelf, removePropertyChangeListener
 
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, dispose, getSystemNameArray, makeSystemName, register, removePropertyChangeListener
 

Constructor Detail

SerialTurnoutManager

public SerialTurnoutManager()
Method Detail

systemLetter

public char systemLetter()
Returns:
The system-specific prefix letter for a specific implementation

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

notifyTurnoutCreationError

public void notifyTurnoutCreationError(String conflict,
                                       int bitNum)
Public method to notify user of Turnout creation error.


askNumControlBits

public int askNumControlBits(String systemName)
Get from the user, the number of addressed bits used to control a turnout. Normally this is 1, and the default routine returns 1 automatically. Turnout Managers for systems that can handle multiple control bits should override this method with one which asks the user to specify the number of control bits. If the user specifies more than one control bit, this method should check if the additional bits are available (not assigned to another object). If the bits are not available, this method should return 0 for number of control bits, after informing the user of the problem. This function is called whenever a new turnout is defined in the Turnout table. It can also be used to set up other turnout control options, such as pulsed control of turnout machines.

Specified by:
askNumControlBits in interface TurnoutManager
Overrides:
askNumControlBits in class AbstractTurnoutManager

askControlType

public int askControlType(String systemName)
Get from the user, the type of output to be used bits to control a turnout. Normally this is 0 for 'steady state' control, and the default routine returns 0 automatically. Turnout Managers for systems that can handle pulsed control as well as steady state control should override this method with one which asks the user to specify the type of control to be used. The routine should return 0 for 'steady state' control, or n for 'pulsed' control, where n specifies the duration of the pulse (normally in seconds).

Specified by:
askControlType in interface TurnoutManager
Overrides:
askControlType in class AbstractTurnoutManager

selectNumberOfControlBits

public int selectNumberOfControlBits()
Public method to allow user to specify one or two output bits for turnout control Note: This method returns 1 or 2 if the user selected, or 0 if the user cancelled without selecting.


selectOutputType

public int selectOutputType()
Public method to allow user to specify pulsed or steady state for two output bits for turnout control Note: This method returns 1 for steady state or 2 for pulsed if the user selected, or 0 if the user cancelled without selecting.


notifySecondBitConflict

public void notifySecondBitConflict(String conflict,
                                    int bitNum)
Public method to notify user when the second bit of a proposed two output bit turnout has a conflict with another assigned bit


instance

public static SerialTurnoutManager instance()


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