Where/how to start?
-
Hi all!
I'm working on a proof of concept project, part of which requires me to use bacnet4j libraries.
Project so far went perfect, until the bacnet part. This is where it all stopped :)Browsing through the forum I got a slight understanding of "what" and "how" yet when I try running your examples (to get a slight idea on how it's working) nothing works.
Am I missing something?So far I have tried DiscoveryTest.java
Exception in thread "main" java.lang.Error: Unresolved compilation problems: The constructor LocalDevice(int, String) is undefined The method setPort(int) is undefined for the type LocalDevice The type new DeviceEventListener(){} must implement the inherited abstract method DeviceEventListener.reinitializeDevice(ReinitializeDeviceRequest$ReinitializedStateOfDevice) The type new DeviceEventListener(){} must implement the inherited abstract method DeviceEventListener.synchronizeTime(DateTime, boolean) The method sendBroadcast(Address, OctetString, UnconfirmedRequestService) in the type LocalDevice is not applicable for the arguments (int, WhoIsRequest) The method getExtendedDeviceInformation(RemoteDevice) is undefined for the type LocalDevice The method sendReadPropertyAllowNull(RemoteDevice, ObjectIdentifier, PropertyIdentifier) is undefined for the type LocalDevice The method readProperties(RemoteDevice, PropertyReferences) is undefined for the type LocalDevice The method readProperties(RemoteDevice, PropertyReferences) is undefined for the type LocalDevice at DiscoveryTest.<init>(DiscoveryTest.java:48) at DiscoveryTest.main(DiscoveryTest.java:152)
LoopDevice.java
Exception in thread "main" java.lang.Error: Unresolved compilation problem: DEFAULT_PORT cannot be resolved or is not a field at LoopDevice.main(LoopDevice.java:38)
And even when replacing DEFAULT_PORT with a random number, I got compiler errors:
Exception in thread "main" java.lang.Error: Unresolved compilation problems: The constructor LocalDevice(int, String) is undefined The method setPort(int) is undefined for the type LocalDevice The type new DeviceEventListener(){} must implement the inherited abstract method DeviceEventListener.reinitializeDevice(ReinitializeDeviceRequest$ReinitializedStateOfDevice) The type new DeviceEventListener(){} must implement the inherited abstract method DeviceEventListener.synchronizeTime(DateTime, boolean) The method getBroadcastAddress() is undefined for the type LocalDevice The method getPort() is undefined for the type LocalDevice at LoopDevice.<init>(LoopDevice.java:52) at LoopDevice.main(LoopDevice.java:38)
BacnetTest (from bacnet4j-src)
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang3/ObjectUtils at com.serotonin.bacnet4j.obj.BACnetObject.setPropertyImpl(BACnetObject.java:269) at com.serotonin.bacnet4j.obj.BACnetObject.setProperty(BACnetObject.java:193) at com.serotonin.bacnet4j.obj.BACnetObject.<init>(BACnetObject.java:88) at com.serotonin.bacnet4j.LocalDevice.<init>(LocalDevice.java:118) at BacnetTest.main(BacnetTest.java:31) Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.ObjectUtils at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 5 more
and so on...
i'm using java 1.7 x64
and bacnet4j 1.3
and seroUtils 1.3What am I doing wrong?
Eventually what I would like to achieve is to list all devices present on the network and write a file on one.
Best regards,
Michael Cann -
I am having the same problem. Is there anything besides the test files and source code to go by?
-
I have a similar problem like you had in BacnetTest. In my project I get an exception when I call "new LocalDevice(1234, transport);". I stepped in up to this point.
private void setPropertyImpl(PropertyIdentifier pid, Encodable value) { Encodable oldValue = properties.get(pid); properties.put(pid, value); if (!ObjectUtils.equals(value, oldValue)) { // Check for subscriptions. if (ObjectCovSubscription.sendCovNotification(id.getObjectType(), pid, this.getCovIncrement())) { synchronized (covSubscriptions) { long now = System.currentTimeMillis(); ObjectCovSubscription sub; for (int i = covSubscriptions.size() - 1; i >= 0; i--) { sub = covSubscriptions.get(i); if (sub.hasExpired(now)) covSubscriptions.remove(i); else if (sub.isNotificationRequired(pid, value)) sendCovNotification(sub, now); } } } } }
The error occurs in the if-statement "ObjectUtils.equals(value, oldValue)". Bizarrely the error doesn't occur in my BacnetTest :-/ Has anybody solved this problem by now?