|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.parameter.AbstractParameter
stella.parameter.AbstractTrigger
stella.parameter.SimpleTrigger
stella.parameter.AbstractSwitch
stella.parameter.RS485Switch
stella.roof.LightSwitch
public class LightSwitch
A class providing access to a RS485-enabled light switch. This means the following:
PollingRS485Server instance
which is registered to the light switch on startup using the
registerDriver(io.Driver) method.KEY_ALLOWONCLEAR flag are checked.
If weather conditions are clear and the KEY_ALLOWONCLEAR flag
is false, the light is not switched on. Otherwise, it is turned on using
a time-out of KEY_TIMEOUT.#switchOn, #switchOff, and the #switchOnTimeout
methods is always allowed.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static boolean |
DEFALLOWONCLEAR
The default allowance to switch on light during night. |
private static int |
DEFCHANNEL
The defalt input channel to read. |
private static boolean |
DEFINVERSE
The default inverse mask interpretation (false). |
private static int |
DEFMASK
The bits masking to the open-roof switches, used as default. |
static String |
DEFNAME
The default parameter name. |
private static String |
DEFREADSWITCH
The default read switch string. |
private static String |
DEFSERIAL
The default serial driver name. |
private static int |
DEFSKIP
The default number of chars to skip on digital input. |
private static String |
DEFSWITCHOFF
The default serial command to switch on the light. |
private static String |
DEFSWITCHON
The default serial command to switch on the light. |
private static long |
DEFTIMEOUT
The default time out after witch light is turned off again. |
private Trigger |
forced
Monitors forced switches. |
static String |
KEY_ALLOWONCLEAR
If true, light may also be switched on during roof open. |
static String |
KEY_CHANNEL
The key pointing to the digital input word to interpret. |
static String |
KEY_INVERSE
The key for interpreting the mask inversely, true or false. |
static String |
KEY_MASK
The key for interpreting the return bitmask as true or false. |
static String |
KEY_READSWITCH
The key linked to the string sent to the serial port before reading. |
static String |
KEY_SKIP
The key for skiping leading bytes on digital input. |
static String |
KEY_TIMEOUT
The default time out for light switch off. |
private Trigger |
open
The roof-open trigger. |
| Fields inherited from class stella.parameter.RS485Switch |
|---|
KEY_INITOFF, KEY_SERIAL, KEY_SWITCHOFF, KEY_SWITCHON |
| Fields inherited from class stella.parameter.SimpleTrigger |
|---|
KEY_INITBOOLEAN |
| 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 | |
|---|---|
LightSwitch(Map prop)
Constructs a new light switch trigger. |
|
| Method Summary | |
|---|---|
protected Boolean |
getBooleanFromResponse(String read)
This method transforms the output of the switches into a single information whether the roof-switches are down. |
protected int |
getDigiatlIOChannelsFromResponse(String read)
The string read in from the serial port has the following format: |
void |
init()
Initializes the light switch. |
void |
newValue(CacheChangedEvent cce)
First, get the current state of the trigger. |
boolean |
registerDriver(Driver server)
Additionally registers the light switch as a cache-changed listener to the polling server. |
void |
registerParameter(Parameter roof)
Registers the weather station. |
| Methods inherited from class stella.parameter.RS485Switch |
|---|
off, on, rescanned |
| Methods inherited from class stella.parameter.AbstractSwitch |
|---|
turnOff, turnOn |
| Methods inherited from class stella.parameter.SimpleTrigger |
|---|
getLastToggleTime, getTrigger, setTrigger |
| Methods inherited from class stella.parameter.AbstractTrigger |
|---|
get, getElapsedToggleTime, isTrue, set, toggleTrigger |
| 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.Trigger |
|---|
getElapsedToggleTime, getLastToggleTime, getTrigger, isTrue, setTrigger, toggleTrigger |
| Methods inherited from interface stella.Parameter |
|---|
get, getFormatted, getName, getString, set |
| 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 |
|---|
public static final String KEY_ALLOWONCLEAR
public static final String KEY_TIMEOUT
public static final String KEY_READSWITCH
public static final String KEY_SKIP
public static final String KEY_CHANNEL
public static final String KEY_MASK
public static final String KEY_INVERSE
public static final String DEFNAME
private static final String DEFSERIAL
private static final String DEFREADSWITCH
private static final int DEFSKIP
private static final int DEFCHANNEL
private static final int DEFMASK
private static final boolean DEFINVERSE
private static final boolean DEFALLOWONCLEAR
private static final String DEFSWITCHON
private static final String DEFSWITCHOFF
private static final long DEFTIMEOUT
private Trigger open
private Trigger forced
| Constructor Detail |
|---|
public LightSwitch(Map prop)
| Method Detail |
|---|
public void init()
init in interface Initializableinit in class RS485Switchpublic boolean registerDriver(Driver server)
registerDriver in interface DriverDependingregisterDriver in class RS485Switchpublic void registerParameter(Parameter roof)
KEY_ALLOWONCLEAR
to true. Note that direct switches of the light via the remote
methods are not affected by the current weather.
registerParameter in interface ParameterDependingpublic void newValue(CacheChangedEvent cce)
newValue in interface CacheChangedListenerprotected Boolean getBooleanFromResponse(String read)
KEY_MASK and
returns true if the result is equal to the trigger mask.
protected int getDigiatlIOChannelsFromResponse(String read)
CH#0[CH#1]...[CH#N]
Where skip isthe number of chars to ignore at the start of the
string. The following channels are all iun 2-char format, each
representing a single byte. It depends on the module used how many
channels will be available on the returned string. Depending on the
values given in the required properties KEY_SKIP and
KEY_CHANNEL, the returned integer represents the byte as
deduced from a two-char hex-string. Examples:
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||