Hi Phill,
Which is the current production release for Bacnet4j which I can upgrade to? 4.1.6?
Thanks and appreciate your support.
Manoj
Hi Phill,
Which is the current production release for Bacnet4j which I can upgrade to? 4.1.6?
Thanks and appreciate your support.
Manoj
Hi Phil,
Thank you very much your response. Much appreciated.
In fact, I'm seriously considering to upgrade to the latest version, however not sure about the timelines right now.
Thank you very much.
Manoj
Hello All,
I'm using Bacnet4j 3.2.3 version of library. In fact, I have a situation where-in concurrent threads are calling the send(RemoteDevice d, ConfirmedRequestService serviceRequest) method of a LocalDevice object. As far as my testing, I don't see any errors related to concurrency here, however I would like to ask your opinion on this, whether it is already thread-safe or do I need to call LocalDevice.send inside a reentrant-lock?
Thank you very much.
Manoj
Hello Phildunlap,
Thank you very much for your quick response. Much appreciated !!
I got your point, will check on those two APIs over this weekend and let you know whether I'm able to find a solution.
Thank you very much.
Manoj
Hello All,
I'm collecting data from devices using subscription with below parameters in the request.
SubscribeCOVRequest covRequest = new SubscribeCOVRequest(
new UnsignedInteger(1), /* Process identifier; same for all subscription requests */
oid, /* Object identifier for subscription */
new Boolean( false ), /* Subscription request with unconfirmed notification; done to reduce overhead on my devices */
new UnsignedInteger( 3600 ) /* TTL in seconds */
);
As the TTL is set for an hour, after every one hour I re-subscribe them again.
Since I'm requesting unconfirmed notification, time-to-time I'm not getting any subscription for some of the objects at all.
Is there a way by which I can get the current subscription status of an object identifier in the device?
Appreciate any response on this.
Thanks
Manoj
Hello All,
Today I updated my program as below. I'm able to run this program without any exception. But, it never received even a single cov notification for hours.
Any idea/help/support is much appreciated !
Thank you very much.
Manoj
import java.net.InetSocketAddress;
import com.serotonin.bacnet4j.LocalDevice;
import com.serotonin.bacnet4j.RemoteDevice;
import com.serotonin.bacnet4j.RemoteObject;
import com.serotonin.bacnet4j.event.DeviceEventListener;
import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
import com.serotonin.bacnet4j.obj.BACnetObject;
import com.serotonin.bacnet4j.service.confirmed.ReinitializeDeviceRequest.ReinitializedStateOfDevice;
import com.serotonin.bacnet4j.service.unconfirmed.UnconfirmedCovNotificationRequest;
import com.serotonin.bacnet4j.transport.DefaultTransport;
import com.serotonin.bacnet4j.transport.Transport;
import com.serotonin.bacnet4j.type.constructed.Address;
import com.serotonin.bacnet4j.type.constructed.Choice;
import com.serotonin.bacnet4j.type.constructed.DateTime;
import com.serotonin.bacnet4j.type.constructed.PropertyValue;
import com.serotonin.bacnet4j.type.constructed.Sequence;
import com.serotonin.bacnet4j.type.constructed.SequenceOf;
import com.serotonin.bacnet4j.type.constructed.TimeStamp;
import com.serotonin.bacnet4j.type.enumerated.EventState;
import com.serotonin.bacnet4j.type.enumerated.EventType;
import com.serotonin.bacnet4j.type.enumerated.MessagePriority;
import com.serotonin.bacnet4j.type.enumerated.NotifyType;
import com.serotonin.bacnet4j.type.enumerated.ObjectType;
import com.serotonin.bacnet4j.type.notificationParameters.NotificationParameters;
import com.serotonin.bacnet4j.type.primitive.Boolean;
import com.serotonin.bacnet4j.type.primitive.CharacterString;
import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
import com.serotonin.bacnet4j.type.primitive.UnsignedInteger;
import com.serotonin.bacnet4j.util.DiscoveryUtils;
public class UnconfirmedCovTest {
public static void main(String[] args) {
IpNetwork network = new IpNetwork("192.23.29.46", 47808);
Transport transport = new DefaultTransport(network);
LocalDevice localDevice = new LocalDevice(999, transport);
try {
localDevice.initialize();
localDevice.getEventHandler().addListener(
new DeviceEventListener() {
@Override
public void textMessageReceived(RemoteDevice arg0, Choice arg1, MessagePriority arg2, CharacterString arg3) {
System.out.println( "textMessageReceived : "
+ arg0 );
}
@Override
public void synchronizeTime(Address arg0, DateTime arg1, boolean arg2) {
System.out.println( "synchronizeTime : "
+ arg0 );
}
@Override
public void reinitializeDevice(Address arg0, ReinitializedStateOfDevice arg1) {
System.out.println( "reinitializeDevice : "
+ arg0 );
}
@Override
public void propertyWritten(Address arg0, BACnetObject arg1, PropertyValue arg2) {
System.out.println( "propertyWritten : "
+ arg0 );
}
@Override
public void privateTransferReceived(Address arg0, UnsignedInteger arg1, UnsignedInteger arg2, Sequence arg3) {
System.out.println( "privateTransferReceived : "
+ arg0 );
}
@Override
public void listenerException(Throwable arg0) {
System.out.println( "listenerException : "
+ arg0 );
}
@Override
public void iHaveReceived(RemoteDevice arg0, RemoteObject arg1) {
System.out.println( "iHaveReceived : "
+ arg0 );
}
@Override
public void iAmReceived(RemoteDevice arg0) {
System.out.println( "iAmReceived : "
+ arg0 );
}
@Override
public void eventNotificationReceived(UnsignedInteger arg0, RemoteDevice arg1, ObjectIdentifier arg2,
TimeStamp arg3, UnsignedInteger arg4, UnsignedInteger arg5, EventType arg6, CharacterString arg7,
NotifyType arg8, Boolean arg9, EventState arg10, EventState arg11, NotificationParameters arg12) {
System.out.println( "eventNotificationReceived.arg0 : "
+ arg0 );
System.out.println( "eventNotificationReceived.arg1 : "
+ arg1 );
System.out.println( "eventNotificationReceived.arg2 : "
+ arg2 );
System.out.println( "eventNotificationReceived.arg3 : "
+ arg3 );
}
@Override
public void covNotificationReceived(UnsignedInteger arg0, RemoteDevice arg1, ObjectIdentifier arg2,
UnsignedInteger arg3, SequenceOf<PropertyValue> arg4) {
System.out.println( "covNotificationReceived.arg0 : "
+ arg0 );
}
@Override
public boolean allowPropertyWrite(Address arg0, BACnetObject arg1, PropertyValue arg2) {
System.out.println( "allowPropertyWrite.arg0 : "
+ arg0 );
return false;
}
}
);
network.registerAsForeignDevice(new InetSocketAddress("192.23.29.46", 47808),9000 );
Thread.sleep(2000);
RemoteDevice d = DiscoveryUtils.discoverDevice(localDevice,700710);
if (d == null)
{
throw new RuntimeException("Remote device not found");
}
else
{
final ObjectIdentifier oid = new ObjectIdentifier(ObjectType.analogInput, Integer.valueOf("10"));
final SequenceOf<PropertyValue> listOfValues = new SequenceOf<>();
final UnconfirmedCovNotificationRequest unconfirmedCovRequest =
new UnconfirmedCovNotificationRequest( new UnsignedInteger(1),
localDevice.getConfiguration().getId(), oid, new UnsignedInteger(60),
listOfValues );
localDevice.send( d.getAddress(), unconfirmedCovRequest );
//localDevice.sendBroadcast( d.getAddress(), unconfirmedCovRequest );
System.out.println( "Sent unconfirmed cov request !!" );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
Hello,
I'm using BACnet4J 3.2.3 to subscribe to COV using UnconfirmedCovNotificationRequest.
But I couldn't make it work. My sample program is below.
Can anyone help/suggest on making this work ?
import java.net.InetSocketAddress;
import com.serotonin.bacnet4j.LocalDevice;
import com.serotonin.bacnet4j.RemoteDevice;
import com.serotonin.bacnet4j.npdu.ip.IpNetwork;
import com.serotonin.bacnet4j.service.unconfirmed.UnconfirmedCovNotificationRequest;
import com.serotonin.bacnet4j.transport.DefaultTransport;
import com.serotonin.bacnet4j.transport.Transport;
import com.serotonin.bacnet4j.type.constructed.PropertyValue;
import com.serotonin.bacnet4j.type.constructed.SequenceOf;
import com.serotonin.bacnet4j.type.enumerated.ObjectType;
import com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier;
import com.serotonin.bacnet4j.type.primitive.ObjectIdentifier;
import com.serotonin.bacnet4j.type.primitive.UnsignedInteger;
import com.serotonin.bacnet4j.util.DiscoveryUtils;
public class UnconfirmedCovTest {
public static void main(String[] args) {
IpNetwork network = new IpNetwork("192.23.29.46", 47808);
Transport transport = new DefaultTransport(network);
LocalDevice localDevice = new LocalDevice(999, transport);
try {
localDevice.initialize();
network.registerAsForeignDevice(new InetSocketAddress("192.23.29.46", 47808),9000 );
Thread.sleep(2000);
RemoteDevice d = DiscoveryUtils.discoverDevice(localDevice,700710);
if (d == null)
{
throw new RuntimeException("Remote device not found");
}
else
{
final ObjectIdentifier oid = new ObjectIdentifier(ObjectType.analogInput, Integer.valueOf("10"));
final SequenceOf<PropertyValue> listOfValues = new SequenceOf<>();
listOfValues.add( new PropertyValue( PropertyIdentifier.presentValue,
null ) );
final UnconfirmedCovNotificationRequest unconfirmedCovRequest =
new UnconfirmedCovNotificationRequest( new UnsignedInteger(1),
oid, oid, new UnsignedInteger(60),
listOfValues );
localDevice.send( d.getAddress(), unconfirmedCovRequest );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
Thank you very much.
Manoj