From 7e7e1c9dd1c39b2c38b0a758f3cc9faa0921b808 Mon Sep 17 00:00:00 2001
From: tangxu <76880903@qq.com>
Date: 星期四, 27 十月 2022 15:20:55 +0800
Subject: [PATCH] 添加自动关闭

---
 Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs       |  127 +++++++++++++--
 /dev/null                                                                |  109 -------------
 Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs     |   14 -
 Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs       |    4 
 Untity/IStation.Untity/转换/BitTransfer.cs                                 |   37 ++++
 Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs      |  153 +++++++++++++++++++
 Socket/IStation.DataDockingSocket4NT/paras/eShutDownInstructionStatus.cs |    2 
 Socket/IStation.DataDockingSocket4NT/paras/eStartUpInstructionStatus.cs  |    6 
 Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs           |   24 +-
 9 files changed, 315 insertions(+), 161 deletions(-)

diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs
index 36382c1..1ba5022 100644
--- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs
+++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/HandleHelper.cs
@@ -11,7 +11,11 @@
 {
     public class HandleHelper : IDataDockingSocket.IHandleHelper
     {
-   
+        static  IMonitorDataDockingSession _session;
+        public static IMonitorDataDockingSession GetLastSession()
+        {//鍏虫満鐢ㄧ殑鏄畾鏃跺櫒, 瀹氭椂鍣ㄩ噷闈㈤渶瑕佽幏鍙栨渶杩戠殑涓�娆¢摼鎺�
+            return _session;
+        }
 
 
         /// <summary>
@@ -53,7 +57,7 @@
         /// </summary>
         public void HandleHeartbeat(IMonitorDataDockingSession session)
         {
-
+            _session = session;
         }
 
         /// <summary>
@@ -75,9 +79,9 @@
             {
                 return;
             }
-
-            if (MonitorMsgHelper.IsCurrentMsg(byteMessage))
-            {
+            _session = session;
+            if (MonitorMsgHelper.IsNeedHandle(byteMessage))
+            {//鐩戞帶鎸囦护
                 var receList = MonitorMsgHelper.HandleReceive(byteMessage);
                 if (receList == null || receList.Count == 0)
                     return;
@@ -94,14 +98,16 @@
                 return;//鎴愬姛灏辫繑鍥炴帀
             }
             //涓嶈鍔爀lse
-            if (ShunDownMsgHelper.InstructionStatus == eShutDownInstructionStatus.鍏虫満鏈烘寚浠ゅ彂閫�)
+            if (ShutDownMsgHelper.IsNeedHandle(byteMessage))
             {
-                ShunDownMsgHelper.HandleReceive(session,byteMessage);
+                if (ShutDownMsgHelper.HandleReceive(session, byteMessage))
+                    return;
             }
             //涓嶈鍔爀lse
-            if (StartUpMsgHelper.IsCurrentMsg(byteMessage))
+            if (StartUpMsgHelper.IsNeedHandle(byteMessage))
             {
-
+                if (StartUpMsgHelper.HandleReceive(session, byteMessage))
+                    return;
             }
 
         }
diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs
index 4345d87..ec2b205 100644
--- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs
+++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/MonitorMsgHelper.cs
@@ -15,11 +15,11 @@
     internal class MonitorMsgHelper
     {
         /// <summary>
-        /// 鏄惁鏄綋鍓峂SG
+        /// 鏄惁鏄綋鍓峂SG,琛ㄧず闇�瑕佸鐞�
         /// </summary>
         /// <param name="byteMessage"></param>
         /// <returns></returns>
-        public static bool IsCurrentMsg(byte[] byteMessage)
+        public static bool IsNeedHandle(byte[] byteMessage)
         {
             if (byteMessage[0] == 0x01 && byteMessage[1] == 0x03 && byteMessage[2] == 0x42)
             {
diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShunDownMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShunDownMsgHelper.cs
deleted file mode 100644
index 252a09e..0000000
--- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShunDownMsgHelper.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-锘縰sing IStation.DataDockingSocket.MsgHandle;
-using IStation.Untity;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace IStation.DataDockingSocket 
-{
-    internal class ShunDownMsgHelper
-    {
-        public static eShutDownInstructionStatus  InstructionStatus = eShutDownInstructionStatus.鏈彂閫�;
-        public static DateTime sendTime  ;
-        /// <summary>
-        /// 寮�濮嬪叧鏈�
-        /// </summary>
-        /// <param name="session"></param>
-        /// <returns></returns>
-        public static bool StartJob(Model.IMonitorDataDockingSession session)
-        {
-            if (session != null)
-            {
-                NtLogHelper.Error($"鍏虫満 session:Close");
-                return false;
-            }
-
-            if (session.IsConnected)
-            {
-                byte[] bts = GetControlMsg();
-
-                session.Send(bts, 0, bts.Length);
-                InstructionStatus = eShutDownInstructionStatus.鍏虫満鏈烘寚浠ゅ彂閫�;
-                sendTime = DateTime.Now;
-                NtLogHelper.Debug("鍏虫満鎸囦护鍙戦��:" + session.SessionName + ":" + BitTransfer.ToString(bts) + ", 鍙戦�佷竴鏉¤姹傛帶鍒舵寚浠�");
-
-                return true;
-            }
-            else
-            {
-                NtLogHelper.Error($"鍏虫満鏃� session:Not connected");
-                return false;
-            }
-
-        }
-
-
-        /// <summary>
-        /// 鏄惁鏄帶鍒舵寚浠�
-        /// </summary>
-        /// <param name="byteMessage"></param>
-        /// <returns></returns>
-        public static bool IsControlMsg(byte[] byteMessage)
-        {
-  
-      
-            return false;
-        }
-
-        /// <summary>
-        /// 鑾峰彇鎺у埗鎸囦护(寮�鏈�)
-        /// </summary>
-        /// <returns></returns>
-        public static byte[] GetControlMsg ()
-        {
-           // var appParas = AppParasHelper.GetInstance();
-           // if (appParas == null || appParas.InstructionStartUp == null || appParas.InstructionStartUp.Content == null)
-            {
-                return BitTransfer.FromString("01-06-00-10-00-01-49-CF");
-            }
-          //  return BitTransfer.FromString(appParas.InstructionStartUp.Content);
-        }
-
-        /// <summary>
-        /// 璇诲彇杩斿洖娑堟伅 
-        /// </summary>
-        /// <param name="byteMessage"></param>
-        public static void HandleReceive(Model.IMonitorDataDockingSession session,byte[] byteMessage)
-        {
-            if (InstructionStatus == eShutDownInstructionStatus.鏈彂閫�)
-                return;
-            if (InstructionStatus == eShutDownInstructionStatus.鍏虫満鏈烘寚浠ゅ彂閫�)
-            {
-                if (byteMessage.Length == 8)
-                {
-                    if (byteMessage[0] == 0x01 && byteMessage[1] == 0x06 && byteMessage[2] == 0x00
-        && byteMessage[3] == 0x10 && byteMessage[4] == 0x00 && byteMessage[5] == 0x01
-        && byteMessage[6] == 0x49 && byteMessage[7] == 0xCF)
-                    {//01-06-00-0F-00-01-78-09
-                        InstructionStatus = eShutDownInstructionStatus.鏈彂閫�;
-
-                        NtLogHelper.Debug("鍏虫満鎸囦护杩斿洖:" + BitTransfer.ToString(byteMessage)  );
-
-                        return;
-                    }
-                }
-                //杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓�
-                if((DateTime.Now- sendTime).TotalSeconds > 3)
-                {
-                    StartJob(session);
-                }
-               
-            }
-    
-          
-        }
-       
-    }
-}
diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs
new file mode 100644
index 0000000..4fb0a0f
--- /dev/null
+++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/ShutDownMsgHelper.cs
@@ -0,0 +1,153 @@
+锘縰sing IStation.DataDockingSocket.MsgHandle;
+using IStation.Untity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IStation.DataDockingSocket 
+{
+    internal class ShutDownMsgHelper
+    {
+        public static eShutDownInstructionStatus  InstructionStatus = eShutDownInstructionStatus.鏈彂閫�;
+        public static DateTime _lastSendTime  ;
+        /// <summary>
+        /// 寮�濮嬪叧鏈�
+        /// </summary>
+        /// <param name="session"></param>
+        /// <returns></returns>
+        public static bool StartJob(Model.IMonitorDataDockingSession session)
+        {
+            if (session != null)
+            {
+                NtLogHelper.Error($"鍏虫満 session:Close");
+                return false;
+            }
+
+            if (!session.IsConnected)
+            {
+                NtLogHelper.Error($"鍏虫満鏃� session:Not connected");
+                return false;
+            }
+
+            byte[] bts = GetControlMsg();
+
+            session.Send(bts, 0, bts.Length);
+            InstructionStatus = eShutDownInstructionStatus.鍏虫満鎸囦护鍙戦��;
+            _lastSendTime = DateTime.Now;
+
+
+
+            NtLogHelper.Debug("鍏虫満鎸囦护鍙戦��:" + session.SessionName + ":" + BitTransfer.ToString(bts)  );
+
+            return true;
+        }
+
+        /// <summary>
+        /// 鑷姩鍏抽棴
+        /// </summary>
+        static System.Timers.Timer _timeAutoClose;
+        public static void StartAutoClose(double second)
+        {
+            NtLogHelper.Info("寮�鍚嚜鍔ㄥ叧鏈烘ā寮� 鏃堕棿:" + second+"s");
+            _timeAutoClose = new System.Timers.Timer(10000 * second);//瀹炰緥鍖朤imer绫伙紝璁剧疆闂撮殧鏃堕棿涓�10000姣锛�
+            _timeAutoClose.Elapsed += new System.Timers.ElapsedEventHandler(ExecuteAutoClose);//鍒拌揪鏃堕棿鐨勬椂鍊欐墽琛屼簨浠讹紱
+            _timeAutoClose.AutoReset = false;//璁剧疆鏄墽琛屼竴娆★紙false锛夎繕鏄竴鐩存墽琛�(true)锛�
+            _timeAutoClose.Enabled = true;//鏄惁鎵цSystem.Timers.Timer.Elapsed浜嬩欢锛�
+            _timeAutoClose.Start(); //鍚姩瀹氭椂鍣�
+        }
+        private static void ExecuteAutoClose(object source, System.Timers.ElapsedEventArgs e)
+        {
+            if (_timeAutoClose == null)
+                return;
+
+            _timeAutoClose.Stop(); //鍏堝叧闂畾鏃跺櫒
+            _timeAutoClose = null;
+            //瑕佹墽琛岀殑涓氬姟浠g爜
+            NtLogHelper.Info("姝e湪鑷姩鍏虫満...." );
+            ShutDownMsgHelper.StartJob(HandleHelper.GetLastSession());
+
+            // t.Start(); //鎵ц瀹屾瘯鍚庡啀寮�鍚櫒
+        }
+        /// <summary>
+        /// 鏄惁鏄帶鍒舵寚浠�
+        /// </summary>
+        /// <param name="byteMessage"></param>
+        /// <returns></returns>
+        public static bool IsControlMsg(byte[] byteMessage)
+        {  
+            return false;
+        }
+
+        /// <summary>
+        /// 鍏虫満鎸囦护
+        /// </summary>
+        static string ControlMsg = "01-06-00-10-00-01-49-CF";
+
+        /// <summary>
+        /// 鑾峰彇鎺у埗鎸囦护(鍏虫満鎸囦护)
+        /// </summary>
+        /// <returns></returns>
+        public static byte[] GetControlMsg()
+        {
+            // var appParas = AppParasHelper.GetInstance();
+            // if (appParas == null || appParas.InstructionStartUp == null || appParas.InstructionStartUp.Content == null)
+            {
+                return BitTransfer.FromString(ControlMsg);
+            }
+            //  return BitTransfer.FromString(appParas.InstructionStartUp.Content);
+        }
+
+        /// <summary>
+        /// 鏄惁闇�瑕佸綋鍓嶇被杩涜澶勭悊
+        /// </summary>
+        /// <param name="byteMessage"></param>
+        /// <returns></returns>
+        public static bool IsNeedHandle(byte[] byteMessage)
+        {
+            if (InstructionStatus == eShutDownInstructionStatus.鍏虫満鎸囦护鍙戦��)
+                return true ;
+                       
+            return false;
+        }
+        /// <summary>
+        /// 璇诲彇杩斿洖娑堟伅 澶勭悊鎴愬姛杩斿洖鎴愬姛, 涓嶆垚鍔熸垨鑰呬笉闇�瑕佸鐞嗚繑鍥瀎alse
+        /// </summary>
+        /// <param name="byteMessage"></param>
+        public static bool HandleReceive(Model.IMonitorDataDockingSession session,byte[] byteMessage)
+        {
+            if (InstructionStatus == eShutDownInstructionStatus.鏈彂閫�)
+                return false ;
+            if (InstructionStatus == eShutDownInstructionStatus.鍏虫満鎸囦护鍙戦��)
+            {
+                if (byteMessage.Length >= ControlMsg.Length)
+                {
+                    string strMessage = BitConverter.ToString(byteMessage, 0, byteMessage.Length);
+                    if (strMessage == ControlMsg)
+                    {
+                        InstructionStatus = eShutDownInstructionStatus.鏈彂閫�;
+
+                        NtLogHelper.Debug("鍏虫満鎸囦护杩斿洖:" + BitTransfer.ToString(byteMessage)  );
+
+                        if(_timeAutoClose != null)
+                        {
+                            _timeAutoClose.Stop(); //鍏堝叧闂畾鏃跺櫒
+                            _timeAutoClose = null;
+                        }
+  
+                        return true ;
+                    }
+                }
+                //杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓�
+                if((DateTime.Now- _lastSendTime).TotalSeconds > 3)
+                {
+                    StartJob(session);                
+                }          
+            }
+
+            return false;
+        }
+       
+    }
+}
diff --git a/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs b/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs
index 68b2fc7..fd927e0 100644
--- a/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs
+++ b/Socket/IStation.DataDockingSocket4NT/MsgHandle/StartUpMsgHelper.cs
@@ -1,69 +1,150 @@
 锘縰sing IStation.DataDockingSocket.MsgHandle;
+using IStation.Model;
 using IStation.Untity;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static System.Collections.Specialized.BitVector32;
 
 namespace IStation.DataDockingSocket 
 {
     internal class StartUpMsgHelper
     {
-        public static eStartUpInstructionStatus ShutUpInstructionStatus = eStartUpInstructionStatus.鏈彂閫�;
+        public static eStartUpInstructionStatus InstructionStatus = eStartUpInstructionStatus.鏈彂閫�;
+        public static DateTime _lastHzSendTime;
+        public static DateTime _lastOpenSendTime;
+        public static MonitorTestControlParas.StartContext _lastParas = null;
 
         /// <summary>
         /// 寮�鏈�
         /// </summary>
         /// <param name="session"></param>
         /// <returns></returns>
-        public static bool StartJob(Model.IMonitorDataDockingSession session)
+        public static bool StartJob(Model.IMonitorDataDockingSession session, MonitorTestControlParas.StartContext paras)
         {
             if (session != null)
             {
                 NtLogHelper.Error($"寮�鏈� session:Close");
                 return false;
             }
-
-            if (session.IsConnected)
+            if(paras == null)
             {
-                byte[] bts = GetControlMsg寮�鏈�();
-
-                session.Send(bts, 0, bts.Length);
-                ShutUpInstructionStatus = eStartUpInstructionStatus.璋冮鎸囦护鍙戦��;
-                NtLogHelper.Info("寮�鏈�" + session.SessionName + ":" + BitTransfer.ToString(bts) + ", 鍙戦�佷竴鏉¤姹傛帶鍒舵寚浠�");
-
-                return true;
+                NtLogHelper.Error($"寮�鏈哄弬鏁颁负绌�");
+                return false;
             }
-            else
+
+            if (!session.IsConnected)
             {
                 NtLogHelper.Error($"寮�鏈烘椂 session:Not connected");
                 return false;
             }
+            if (paras.HZ <= 10)
+            {
+                NtLogHelper.Error($"寮�鏈烘椂 璁剧疆鐨勮皟棰戦鐜囪繃浣�!");
+                return false;
+            }
+            _lastParas = paras;
 
+            //switch (context.OperatingMode)
+            //{
+            //    case Model.MonitorTestControlParas.eOperatingMode.Timing:
+            //        break;
+            //    case Model.MonitorTestControlParas.eOperatingMode.ConstantFlow:
+            //        break;
+            //    default:
+            //        break;
+            //}
+
+            byte[] bts = GetControlMsg璋冮(paras.HZ);
+
+
+            session.Send(bts, 0, bts.Length);
+            InstructionStatus = eStartUpInstructionStatus.璋冮鎸囦护鍙戦��;
+            _lastHzSendTime = DateTime.Now;
+
+            NtLogHelper.Info("寮�鏈烘寚浠�: 璋冮 " + BitTransfer.ToString(bts) + ", HZ:"+ paras.HZ);
+
+            return true;
         }
 
-
         /// <summary>
-        /// 
+        /// 鏄惁闇�瑕佸綋鍓嶇被杩涜澶勭悊
         /// </summary>
         /// <param name="byteMessage"></param>
         /// <returns></returns>
-        public static bool IsCurrentMsg(byte[] byteMessage)
+        public static bool IsNeedHandle(byte[] byteMessage)
         {
-            if(byteMessage.Length == 8)
+            if(InstructionStatus != eStartUpInstructionStatus.鏈彂閫�)
+                return true;
+            else
+                return false;
+        }
+        /// <summary>
+        /// 鍏虫満鎸囦护
+        /// </summary>
+        static string ControlMsgOpen = "01-06-00-0F-00-01-78-09";
+        /// <summary>
+        /// 璇诲彇杩斿洖娑堟伅 澶勭悊鎴愬姛杩斿洖鎴愬姛, 涓嶆垚鍔熸垨鑰呬笉闇�瑕佸鐞嗚繑鍥瀎alse
+        /// </summary>
+        /// <param name="byteMessage"></param>
+        public static bool HandleReceive(Model.IMonitorDataDockingSession session, byte[] byteMessage)
+        {
+            if (InstructionStatus == eStartUpInstructionStatus.鏈彂閫�)
+                return false;
+            if (InstructionStatus == eStartUpInstructionStatus.寮�鏈烘寚浠ゅ彂閫�)
             {
-                if (byteMessage[0] == 0x01 && byteMessage[1] == 0x06 && byteMessage[2] == 0x00
-    && byteMessage[3] == 0x0F && byteMessage[4] == 0x00 && byteMessage[5] == 0x01
-    && byteMessage[6] == 0x78 && byteMessage[7] == 0x09)
-                {//01-06-00-0F-00-01-78-09
-                    return true;
+                if (byteMessage.Length >= ControlMsgOpen.Length)
+                {
+                    string strMessage = BitConverter.ToString(byteMessage, 0, byteMessage.Length);
+                    if (strMessage == ControlMsgOpen)
+                    {//01-06-00-0F-00-01-78-09
+                        InstructionStatus = eStartUpInstructionStatus.鏈彂閫�;
+
+                        NtLogHelper.Debug("寮�鏈烘寚浠よ繑鍥�:" + BitTransfer.ToString(byteMessage));
+                        //寮�鍚嚜鍔ㄥ叧闂�
+                        ShutDownMsgHelper.StartAutoClose(_lastParas.OperatingValue);
+                        return true;
+                    }
+                }
+                //杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓�
+                if ((DateTime.Now - _lastOpenSendTime).TotalSeconds > 5)
+                {
+                    SendOpenMsg(session);
                 }
             }
-      
+            if (InstructionStatus == eStartUpInstructionStatus.璋冮鎸囦护鍙戦��)
+            {
+                //闇�瑕佸垽鏂槸鍚︽槸璋冮鎸囦护:浠ュ悗鍐嶈ˉ鍏�
+                {
+                    SendOpenMsg(session);
+                }
+
+
+                //杩斿洖澶辫触, 鍐嶅彂閫佷竴娆″啀纭涓�涓�
+                if ((DateTime.Now - _lastHzSendTime).TotalSeconds > 5)
+                {
+                    StartJob(session, _lastParas);
+                }
+            }
+
             return false;
         }
 
+        private static  void SendOpenMsg(Model.IMonitorDataDockingSession session)
+        {
+            byte[] bts = GetControlMsg寮�鏈�();
+
+
+            session.Send(bts, 0, bts.Length);
+            InstructionStatus = eStartUpInstructionStatus.寮�鏈烘寚浠ゅ彂閫�;
+            _lastOpenSendTime = DateTime.Now;
+
+            NtLogHelper.Info("寮�鏈烘寚浠�: 寮�鏈� " + BitTransfer.ToString(bts) + ",  ");
+        }
+
+ 
         /// <summary>
         /// 鑾峰彇鎺у埗鎸囦护(寮�鏈�)
         /// </summary>
@@ -73,7 +154,7 @@
             //var appParas = AppParasHelper.GetInstance();
             //if (appParas == null || appParas.InstructionStartUp == null || appParas.InstructionStartUp.Content == null)
             {
-                return BitTransfer.FromString("01-06-00-0F-00-01-78-09");
+                return BitTransfer.FromString(ControlMsgOpen);
             }
             //return BitTransfer.FromString(appParas.InstructionStartUp.Content);
         }
diff --git a/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs b/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs
index 01c628b..4eede9d 100644
--- a/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs
+++ b/Socket/IStation.DataDockingSocket4NT/control/SendControlJobHelper.cs
@@ -56,7 +56,7 @@
                         {
                             case Model.MonitorTestControlParas.eControlType.Stop:
                                 {
-                                    ShunDownMsgHelper.StartJob(session);
+                                    ShutDownMsgHelper.StartJob(session);
                                 }
                                 break;
                             case Model.MonitorTestControlParas.eControlType.Start:
@@ -66,16 +66,8 @@
                                     var context = Model.MonitorTestControlParas.StartContext.ToModel(paras.Context);
                                     if (context == null)
                                         return default;
-                                    switch (context.OperatingMode)
-                                    {
-                                        case Model.MonitorTestControlParas.eOperatingMode.Timing:
-                                            break;
-                                        case Model.MonitorTestControlParas.eOperatingMode.ConstantFlow:
-                                            break;
-                                        default:
-                                            break;
-                                    }
-                                    // StartUpMsgHelper.StartJob(session);
+
+                                    StartUpMsgHelper.StartJob(session, context);
                                 }
                                 break;
                             default:
diff --git a/Socket/IStation.DataDockingSocket4NT/paras/eShutDownInstructionStatus.cs b/Socket/IStation.DataDockingSocket4NT/paras/eShutDownInstructionStatus.cs
index 11d9caa..bb68efe 100644
--- a/Socket/IStation.DataDockingSocket4NT/paras/eShutDownInstructionStatus.cs
+++ b/Socket/IStation.DataDockingSocket4NT/paras/eShutDownInstructionStatus.cs
@@ -9,7 +9,7 @@
     public enum eShutDownInstructionStatus
     {
         鏈彂閫� = 0, 
-        鍏虫満鏈烘寚浠ゅ彂閫� = 3,
+        鍏虫満鎸囦护鍙戦�� = 3,
         //鍏虫満鎸囦护杩斿洖 = 4
     }
 }
diff --git a/Socket/IStation.DataDockingSocket4NT/paras/eStartUpInstructionStatus.cs b/Socket/IStation.DataDockingSocket4NT/paras/eStartUpInstructionStatus.cs
index 30656dc..132b019 100644
--- a/Socket/IStation.DataDockingSocket4NT/paras/eStartUpInstructionStatus.cs
+++ b/Socket/IStation.DataDockingSocket4NT/paras/eStartUpInstructionStatus.cs
@@ -9,9 +9,7 @@
     public enum eStartUpInstructionStatus
     {
         鏈彂閫� = 0,
-        璋冮鎸囦护鍙戦�� = 1,
-        璋冮鎸囦护杩斿洖 = 2,
-        寮�鏈烘寚浠ゅ彂閫� = 3,
-        寮�鏈烘寚浠よ繑鍥� = 4
+        璋冮鎸囦护鍙戦�� = 1, 
+        寮�鏈烘寚浠ゅ彂閫� = 3, 
     }
 }
diff --git "a/Untity/IStation.Untity/\350\275\254\346\215\242/BitTransfer.cs" "b/Untity/IStation.Untity/\350\275\254\346\215\242/BitTransfer.cs"
index 77efc93..1eac0a1 100644
--- "a/Untity/IStation.Untity/\350\275\254\346\215\242/BitTransfer.cs"
+++ "b/Untity/IStation.Untity/\350\275\254\346\215\242/BitTransfer.cs"
@@ -26,14 +26,47 @@
         {
             try
             {
-                string[] strSplit = str.Split(spliter);
-                return strSplit.Select(x => byte.Parse(x, System.Globalization.NumberStyles.AllowHexSpecifier)).ToArray();
+               
+                    string[] strSplit = str.Split(spliter);
+                    return strSplit.Select(x => byte.Parse(x, System.Globalization.NumberStyles.AllowHexSpecifier)).ToArray();
+      
             }
             catch
             {
                 return default;
             }
         }
+        /// <summary>
+        /// 瀛楃涓茶浆16杩涘埗瀛楃2
+        /// </summary>
+        /// <param name="content">瀛楃涓�</param>
+        /// <param name="encode">缂栫爜鏍煎紡</param>
+        /// <returns></returns>
+        private List<byte> FromString(string content, out string error_info)
+        {
+            //鍘绘帀绌烘牸
+            string[] arr = content.Split(' ');
+            if (arr.Length < 3)
+            {
+                arr = content.Split('-');
+                if (arr.Length < 3)
+                {
+                    error_info = "瀛楃鏃犳硶瑙f瀽";
+                    return null;
+                }
+            }
+            List<byte> result = new List<byte>();
+            for (int i = 0; i < arr.Length; i++)
+            {
+                if (string.IsNullOrWhiteSpace(arr[i]))
+                    continue;
+
+                var dddd = Convert.ToByte(arr[i], 16);
+                result.Add(dddd);
+            }
+            error_info = null;
+            return result;
+        }
 
 
     }

--
Gitblit v1.9.3