AddSelectClause() public method

Adds the specified property to the event filter.
public AddSelectClause ( Opc.Ua.NodeId eventTypeId, Opc.Ua.QualifiedName propertyName ) : void
eventTypeId Opc.Ua.NodeId
propertyName Opc.Ua.QualifiedName
return void
コード例 #1
0
        public Result <DataResponse> GetEventData(OpcUAQuery query, NodeId startNodeId, Opc.Ua.EventFilter eventFilter)
        {
            var nodeCache = _nodeCacheFactory.Create(_session);

            eventFilter.AddSelectClause(ObjectTypeIds.BaseEventType, "SourceNode");
            eventFilter.AddSelectClause(ObjectTypeIds.BaseEventType, "EventType");

            var eventFilterValues = GetEventFilterValues(startNodeId, eventFilter);

            if (eventFilterValues == null)
            {
                var monitorItem = AddMonitorItem(startNodeId, eventFilter);
                eventFilterValues = new EventFilterValues(monitorItem, query, eventFilter);
                if (!TryAddEventFilterValues(startNodeId, eventFilterValues))
                {
                    RemoveMonitorItem(monitorItem);
                    eventFilterValues = null;
                }
            }

            lock (_eventData)
            {
                if (eventFilterValues == null)
                {
                    eventFilterValues = GetEventFilterValues(startNodeId, eventFilter);
                }
                if (eventFilterValues != null)
                {
                    return(_eventDataResponse.CreateEventSubscriptionDataResponse(eventFilterValues.Values.Values, query, nodeCache));
                }
            }
            return(new Result <DataResponse>(StatusCodes.BadUnexpectedError, ""));
        }
コード例 #2
0
        internal static Opc.Ua.EventFilter GetEventFilter(OpcUAQuery query, NamespaceTable namespaceTable)
        {
            var eventFilter = new Opc.Ua.EventFilter();

            if (query.eventQuery?.eventColumns != null)
            {
                foreach (var column in query.eventQuery.eventColumns)
                {
                    var bp   = Converter.GetBrowsePath(column.browsePath, namespaceTable);
                    var path = SimpleAttributeOperand.Format(bp);
                    eventFilter.AddSelectClause(ObjectTypes.BaseEventType, path, Attributes.Value);
                }
            }


            if (query.eventQuery?.eventFilters != null)
            {
                for (int i = 0; i < query.eventQuery.eventFilters.Length; i++)
                {
                    var filter = query.eventQuery.eventFilters[i];
                    eventFilter.WhereClause.Push(filter.oper, GetOperands(filter, namespaceTable));
                }
            }
            return(eventFilter);
        }