QuickOPC User's Guide and Reference
EasyUADataChangeNotificationEventHandler Delegate



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA Namespace : EasyUADataChangeNotificationEventHandler Delegate
The source of the event.
An OpcLabs.EasyOpc.UA.OperationModel.EasyUADataChangeNotificationEventArgs that contains the event data.
Represents the method that will handle an event raised for every significant data change in a subscribed OPC monitored item.
Syntax
'Declaration
 
<ComVisibleAttribute(False)>
Public Delegate Sub EasyUADataChangeNotificationEventHandler( _
   ByVal sender As Object, _
   ByVal e As EasyUADataChangeNotificationEventArgs _
) 
'Usage
 
Dim instance As New EasyUADataChangeNotificationEventHandler(AddressOf HandlerMethod)
[ComVisible(false)]
public delegate void EasyUADataChangeNotificationEventHandler( 
   object sender,
   EasyUADataChangeNotificationEventArgs e
)
[ComVisible(false)]
public delegate void EasyUADataChangeNotificationEventHandler( 
   Object^ sender,
   EasyUADataChangeNotificationEventArgs^ e
)

Parameters

sender
The source of the event.
e
An OpcLabs.EasyOpc.UA.OperationModel.EasyUADataChangeNotificationEventArgs that contains the event data.
Remarks

 

When there is a significant change related to monitored item you have subscribed to, the EasyUAClient object generates a  DataChangeNotification event. What constitutes a significant change is given by the data change filter specified when the subscription was created. For subscription mechanism to be useful, you should hook one or more event handlers to this event.

To be more precise, the DataChangeNotification event is actually generated in other cases, too.

First of all, you always receive at least one DataChangeNotification event notification after you make a subscription; this notification either contains the initial data for the item, or an indication that data is not currently available. This behavior allows your application to rely on the component to provide at least some information for each subscribed item.

Secondly, the DataChangeNotification event is generated every time the component loses connection to the monitored item, and when it reestablishes the connection. This way, your application is informed about any problems related to the item, and can process them accordingly if needed.

You will also receive the DataChangeNotification notification if the status of the item changes (not just its actual data value). In fact, you can influence whether the timestamp or value changes trigger a notification, with the Trigger property in UADataChangeFilter.

The DataChangeNotification event notification contains an EasyUADataChangeNotificationEventArgs argument. You will find all kind of relevant data in this object. Some properties in this object contain valid information no matter what kind of change the notification is about. These properties are in Arguments (containing also information such as SubscriptionParametersMonitoringParametersNodeDescriptorEndpointDescriptor and State).

For further processing, your code should always inspect the value of Exception property of the event arguments. If this property is set to a null reference, the notification carries an actual change in item’s data, and the AttributeData property has the new value, timestamps and status of the item, in form of UAAttributeData object. If the Exception property is not a null reference, there has been an error related to the item, and the AttributeData property is not valid. In such case, the Exception property contains information about the problem.

The DataChangeNotification event handler is called on a thread determined by the EasyUAClient component. For details, please refer to “Multithreading and Synchronization” chapter under “Advanced Topics”.

In short, however, we can say that if you are writing e.g. Windows Forms application, the component takes care of calling the event handler on the user interface thread of the form, making it safe for your code to update controls on the form, or do other form-related actions, from the event handler.

 

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also