public class DeviceTrigger extends SimpleTrigger implements ErrorCaster
registerCommandLaunching(stella.CommandLaunching).
Due to this special behaviour the construction of a device trigger with the
AbstractParameter.createParameter(java.util.Map<java.lang.String, java.lang.String>) method is not advised.
| Modifier and Type | Class and Description |
|---|---|
private class |
DeviceTrigger.PingTask
The timer task that connects to the device.
|
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static long |
DEFPING
The default value of the is-alive intervall, in ms (10000).
|
private CommandLaunching |
device
The reference to the underlying command server.
|
private List<ErrorListener> |
errlist
The vector of error listeners.
|
static String |
KEY_PING
The key linked to the is-alive intervall.
|
static String |
NAME_EXT
The default extension to the trigger's server name.
|
private TimerTask |
ping
The timer task of the trigger that does the actual ping.
|
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 |
|---|
DeviceTrigger(Map<String,String> prop)
Constructs a new sequence trigger with the given name and default value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addErrorListener(ErrorListener ear)
Registers an error event listener to this sequencer.
|
void |
exit()
Cancels the pinger task on exit.
|
long |
getPingPeriod()
Returns the onig period of this device trigger.
|
TimerTask |
getTimerTask()
Return the timer task associated with this device trigger.Note that
starting the device trigger via an timer objects lies within the
responsiblity of the calling object.
|
protected void |
notifyErrorListener(ErrorEvent ee)
Notifies all registered ErrorListeners.
|
void |
registerCommandLaunching(CommandLaunching server)
Registers a command launching instance to this device trigger.
|
void |
removeErrorListener(ErrorListener ear)
Deregisters an error event listener from this sequencer.
|
Boolean |
setTrigger(Boolean val)
Sets the value of this trigger.
|
Boolean |
toggleTrigger()
Toggling the trigger is not allowed, set is only through timer task.
|
getLastToggleTime, getTrigger, init, rescannedget, getElapsedToggleTime, isTrue, setcreateParameter, delivers, 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 NAME_EXT
public static final String KEY_PING
private static final long DEFPING
private CommandLaunching device
private final List<ErrorListener> errlist
private final TimerTask ping
public void exit()
exit in interface ExitCleaningexit in class AbstractParameterpublic void registerCommandLaunching(CommandLaunching server)
The default start value of the trigger is retrieved from the server. Note that this are special triggers that are always constructed in a trigger set, but should never be specialized in the trigger set trigger's list!
public long getPingPeriod()
getTimerTask() method. Note that
starting the device trigger via an timer objects lies within the
responsiblity of the calling object.public TimerTask getTimerTask()
public Boolean setTrigger(Boolean val)
setTrigger in interface TriggeringsetTrigger in class SimpleTriggerpublic Boolean toggleTrigger()
toggleTrigger in interface TriggeringtoggleTrigger in class AbstractTriggerpublic void addErrorListener(ErrorListener ear)
addErrorListener in interface ErrorCasterpublic void removeErrorListener(ErrorListener ear)
removeErrorListener in interface ErrorCasterprotected void notifyErrorListener(ErrorEvent ee)
An error event signaling a lost connection is only generated if the connection state changes from connected to not connected, not if a server is simply not connected.
ee - The ErrorEvent to pass to the Listeners.