use of org.openhab.binding.lcn.connection.ModInfo in project openhab1-addons by openhab.
the class ModSn method process.
/**
* Updates the module's data cache with the firmware date.
* {@inheritDoc}
*/
@Override
public void process(Connection conn) {
// Will replace source segment 0 with the local segment id
super.process(conn);
ModInfo info = conn.getModInfo(this.logicalSourceAddr);
if (info != null) {
info.setSwAge(this.swAge);
info.requestSwAge.onResponseReceived();
}
}
use of org.openhab.binding.lcn.connection.ModInfo in project openhab1-addons by openhab.
the class ModStatusVar method process.
/**
* Resolves "unknown" variable types and notifies the connection about the received variable status.
* {@inheritDoc}
*/
@Override
public void process(Connection conn) {
// Will replace source segment 0 with the local segment id
super.process(conn);
ModInfo info = conn.getModInfo(this.logicalSourceAddr);
if (info != null) {
this.var = this.origVar == LcnDefs.Var.UNKNOWN ? info.getLastRequestedVarWithoutTypeInResponse() : this.origVar;
if (this.var != LcnDefs.Var.UNKNOWN) {
if (info.getLastRequestedVarWithoutTypeInResponse() == this.var) {
// Reset
info.setLastRequestedVarWithoutTypeInResponse(LcnDefs.Var.UNKNOWN);
}
if (info.requestStatusVars.containsKey(this.var)) {
info.requestStatusVars.get(this.var).onResponseReceived();
}
}
}
}
use of org.openhab.binding.lcn.connection.ModInfo in project openhab1-addons by openhab.
the class VarReset method register.
/** {@inheritDoc} */
@Override
public void register(Connection conn) {
if (!this.addr.isGroup()) {
long currTime = System.nanoTime();
ModInfo info = conn.updateModuleData((LcnAddrMod) this.addr);
if (!info.requestSwAge.isActive()) {
// Firmware version is required
info.requestSwAge.nextRequestIn(0, currTime);
}
if (info.requestStatusVars.containsKey(this.var) && !info.requestStatusVars.get(this.var).isActive()) {
info.requestStatusVars.get(this.var).nextRequestIn(0, currTime);
}
}
}
use of org.openhab.binding.lcn.connection.ModInfo in project openhab1-addons by openhab.
the class VarVisualize method register.
/** {@inheritDoc} */
@Override
public void register(Connection conn) {
long currTime = System.nanoTime();
ModInfo info = conn.updateModuleData((LcnAddrMod) this.addr);
if (!info.requestSwAge.isActive()) {
// Firmware version is required
info.requestSwAge.nextRequestIn(0, currTime);
}
if (info.requestStatusVars.containsKey(this.var) && !info.requestStatusVars.get(this.var).isActive()) {
info.requestStatusVars.get(this.var).nextRequestIn(0, currTime);
}
}
use of org.openhab.binding.lcn.connection.ModInfo in project openhab1-addons by openhab.
the class LockKeysTemporary method send.
/** {@inheritDoc} */
@Override
public void send(Connection conn, Item item, Command cmd) {
boolean sent = false;
for (int tableId = 0; tableId < 4; ++tableId) {
for (int keyId = 0; keyId < 8; ++keyId) {
if (this.keys[tableId][keyId]) {
// Lock if at least one key should be locled
if (tableId == 0) {
// Only table A is currently supported
conn.queue(this.addr, !this.addr.isGroup(), PckGenerator.lockKeyTabATemporary(this.time, this.timeUnit, this.keys[tableId]));
sent = true;
} else {
logger.error(String.format("Locking keys from table %s (temporary) is not supported.", tableId == 1 ? "B" : tableId == 2 ? "C" : "D"));
}
break;
}
}
}
// Force status update (status is polled and should be updated now)
if (sent && !this.addr.isGroup()) {
ModInfo info = conn.getModInfo((LcnAddrMod) this.addr);
if (info != null) {
info.requestStatusLockedKeys.nextRequestIn(ModInfo.STATUS_REQUEST_DELAY_AFTER_COMMAND_MSEC, System.nanoTime());
}
}
}
Aggregations