From b83a01eec16b236d099dcea3e7a5051c8cae9c6c Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期五, 03 七月 2020 10:48:37 +0800
Subject: [PATCH] Merge branch 'master' of http://gitblit.broconcentric.com:8088/r/M071

---
 src/Bro.Device.GTSCard/GTSCardDriver.cs |   37 ++++++++++++++++++++++---------------
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/Bro.Device.GTSCard/GTSCardDriver.cs b/src/Bro.Device.GTSCard/GTSCardDriver.cs
index 60e54b3..2cb1a6d 100644
--- a/src/Bro.Device.GTSCard/GTSCardDriver.cs
+++ b/src/Bro.Device.GTSCard/GTSCardDriver.cs
@@ -18,12 +18,12 @@
 namespace Bro.Device.GTSCard
 {
     [Device("GTSCard", "鍥洪珮鏉垮崱", EnumHelper.DeviceAttributeType.Device)]
-    public class GTSCardDriver : DeviceBase, IMonitor, IMotion
+    public class GTSCardDriver : MotionCardBase
     {
         // 寮傚父浜嬩欢
         public Action<Exception> OnExceptionRaised;
 
-        public GTSCardInitialConfig IConfig
+        public GTSCardInitialConfig IIConfig
         {
             get
             {
@@ -42,7 +42,7 @@
             _isResetting = isReset;
         }
 
-        public List<AxisInfo> GetCurrentAxisInfo(params string[] axisName)
+        public override List<AxisInfo> GetCurrentAxisInfo(params string[] axisName)
         {
             throw new NotImplementedException();
         }
@@ -74,6 +74,14 @@
             AllMoveStop();
             AllAxisOff();
         }
+
+        public override ResponseMessage Run(IOperationConfig config)
+        {
+            ResponseMessage responseMessage = new ResponseMessage();
+
+
+            return responseMessage;
+        }
         #endregion
 
         #region GTSCard
@@ -93,6 +101,7 @@
                 throw new Exception("鏉垮崱杞藉叆閰嶇疆鏂囦欢寮傚父锛岄敊璇爜锛�" + res);
             }
         }
+
 
         public bool AllAxisOn()
         {
@@ -153,7 +162,7 @@
         /// </summary>
         /// <param name="item">杩愬姩瀵硅薄</param>
         /// <returns>杩愬姩鎺у埗+鍋滄鍒ゆ柇</returns>
-        public ResponseMessage MoveToPoint(IOperationConfig opConfig)
+        public override ResponseMessage MoveToPoint(IOperationConfig opConfig)
         {
             bool resultOK = false;
             var gtsOperationConfig = opConfig as GTSCardOperationConfig;
@@ -680,8 +689,6 @@
         #endregion
 
         #region IMonitor
-        public event Action<DateTime, string, IDevice, IMonitorSet> OnMonitorInvoke;
-        public event Action<DateTime, IDevice, IWarningSet> OnMonitorAlarm;
 
         public List<IOItem> MonitorValues { get; set; } = new List<IOItem>();
 
@@ -703,13 +710,13 @@
                 {
                     IONum = index,
                     Value = (inValue & (1 << index)) == 0 ? 1 : 0,
-                    IOType = IOType.In
+                    IOType = IOType.INPUT
                 };
                 IOItem outItem = new IOItem()
                 {
                     IONum = index,
                     Value = (outValue & (1 << index)) == 0 ? 1 : 0,
-                    IOType = IOType.Out
+                    IOType = IOType.OUTPUT
                 };
                 result.Add(inItem);
                 result.Add(outItem);
@@ -718,7 +725,7 @@
             return result;
         }
 
-        public async void Monitor()
+        public async override void Monitor()
         {
             await Task.Run(() =>
             {
@@ -736,8 +743,8 @@
                         sw.Start();
                         if (MonitorValues.Count == newValues.Count)
                         {
-                            var tempNew = new List<IOItem>(newValues);//clone
-                            var tempOld = new List<IOItem>(MonitorValues);
+                            var tempNew = newValues.DeepSerializeClone();//clone
+                            var tempOld = MonitorValues.DeepSerializeClone();
                             MonitorCheckAndInvoke(tempNew, tempOld);
                         }
                         MonitorValues = new List<IOItem>(newValues);
@@ -780,7 +787,7 @@
             foreach (var replyIOData in monitorSet.ReplyIODatas)
             {
                 //鍐欏叆IO杈撳嚭
-                if (replyIOData.IOType == IOType.Out)
+                if (replyIOData.IOType == IOType.OUTPUT)
                 {
                     GTSCardAPI.GT_SetDoBit((short)IConfig.CardNum, GTSCardAPI.MC_GPI, (short)replyIOData.IONum, (short)replyIOData.Value);
                 }
@@ -805,7 +812,7 @@
                     warningSet.TriggerTime = DateTime.Now;
                     warningSet.WarningDescription = $"璀︽姤锛歿warningSet.Name}-瑙﹀彂绱㈠紩锛歿warningSet.TriggerIndex}-{warningSet.WarningIOModel.GetEnumDescription()}:{warningSet.WarningCode}";
                     SaveAlarmCSVAsync(DateTime.Now, this.Name, warningSet);
-                    OnMonitorAlarm?.BeginInvoke(DateTime.Now, this, warningSet, null, null);
+                    ExcuteMonitorAlarm(DateTime.Now, this, warningSet);
                 }
             });
             #endregion
@@ -836,14 +843,14 @@
                         //    return tempNew[index].Value;
                         //}).ToList();
 
-                        OnMonitorInvoke?.BeginInvoke(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet, OnMethodInvoked, monitorSet);
+                        ExcuteMonitorInvok(DateTime.Now, monitorSet.InvokeDevice, this, monitorSet, OnMethodInvoked);
                     }
                 }
             });
             #endregion
         }
 
-        public void ResetAlarm()
+        public override void ResetAlarm()
         {
             int axis_sts;
             uint clk;

--
Gitblit v1.8.0