jmri
Interface SensorManager

Show UML class diagram
All Superinterfaces:
Manager
All Known Implementing Classes:
AbstractSensorManager, AcelaSensorManager, CbusSensorManager, Dcc4PcSensorManager, EcosSensorManager, InternalSensorManager, InternalSensorManager, JMRIClientSensorManager, LnSensorManager, LnSensorManager, MarklinSensorManager, NceSensorManager, OlcbSensorManager, ProxySensorManager, RfidSensorManager, RpsSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SpecificSensorManager, SpecificSensorManager, SpecificSensorManager, SpecificSensorManager, SpecificSensorManager, SpecificSensorManager, SRCPSensorManager, XNetSensorManager

public interface SensorManager
extends Manager

Interface for controlling 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
 
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
 
Method Summary
 boolean allowMultipleAdditions(String systemName)
          A method that determines if it is possible to add a range of sensors in numerical order eg 10 to 30 will return true.
 String createSystemName(String curAddress, String prefix)
           
 void dispose()
          Free resources when no longer used.
 Sensor getBySystemName(String s)
           
 Sensor getByUserName(String s)
           
 long getDefaultSensorDebounceGoingActive()
           
 long getDefaultSensorDebounceGoingInActive()
           
 String getNextValidAddress(String curAddress, String prefix)
          Determine if the address supplied is valid and free, if not then it shall return the next free valid address up to a maximum of 10 address away from the initial address.
 Sensor getSensor(String name)
          Locate via user name, then system name if needed.
 List<String> getSystemNameList()
           
 Sensor newSensor(String systemName, String userName)
          Return an instance with the specified system and user names.
 Sensor provideSensor(String name)
          Locate via user name, then system name if needed.
 void setDefaultSensorDebounceGoingActive(long timer)
           
 void setDefaultSensorDebounceGoingInActive(long timer)
           
 void updateAll()
          Requests status of all layout sensors under this Sensor Manager.
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, getBeanBySystemName, getBeanByUserName, getNamedBean, getNamedBeanList, getSystemNameArray, getSystemPrefix, getXMLOrder, makeSystemName, register, removePropertyChangeListener, systemLetter, typeLetter
 

Method Detail

provideSensor

Sensor provideSensor(String name)
Locate via user name, then system name if needed. If that fails, create a new sensor: If the name is a valid system name, it will be used for the new sensor. Otherwise, the makeSystemName method will attempt to turn it into a valid system name.

Parameters:
name - User name, system name, or address which can be promoted to system name
Returns:
Never null
Throws:
IllegalArgumentException - if Sensor doesn't already exist and the manager cannot create the Sensor due to e.g. an illegal name or name that can't be parsed.

getSensor

Sensor getSensor(String name)
Locate via user name, then system name if needed. Does not create a new one if nothing found

Parameters:
name -
Returns:
null if no match found

dispose

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

newSensor

Sensor newSensor(String systemName,
                 String userName)
Return an instance with the specified system and user names. Note that two calls with the same arguments will get the same instance; there is only one Sensor object representing a given physical turnout and therefore only one with a specific system or user name.

This will always return a valid object reference; a new object will be created if necessary. In that case:

Note that it is possible to make an inconsistent request if both addresses are provided, but the given values are associated with different objects. This is a problem, and we don't have a good solution except to issue warnings. This will mostly happen if you're creating Turnouts when you should be looking them up.

Returns:
requested Sensor object (never null)
Throws:
IllegalArgumentException - if cannot create the Sensor due to e.g. an illegal name or name that can't be parsed.

getByUserName

Sensor getByUserName(String s)

getBySystemName

Sensor getBySystemName(String s)

getSystemNameList

List<String> getSystemNameList()
Specified by:
getSystemNameList in interface Manager

updateAll

void updateAll()
Requests status of all layout sensors under this Sensor Manager. This method may be invoked whenever the status of sensors needs to be updated from the layout, for example, when an XML configuration file is read in. Note that there is a null implementation of this method in AbstractSensorManager. This method only needs be implemented in system-specific Sensor Managers where readout of sensor status from the layout is possible.


allowMultipleAdditions

boolean allowMultipleAdditions(String systemName)
A method that determines if it is possible to add a range of sensors in numerical order eg 10 to 30 will return true. where as if the address format is 1b23 this will return false.


getNextValidAddress

String getNextValidAddress(String curAddress,
                           String prefix)
                           throws JmriException
Determine if the address supplied is valid and free, if not then it shall return the next free valid address up to a maximum of 10 address away from the initial address.

Parameters:
prefix - - The System Prefix used to make up the systemName
curAddress - - The hardware address of the turnout we which to check.
Throws:
JmriException

createSystemName

String createSystemName(String curAddress,
                        String prefix)
                        throws JmriException
Throws:
JmriException

getDefaultSensorDebounceGoingActive

long getDefaultSensorDebounceGoingActive()

getDefaultSensorDebounceGoingInActive

long getDefaultSensorDebounceGoingInActive()

setDefaultSensorDebounceGoingActive

void setDefaultSensorDebounceGoingActive(long timer)

setDefaultSensorDebounceGoingInActive

void setDefaultSensorDebounceGoingInActive(long timer)


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