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.
Problem with Read Property Request
-
I tried using your library, and indeed it is different from mine, since I also had to add the commons-lang3.3.1.jar at the project to make it work.
Despite this, However, the problem is not solved :-( -
Ok, but can you post the stack trace? I assume the line numbers are different now.
-
Yes, the line numbers are different.
This is the stack trace:Exception in thread "main" java.lang.NullPointerException at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.send(IpMessageControl.java:226) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:480) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:470) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:463) at Prova_B4J.main(Prova_B4J.java:143)
-
Your remote device has a segmentationSupported value of null. Normally you wouldn't instantiate your own RemoteDevice objects, BTW. An IAm (resulting from a WhoIs broadcast) is the typical means of instantiation. A "manual" way to get remote devices is to use the LocalDevice.findRemoteDevice method.
-
I tried your solutions, but there are other problems.
If I use:remoteDevice=localDevice.findRemoteDevice( new Address(new byte[] { (byte) 192, (byte) 168, (byte) 1, (byte) 112 },0xBAC0 ), null, 1);
eclipse return this exception:
Exception in thread "main" com.serotonin.bacnet4j.exception.BACnetException: java.lang.NullPointerException at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.sendImpl(IpMessageControl.java:377) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.send(IpMessageControl.java:302) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.send(IpMessageControl.java:248) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:480) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:470) at com.serotonin.bacnet4j.LocalDevice.findRemoteDevice(LocalDevice.java:1047) at Prova_B4J_2.main(Prova_B4J_2.java:57) Caused by: java.lang.NullPointerException at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.sendImpl(IpMessageControl.java:374) ... 6 more
If I use:
localDevice.sendBroadcast(0xBAC0,new WhoIsRequest(null,null));
eclipse return:
Exception in thread "main" com.serotonin.bacnet4j.exception.BACnetException: java.lang.NullPointerException at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.sendImpl(IpMessageControl.java:377) at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.sendBroadcast(IpMessageControl.java:359) at com.serotonin.bacnet4j.LocalDevice.sendBroadcast(LocalDevice.java:520) at Prova_B4J_2.main(Prova_B4J_2.java:59) Caused by: java.lang.NullPointerException at com.serotonin.bacnet4j.npdu.ip.IpMessageControl.sendImpl(IpMessageControl.java:374) ... 3 more
-
Did you initialize the local device before sending those requests?
-
Perfect!! Thnak you very, but very very very much for the help!
I have only another questions...If I send an I-am message from VTS to instantiate the remote device in my java program, I have no problem ... but if I send it from another java program (always based on bacnet4j), eclipse returns this exception when I send the ReadPropertyRequest:
Exception in thread "main" com.serotonin.bacnet4j.exception.ErrorAPDUException: ErrorAPDU(choice=5, errorClass=Object, errorCode=Unknown object) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:489) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:470) at com.serotonin.bacnet4j.LocalDevice.send(LocalDevice.java:463) at Prova_B4J_2.main(Prova_B4J_2.java:106)
-
Your BACnet4J device does not have the object you are looking for. You need to create a BACnet object with the correct properties, and then add it to the local device.
-
Thank you mlohbihler! You have been my salvation!
-
Glad to help. Buy a license. :)
-
:wink: