• Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

    Improvements

    BACnet4J general discussion
    2
    3
    1938
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      apl last edited by

      Hi,

      is it really necessary to set localDevice in the constructor of com.serotonin.bacnet4j.obj.BAcnetObject, doing this in localDevce.add() should be the better way?

      Create wrappers for the base Objects (BAchnetObject)
      that implement the required and optional properties?
      => AnalogInput
      like this:

      public class AnalogInputDoubleObject extends BACnetObject {
      
          public AnalogInputDoubleObject(LocalDevice localDevice, ObjectIdentifier id) throws BACnetServiceException {
              super(localDevice, id);
          }
      
          public AnalogInputDoubleObject(LocalDevice localDevice) throws BACnetServiceException {
              this(localDevice, localDevice.getNextInstanceObjectIdentifier(ObjectType.analogInput));
          }
      
          public void setPresentValue(double value) throws BACnetServiceException {
              setProperty(PropertyIdentifier.presentValue, new com.serotonin.bacnet4j.type.primitive.Double(value));
          }
      
          @Required
          public double getPresentValue() throws BACnetServiceException {
              final com.serotonin.bacnet4j.type.primitive.Double value = (com.serotonin.bacnet4j.type.primitive.Double)getProperty(PropertyIdentifier.description);
              return value == null ? null : value.doubleValue();
          }
      
          public void setDescription(String description) throws BACnetServiceException {
              setProperty(PropertyIdentifier.description, new CharacterString(description));
          }
      
          @Option
          @Override
          public String getDescription() {
              return super.getDescription();
          }
      
          public void setUnits(EngineeringUnits units) throws BACnetServiceException {
              setProperty(PropertyIdentifier.units, units);
          }
      
          @Required
          public EngineeringUnits getUnits() throws BACnetServiceException {
              return (EngineeringUnits)getProperty(PropertyIdentifier.units);
          }
      
          public void setDeviceType(String deviceType) throws BACnetServiceException {
              setProperty(PropertyIdentifier.deviceType, new CharacterString(deviceType));
          }
      
          @Option
          public String getDeviceType() throws BACnetServiceException {
              final CharacterString value = (CharacterString)getProperty(PropertyIdentifier.description);
              return value == null ? null : value.getValue();
          }
      
          public void setOutOfService(boolean value) throws BACnetServiceException {
              setProperty(PropertyIdentifier.outOfService, new com.serotonin.bacnet4j.type.primitive.Boolean(value));
          }
      
          @Required
          public boolean getOutOfService() throws BACnetServiceException {
              com.serotonin.bacnet4j.type.primitive.Boolean value = (com.serotonin.bacnet4j.type.primitive.Boolean)getProperty(PropertyIdentifier.outOfService);
              return value == null ? null : value.booleanValue();
          }
      

      And last but noit least create a library of proxies for real Devices that encapsulates the readProperty process and act as "normal" java classes with properties?

      Arne

      1 Reply Last reply Reply Quote 0
      • M
        mlohbihler last edited by

        is it really necessary to set localDevice in the constructor of com.serotonin.bacnet4j.obj.BAcnetObject, doing this in localDevce.add() should be the better way?

        Check out LocalDevice. It is an example of where a BACnetObject is created without being added to the localDevice instance. It's debatable whether it needs to know the localDevice instance i suppose, but it is possible to send a message to "yourself", so i'd prefer to leave it the way it is.

        Create wrappers for the base Objects (BAchnetObject)
        that implement the required and optional properties?
        This was considered at the time of original development. It's a reasonable suggestion, but considering how BACnet attempts to normalize all object properties, how much would this really help? (Of course, at the same time BACnet goes to the trouble to define in detail all object properties, so i suppose the argument could go either way.)

        And last but noit least create a library of proxies for real Devices that encapsulates the readProperty process and act as "normal" java classes with properties?
        Kind of like EJBs? I suppose, but it sounds like 6 of one, half dozen of the other.

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • First post
          Last post