Opc.Ua.Client.MonitoredItem.GetEventType C# (CSharp) Method

GetEventType() public method

Returns value of the field name containing the event type.
public GetEventType ( EventFieldList eventFields ) : INode
eventFields EventFieldList
return INode
        public INode GetEventType(EventFieldList eventFields)
        {
            // get event type.
            NodeId eventTypeId = GetFieldValue(eventFields, ObjectTypes.BaseEventType, Opc.Ua.BrowseNames.EventType) as NodeId;

            if (eventTypeId != null && m_subscription != null && m_subscription.Session != null)
            {
                return m_subscription.Session.NodeCache.Find(eventTypeId);
            }

            // no event type in event field list.
            return null;
        }

Usage Example

コード例 #1
0
ファイル: ComAeProxy.cs プロジェクト: yuriik83/UA-.NET
        /// <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");
            }
        }
All Usage Examples Of Opc.Ua.Client.MonitoredItem::GetEventType