Opc.Ua.Server.SamplingGroup.StopMonitoring C# (CSharp) Method

StopMonitoring() public method

Stops monitoring the item.
public StopMonitoring ( ISampledDataChangeMonitoredItem monitoredItem ) : bool
monitoredItem ISampledDataChangeMonitoredItem
return bool
        public bool StopMonitoring(ISampledDataChangeMonitoredItem monitoredItem)
        {
            lock (m_lock)
            {
                if (m_items.ContainsKey(monitoredItem.Id))
                {
                    m_itemsToRemove.Add(monitoredItem);
                    return true;
                }
                    
                return false;
            }
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Stops monitoring the item.
        /// </summary>
        /// <remarks>
        /// It will call the external source to stop the monitoring if an external source was provided originally.
        /// The changes will not take affect until the ApplyChanges() method is called.
        /// </remarks>
        public virtual void StopMonitoring(ISampledDataChangeMonitoredItem monitoredItem)
        {
            lock (m_lock) {
                // check for sampling group.
                SamplingGroup samplingGroup = null;

                if (m_sampledItems.TryGetValue(monitoredItem, out samplingGroup))
                {
                    if (samplingGroup != null)
                    {
                        samplingGroup.StopMonitoring(monitoredItem);
                    }

                    m_sampledItems.Remove(monitoredItem);
                    return;
                }
            }
        }