Test sample don't compile, please update
-
Thanks, but still unable to make it work. I noticed that on the old version of the bacnet4j it was necessary to set the IP address of the client but this setting is no longer present.
The support from Bacnet test tool is telling me that my device is not hearing the who-is message.
-
You can experiment with a different broadcast address perhaps, such as the broadcast address specific to the network segment you've defined. Like, 192.168.1.255 for the 192.168.1.0/24 network.
-
I've changed the broadcast address but didn't help either... I've tried with wireshark and with the old version I see the bacnet packets
With the new version I don't see anything.
Is there some logging that I can enable to see if at least the "who-is" packet is received from the device?
Thanks -
Is there some logging that I can enable to see if at least the "who-is" packet is received from the device?
Yes. You can probably use the debug-log4j2.xml file from Mango/classes/ with the Java argument
-Dlog4j.configurationFile=/path/to/Mango/classes/debug-log4j2.xml
which has the entry<AsyncLogger includeLocation="true" name="com.serotonin.bacnet4j" level="debug"/>
(which you can lower to "trace" level logging for even more information), and you will see output into the command line and into the location specified in the debug-log4j2.xml file (the ma.log file). Or you can supply a log4j2 configuration of your own devising. The main things is that thecom.serotonin.bacnet4j
package be logging at either trace or debug level. -
Bacnet4j 4.x requires Java8, which I do not have, so I switched to Bacnet4j 3.x
Is Bacnet4j 3.x still supported?Also I got
com.serotonin.bacnet4j.exception.BACnetRuntimeException: com.serotonin.bacnet4j.exception.BACnetServiceException: class=Property, code=writeAccessDenied at com.serotonin.bacnet4j.obj.BACnetObject.writeProperty(BACnetObject.java:355) at com.ups.bacnet.Bacnet.run(Bacnet.java:619) at java.lang.Thread.run(Thread.java:748) Caused by: com.serotonin.bacnet4j.exception.BACnetServiceException: class=Property, code=writeAccessDenied at com.serotonin.bacnet4j.obj.mixin.CommandableMixin.writeProperty(CommandableMixin.java:132) at com.serotonin.bacnet4j.obj.BACnetObject.writeProperty(BACnetObject.java:430) at com.serotonin.bacnet4j.obj.BACnetObject.writeProperty(BACnetObject.java:352) ... 2 common frames omitted
While doing
AnalogValueObject avin1; avin1 = new AnalogValueObject(localDevice.getNextInstanceObjectNumber(ObjectType.analogInput),"Input voltage", 232, EngineeringUnits.volts, false); localDevice.addObject(avin1); avin1.writeProperty(PropertyIdentifier.presentValue, new Real(1));
-
Bacnet4j 4.x requires Java8, which I do not have, so I switched to Bacnet4j 3.x
Is Bacnet4j 3.x still supported?Not really. No further development is likely to be done on 3.x to my knowledge, but the original author is still the maintainer so he has some discretion over that.
While doing
All i'm noticing offhand is that you're using ObjectType.analogInput instead of ObjectType.analogValue to get the next object number when you're making an AnalogValueObject - which is probably not what was desired.
After that I notice those are probably line numbers from 3.x because they do not align with the current state of the code. I couldn't figure out quite which method signature for 'writeProperty' you were attempting to invoke, either. Do you have a link to the repository in the state you're using it?
-
https://github.com/infiniteautomation/BACnet4J/tree/a9696f25dde11ce7ee65b9a2487f91f015fce83a
This should be version 3.2.2 (the one I'm using)
-
I solved by replacing
writeProperty
withwritePropertyImpl
which skips "using mixins"... no idea of what is it.Also I noticed that on the old version the device was always discovered, but with this version, the device is discovered only if started while the client is running. I suspect that the old version did send getIAM periodically...
-
Also: how does this snippet translates with the new API?
obj.setProperty(PropertyIdentifier.objectName, new CharacterString("Mains status")); obj.setProperty(PropertyIdentifier.inactiveText, new CharacterString("Not present")); obj.setProperty(PropertyIdentifier.activeText, new CharacterString("Present"));
Thanks
-
Are you perhaps looking for the
writePropertyInternal
method of BACnetObject ? -
Ok thanks, that solves most of my issues. But I noticed that on the old version the device was always discovered, but with this version, the device is discovered only if started while the client is running. I suspect that the old version did send getIAM periodically...
Should I start a thread and send getIAM every 30 seconds or so?
-
Do you mean WhoIsRequest? You could elect to send another WhoIs in certain situations (such as not finding all the devices you expect, on a timer, etc) but you'll note that the LocalDevice::getRemoteDevice method calls RemoteDeviceFinder.findDevice (at least in the most recent version of it) which will specifically send the WhoIs for that device. Recall that there is the device cache in the local device to prevent retrying device resolution over and over rapidly if a device isn't found.