Пример #1
0
        /// <summary>
        /// 数据订阅事件
        /// </summary>
        /// <param name="dwTransid"></param>
        /// <param name="hGroup"></param>
        /// <param name="hrMasterquality"></param>
        /// <param name="hrMastererror"></param>
        /// <param name="dwCount"></param>
        /// <param name="phClientItems"></param>
        /// <param name="pvValues"></param>
        /// <param name="pwQualities"></param>
        /// <param name="pftTimeStamps"></param>
        /// <param name="pErrors"></param>
        public virtual void OnDataChange(Int32 dwTransid,
                                         Int32 hGroup,
                                         Int32 hrMasterquality,
                                         Int32 hrMastererror,
                                         Int32 dwCount,
                                         int[] phClientItems,
                                         object[] pvValues,
                                         short[] pwQualities,
                                         OpcRcw.Da.FILETIME[] pftTimeStamps,
                                         int[] pErrors)

        {
            var e = new OpcDaCustomAsyncEventArgs
            {
                GroupHandle       = hGroup,
                Count             = dwCount,
                Errors            = pErrors,
                Values            = pvValues,
                ClientItemsHandle = phClientItems
            };

            if (OnDataChanged != null)
            {
                OnDataChanged(this, e);
            }
        }
Пример #2
0
 /// <summary>
 /// 异步读取数据完成事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void ReadCompleted(object sender, OpcDaCustomAsyncEventArgs e)
 {
     if (OnReadCompleted != null)
     {
         OnReadCompleted(this, e);
     }
 }
Пример #3
0
        /// <summary>
        /// 显示数据
        /// </summary>
        /// <param name="e"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        public static object ShowValue(OpcDaCustomAsyncEventArgs e, int index)
        {
            object returnValue = null;

            if (e.ClientItemsHandle != null)
            {
                returnValue = e.Values[e.ClientItemsHandle.First(s => s == index) - 1];
            }
            return(returnValue);
        }
Пример #4
0
 /// <summary>
 /// 写入数据完成事件
 /// </summary>
 /// <param name="dwTransid"></param>
 /// <param name="hGroup"></param>
 /// <param name="hrMastererr"></param>
 /// <param name="dwCount"></param>
 /// <param name="pClienthandles"></param>
 /// <param name="pErrors"></param>
 public virtual void OnWriteComplete(Int32 dwTransid,
                                     Int32 hGroup,
                                     Int32 hrMastererr,
                                     Int32 dwCount,
                                     int[] pClienthandles,
                                     int[] pErrors)
 {
     if (OnWriteCompleted != null)
     {
         var e = new OpcDaCustomAsyncEventArgs
         {
             Errors = pErrors
         };
         if (OnWriteCompleted != null)
         {
             OnWriteCompleted(this, e);
         }
     }
 }