Proper response for ReadPropertyMultiple, PID=all
-
I defined some proprietary properties on the analog-value object and when I disable the ReadPropertyMultiple requests the Bacnet4J server returns all properties to the client (for testing I am using MBS BACeye). Obviously, the client reads the properties one by one based on the property-list.
With ReadPropertyMultiple enabled the proprietary properties must be queried manually. I noticed, that the client sends the request with PropertyIdentifier.all (#8).
ReadPropertyMultipleRequest [listOfReadAccessSpecs=[ReadAccessSpecification [objectIdentifier=analog-value 45, listOfPropertyReferences=[PropertyReference [propertyIdentifier=all, propertyArrayIndex=null]]]]]
Should I as application developer create the response with the List of Read Access Results (Bacnet 15.7.1.2.1) od does it Bacnet4J automaticaly for me? I checked the answer using this code snippet and it looks like the Bacnet4J response does not contain the proprietary properties,
public void requestReceived(Address from, Service service) { super.requestReceived(from, service); if (service.getChoiceId() == 14) { ReadPropertyMultipleRequest req = (ReadPropertyMultipleRequest) service; CommLogger.info("REQ: " + req.toString()); SequenceOf<ReadAccessSpecification> ras = req.getListOfReadAccessSpecs(); try { final ReadPropertyMultipleAck ack = (ReadPropertyMultipleAck) new ReadPropertyMultipleRequest( ras).handle(executor.getLocalDevice(), from); CommLogger.info("RSP: " + ack.toString()); } catch (BACnetException e) { e.printStackTrace(); } } }
Robert
-
@carnecro I've never actually attempted to do this but from looking at the code it would seem that the returned list of properties for an
all
request is built from the properties that are added in the ObjectProperties class. The list for an AnalogObjectValue is created on roughly line 706. I would think that if you were to manually add your proprietary properties to this map when you initialize your AnalogValueObject then they will be returned in a request for all properties. So this code, executed once will likely solve your problem:boolean required = true; //If property is required PropertyIdentifier yourCustomPropertyId = new PropertyIdentifier(492); com.serotonin.bacnet4j.obj.ObjectProperties.add(ObjectType.analogValue, yourCustomPropertyId, YourCustomPropertyClass.class, required);
Also as a side note I've dealt with some hardware BACnet devices that don't let you read the
PropertyIdentifier.all(#8)
which has forced us to not be able to rely on that type of request.