Example #1
0
 /** {@inheritDoc} */
 @Override
 public void register(Connection conn) {
   ModInfo info = conn.updateModuleData((LcnAddrMod) this.addr);
   if (!info.requestStatusLedsAndLogicOps.isActive()) {
     info.requestStatusLedsAndLogicOps.nextRequestIn(0, System.nanoTime());
   }
 }
Example #2
0
 /** {@inheritDoc} */
 @Override
 public void send(Connection conn, Item item, Command cmd) {
   LcnDefs.VarValue value = this.value;
   if (value == null && cmd instanceof DecimalType) {
     value = LcnDefs.VarValue.fromVarUnit(((DecimalType) cmd).doubleValue(), this.unit, true);
   }
   if (value != null) {
     try {
       boolean is2013 = !this.forceOld;
       ModInfo info = null;
       if (!this.addr.isGroup()) {
         info = conn.getModInfo((LcnAddrMod) this.addr);
         if (info != null) {
           is2013 = info.getSwAge() >= 0x170206;
         }
       }
       if (LcnDefs.Var.toVarId(this.var) != -1) {
         // Absolute commands for variables are not supported.
         // We fake the missing command by using reset and relative commands.
         conn.queue(this.addr, !this.addr.isGroup(), PckGenerator.varReset(this.var, is2013));
         conn.queue(
             this.addr,
             !this.addr.isGroup(),
             PckGenerator.varRel(this.var, LcnDefs.RelVarRef.CURRENT, value.toNative(), is2013));
       } else {
         conn.queue(
             this.addr, !this.addr.isGroup(), PckGenerator.varAbs(this.var, value.toNative()));
       }
       // Force a status update
       if (info != null
           && LcnDefs.Var.shouldPollStatusAfterCommand(this.var, is2013)
           && info.requestStatusVars.containsKey(this.var)) {
         info.requestStatusVars
             .get(this.var)
             .nextRequestIn(ModInfo.STATUS_REQUEST_DELAY_AFTER_COMMAND_MSEC, System.nanoTime());
       }
     } catch (IllegalArgumentException ex) {
       logger.warn(
           String.format(
               "Variable of type %s does not support \"set absolute\" commands.", this.var));
     }
   }
 }
Example #3
0
 /** {@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()) {
       info.requestSwAge.nextRequestIn(0, currTime); // Firmware version is required
     }
     if (info.requestStatusVars.containsKey(this.var)
         && !info.requestStatusVars.get(this.var).isActive()) {
       info.requestStatusVars.get(this.var).nextRequestIn(0, currTime);
     }
   }
 }
Example #4
0
 /** {@inheritDoc} */
 @Override
 public void send(Connection conn, Item item, Command cmd) {
   conn.queue(this.addr, true, this.pck);
 }