Esempio n. 1
0
  public void createWatchDog() {
    if (connector != null && groupAddress != null) {
      connector.addWatchDog(
          groupAddress,
          new KNXWatchDog() {
            @Override
            public void notifyWatchDog(byte[] apdu) {
              try {
                DPTXlator8BitUnsigned x =
                    new DPTXlator8BitUnsigned(DPTXlator8BitUnsigned.DPT_SCALING);
                ProcessCommunicatorImpl.extractGroupASDU(apdu, x);

                log.info(
                    "Status for "
                        + DPST_5_1_ImplKnx.this.getHref()
                        + " now "
                        + x.getValueUnsigned());

                value().set(x.getValueUnsigned());
                value().setNull(false);
              } catch (KNXException e) {
                e.printStackTrace();
              }
            }
          });
    }
  }
Esempio n. 2
0
  @Override
  public void refreshObject() {
    // here we need to read from the bus, only if the read flag is set at the data point
    if (this.value().isReadable()) {
      int value = connector.readInt(groupAddress, DPTXlator8BitUnsigned.DPT_SCALING.getID());
      this.value().set(value);
      this.value().setNull(false);
    }

    // run refresh from super class
    super.refreshObject();
  }
Esempio n. 3
0
  @Override
  public void writeObject(Obj obj) {
    if (this.value().isWritable()) {
      // always pass the writeObject call to the super method (triggers, oBIX related internal
      // services like watches, alarms, ...)
      // also the internal instance variables get updated
      super.writeObject(obj);

      // set isNull to false
      this.value().setNull(false);

      // now write this.value to the KNX bus
      connector.write(groupAddress, this.value().get());
    }
  }