public class Blinker extends SimpleEventTrigger implements ParameterDepending
blinkClose() and a method for preceeding a roof-open event,
blinkOpen(). Both methods may notify a monitor when the blinking
phase ended. Two different methods are used to allow different
flashing intervals on open and close which may be desired if quick closing
of the roof is more important than proper warning. The trigger value
is true if the blinker is in its flashing state.
The blinking interval is definable via the KEY_PHASEON and the
KEY_PHASEOFF properties. These give the on/off durations in ms.
The
entire length of the blinking phase is determined via the
KEY_BLINKOPEN and KEY_BLINKCLOSE properties, the required
blinker paramter is stated in #KEY_LIGHTSWITCH.
| Modifier and Type | Class and Description |
|---|---|
private class |
Blinker.SwitchTask
A timer task class that writes a string to the serial line.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private TimerTask |
blink
The timer task ending the blinking phase.
|
private static long |
DEFBLINKCLOSE
The default duration of the blink phase on close.
|
private static long |
DEFBLINKOPEN
The default duration of the blink phase on open.
|
static String |
DEFNAME
The default name of this trigger.
|
private static long |
DEFPHASEOFF
The default duration of the off-phase.
|
private static long |
DEFPHASEON
The default duration of the on-phase.
|
static String |
KEY_BLINKCLOSE
The key for the duration of the entire blink phase on close, in ms.
|
static String |
KEY_BLINKOPEN
The key for the duration of the entire blink phase on open, in ms.
|
static String |
KEY_PHASEOFF
The key determining the duration of the off-phase, in ms.
|
static String |
KEY_PHASEON
The key determining the duration of the on-phase, in ms.
|
static String |
KEY_SIGNALSWITCH
The name of the light switch trigger.
|
private Switch |
light
The serial server for switching the light.
|
private TimerTask |
off
The timer task switching the light off.
|
private TimerTask |
on
The timer task switching the light on.
|
private Timer |
timer
The timer task scheduler used for blinking and stopping.
|
KEY_INITBOOLEANKEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWNKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASSKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME| Constructor and Description |
|---|
Blinker(Map prop)
Constructs a new blinker object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
blinkClose()
Blinks before closing the roof.
|
void |
blinkOpen()
Blinks before opening the roof.
|
private void |
doBlink(long onperiod,
long offperiod,
long duration)
Performs the blinking, set the trigger to true on start and resets it
after the blinking phase.
|
long |
getCloseBlinkPeriod()
Returns the entire time of the blinking period on close-roof actions.
|
long |
getOpenBlinkPeriod()
Returns the entire time of the blinking period on open-roof actions.
|
void |
registerParameter(Parameter lux)
Registers the paramters.
|
void |
stopBlink()
Quit blinking phase immediately.
|
getMonitor, registerMonitor, setTrigger, toggleTriggergetLastToggleTime, getTrigger, init, rescannedget, getElapsedToggleTime, isTrue, setcreateParameter, delivers, exit, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, overrideDefaultName, register, setName, toStringclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, 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, parseObject, reload, removeProperty, requires, setObject, setProperties, setProperty, stringPropertiesequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreloadgetFormatted, getName, getStringdefaultBoolean, 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, stringPropertiespublic static final String KEY_PHASEON
public static final String KEY_PHASEOFF
public static final String KEY_BLINKOPEN
public static final String KEY_BLINKCLOSE
public static final String KEY_SIGNALSWITCH
public static final String DEFNAME
private static final long DEFPHASEON
private static final long DEFPHASEOFF
private static final long DEFBLINKOPEN
private static final long DEFBLINKCLOSE
private Switch light
private Timer timer
private TimerTask on
private TimerTask off
private TimerTask blink
public Blinker(Map prop)
public void registerParameter(Parameter lux)
RS485Switch and named after KEY_SIGNALSWITCH is found
blinking will occur as planned.registerParameter in interface ParameterDependingpublic long getOpenBlinkPeriod()
SimpleTrigger.getLastToggleTime() and
AbstractTrigger.getElapsedToggleTime().public long getCloseBlinkPeriod()
SimpleTrigger.getLastToggleTime() and
AbstractTrigger.getElapsedToggleTime().public void blinkOpen()
public void blinkClose()
public void stopBlink()
private void doBlink(long onperiod,
long offperiod,
long duration)
onperiod - The duration of the on-phase, in ms.offperiod - The duration of the off-phase, in ms.duration - The entire duration of the blinking phase, in ms.