当前位置: 首页>>代码示例>>C#>>正文


C# Server.MonitoredItem类代码示例

本文整理汇总了C#中Opc.Ua.Server.MonitoredItem的典型用法代码示例。如果您正苦于以下问题:C# MonitoredItem类的具体用法?C# MonitoredItem怎么用?C# MonitoredItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MonitoredItem类属于Opc.Ua.Server命名空间,在下文中一共展示了MonitoredItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ComAeSubscriptionClient

        /// <summary>
        /// Initializes a new instance of the <see cref="ComAeSubscriptionClient"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="cache">The cache for known types.</param>
        /// <param name="namespaceIndex">The namespace index for the event types.</param>
        /// <param name="manager">The manager.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        public ComAeSubscriptionClient(
            ServerSystemContext context,
            ComAeClientConfiguration configuration,
            AeTypeCache cache,
            ushort namespaceIndex,
            ComAeClientManager manager,
            MonitoredItem monitoredItem)
        {
            m_defaultContext = context;
            m_separators = configuration.SeperatorChars;
            m_cache = cache;
            m_namespaceIndex = namespaceIndex;
            m_manager = manager;
            m_refreshComplete = new ManualResetEvent(false);
            m_monitoredItems = new List<MonitoredItem>();
            m_monitoredItems.Add(monitoredItem);
            m_qualifiedName = null;
            m_isSource = false;

            NodeHandle handle = monitoredItem.ManagerHandle as NodeHandle;
            AeAreaState area = handle.Node as AeAreaState;

            if (area != null)
            {
                m_qualifiedName = area.QualifiedName;
                m_isSource = false;
            }
            else
            {
                AeSourceState source = handle.Node as AeSourceState;

                if (source != null)
                {
                    m_qualifiedName = source.QualifiedName;
                    m_isSource = true;
                }
            }
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:47,代码来源:ComAeSubscriptionClient.cs

示例2: QueueValue

        /// <summary>
        /// Queues the value to the monitored item.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="request">The request.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        public void QueueValue(ServerSystemContext context, ReadRequest request, MonitoredItem monitoredItem)
        {
            NodeHandle handle = monitoredItem.ManagerHandle as NodeHandle;

            if (handle == null)
            {
                return;
            }

            ReadValueId nodeToRead = monitoredItem.GetReadValueId();
            DataValue value = new DataValue();
            ServiceResult error = null;
            
            // read item value.
            DaItemState item = handle.Node as DaItemState;
            DaPropertyState daProperty = handle.Node as DaPropertyState;
            PropertyState uaProperty = handle.Node as PropertyState;

            if (item != null)
            {
                error = request.GetResult(context, item, nodeToRead, value, monitoredItem.DiagnosticsMasks);
            }

            // read vendor defined property value.
            else if (daProperty != null)
            {
                error = request.GetResult(context, daProperty, nodeToRead, value, monitoredItem.DiagnosticsMasks);
            }

            // read UA defined property value.
            else if (uaProperty != null)
            {
                error = request.GetResult(context, uaProperty, nodeToRead, value, monitoredItem.DiagnosticsMasks);
            }

            value.ServerTimestamp = DateTime.UtcNow;

            if (value.StatusCode != StatusCodes.BadNotFound)
            {
                monitoredItem.QueueValue(value, error);
            }
            else
            {
                monitoredItem.QueueValue(value, StatusCodes.BadNodeIdUnknown);
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:52,代码来源:SubscribeRequest.cs

示例3: CreateSampledItem

        /// <summary>
        /// Creates a new sampled item.
        /// </summary>
        private void CreateSampledItem(double samplingInterval, MonitoredItem monitoredItem)
        {
            m_sampledItems.Add(monitoredItem);

            if (m_samplingTimer == null)
            {
                m_samplingTimer = new Timer(DoSample, null, (int)m_minimumSamplingInterval, (int)m_minimumSamplingInterval);
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:12,代码来源:DiagnosticsNodeManager.cs

示例4: OnMonitoredItemDeleted

        /// <summary>
        /// Called after deleting a MonitoredItem.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="handle">The handle for the node.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        protected override void OnMonitoredItemDeleted(
            ServerSystemContext context,
            NodeHandle handle,
            MonitoredItem monitoredItem)
        {
            // check if diagnostics collection needs to be turned off.
            if (IsDiagnosticsNode(handle.Node))
            {
                if (monitoredItem.MonitoringMode != MonitoringMode.Disabled)
                {
                    m_diagnosticsMonitoringCount--;

                    if (m_diagnosticsMonitoringCount == 0 && m_diagnosticsScanTimer != null)
                    {
                        m_diagnosticsScanTimer.Dispose();
                        m_diagnosticsScanTimer = null;
                    }

                    if (m_diagnosticsScanTimer != null)
                    {
                        DoScan(true);
                    }
                }
            }

            // check if sampling needs to be turned off.
            if (monitoredItem.AttributeId == Attributes.Value)
            {
                BaseVariableState variable = handle.Node as BaseVariableState;

                if (variable != null && variable.MinimumSamplingInterval > 0)
                {
                    DeleteSampledItem(monitoredItem);
                }
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:42,代码来源:DiagnosticsNodeManager.cs

示例5: OnMonitoringModeChanged

 /// <summary>
 /// Called after changing the MonitoringMode for a MonitoredItem.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="handle">The handle for the node.</param>
 /// <param name="monitoredItem">The monitored item.</param>
 /// <param name="previousMode">The previous monitoring mode.</param>
 /// <param name="monitoringMode">The current monitoring mode.</param>
 protected virtual void OnMonitoringModeChanged(
     ServerSystemContext context,
     NodeHandle handle,
     MonitoredItem monitoredItem,
     MonitoringMode previousMode,
     MonitoringMode monitoringMode)
 {
     // overridden by the sub-class.
 }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:17,代码来源:QuickstartNodeManager.cs

示例6: ReadInitialValue

        /// <summary>
        /// Reads the initial value for a monitored item.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="handle">The item handle.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        protected virtual void ReadInitialValue(
            ServerSystemContext context,
            NodeHandle handle,
            MonitoredItem monitoredItem)
        {
            DataValue initialValue = new DataValue();

            initialValue.Value = null;
            initialValue.ServerTimestamp = DateTime.UtcNow;
            initialValue.SourceTimestamp = DateTime.MinValue;
            initialValue.StatusCode = StatusCodes.BadWaitingForInitialData;

            ServiceResult error = handle.Node.ReadAttribute(
                context,
                monitoredItem.AttributeId,
                monitoredItem.IndexRange,
                monitoredItem.DataEncoding,
                initialValue);

            monitoredItem.QueueValue(initialValue, error);
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:27,代码来源:QuickstartNodeManager.cs

示例7: OnMonitoringModeChanged

        /// <summary>
        /// Called after changing the MonitoringMode for a MonitoredItem.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="handle">The handle for the node.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        /// <param name="previousMode">The previous monitoring mode.</param>
        /// <param name="monitoringMode">The current monitoring mode.</param>
        protected override void OnMonitoringModeChanged(
            ServerSystemContext context,
            NodeHandle handle,
            MonitoredItem monitoredItem,
            MonitoringMode previousMode,
            MonitoringMode monitoringMode)
        {
            if (SystemScanRequired(handle.MonitoredNode, monitoredItem))
            {
                BaseVariableState source = handle.Node as BaseVariableState;

                if (previousMode != MonitoringMode.Disabled && monitoredItem.MonitoringMode == MonitoringMode.Disabled)
                {
                    m_system.StopMonitoringValue(monitoredItem.Id);
                }

                if (previousMode == MonitoringMode.Disabled && monitoredItem.MonitoringMode != MonitoringMode.Disabled)
                {
                    m_system.StartMonitoringValue(monitoredItem.Id, monitoredItem.SamplingInterval, source);
                }
            }
        }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:30,代码来源:TestDataNodeManager.cs

示例8: OnMonitoredItemCreated

 /// <summary>
 /// Called after creating a MonitoredItem.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="handle">The handle for the node.</param>
 /// <param name="monitoredItem">The monitored item.</param>
 protected override void OnMonitoredItemCreated(
     ServerSystemContext context,
     NodeHandle handle,
     MonitoredItem monitoredItem)
 {
     if (SystemScanRequired(handle.MonitoredNode, monitoredItem))
     {
         if (monitoredItem.MonitoringMode != MonitoringMode.Disabled)
         {
             m_system.StartMonitoringValue(
                 monitoredItem.Id, 
                 monitoredItem.SamplingInterval, 
                 handle.Node as BaseVariableState);
         }
     }    
 }
开发者ID:OPCFoundation,项目名称:UA-.NETStandardLibrary,代码行数:22,代码来源:TestDataNodeManager.cs

示例9: Modify

 /// <summary>
 /// Modifies the request after the specified item changes.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="monitoredItem">The monitored item.</param>
 public void Modify(ServerSystemContext context, MonitoredItem monitoredItem)
 {
     // nothing to do.
 }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:9,代码来源:HdaSubscribeRequestManager.cs

示例10: Add

        /// <summary>
        /// Adds the specified monitored item.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        public void Add(ServerSystemContext context, MonitoredItem monitoredItem)
        {
            if (monitoredItem == null)
            {
                return;
            }

            // save the monitored item.
            if (m_monitoredItems == null)
            {
                m_monitoredItems = new List<MonitoredItem>();
            }

            m_monitoredItems.Add(monitoredItem);
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:20,代码来源:HdaSubscribeRequestManager.cs

示例11: RemoveItem

        /// <summary>
        /// Removes an item from the subscription.
        /// </summary>
        public int RemoveItem(MonitoredItem monitoredItem)
        {
            lock (m_monitoredItems)
            {
                for (int ii = 0; ii < m_monitoredItems.Count; ii++)
                {
                    if (m_monitoredItems[ii].Id == monitoredItem.Id)
                    {
                        m_monitoredItems.RemoveAt(ii);
                        break;
                    }
                }

                return m_monitoredItems.Count;
            }
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:19,代码来源:ComAeSubscriptionClient.cs

示例12: AddItem

 /// <summary>
 /// Adds an item to a subscription.
 /// </summary>
 public void AddItem(MonitoredItem monitoredItem)
 {
     lock (m_monitoredItems)
     {
         m_monitoredItems.Add(monitoredItem);
     }
 }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:10,代码来源:ComAeSubscriptionClient.cs

示例13: Modify

 /// <summary>
 /// Modifies the request after the specified item changes.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="monitoredItem">The monitored item.</param>
 public void Modify(ServerSystemContext context, MonitoredItem monitoredItem)
 {
     // re-queue the last value.
     if (m_lastRequest != null)
     {
         QueueValue(context, m_lastRequest, monitoredItem);
     }
 }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:13,代码来源:SubscribeRequest.cs

示例14: Add

        /// <summary>
        /// Adds the specified monitored item.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="monitoredItem">The monitored item.</param>
        public void Add(ServerSystemContext context, MonitoredItem monitoredItem)
        {
            if (monitoredItem == null)
            {
                return;
            }

            // save the monitored item.
            if (m_monitoredItems == null)
            {
                m_monitoredItems = new List<MonitoredItem>();
            }

            m_monitoredItems.Add(monitoredItem);

            // queue the initial value.
            if (m_lastRequest != null)
            {
                QueueValue(context, m_lastRequest, monitoredItem);
            }
        }
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:26,代码来源:SubscribeRequest.cs

示例15: CreateMonitoredItem

        /// <summary>
        /// Creates a set of monitored items.
        /// </summary>
        public MonitoredItem CreateMonitoredItem(
            OperationContext           context,
            INodeManager               nodeManager,
            object                     handle,
            uint                       subscriptionId,
            uint                       monitoredItemId,
            TimestampsToReturn         timestampsToReturn,
            double                     publishingInterval,
            MonitoredItemCreateRequest itemToCreate,
            EventFilter                filter)
        {
            lock (m_lock)
            {
                // calculate sampling interval.
                double samplingInterval = itemToCreate.RequestedParameters.SamplingInterval;
                
                if (samplingInterval < 0)
                {
                    samplingInterval = publishingInterval;
                }
                
                // limit the queue size.
                uint queueSize = itemToCreate.RequestedParameters.QueueSize;

                if (queueSize > m_maxEventQueueSize)
                {
                    queueSize = m_maxEventQueueSize;
                }
                
                // create the monitored item.
                MonitoredItem monitoredItem = new MonitoredItem(
                    m_server,
                    nodeManager,
                    handle,
                    subscriptionId,
                    monitoredItemId,
                    context.Session,
                    itemToCreate.ItemToMonitor,
                    context.DiagnosticsMask,
                    timestampsToReturn,
                    itemToCreate.MonitoringMode,
                    itemToCreate.RequestedParameters.ClientHandle,
                    filter,
                    filter,
                    null,
                    samplingInterval,
                    queueSize,
                    itemToCreate.RequestedParameters.DiscardOldest,
                    MinimumSamplingIntervals.Continuous);

                // save the monitored item.
                m_monitoredItems.Add(monitoredItemId, monitoredItem);

                return monitoredItem;
            }
        }
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:59,代码来源:EventManager.cs


注:本文中的Opc.Ua.Server.MonitoredItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。