The test tool could not find the device instantiated by Java
-
Hello, I have encountered a problem here that has not been solved for a long time. I instantiated a device through the following code, but I could not find this device through the test tool. I hope you can help me, thank you
public class Device { LocalDevice localDevice; public void init() throws Exception { IpNetwork network = new IpNetworkBuilder() .withBroadcast("192.168.33.255", 24) .withLocalBindAddress("192.168.33.101") .withPort(47999) .build(); Transport transport = new DefaultTransport(network); localDevice = new LocalDevice(1996, transport); localDevice.initialize(); } public static void main(String[] args) throws Exception { new Device().init(); } }
-
Hi mmmoczj,
Surely there is more to your test? This seems to me like the process would exit before any responses would have had a chance to respond.
Assuming the issue isn't your program exiting after the all to initialize the LocalDevice (which send a WhoIS but does not pause the thread that called it to listen for some amount of time for responses, that's handled by another thread elsewhere), then I would guess you may want to try other possible addresses, such as a broadcast of
255.255.255.255
with a bind address of0.0.0.0
Also if you call initialize without having a device object added to the local device, it will do some scanning and try to assign itself a number. You can see what the initialize method does here, although what is shown on the main branch may or may not be what you are working with: https://github.com/infiniteautomation/BACnet4J/blob/master/src/main/java/com/serotonin/bacnet4j/LocalDevice.java#L312