Invalid Data Type
-
Hi again,
We're trying to send a WritePropertyRequest to the Present Value property of a Binary Value object, however the response (ack) we get back from the remote device is an error, with
errorClass = 2 // property
anderrorCode = 9 // invalidDataType
. We're sending a property value of typeBoolean
, which is what I'd expect to be the accepted data type for a binary value, but maybe I'm wrong. Also I'm not quite sure about thepropertyArrayIndex
parameter. So I guess I'm wondering if the following parameters are correct:// Kotlin localDevice.send(remoteDevice, WritePropertyRequest(ObjectIdentifier(ObjectType.binaryValue, 2), // object PropertyIdentifier.presentValue, // property null, // propertyArrayIndex. null since the present value property is not an array (?) Boolean.valueOf(true), // propertyValue UnsignedInteger(1)), // priority ResponseConsumer())
Thanks in advance,
Joshua -
Hi Joshua,
Have a look at https://github.com/infiniteautomation/BACnet4J/blob/master/src/main/java/com/serotonin/bacnet4j/obj/ObjectProperties.java
Which correlates ObjectType, PropertyIdentifier, the data type of the property, whether it is required, and whether it is an array. Specifically, you want this: https://github.com/infiniteautomation/BACnet4J/blob/e1550a4731d79a9649f376654526beaa0fd12e48/src/main/java/com/serotonin/bacnet4j/obj/ObjectProperties.java#L905
which is:
add(ObjectType.binaryValue, PropertyIdentifier.presentValue, BinaryPV.class, true);
And shows the presentValue of a binaryValue is a BinaryPV type.(and required; not an array). You should be fine leaving the propertyArrayIndex null on that write.
-
@phildunlap Perfect, thank you. Not sure how I missed that file before, but it will be extremely useful in the future.
Cheers!