Hey @terrypacker,
Please help to resolve the above queries related to BACne MS/TP.
Hey @terrypacker,
Please help to resolve the above queries related to BACne MS/TP.
@terrypacker Is it compulsory to start discovery on slave and master at the same time?
I am able to discover remote devices using BACnet/IP.
And the same way I am doing with MSTP. The difference between BACnet IP and MSTP is only about the connection type/ communication medium like Ethernet or serial [RS485]. Another thing related to request-response is the same. Am I correct?
According to my understanding, I have to provide the serial config details to the master node and create one local device and initialize it and do the "WhoIs" request-response.
But, currently, I am not able to get "iAmReceived" on local device listeners.
Am I wrong at any place?
Sorry terry, but I don't understand the socket bridge. Can you please give details like what should I do?
I just want to do as simple as done in the below example.
https://github.com/infiniteautomation/BACnet4J-samples/blob/master/src/test/java/com/infiniteautomation/bacnet4j/rs485/SerialTest.java
@terrypacker Thank you so much for the response.
Yes, I have used that snippet.
Here is my serial port settings,
final SerialPort serialPort = new SerialPort("COM12");
boolean b = serialPort.openPort();
System.out.println("port open? :: "+b);
b = serialPort.setParams(SerialPort.BAUDRATE_38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
I am able to open the port and got below success logs for it.
port open? :: true
parameter set? : true
Also with slave node, I have got below logs.
getBytesIn :: 1855
getBytesOut :: 0
With the listen() snippet given in
https://github.com/infiniteautomation/BACnet4J/blob/master/src/test/java/com/serotonin/bacnet4j/adhoc/rs485/PortTest.java
I got frames as below...
55ff0102010000f5
55ff01030100007c
55ff0104010000c6
55ff01050100004f
55ff0106010000d7
55ff01070100005e
55ff0108010000a0
55ff010901000029
55ff010a010000b1
55ff010b01000038
55ff010c01000082
55ff010d0100000b
55ff010e01000093
And still not able to discover remote devices...
Am I doing anything wrong in this?
If you have any test case with MS/TP then please share. I will be very grateful to you.
Hi,
Anyone there to guide me with this issue...
Please do the need full as I am stuck with the issue.
Thanks,
Vihangi
Hi,
I am trying to perform BACnet Master Slave communication and for that, I have done below things as given in the example.
For Master Device:
static void master(final SerialPort serialPort) throws Exception {
try (JsscSerialPortInputStream in = new JsscSerialPortInputStream(serialPort);
JsscSerialPortOutputStream out = new JsscSerialPortOutputStream(serialPort)) {
final MasterNode node = new MasterNode("test", in, out, (byte) 3, 2);
node.setMaxInfoFrames(5);
node.setUsageTimeout(100);
final MstpNetwork network = new MstpNetwork(node, 0);
final Transport transport = new DefaultTransport(network);
final LocalDevice ld = new LocalDevice(1970, transport);
ld.initialize();
System.out.println(prefix() + "Initialized");
for (int i = 0; i < 10; i++) {
System.out.println(prefix() + "Discovering");
final RemoteDeviceDiscoverer rdd = ld.startRemoteDeviceDiscovery((r) -> {
System.out.println(prefix() + "Device: " + r + ", " + r.getName());
});
ThreadUtils.sleep(6000);
System.out.println("remote device list :: "+rdd.getRemoteDevices());
rdd.stop();
}
System.out.println(prefix() + "Terminating");
ld.terminate();
}
}
For Slave Device:
static void slave(final SerialPort serialPort) throws Exception {
try (JsscSerialPortInputStream in = new JsscSerialPortInputStream(serialPort);
JsscSerialPortOutputStream out = new JsscSerialPortOutputStream(serialPort)) {
final SlaveNode node = new SlaveNode("test", in, out, (byte) 3); //Creating mstp node and place it in ideal state
final MstpNetwork network = new MstpNetwork(node, 0);
final Transport transport = new DefaultTransport(network);
final LocalDevice ld = new LocalDevice(111, transport);
ld.initialize();
ld.startRemoteDeviceDiscovery((r) -> {
System.out.println("Get instance number: "+r.getInstanceNumber());
});
ThreadUtils.sleep(100000);
System.out.println("getBytesIn :: "+node.getBytesIn());
System.out.println("getBytesOut :: "+node.getBytesOut());
ld.terminate();
}
}
But still not able to discover the remote devices.
Is there anything that I miss or any mistake I have done?
I think it's probably obvious that I am new to BACnet and the BACnet4J library. I would be super grateful for any help!
Thank you,
Vihangi
Hi @terrypacker
This is just a gentle reminder of the above query. So, I can conclude my confusion.
Please guide me as soon as possible.
Regards,
Vihangi
Hi @terrypacker
Thanks for the response.
Actually I have check the library and found some classes regarding Network security which is as below.
com.serotonin.bacnet4j.type.constructed -> KeyIdentifier
com.serotonin.bacnet4j.type.constructed -> SecurityKeySet
com.serotonin.bacnet4j.type.enumerated -> ObjectType [network security as Object type]
This object has different properties to set security key points such as
Thus, I am asking to understand these things with practical analysis.
So, If possible then please provide an example so I can understand it.
Hi
I am new to the BACnet4J library and I want to know how this library will providing network security features of BACnet protocol.
Please guide me for the same as soon as possible.
Regards,
Vihangi
Still not able to read Log buffer values.
Got same Error:
ErrorAPDU(errorClass=property, errorCode=invalid-data-type,errorClass=property, errorCode=invalid-data-type) Error: ErrorAPDU(errorClass=property, errorCode=invalid-data-type,errorClass=property, errorCode=invalid-data-type), originalInvokeId=18
Please help me with this.
Hi,
I want to know, how to configured intrinsic and algorithmic reporting for remote device objects?
According to examples, We need to create objects using BACnetObject class and then we can add support of reporting to that object by "supportIntrinsicReporting(int, int, float, float, float, LimitEnable, EventTransitionBits, NotifyType, int)" API.
But, for the remote device, we already have device objects and we will use that object using ObjectIdentifier. And that will not give mapping to BACnetObject instance. Then, how can we do it for a remote device?
Yes, I have tried to trigger it and it will work. But, with " logging-type Value = polled", it was not able to get a trend log.
With polling, it will generate below error:
ErrorAPDU(errorClass=property, errorCode=invalid-data-type,errorClass=property, errorCode=invalid-data-type) Error: ErrorAPDU(errorClass=property, errorCode=invalid-data-type,errorClass=property, errorCode=invalid-data-type), originalInvokeId=18
Read the output of log buffer property:
Error: ErrorAPDU(errorClass=property, errorCode=read-access-denied,errorClass=property, errorCode=read-access-denied)
Is there any configuration issue?
Hi Phildunlap,
I am getting below error while reading log record of TrendLog Object.
Error:
Error: ErrorAPDU(errorClass=property, errorCode=read-access-denied,errorClass=property, errorCode=read-access-denied)
Other Property Values are as below:
Property:: acked-transitions Value :: EventTransitionBits [to-offnormal=true, to-fault=true, to-normal=true]
Property:: align-intervals Value :: true
Property:: buffer-size Value :: 50
Property:: client-cov-increment Value :: ClientCov [entry=2.0]
Property:: cov-resubscription-interval Value :: 200
Property:: description Value :: EventEnrollment Object
Property:: event-enable Value :: EventTransitionBits [to-offnormal=false, to-fault=true, to-normal=false]
Property:: event-state Value :: normal
Property:: event-time-stamps Value :: [TimeStamp [choice=DateTime [date=Date [year=255, month=UNSPECIFIED, day=255, dayOfWeek=UNSPECIFIED], time=255:255:255.255]], TimeStamp [choice=DateTime [date=Date [year=255, month=UNSPECIFIED, day=255, dayOfWeek=UNSPECIFIED], time=255:255:255.255]], TimeStamp [choice=DateTime [date=Date [year=255, month=UNSPECIFIED, day=255, dayOfWeek=UNSPECIFIED], time=255:255:255.255]]]
Property:: interval-offset Value :: 100
Property:: last-notify-record Value :: 1064
Property:: log-device-object-property Value :: DeviceObjectPropertyReference [objectIdentifier=analog-output 12, propertyIdentifier=present-value, propertyArrayIndex=null, deviceIdentifier=device 105]
Property:: enable Value :: true
Property:: log-interval Value :: 100
Property:: logging-type Value :: polled
Property:: notification-class Value :: 19
Property:: notification-threshold Value :: 100
Property:: notify-type Value :: event
Property:: object-identifier Value :: trend-log 26
Property:: object-name Value :: EventEnrollment-Object
Property:: object-type Value :: trend-log
Property:: profile-name Value :: Default
Property:: record-count Value :: 50
Property:: records-since-notification Value :: 26
Property:: start-time Value :: DateTime [date=Date [year=119, month=SEPTEMBER, day=27, dayOfWeek=FRIDAY], time=4:0:0.0]
Property:: stop-time Value :: DateTime [date=Date [year=119, month=OCTOBER, day=4, dayOfWeek=FRIDAY], time=6:30:0.0]
Property:: stop-when-full Value :: false
Property:: total-record-count Value :: 1094
Please help me with this.
As I want to poll and read trend logs.
Thanks, Phildunlap !!
Hi Phildunlap, Thanks for the reply.
My error is resolved by doing below changes:
new DefaultTransport(new IpNetworkBuilder().withPort(47809).withBroadcast(broadcastAdd, 24).build()
Can we implement BACnet router to do communication between two devices with the different ports?
For example:
One device with port 47808 and another one with 47809
Is it possible to do this with BACnet4J library?
Hi,
With BACnet4J library, I am trying to create a new object of the local device using port 47809 and initialize it.
Code snippet::
static LocalDevice initializeLocalDevice() {
LocalDevice device = null;
try {
device = new LocalDevice(localDeviceId, new DefaultTransport(new IpNetworkBuilder().withPort(47809).build()));
device.initialize();
} catch (Exception e) {
System.err.println("Error in initializeLocalDevice: " + e);
e.printStackTrace();
}
return device;
}
But, got below error while executing the above code.
Error:
Error in initializeLocalDevice: java.lang.IllegalArgumentException: Either withBroadcast or withSubnet must be called.
java.lang.IllegalArgumentException: Either withBroadcast or withSubnet must be called.
at com.serotonin.bacnet4j.npdu.ip.IpNetworkBuilder.build(IpNetworkBuilder.java:129)
Please provide any solution for the same.
Thanks,
Vihangi