stella.parameter
Class SerialValue

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by stella.parameter.AbstractParameter
                  extended by stella.parameter.AbstractValue
                      extended by stella.parameter.SerialValue
All Implemented Interfaces:
DriverDepending, Cloneable, Parameter, Value, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, Reloadable, ResourceSupplying

public class SerialValue
extends AbstractValue
implements DriverDepending, Reloadable

A class providing access to a RS485-enabled switch. This means the following:

Note that this class should never be used directly.


Nested Class Summary
static class SerialValue.DewarPressure
          Dewar pressure conversion function.
static class SerialValue.Test
          Test class.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Double cache
          The old value, if reading fails.
private  Function convert
          The function to calculate the true value out of the reading.
private static boolean DEFALLOWCACHE
          Default cache is allowed.
static String KEY_ALLOWCACHE
          If true we allow cached returns in case of read failures.
static String KEY_FUNCTIONCLASS
          The conversion function class.
static String KEY_FUNCTIONINIT
          The conversion function init.
static String KEY_SERIAL
          The name of the serial server to use.
static String KEY_WRITE
          The command we write to the serial server to read in the value.
private  boolean lastread
          True, if last read was successful.
private  AbstractSerialDriver serial
          The serial server to send commands to.
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
SerialValue(Map<String,String> prop)
          Constructs a new light switch trigger.
 
Method Summary
 Number getValue()
          Getting the value is writing to the server and reading in the response.
 void init()
          Initializes the light switch.
 boolean registerDriver(Driver rs485)
          Registers the driver.
 double rescanned(String key, String old, String newval)
          As any parameter depending instance we fail if the parameter we depend on is now a different one.
 Number setValue(Number w)
          Setting the value is not allowed.
 
Methods inherited from class stella.parameter.AbstractValue
get, set
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, register, setName, toString
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.Reloadable
reload
 
Methods inherited from interface stella.Parameter
getFormatted, getName, getString
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 

Field Detail

KEY_SERIAL

public static final String KEY_SERIAL
The name of the serial server to use.

See Also:
Constant Field Values

KEY_WRITE

public static final String KEY_WRITE
The command we write to the serial server to read in the value.

See Also:
Constant Field Values

KEY_ALLOWCACHE

public static final String KEY_ALLOWCACHE
If true we allow cached returns in case of read failures.

See Also:
Constant Field Values

KEY_FUNCTIONCLASS

public static final String KEY_FUNCTIONCLASS
The conversion function class.

See Also:
Constant Field Values

KEY_FUNCTIONINIT

public static final String KEY_FUNCTIONINIT
The conversion function init.

See Also:
Constant Field Values

DEFALLOWCACHE

private static final boolean DEFALLOWCACHE
Default cache is allowed.

See Also:
Constant Field Values

serial

private AbstractSerialDriver serial
The serial server to send commands to.


convert

private Function convert
The function to calculate the true value out of the reading.


cache

private Double cache
The old value, if reading fails.


lastread

private boolean lastread
True, if last read was successful. Used for logging.

Constructor Detail

SerialValue

public SerialValue(Map<String,String> prop)
Constructs a new light switch trigger. As a monitor for notification of cache-cahnged events, this trigger registers itself in the init section.
All additional properties have default values.

Method Detail

init

public void init()
Initializes the light switch.

Specified by:
init in interface Initializable
Overrides:
init in class AbstractParameter

rescanned

public double rescanned(String key,
                        String old,
                        String newval)
As any parameter depending instance we fail if the parameter we depend on is now a different one.

Specified by:
rescanned in interface Reloadable
Overrides:
rescanned in class AbstractParameter

registerDriver

public boolean registerDriver(Driver rs485)
Registers the driver. First, it is checked for instancy of PollingRS485Server. If so, it's name is check to match the KEY_SERIAL name. If this, too, is fulfilled, the server is passed to the super-method, which does the necessary cache change registration. Additionally an instance of this server is stored locally to allow sending of commands to the serial server.

Specified by:
registerDriver in interface DriverDepending
Returns:
True if registering at the driver was successful.

setValue

public Number setValue(Number w)
Setting the value is not allowed.

Specified by:
setValue in interface Value

getValue

public Number getValue()
Getting the value is writing to the server and reading in the response.

Specified by:
getValue in interface Value