Esempio n. 1
0
        /// <summary>
        /// 读一个变量
        /// </summary>
        /// <param name="tag"></param>
        /// <returns></returns>
        public TagItem Read(TagItem tag)
        {
            DataValue value = uAClient.ReadValue(tag.GetNodeId());

            tag.Value     = value.Value;
            tag.Quality   = value.StatusCode.ToString();
            tag.Timestamp = value.SourceTimestamp;
            return(tag);
        }
Esempio n. 2
0
 /// <summary>
 /// 写变量
 /// </summary>
 /// <param name="tag"></param>
 /// <returns></returns>
 public bool Write(TagItem tag)
 {
     uAClient.WriteValues(new List <string>()
     {
         tag.ValueToWrite?.ToString()
     }, new List <string>()
     {
         tag.GetNodeId()
     });
     return(true);
 }
Esempio n. 3
0
        /// <summary>
        /// 添加订阅
        /// </summary>
        /// <param name="tag"></param>
        /// <returns></returns>
        public bool AddSubscription(TagItem tag)
        {
            MonitoredItem item = uAClient.AddMonitoredItem(_Subscription, tag.GetNodeId(), tag.Name, tag.SampleRate);

            _SubscriptionTags.Add(tag.ServerId, tag);
            _MonitorItem.Add(tag.ServerId, item);
            if (item.Created)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }