/// <summary>
/// Processes a Publish response from the UA server for AddressSpace changes.
/// </summary>
/// <param name="monitoredItem"></param>
/// <param name="e"></param>
void AddressSpaceChange_Notification(MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs e)
{
try
{
EventFieldList eventFields = e.NotificationValue as EventFieldList;
if (eventFields == null)
{
return;
}
if (monitoredItem != null)
{
if (monitoredItem.ClientHandle != eventFields.ClientHandle)
{
return;
}
}
INode eventUA = monitoredItem.GetEventType(eventFields);
if (eventUA.NodeId == new NodeId(Opc.Ua.ObjectTypes.BaseModelChangeEventType))
{
//TODO:if we get this event we know a change was made, but we do not know what so we will beed to get all EventTypes and compare and update our config data
}
else if (eventUA.NodeId != new NodeId(Opc.Ua.ObjectTypes.GeneralModelChangeEventType))
{
//We are not interested in any other event, so we will return.
//If we can set the where clause on the filter for this item, this else clause can be removed.
return;
}
else
{
object v = monitoredItem.GetFieldValue(eventFields, Opc.Ua.ObjectTypes.GeneralModelChangeEventType, new QualifiedName(Opc.Ua.BrowseNames.Changes));
//ChangeStructureDataTypeCollection changes = (ChangeStructureDataTypeCollection) monitoredItem.GetFieldValue(eventFields, ObjectTypes.GeneralModelChangeEventType, new QualifiedName(GeneralModelChangeEvent.Names.Changes));
}
}
catch (Exception ex)
{
Utils.Trace(ex, "Unexpected error in AddressSpaceChange_Notification");
}
}