Closed danishmhmd closed 3 years ago
Have you set COVNotification to TRUE like servicesSupported.setConfirmedCovNotification(true);
Yes as below: remoteDevice.getServicesSupported().setConfirmedCovNotification(true); Here are the console logs of library when i device sends the COV and library reply it with service not supported:-
[BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from local network. From=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], local=0 [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from [a,0,0,66,ba,c0]: NPDU [from=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], linkService=null, queue=[0,4,a8,1,9,1,1c,2,0,1e,2c,2c,4,c0,0,5,39,0,4e,9,55,2e,91,0,2f,9,6f,2e,82,4,0,2f,4f]]
After carefully analyzing the wireshark logs sent earlier I noticed the following:
So please look at the code around MSV and if possible share the code so as to reproduce from my side to see how can I help you.
Sure, Please find the sample code snippet below for communication class and listener :-
=================================================================================================
IpNetworkBuilder builder = new IpNetworkBuilder();
builder.withPort(Variables.port);
builder.withSubnet(Variables.subnetAddress, Variables.networkPrefixLength);
builder.withReuseAddress(true);
IpNetwork network = builder.build();
Transport transport = new DefaultTransport(network);
LocalDevice localDevice;
localDevice = new LocalDevice(Variables.device_no, transport);
localDevice.initialize();
localDevice.getEventHandler().addListener(new CustomListener(localDevice));
WhoISRequestCustom whois = new WhoISRequestCustom(localDevice); whois.whois();
SubscribeCOVRequest subscribeCOVRequest = new SubscribeCOVRequest(new UnsignedInteger(1), new ObjectIdentifier(ObjectType.multiStateValue, 5),
Boolean.TRUE, new UnsignedInteger(0));
SubscribeCOVRequest subscribeCOVRequest2 = new SubscribeCOVRequest(new UnsignedInteger(4),
new ObjectIdentifier(ObjectType.analogInput, 0),
Boolean.TRUE, new UnsignedInteger(0));
localDevice.send(remoteDevice1,
subscribeCOVRequest).get();
localDevice.send(remoteDevice1,
subscribeCOVRequest2).get();
======================================================================
public class CustomListener extends DeviceEventAdapter { LocalDevice localDevice;
public CustomListener(LocalDevice localDevice) { this.localDevice = localDevice; }
@Override
public void iAmReceived(final RemoteDevice d)
{
System.out.println("I AM FOR Devcice " + d.toString());
new Thread(new Runnable() {
public void run()
{
try
{
DiscoveryUtils.getExtendedDeviceInformation(localDevice, d);
SequenceOf
System.out.println("I AM " + oids);
}
catch (BACnetException e)
{
e.printStackTrace();
}
}
}).start();
}
public void covNotificationReceived(
final UnsignedInteger subscriberProcessIdentifier,
final ObjectIdentifier initiatingDeviceIdentifier,
final ObjectIdentifier monitoredObjectIdentifier,
final UnsignedInteger timeRemaining,
final SequenceOf
System.out.println(
"subscriberProcessIdentifier " + subscriberProcessIdentifier
+ " ,initiatingDeviceIdentifier:"
+ initiatingDeviceIdentifier.toString());
System.out.println("monitoredObjectIdentifier "
+ monitoredObjectIdentifier.toString());
for (int i = 0; i < listOfValues.getCount(); i++)
{
try
{
System.out.println(
"List of value" + listOfValues.get(i).toString());
}
catch (Exception e)
{
// TODO: handle exception
}
if (!(listOfValues.getValues().get(i)
.getValue() instanceof StatusFlags))
{
System.out.println("COV_Result: Instance-ID:"
+ monitoredObjectIdentifier.getInstanceNumber()
+ " Value:" + listOfValues.getValues().get(i).getValue()
+ " Type: "
+ monitoredObjectIdentifier.getObjectType().intValue()
+ " Object Type "
+ monitoredObjectIdentifier.getObjectType());
}
}
}
catch (Exception e)
{
System.err.println(
" Exception occurs while reading COV Notification " + e);
}
}
@Override public void iHaveReceived(final RemoteDevice d, final RemoteObject o) { try { System.out.println(" I Have Received !!!!!!!!!!!!!! " + d.toString()
" " + o.toString()); } catch (Exception e) { System.err.println(" Exception occurs in I have Received " + e); } }
@Override public void propertyWritten(final Address from, final BACnetObject obj, final PropertyValue pv) { System.out.println(" propertyWritten " + from.toString() + " "
@Override public void eventNotificationReceived( final UnsignedInteger processIdentifier, final ObjectIdentifier initiatingDeviceIdentifier, final ObjectIdentifier eventObjectIdentifier, final TimeStamp timeStamp, final UnsignedInteger notificationClass, final UnsignedInteger priority, final EventType eventType, final CharacterString messageText, final NotifyType notifyType, final Boolean ackRequired, final EventState fromState, final EventState toState, final NotificationParameters eventValues) { try { System.out.println(" Event Notification Received !!!!!!!!!11"); } catch (Exception e) { System.err.println( "Exception occurs in event Notification Received " + e); } }
@Override public void requestReceived(final Address from, final Service service) { try { System.out.println(" From " + from.toString() + " ,service "
service.toString()); } catch (Exception e) { // TODO: handle exception } }
@Override public void textMessageReceived( final ObjectIdentifier textMessageSourceDevice, final Choice messageClass, final MessagePriority messagePriority, final CharacterString message) { System.out.println("Test message "); }
@Override public void synchronizeTime(final Address from, final DateTime dateTime, final boolean utc) { System.out.println("synchronizeTime "); }
}
WireShark Capture attached as well Capure.pcapng.txt
I tried the code, but I receicved Simple Ack for MSV,1 and AI,1. Screenshot of the wireshark is enclosed.
192.168.1.143 - BACnet4J
I guess i found the issue i was using version 5.0.0 and you are testing on 6.0.0-SNAPSHOT. Let me once check this with version and update back
Have checked, it is working fine in 6.0.0-SNAPSHOT had the issue with 5.0.0
Hi I was exploring the library for all different COV type but i noticed i am unable to get the COV packets on my listener, however i checked wireshark there seems to be some error of unknown service while subscribing even after that device do sends the notification of which library reply with unknown service. However same is working with a third party online tool i checked called Yabe. PFA screenshot of wire shark with bacnet4j and yabe. Below are the logs which i see when a notification is sent from device: [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from local network. From=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], local=0 [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from [a,0,0,66,ba,c0]: NPDU [from=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], linkService=null, queue=[0,4,f6,1,9,4,1c,2,0,1e,2c,2c,4,c0,0,5,39,0,4e,9,55,2e,91,3,2f,9,6f,2e,82,4,0,2f,4f]] [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from local network. From=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], local=0 [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from [a,0,0,66,ba,c0]: NPDU [from=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], linkService=null, queue=[0,4,f7,1,9,1,1c,2,0,1e,2c,2c,4,c0,0,5,39,0,4e,9,55,2e,91,3,2f,9,6f,2e,82,4,0,2f,4f]] [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from local network. From=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], local=0 [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from [a,0,0,66,ba,c0]: NPDU [from=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], linkService=null, queue=[0,4,f8,1,9,4,1c,2,0,1e,2c,2c,4,c0,0,5,39,0,4e,9,55,2e,91,0,2f,9,6f,2e,82,4,0,2f,4f]] [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from local network. From=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], local=0 [BACnet4J IP socket listener for device 0] DEBUG com.serotonin.bacnet4j.npdu.Network - Received NPDU from [a,0,0,66,ba,c0]: NPDU [from=Address [networkNumber=0, macAddress=[a,0,0,66,ba,c0]], linkService=null, queue=[0,4,f9,1,9,1,1c,2,0,1e,2c,2c,4,c0,0,5,39,0,4e,9,55,2e,91,0,2f,9,6f,2e,82,4,0,2f,4f]]
![Yabe](https://user-images.githubusercontent.com/44496953/128324468-73dfbc89-5ced-411d-9654-40ffe6769e6a.png)