Hi,
I'm having problem with discovery devices when using method 'getExtendedDeviceInformation'. The application stops and after some time I got a timeout error.
To test the BACnet I use VTS application. The VTS respond 4 times but it looks like the BACnet4j doesn't see the responses.
P.S.
Also the VTS can see 'Iam' message so it's not a communication issue.
public static void main(String[] args) throws Exception {
LocalDevice localDevice = new LocalDevice(12, "192.168.254.255");
localDevice.getEventHandler().addListener(new Listener());
localDevice.initialize();
localDevice.sendBroadcast(47808, new WhoIsRequest());
// Wait a bit for responses to come in.
Thread.sleep(1000);
// Get extended information for all remote devices.
for (RemoteDevice d : localDevice.getRemoteDevices()) {
localDevice.getExtendedDeviceInformation(d);
List<ObjectIdentifier> oids = ((SequenceOf<ObjectIdentifier>) localDevice.sendReadPropertyAllowNull(d, d
.getObjectIdentifier(), PropertyIdentifier.objectList)).getValues();
PropertyReferences refs = new PropertyReferences();
for (ObjectIdentifier oid : oids)
addPropertyReferences(refs, oid);
PropertyValues pvs = localDevice.readProperties(d, refs);
System.out.println(pvs);
System.out.println(d);
}
localDevice.terminate();
}
private static void addPropertyReferences(PropertyReferences refs, ObjectIdentifier oid) {
refs.add(oid, PropertyIdentifier.objectName);
ObjectType type = oid.getObjectType();
if (ObjectType.accumulator.equals(type)) {
refs.add(oid, PropertyIdentifier.units);
}
else if (ObjectType.analogInput.equals(type) || ObjectType.analogOutput.equals(type)
|| ObjectType.analogValue.equals(type) || ObjectType.pulseConverter.equals(type)) {
refs.add(oid, PropertyIdentifier.units);
}
else if (ObjectType.binaryInput.equals(type) || ObjectType.binaryOutput.equals(type)
|| ObjectType.binaryValue.equals(type)) {
refs.add(oid, PropertyIdentifier.inactiveText);
refs.add(oid, PropertyIdentifier.activeText);
}
else if (ObjectType.lifeSafetyPoint.equals(type)) {
refs.add(oid, PropertyIdentifier.units);
}
else if (ObjectType.loop.equals(type)) {
refs.add(oid, PropertyIdentifier.outputUnits);
}
else if (ObjectType.multiStateInput.equals(type) || ObjectType.multiStateOutput.equals(type)
|| ObjectType.multiStateValue.equals(type)) {
refs.add(oid, PropertyIdentifier.stateText);
}
else
return;
refs.add(oid, PropertyIdentifier.presentValue);
}
static class Listener extends DefaultDeviceEventListener {
@Override
public void iAmReceived(RemoteDevice d) {
System.out.println("IAm received" + d);
}
}