-1

I'm working with bacnet via java, the bacnet4j project. I have a device with bacnet objects and I want to monitor this object by second devices (COV). How can i run subscripton?

I should take advantage of localDevice.getEventHandler().addListener(new DeviceEventListener() { and use the functions that are there?

Maybe someone put me on the right track. Or is there any example I can analyze?

  • Can you clarify which side of communication you are - a subscription client who wants to get notified or subscription host who should send notifications? – splatch Nov 12 '20 at 22:00
  • I want to receive a notification and process it, but I don't know where the notification is from other devices – Wojciech Czernoch Nov 13 '20 at 09:12

1 Answers1

0

I haven't tested this with real device (I authored bacnet4j-wrapper for subset of BACnet objects).

The change of value is two step process. First you need to add DeviceEventListener, just as you did. A more convenient way is DeviceEventAdapter which ships all methods - one you need to implement is covNotificationReceived. Once you have your listener in place you need to fire SubscribeCOVRequest for specific object you want to watch.

Take a look on sources ChangeOfValueTest.java.

splatch
  • 1,547
  • 2
  • 10
  • 15
  • I get this message after trying to resubscribe from another device [BACnet4J transport for device 98] WARN com.serotonin.bacnet4j.service.unconfirmed.UnconfirmedPrivateTransferRequest - No handler found for vendorId 8, serviceNumber 1, ignoring unconfirmed private transfer – Wojciech Czernoch Nov 17 '20 at 11:21
  • Log entry you have is a remote request. I am not sure if these are correlated, are you sure your subscription request leaves your node and goes along the way? Please check with wireshark to confirm behavior. You can also try reading remote device subscriptions to see if was accepted by destination. Try with `PropertyIdentifier.activeCovSubscriptions`. Some devices have limit of active subscribers. – splatch Nov 17 '20 at 11:39
  • I had some time to look at it. I send SubscribeCOVPropertyRequest with VTS program. In BACnet4J I see this request in requestReceived (not in covNotificationReceived). VTS program ireturns information about the error as if BACnet4J was unable to handle this query. I do not know how to activate the option of sending values ​​to the device that requested it. – Wojciech Czernoch Feb 05 '21 at 13:07
  • Log: E / BACnet: requestReceived address: Address [networkNumber = 0, macAddress = [a, 1, a, f, ba, c0]] | 10.1.10.15:47808 service: Encodable (com.serotonin.bacnet4j.service.confirmed.SubscribeCOVPropertyRequest) ChoiceId (): 28 getNetworkPriority (): null. – Wojciech Czernoch Feb 05 '21 at 13:07