Reading Trendlog LogBuffer property should return an error
-
The BACnet standard states that any attempt to read the LogBuffer property of a Trendlog or Trendlog Multiple object with a ReadProperty-Request or a ReadPropertyMultiple-Request shall cause a a Result(-) response, with an Error class of PROPERTY, and an Error Code of READ_ACCESS_DENIED.
Currently BACnet4j does not do this.
I've created a couple of patches which I believe fix this:diff --git a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java --- a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java +++ b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java @@ -44,6 +44,8 @@ import com.serotonin.bacnet4j.type.constructed.ReadAccessResult.Result; import com.serotonin.bacnet4j.type.constructed.ReadAccessSpecification; import com.serotonin.bacnet4j.type.constructed.SequenceOf; +import com.serotonin.bacnet4j.type.enumerated.ErrorClass; +import com.serotonin.bacnet4j.type.enumerated.ErrorCode; import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier; import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier; import com.serotonin.bacnet4j.type.primitive.OctetString; @@ -151,7 +153,10 @@ else { // Get the specified property. try { - results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); + if (pid.equals(PropertyIdentifier.logBuffer)) + results.add(new Result(pid, pin, new BACnetError(ErrorClass.property, ErrorCode.readAccessDenied))); + else + results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); } catch (BACnetServiceException e) { results.add(new Result(pid, pin, new BACnetError(e.getErrorClass(), e.getErrorCode())));
diff --git a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java
--- a/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java
+++ b/src/com/serotonin/bacnet4j/service/confirmed/ReadPropertyMultipleRequest.java
@@ -44,6 +44,8 @@
import com.serotonin.bacnet4j.type.constructed.ReadAccessResult.Result;
import com.serotonin.bacnet4j.type.constructed.ReadAccessSpecification;
import com.serotonin.bacnet4j.type.constructed.SequenceOf;
+import com.serotonin.bacnet4j.type.enumerated.ErrorClass;
+import com.serotonin.bacnet4j.type.enumerated.ErrorCode;
import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;
import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
import com.serotonin.bacnet4j.type.primitive.OctetString;
@@ -151,7 +153,10 @@
else {
// Get the specified property.
try {-
results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin)));
-
if (pid.equals(PropertyIdentifier.logBuffer))
-
results.add(new Result(pid, pin, new BACnetError(ErrorClass.property, ErrorCode.readAccessDenied)));
-
else
-
results.add(new Result(pid, pin, obj.getPropertyRequired(pid, pin))); } catch (BACnetServiceException e) { results.add(new Result(pid, pin, new BACnetError(e.getErrorClass(), e.getErrorCode())));
-