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.
PropertyArrayIndex=null with SlaveDeviceTest
-
I have downloaded and run bacnet4J 1.2, then I have tried to run the SlaveDeviceTest together with the DiscoveryTest. Of course, I have adjusted the IP address.
This is my output:IAm receivedRemoteDevice(instanceNumber=1968, address=Address(networkNumber=0, macAddress=[a,1,a,47,8,14]), network=null) ObjectPropertyReference(objectIdentifier=Analog Input 0, propertyIdentifier=Object name, propertyArrayIndex=null) ObjectPropertyReference(objectIdentifier=Analog Input 0, propertyIdentifier=Units, propertyArrayIndex=null) ObjectPropertyReference(objectIdentifier=Analog Input 0, propertyIdentifier=Present value, propertyArrayIndex=null) RemoteDevice(instanceNumber=1968, address=Address(networkNumber=0, macAddress=[a,1,a,47,8,14]), network=null)
This is my code on SlaveDeviceTest
BACnetObject ai0x = new BACnetObject(localDevice, localDevice.getNextInstanceObjectIdentifier(ObjectType.analogInput)); ai0x.setProperty(PropertyIdentifier.objectName, new CharacterString("AAAAAaaaaAAAA")); ai0x.setProperty(PropertyIdentifier.units, EngineeringUnits.centimeters); localDevice.addObject(ai0x);
My question is: why is the propertyArray null? Shouldn't it contain my values instead?
Thanks.
-
No. An ObjectPropertyReference is a reference to an object property, as the name would suggest. It is not the property value. It is the propertyArrayIndex that is null. A reference does not have a propertyArray.
-
Thanks! My next question is: how do I get the object property/propertyArray/whathever contains my values?
This is the code from DiscoveryTest:
for (RemoteDevice d : localDevice.getRemoteDevices()) { localDevice.getExtendedDeviceInformation(d); List<ObjectIdentifier> oids = ((SequenceOf<ObjectIdentifier>) localDevice.sendReadPropertyAllowNull(d, d .getObjectIdentifier(), PropertyIdentifier.objectList)).getValues(); PropertyReferences refs = new PropertyReferences(); for (ObjectIdentifier oid : oids) addPropertyReferences(refs, oid); PropertyValues pvs = localDevice.readProperties(d, refs); // pvs. Iterator<ObjectPropertyReference> i=pvs.iterator(); while (i.hasNext()){ System.out.println(i.next()); } System.out.println(d); }
-
That's pretty much it, yes.
-
On the SlaveDeviceTest, I have set
ai0x.setProperty(PropertyIdentifier.objectName, new CharacterString("AAAAAaaaaAAAA")); ai0x.setProperty(PropertyIdentifier.units, EngineeringUnits.centimeters);
How do I get them on the DiscoveryTest?
-
To clarify: I don't know how to get the property values. The code posted prints the reference instead of the actual values...
Please let me know how to rectify this, thanks.
-
PropertyValues pvs = localDevice.readProperties(d, refs); Iterator<ObjectPropertyReference> i=pvs.iterator(); while (i.hasNext()){ PropertyValue pv = pvs.get(i.next()); System.out.println(pv); }
-
It works! Many thanks! :mrgreen: :mrgreen: :mrgreen: