Ejemplo n.º 1
0
        public virtual void MonitorNotifyDataChange(NodeId id, DataValue dv)
        {
            Application.ServerMonitorKey key = new Application.ServerMonitorKey(id, NodeAttribute.Value);
            try
            {
                this.monitorMapRW.EnterReadLock();
                if (!this.monitorMap.TryGetValue(key, out List <MonitoredItem> monitoredItemList))
                {
                    return;
                }

                for (int index = 0; index < monitoredItemList.Count; ++index)
                {
                    if (monitoredItemList[index].QueueData.Count >= monitoredItemList[index].QueueSize)
                    {
                        monitoredItemList[index].QueueOverflowed = true;
                    }
                    else
                    {
                        monitoredItemList[index].QueueData.Enqueue(dv);
                    }

                    if (monitoredItemList[index].ParentSubscription.ChangeNotification == Subscription.ChangeNotificationType.None)
                    {
                        monitoredItemList[index].ParentSubscription.ChangeNotification = Subscription.ChangeNotificationType.AtPublish;
                    }
                }
            }
            finally
            {
                this.monitorMapRW.ExitReadLock();
            }
        }
Ejemplo n.º 2
0
        public virtual bool MonitorAdd(object session, MonitoredItem mi)
        {
            if (!this.AddressSpaceTable.TryGetValue(mi.ItemToMonitor.NodeId, out LibUA.Core.Node _) || !this.SessionHasPermissionToRead(session, mi.ItemToMonitor.NodeId))
            {
                return(false);
            }

            Application.ServerMonitorKey key = new Application.ServerMonitorKey(mi.ItemToMonitor);
            try
            {
                this.monitorMapRW.EnterWriteLock();
                if (this.monitorMap.TryGetValue(key, out List <MonitoredItem> monitoredItemList))
                {
                    monitoredItemList.Add(mi);
                }
                else
                {
                    this.monitorMap.Add(key, new List <MonitoredItem>()
                    {
                        mi
                    });
                }
            }
            finally
            {
                this.monitorMapRW.ExitWriteLock();
            }
            return(true);
        }
Ejemplo n.º 3
0
        public virtual void MonitorRemove(object session, MonitoredItem mi)
        {
            Application.ServerMonitorKey key = new Application.ServerMonitorKey(mi.ItemToMonitor);
            try
            {
                this.monitorMapRW.EnterWriteLock();
                if (!this.monitorMap.TryGetValue(key, out List <MonitoredItem> monitoredItemList))
                {
                    return;
                }

                monitoredItemList.Remove(mi);
            }
            finally
            {
                this.monitorMapRW.ExitWriteLock();
            }
        }