public class OneWireMultiSwitch extends AbstractSwitch implements DriverDepending, Reloadable
KEY_SINGLEON option is set, switching on
means that all other switches are off on this address, otherwise we leave the
state of the other switches untouched.
#KEY_BIND is
true.DriverDepending interface.KEY_INITOFF key.
PropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEFINITOFF
The initial state of the switch.
|
private static boolean |
DEFSINGLEON
The initial state of the switch.
|
static String |
KEY_INITOFF
The key defining initial off.
|
static String |
KEY_ONEWIRE
The name of the one-wire driver to use.
|
static String |
KEY_PATH
The path to the switch board plus channel, e.g '/12.(add)/PIO.A'.
|
static String |
KEY_SINGLEON
If true, there is only a single switch in the on state allowed.
|
static String |
KEY_SWITCHBIT
The integer mask to the switch.
|
private OneWireDriver |
serial
The serial server to send commands to.
|
private static Map<OneWireDriver,Map<String,Integer>> |
table
The lookuptable for all one-wire multi switches.
|
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 |
|---|
OneWireMultiSwitch(Map prop)
Constructs a new light switch trigger.
|
| Modifier and Type | Method and Description |
|---|---|
void |
init()
Initializes the one wire switch switch.
|
protected boolean |
off()
Turn the switch off.
|
protected boolean |
on()
Turns the switch on.
|
private String |
readSerial()
Reads the 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.
|
protected String |
toWrite(int mask)
Converts the integer to write to the correct string.
|
private boolean |
writeSerial(OneWireDriver bus,
int mask)
Writes to the ow-bus driver the specified int.
|
turnOff, turnOngetLastToggleTime, getTrigger, setTriggerget, getElapsedToggleTime, isTrue, set, toggleTriggercreateParameter, 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, waitreloaddefaultBoolean, 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, stringPropertiesgetElapsedToggleTime, getLastToggleTime, getTrigger, isTrue, setTrigger, toggleTriggerpublic static final String KEY_ONEWIRE
public static final String KEY_PATH
public static final String KEY_SWITCHBIT
public static final String KEY_SINGLEON
public static final String KEY_INITOFF
private static final boolean DEFSINGLEON
private static final boolean DEFINITOFF
private OneWireDriver serial
private static Map<OneWireDriver,Map<String,Integer>> table
public OneWireMultiSwitch(Map prop)
public void init()
throws InitException
init in interface Initializableinit in class SimpleTriggerInitExceptionpublic double rescanned(String key, String old, String newval)
rescanned in interface Reloadablerescanned in class SimpleTriggerpublic boolean registerDriver(Driver rs485)
OneWireDriver. If so, it's name is check to match the
KEY_ONEWIRE name. If this, too, is fulfilled, an instance of
this server is stored locally to allow sending of commands to the serial
server.registerDriver in interface DriverDependingprotected boolean on()
KEY_SINGLEON, we either or the bitmask
into the cached reading and write this to the stream or we write solely
the bitmask. Whenever the result of the process is okay, we store the
byte in the table cache.on in class AbstractSwitchprotected boolean off()
off in class AbstractSwitchprotected String toWrite(int mask)
private boolean writeSerial(OneWireDriver bus, int mask)
toWrite(int) method. The default
implementation converts the integer at base 10, no leading zeros. If
writing was successful, the cache is updated.private String readSerial()