Closed janb93 closed 1 year ago
Hello @janb93,
Can you please post stack trace which includes org.code_house
and com.serotonin.bacnet4j
lines?
This is only thing from org.code_house
nov 20 10:58:15 run.sh[65084]: java.lang.NullPointerException
nov 20 10:58:15 run.sh[65084]: at org.code_house.bacnet4j.wrapper.ip.BacNetIpClient.addNetworkRouter(BacNetIpClient.java:76)
Please make sure that you first call client.start()
, otherwise network transport might not be fully initialized.
BacNetIpClient bacNetIpClient = new BacNetIpClient(deviceIP, personalId);
bacNetIpClient.start(); // needed to fully initialize client
bacNetIpClient.addNetworkRouter(networkNumber, deviceIP, 47808);
bacNetClient = bacNetIpClient;
correctDevice = new Device(deviceId, macAddressBytes, networkNumber);
Yes, this helped! Thank you! If anyone needs working code:
bacNetIpClient = new BacNetIpClient(deviceIP, personalId);
bacNetIpClient.start();
bacNetIpClient.addNetworkRouter(networkNumber, deviceIP, port);
correctDevice = new Device(deviceId, macAddressBytes, networkNumber);
bacNetIpClient.stop();
Thanks for confirmation. Together we will deliver not only working code but some pieces of documentation. ;-)
Hello,
I know all the properties for connecting the BACnet device and want to connect directly. I have a problem that I receive the NullPointerException for the method "addNetworkRouter".
Here is my code: