jmri.implementation
Class LightControl

java.lang.Object
  extended by jmri.implementation.LightControl

public class LightControl
extends Object

Each LightControl object is linked to a specific Light, and provides one of the controls available for switching the Light ON/OFF in response to time or events occurring on the layout.

Each LightControl holds the information for one control of the parent Light.

Each Light may have as many controls as desired by the user. It is the user's responsibility to ensure that the various control mechanisms do not conflict with one another.

Available control types are those defined in the Light.java interface. Control types: SENSOR_CONTROL FAST_CLOCK_CONTROL TURNOUT_STATUS_CONTROL TIMED_ON_CONTROL TWO_SENSOR_CONTROL


This file is part of JMRI.

JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Author:
Dave Duchamp Copyright (C) 2010

Field Summary
protected  Timebase _clock
           
protected  int _controlSensorSense
           
protected  Turnout _controlTurnout
           
protected  NamedBeanHandle<Sensor> _namedControlSensor
           
protected  NamedBeanHandle<Sensor> _namedControlSensor2
           
protected  NamedBeanHandle<Sensor> _namedTimedControlSensor
           
protected  Light _parentLight
           
protected  ActionListener _timedControlListener
           
protected  Timer _timedControlTimer
           
protected  int _timeOff
           
protected  int _timeOn
           
protected  int _timeOnDuration
           
protected  NamedBeanHandleManager nbhm
           
 
Constructor Summary
LightControl()
          Main constructor methods
LightControl(Light l)
           
 
Method Summary
 void activateLightControl()
          Activates a Light Control by control type.
 void deactivateLightControl()
          Deactivates a LightControl by control type.
 String getControlSensor2Name()
           
 String getControlSensorName()
           
 int getControlSensorSense()
           
 String getControlTimedOnSensorName()
           
 String getControlTurnoutName()
           
 int getControlTurnoutState()
           
 int getControlType()
          Accessor methods
 int getFastClockOffHour()
           
 int getFastClockOffMin()
           
 int getFastClockOnHour()
           
 int getFastClockOnMin()
           
 int getTimedOnDuration()
           
 void setControlSensor2Name(String sensorName)
           
 void setControlSensorName(String sensorName)
           
 void setControlSensorSense(int sense)
           
 void setControlTimedOnSensorName(String sensorName)
           
 void setControlTurnout(String turnoutName)
           
 void setControlTurnoutState(int state)
           
 void setControlType(int type)
           
 void setFastClockControlSchedule(int onHour, int onMin, int offHour, int offMin)
           
 void setParentLight(Light l)
           
 void setTimedOnDuration(int duration)
           
protected  void twoSensorChanged(PropertyChangeEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_controlSensorSense

protected int _controlSensorSense

_timeOnDuration

protected int _timeOnDuration

_parentLight

protected Light _parentLight

_namedControlSensor

protected NamedBeanHandle<Sensor> _namedControlSensor

_namedControlSensor2

protected NamedBeanHandle<Sensor> _namedControlSensor2

_clock

protected Timebase _clock

_timeOn

protected int _timeOn

_timeOff

protected int _timeOff

_controlTurnout

protected Turnout _controlTurnout

_namedTimedControlSensor

protected NamedBeanHandle<Sensor> _namedTimedControlSensor

_timedControlTimer

protected Timer _timedControlTimer

_timedControlListener

protected ActionListener _timedControlListener

nbhm

protected NamedBeanHandleManager nbhm
Constructor Detail

LightControl

public LightControl()
Main constructor methods


LightControl

public LightControl(Light l)
Method Detail

getControlType

public int getControlType()
Accessor methods


setControlType

public void setControlType(int type)

setControlSensorName

public void setControlSensorName(String sensorName)

getControlSensorSense

public int getControlSensorSense()

getControlSensorName

public String getControlSensorName()

setControlSensorSense

public void setControlSensorSense(int sense)

getFastClockOnHour

public int getFastClockOnHour()

getFastClockOnMin

public int getFastClockOnMin()

getFastClockOffHour

public int getFastClockOffHour()

getFastClockOffMin

public int getFastClockOffMin()

setFastClockControlSchedule

public void setFastClockControlSchedule(int onHour,
                                        int onMin,
                                        int offHour,
                                        int offMin)

getControlTurnoutName

public String getControlTurnoutName()

setControlTurnout

public void setControlTurnout(String turnoutName)

getControlTurnoutState

public int getControlTurnoutState()

setControlTurnoutState

public void setControlTurnoutState(int state)

getControlTimedOnSensorName

public String getControlTimedOnSensorName()

setControlTimedOnSensorName

public void setControlTimedOnSensorName(String sensorName)

getTimedOnDuration

public int getTimedOnDuration()

setTimedOnDuration

public void setTimedOnDuration(int duration)

getControlSensor2Name

public String getControlSensor2Name()

setControlSensor2Name

public void setControlSensor2Name(String sensorName)

setParentLight

public void setParentLight(Light l)

activateLightControl

public void activateLightControl()
Activates a Light Control by control type. This method tests the control type, and set up a control mechanism, appropriate for the control type.


twoSensorChanged

protected void twoSensorChanged(PropertyChangeEvent e)

deactivateLightControl

public void deactivateLightControl()
Deactivates a LightControl by control type. This method tests the control type, and deactivates the control mechanism, appropriate for the control type.



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