If you don't have to worry about that, you can just set your network number to 0 which is the local network number.
Great, I will use 0 for the network number.
If you are looking to bridge the two networks, then you'll need a LocalDevice on each, and your code will be reading from one of them, and setting the object values on the other (so that it can be polled by the other devices on the 485 bus (or they could have registered for COV on those objects, or you can set them out to the devices)
Could you explain this a little more further? I thought in our situation there's only one network, so I'm not quite sure what you mean by bridging the two networks.
As I understand it, I need to set up my Android device as a LocalDevice and I will send commands to/subscribe to COVs on the heat pump, which will be a RemoteDevice. Do I need a second LocalDevice somewhere?
Thanks for your help, I appreciate it.
Thank you very much for your detailed reply.
My main confusion is how the InputStream works. An InputStream does not represent a continuous stream of data, it only contains a fixed number of bytes, and there's no way to 'update' the input stream to add more bytes, without creating a new one. So I don't know how the library keeps on reading the continuous data from the device via an InputStream.
We're trying to implement BACnet on our Android Things device and we're wondering if/how we can use the BACnet4J library to accomplish this. Our device will act as a thermostat/heat pump controller.
- MSTP network
- Using UART/RS-485 to communicate from Android Things device (master) to a BACnet-ready heat pump (another master)
- Will be adding more devices to the MSTP network in the future
I'm not exactly sure how to connect the way Android reads in bytes from UART to the BACnet4J library. Here is the documentation for Android Things UART: https://developer.android.com/things/sdk/pio/uart. With the setup described in the documentation (using the callback), I am able to read in bytes from the heat pump. Right now I can see by looking at the byte arrays coming in that it is polling for master, i.e.
55 ff 1 0 18 0 0 91 55 ff 1 1 18 0 0 a2 55 ff 1 2 18 0 0 3a ...
My question is how do I convert the incoming bytes from the heat pump (and other devices on the network) into service requests/objects that my device can understand and respond to if necessary.
Also, I understand that I need to set up my Android Things device as a LocalDevice. However the localDevice needs a Transport, which needs a (Mstp)Network, which needs a (Mstp)Node. I don't know how to set all this up. If someone could describe how to implement this hierarchy it would be greatly appreciated. Specifically
- How do I set up the MstpNetwork? How do I choose the
- MstpNetwork needs an MstpNode. How does a Node differ from a local/remote device? Why is there only one Node per network? What should I provide for the
I think it's probably obvious that I am new to BACnet and the BACnet4J library. I would be super grateful for any help!