jmri
Interface Sensor

Show UML class diagram
All Superinterfaces:
NamedBean
All Known Implementing Classes:
AbstractSensor, AcelaSensor, CbusSensor, CoreIdRfidSensor, Dcc4PcSensor, EcosSensor, JMRIClientSensor, LnSensor, MarklinSensor, NceSensor, OlcbSensor, RfidSensor, RpsSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SerialSensor, SRCPSensor, XNetSensor

public interface Sensor
extends NamedBean

General input device representation. Often subclassed for specific types of sensors.


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.


Field Summary
static int ACTIVE
           
static int INACTIVE
           
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Request a call-back when the bound KnownState property changes.
 void dispose()
          Remove references to and from this object, so that it can eventually be garbage-collected.
 boolean getInverted()
          Get the inverted state.
 int getKnownState()
          Known state on layout is a bound parameter
 int getRawState()
          Used to return the Raw state of a sensor prior to the known state of a sensor being set.
 Reporter getReporter()
          Retrieve the reporter assocated with this sensor if there is one.
 long getSensorDebounceGoingActiveTimer()
          Get the Active debounce delay in milliSeconds.
 long getSensorDebounceGoingInActiveTimer()
          Get the InActive debounce delay in milliSeconds.
 void removePropertyChangeListener(PropertyChangeListener l)
          Remove a request for a call-back when a bound property changes.
 void requestUpdateFromLayout()
          Request an update from the layout soft/hardware.
 void setInverted(boolean inverted)
          Control whether the actual sensor input is considered to be inverted, e.g. the normal electrical signal that results in an ACTIVE state now results in an INACTIVE state.
 void setKnownState(int newState)
          Potentially allow the user to set the known state on the layout.
 void setReporter(Reporter re)
          Some sensor boards also serve the function of being able to report back train identities via such methods as RailCom.
 void setSensorDebounceGoingActiveTimer(long timer)
          Set the Active debounce delay in milliSeconds.
 void setSensorDebounceGoingInActiveTimer(long timer)
          Set the InActive debounce delay in milliSeconds.
 boolean useDefaultTimerSettings()
          Does this sensor use the default timers for
 void useDefaultTimerSettings(boolean boo)
          Use the timers specified in the Sensor manager, for the debounce delay
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getState, getSystemName, getUserName, removeProperty, setComment, setProperty, setState, setUserName, updateListenerRef
 

Field Detail

ACTIVE

static final int ACTIVE
See Also:
Constant Field Values

INACTIVE

static final int INACTIVE
See Also:
Constant Field Values
Method Detail

getKnownState

int getKnownState()
Known state on layout is a bound parameter

Returns:
known state value

setKnownState

void setKnownState(int newState)
                   throws JmriException
Potentially allow the user to set the known state on the layout. This might not always be available, depending on the limits of the underlying system and implementation.

Throws:
JmriException

requestUpdateFromLayout

void requestUpdateFromLayout()
Request an update from the layout soft/hardware. May not even happen, and if it does it will happen later; listen for the result.


setInverted

void setInverted(boolean inverted)
Control whether the actual sensor input is considered to be inverted, e.g. the normal electrical signal that results in an ACTIVE state now results in an INACTIVE state.

Changing this changes the state from ACTIVE to INACTIVE and vice-versa, with notifications; UNKNOWN and INCONSISTENT are left unchanged.


getInverted

boolean getInverted()
Get the inverted state. If true, the electrical signal that results in an ACTIVE state now results in an INACTIVE state.


addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener l)
Request a call-back when the bound KnownState property changes.

Specified by:
addPropertyChangeListener in interface NamedBean

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener l)
Remove a request for a call-back when a bound property changes.

Specified by:
removePropertyChangeListener in interface NamedBean

dispose

void dispose()
Remove references to and from this object, so that it can eventually be garbage-collected.

Specified by:
dispose in interface NamedBean

getRawState

int getRawState()
Used to return the Raw state of a sensor prior to the known state of a sensor being set. The raw state value can be different when the sensor debounce option is used.

Returns:
raw state value

setSensorDebounceGoingActiveTimer

void setSensorDebounceGoingActiveTimer(long timer)
Set the Active debounce delay in milliSeconds. If a zero value is entered then debounce delay is de-activated.


getSensorDebounceGoingActiveTimer

long getSensorDebounceGoingActiveTimer()
Get the Active debounce delay in milliSeconds.


setSensorDebounceGoingInActiveTimer

void setSensorDebounceGoingInActiveTimer(long timer)
Set the InActive debounce delay in milliSeconds. If a zero value is entered then debounce delay is de-activated.


getSensorDebounceGoingInActiveTimer

long getSensorDebounceGoingInActiveTimer()
Get the InActive debounce delay in milliSeconds.


useDefaultTimerSettings

void useDefaultTimerSettings(boolean boo)
Use the timers specified in the Sensor manager, for the debounce delay


useDefaultTimerSettings

boolean useDefaultTimerSettings()
Does this sensor use the default timers for


setReporter

void setReporter(Reporter re)
Some sensor boards also serve the function of being able to report back train identities via such methods as RailCom. The setting and creation of the reporter against the sensor should be done when the sensor is created. This information is not saved.

returns null if there is no direct reporter.


getReporter

Reporter getReporter()
Retrieve the reporter assocated with this sensor if there is one.

returns null if there is no direct reporter.



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