sp_TopicIcon
How to get Data Change Notification OPC UA Java Client
Avatar
Lijo Louis
Posts: 4
05/20/2016 - 02:01

1

Hi,

I am using OPC UA java stack and developing an OPC UA client. I have made subscriptions and publish request to a monitored Item. I am using datachangefilter to set trigger if the value of the monitored item changes. code snippet is given below.

            DataChangeFilter filter = new DataChangeFilter();
            filter.setTrigger(DataChangeTrigger.StatusValue);

I am not getting any notification from server side. I am able to receive a publish response which has an error Bad_SequenceNumberUnknown (0x807A0000) "The sequence number is unknown to the server." I have read few comments about this error. For example change retransmission queue size on server side. I am not able to resolve this error any way and not able to get any notification.

Can you please help me how can I get datachange notification and to get the changed value.

Thank you for your time and considerationSmile

Lijo

Avatar
05/20/2016 - 21:45

2

Bad_SequenceNumberUnknown should only occur if you provide "subscriptionAcknowledgements" in the request. Since you never received notifications, this parameter is supposed to be empty (an empty list).

If this does not apply I suggest that you use another Client (you can google for free stuff) and use the OPC UA wireshark plugin to analyse the difference between your request and the working request of other clients.

-Karl

Avatar
Lijo Louis
Posts: 4
05/23/2016 - 07:23

3

Dear Karl,

Thank you very much for your information. Now I am able to get notification. But i want to get the notification only when data change occurs. I am using this code snippet 

            DataChangeFilter datachange = new DataChangeFilter();
            datachange.setTrigger(DataChangeTrigger.StatusValue);
            ExtensionObject filter = new ExtensionObject(datachange.getTypeId());
            MonitoringParameters parameters = new MonitoringParameters(
                     clientHandle,
                     0.0,     // sampling interval
                     filter,       // filter
                     QueueSize,   // queue size
                     false);      // discard oldest      
            MonitoredItemCreateRequest monitoreditm = new MonitoredItemCreateRequest(ReadvalueId,MonitoringMode.Reporting,parameters);

After setting trigger also sevice request looks like this ;- 

serviceRequest: message=CreateMonitoredItemsRequest

/***** only filter part***/////////

 Filter=DataChangeFilter: DataChangeFilter
          Trigger=null
          DeadbandType=null
          DeadbandValue=null

 And corresponding response message--- Response: CreateMonitoredItemsResponse   

/***** only filter part***/////////

 FilterResult=null   

Can you please help me to get notification only when data change occurs. I really appreciate your time and consideration.

Thank you Smile

Avatar
05/23/2016 - 23:43

4

It is a fundamental property of subscriptions that notifications are only sent when data changes. There is not even a way to set it up differently.

An initial notification is sent after creating the monitored item. After that, notifications are only sent when value or status changes.

-Karl

Avatar
Lijo Louis
Posts: 4
05/25/2016 - 01:27

5

Ok That helps. I could receive publish response and data change notification. Now I get NotificationData as ExtensionObject from publish response. Is there any way to decode it using Opc ua java stack. I want to get the changed value and node id from publish response.

 

Thank you very much

Lijo

Avatar
05/26/2016 - 04:22

6

I don't know enough about the Java stack. To get help you may want to create an issue on github.

Avatar
Lijo Louis
Posts: 4
05/27/2016 - 07:18

7

Ok.Thank you

Forum Timezone:
America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 24
Currently Browsing this Page:
1 Guest(s)

Devices in use: Desktop (22), Phone (2)

Forum Stats:
Groups: 2
Forums: 10
Topics: 1415
Posts: 4778