jmri
Interface SensorManager

All Superinterfaces:
Manager
All Known Implementing Classes:
AbstractSensorManager, AcelaSensorManager, CbusSensorManager, InternalSensorManager, LnSensorManager, NceSensorManager, ProxySensorManager, RpsSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, SerialSensorManager, 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.

Author:
Bob Jacobsen Copyright (C) 2001

Method Summary
 void dispose()
          Free resources when no longer used.
 Sensor getBySystemName(String s)
           
 Sensor getByUserName(String s)
           
 Sensor getSensor(String name)
          Locate via user name, then system name if needed.
 List 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 updateAll()
          Requests status of all layout sensors under this Sensor Manager.
 
Methods inherited from interface jmri.Manager
addPropertyChangeListener, deregister, 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 -
Returns:
Never null under normal circumstances

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)

getByUserName

Sensor getByUserName(String s)

getBySystemName

Sensor getBySystemName(String s)

getSystemNameList

List 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.



Copyright © 1997 - 2008 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: SourceForge_Logo