Hello community,
I'm searching for an example how to use the old ObjectProperties.addPropertyTypeDefinition in bacnet4j4 now. I don't know how to add new ObjectProperties.
In the past ObjectProperties could be defined like this:
ObjectProperties.addPropertyTypeDefinition(ObjectType.lifeSafetyZone,
PropertyIdentifier.forId(MY_SPECIAL_VALUE),
CharacterString.class, true, false);
Now the add- function is private, so bacnet4j cannot handle answers for the PropertieIdentifier with the value of MY_SPECIAL_VALUE. Because of this the Objectpropertie is undefined. RequestUtils.readProperties causes failures in parsing the ComplexAck.
RequestUtils.readProperties(localDevice, d, oprs, null);
with oprs
final List<ObjectPropertyReference> oprs = new ArrayList<>();
oprs.add(new ObjectPropertyReference(oId, PropertyIdentifier.objectName));
oprs.add(new ObjectPropertyReference(oId, PropertyIdentifier.description));
oprs.add(new ObjectPropertyReference(oId,
PropertyIdentifier.forId(MY_SPECIAL_VALUE)));
Stack-Trace:
Caused by: com.serotonin.bacnet4j.exception.BACnetException: property: missing-required-parameter
at com.serotonin.bacnet4j.transport.ServiceFutureImpl.result(ServiceFutureImpl.java:76) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.transport.ServiceFutureImpl.get(ServiceFutureImpl.java:63) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.util.RequestUtils.readProperties(RequestUtils.java:313) ~[bacnet4j-4.1.6.jar:?]
... 13 more
Caused by: com.serotonin.bacnet4j.exception.BACnetErrorException: property: missing-required-parameter
at com.serotonin.bacnet4j.type.Encodable.popEnd(Encodable.java:186) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.primitive.Primitive.createPrimitive(Primitive.java:67) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.Encodable.readANY(Encodable.java:368) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.constructed.Choice.read(Choice.java:102) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.constructed.Choice.<init>(Choice.java:75) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.Encodable.readChoice(Encodable.java:267) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.constructed.ReadAccessResult$Result.<init>(ReadAccessResult.java:141) ~[bacnet4j-4.1.6.jar:?]
at sun.reflect.GeneratedConstructorAccessor45.newInstance(Unknown Source) ~[?:?]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_131]
at com.serotonin.bacnet4j.type.Encodable.read(Encodable.java:230) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.constructed.SequenceOf.<init>(SequenceOf.java:87) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.Encodable.readSequenceOf(Encodable.java:309) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.Encodable.readOptionalSequenceOf(Encodable.java:342) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.constructed.ReadAccessResult.<init>(ReadAccessResult.java:75) ~[bacnet4j-4.1.6.jar:?]
at sun.reflect.GeneratedConstructorAccessor48.newInstance(Unknown Source) ~[?:?]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_131]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_131]
at com.serotonin.bacnet4j.type.Encodable.read(Encodable.java:230) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.constructed.SequenceOf.<init>(SequenceOf.java:74) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.type.Encodable.readSequenceOf(Encodable.java:298) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.service.acknowledgement.ReadPropertyMultipleAck.<init>(ReadPropertyMultipleAck.java:56) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.service.acknowledgement.AcknowledgementService.createAcknowledgementService(AcknowledgementService.java:52) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.apdu.ComplexACK.parseServiceData(ComplexACK.java:211) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.transport.DefaultTransport.completeComplexAckResponse(DefaultTransport.java:757) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.transport.DefaultTransport.receiveAPDU(DefaultTransport.java:679) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.transport.DefaultTransport.receiveImpl(DefaultTransport.java:573) ~[bacnet4j-4.1.6.jar:?]
at com.serotonin.bacnet4j.transport.DefaultTransport.run(DefaultTransport.java:493) ~[bacnet4j-4.1.6.jar:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
Wireshark of this special property:
Is someone able to show me a way to fix my problem?
Many thanks in advance,
Bernd