コード例 #1
0
  public void writeObject(Obj input) {
    // A write on this object was received, update the according data point.
    super.writeObject(input);

    try {
      bacnetConnector.writeProperty(
          switchDP.getDeviceIdentifier(),
          switchDP.getObjectIdentifier(),
          switchDP.getPropertyIdentifier(),
          new com.serotonin.bacnet4j.type.primitive.Enumerated(enabled.get() ? 1 : 0),
          BACNET_PRIORITY);
    } catch (BACnetException e) {
      e.printStackTrace();
    } catch (PropertyValueException e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void refreshObject() {
    try {
      Encodable property =
          bacnetConnector.readProperty(
              switchDP.getDeviceIdentifier(),
              switchDP.getObjectIdentifier(),
              switchDP.getPropertyIdentifier());

      if (property instanceof com.serotonin.bacnet4j.type.primitive.Boolean) {
        enabled.set(((com.serotonin.bacnet4j.type.primitive.Boolean) property).booleanValue());
      }

    } catch (BACnetException e) {
      e.printStackTrace();
    } catch (PropertyValueException e) {
      e.printStackTrace();
    }
  }