Reputation: 11
I been trying to understand how bacnet java works on device reply “iam” message to the respective call
For example: 1. Device 5678 send broadcast message with new whois message(device id 1234) 2. Device 1234 replies “iam” message to device 5678.
Questions How device 1234 send “iam” message to 5678? Which part of JAVA code does that??
I'm happy for any input on the subject.
Best regards Sorc
Upvotes: 0
Views: 1498
Reputation: 488
On the basis that the Who-Is broadcast contains the SADR/source address, the receiving devices knows where to send it's response - if it did want to give a unicast/directed response.
You then have to listen out for the UDP (or rather UDP/IP) response, and then you have to parse it, for the Object ID.
I believe the older version of 'BACnet4J' required a listener class; e.g.:
static class Listener extends DeviceEventAdapter
{
@Override
public void iAmReceived(RemoteDevice d)
...
But I believe the newer version has a 'discoverer'/"RemoteDeviceDiscoverer", e.g.:
RemoteDeviceDiscoverer discoverer = localDevice.startRemoteDeviceDiscovery();
discoverer.start();
TimeUnit.SECONDS.sleep(5);
discoverer.stop();
if(! discoverer.getRemoteDevices().isEmpty()) {
...
Upvotes: 0
Reputation: 11
who-is and i-am are both unconfirmed BACnet services. when a who-is is sent (broadcast or unicast) by a device, other devices present in network reply with i-am.
assuming that you are using java based BACnet stack (library) to create your own application. your application will receive i-am, that received from network in the form of callback from stack library.
in general the stack (implemented in any programming language) will decode this data and pass it to application in the form of callbacks.
hope this helps you.
Upvotes: 1