/// <see cref="BaseListCtrl.UpdateItem" />
        protected override void UpdateItem(ListViewItem listItem, object item)
        {
            SimpleAttributeOperand clause = item as SimpleAttributeOperand;

            if (clause == null)
            {
                base.UpdateItem(listItem, item);
                return;
            }

            INode eventType = m_session.NodeCache.Find(clause.TypeDefinitionId);

            if (eventType != null)
            {
                listItem.SubItems[0].Text = String.Format("{0}", eventType);
            }
            else
            {
                listItem.SubItems[0].Text = String.Format("(unspecified)");
            }

            listItem.SubItems[1].Text = String.Format("{0}", SimpleAttributeOperand.Format(clause.BrowsePath));
            listItem.SubItems[2].Text = String.Format("{0}", clause.IndexRange);

            listItem.Tag = item;
        }
        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);
        }
 /// <summary>
 /// Utility method to combine the retrieved field names (from the monitored item filter select clause)
 /// and the retrieved field values (from a received event) into a name/value dictionary.
 /// </summary>
 /// <param name="arg">A field list from a received event.</param>
 /// <returns>A dictionary of field name to field value.</returns>
 protected Dictionary <string, object> EventFieldListToDictionary(EventFieldList arg)
 {
     return
         (((EventFilter)MonitoredItem.Filter).SelectClauses           // all retrieved fields for event
          .Zip(arg.EventFields)                                       // values of retrieved fields
          .ToDictionary(
              p => SimpleAttributeOperand.Format(p.First.BrowsePath), // e.g. "/EventId"
              p => p.Second.Value));
 }
Beispiel #4
0
        /// <summary>
        /// Returns the field name the specified SelectClause in the EventFilter.
        /// </summary>
        public string GetFieldName(int index)
        {
            EventFilter filter = m_filter as EventFilter;

            if (filter == null)
            {
                return(null);
            }

            if (index < 0 || index >= filter.SelectClauses.Count)
            {
                return(null);
            }

            return(Utils.Format("{0}", SimpleAttributeOperand.Format(filter.SelectClauses[index].BrowsePath)));
        }