Hi Joshua, welcome to the forum!
I think it's probably obvious that I am new to BACnet and the BACnet4J library. I would be super grateful for any help!
No worries! The support here for BACnet4J here is not as zealous as Mango at large, but I will try to help when I think I can.
I'm not exactly sure how to connect the way Android reads in bytes from UART to the BACnet4J library.
I would consider opening the input and ouput streams, and then using the MstpNode constructor that takes input and output streams. This will enable the portId variable you asked about to be any string (I think it's only used to make the information available, not used). The constructors require either the streams are already open or that you pass in a SerialPortWrapper in. So, you can just pass in the UART stream. 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)
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.
Well you're essentially correct! I would think you'd be looking for something like....
byte stationId = 1;
int networkNumber = 0;
int localDeviceId = 123;
InputStream in = getUartInputStream();
OutputStream out = getUartOutputStream();
MstpNode mstpNode = new MasterNode("UART", in, out, stationId); //Must be unique station ID on the UART
//Make calls on mstpNode to set max frames, usage timeout, whatever
MstpNetwork network = new MstpNetwork(mstpNode, networkNumber);
Transport transport = new DefaultTransport(network);
//Set transport settings like timeout, segment window, whatever
LocalDevice localDevice = new LocalDevice(localDeviceId, transport);
//Set up the device object, add any other objects you want available, localDevice.getDeviceObject()
How do I choose the localNetworkNumber?
Is determined if there is some topology where one BACnet device may be a router to another network. If you don't have to worry about that, you can just set your network number to 0 which is the local network number. But, if the devices it is communicating with have a network number set (and there aren't any gateways or IP to serial type devices) just use that device's network number. It only comes in to play in more complicated networks where a device will announce it routes requests to a particular network on behalf of devices on the network it advertises that on.
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.
It's talking BACnet over the UART, yes? You can send a COV subscription and handle incoming COV notifications to write properties on objects you've addObject'ed to on the second local device, the local device on the rs-485 network.
MstpNetwork needs an MstpNode. How does a Node differ from a local/remote device? Why is there only one Node per network?
I think those are semantic questions, but I am not the original author and only know so-much about the BACnet specification and the decisions made in implementing it in BACnet4J. I would say a distinction between an MstpNode and a LocalDevice is that a LocalDevice is a higher level abstraction of BACnet workings. It's just some separation of protocol and application.