From 913c2f4f74d58617a9e23e63da0094295b722c8b Mon Sep 17 00:00:00 2001
From: C3204 <zhengyabo@lanpucloud.cn>
Date: 星期四, 08 一月 2026 13:18:51 +0800
Subject: [PATCH] 增加IO触发相机获取图像后自动触发对应的检测流程以及Log记录。

---
 LB_SmartVision/VisionForm.cs                          |   48 +++++++
 LB_VisionProcesses/Cameras/BaseCamera.cs              |    5 
 LB_VisionProcesses/Cameras/LBCameras/PHM6000Camera.cs |   30 +++++
 LB_VisionProcesses/Cameras/HRCameras/HRCamera.cs      |  257 +++++++++++++++++++++++++++++++++++-------
 4 files changed, 293 insertions(+), 47 deletions(-)

diff --git a/LB_SmartVision/VisionForm.cs b/LB_SmartVision/VisionForm.cs
index 98bf6a7..6a1c1d6 100644
--- a/LB_SmartVision/VisionForm.cs
+++ b/LB_SmartVision/VisionForm.cs
@@ -65,6 +65,7 @@
             Assembly_LB_VisionProcessesDll = Assembly.Load(Assembly_LB_VisionProcessesBytes);
 
             GlobalVar.dicCommunicators.DictionaryChanged += CommunicatorsChanged;
+            GlobalVar.dicCameras.DictionaryChanged += CamerasChanged;
             GlobalVar.dicProcesses.DictionaryChanged += ProcessRunBllChanged;
 
             //鏈�寮�濮嬪氨娓呯┖鎵�鏈塗ab椤�
@@ -238,7 +239,30 @@
 
         private void CommunicatorsChanged(object? sender, DictionaryChangedEventArgs<string, BaseCommunicator> e)
         {
-
+            try
+            {
+                switch (e.ChangeType)
+                {
+                    case DictionaryChangeType.Added:
+                        e.NewValue.TriggerRunMessageReceived += TriggerRunMessageReceived;
+                        LogInfo($"閫氳鍙{e.NewValue.CommunicatorName}]鍔犺浇瑙﹀彂閫氳", LogInfoType.INFO);
+                        e.NewValue.CommunicatorName = e.NewKey;
+                        break;
+                    case DictionaryChangeType.Renamed:
+                        string OldCommunicatorName = e.OldKey;
+                        string NewCommunicatorName = e.NewKey;
+                        LogInfo(string.Format("閲嶅懡鍚嶉�氳鍙e悕[{0}]淇敼涓篬{1}]", OldCommunicatorName, NewCommunicatorName), LogInfoType.INFO);
+                        e.NewValue.CommunicatorName = NewCommunicatorName;
+                        break;
+                    case DictionaryChangeType.Removed:
+                        if (e.OldValue != null && e.OldValue is BaseCommunicator)
+                            e.OldValue.Disconnect();
+                        e.OldValue.TriggerRunMessageReceived -= TriggerRunMessageReceived;
+                        LogInfo($"閫氳鍙{e.OldValue.CommunicatorName}]绉婚櫎瑙﹀彂閫氳", LogInfoType.INFO);
+                        break;
+                }
+            }
+            catch { }
         }
 
         private void LogInfo(string strLog, LogInfoType infoType)
@@ -525,6 +549,28 @@
             }
         }
 
+        private void CamerasChanged(object sender, DictionaryChangedEventArgs<string, BaseCamera> e)
+        {
+            try
+            {
+                switch (e.ChangeType)
+                {
+                    case DictionaryChangeType.Added:
+                        e.NewValue.TriggerRunMessageReceived += TriggerRunMessageReceived;
+                        LogInfo($"鐩告満[{e.NewValue.SN}]鍔犺浇瑙﹀彂閫氳", LogInfoType.INFO);
+                        e.NewValue.SN = e.NewKey;
+                        break;
+                    case DictionaryChangeType.Removed:
+                        if (e.OldValue != null && e.OldValue is BaseCommunicator)
+                            e.OldValue.CloseDevice();
+                        e.OldValue.TriggerRunMessageReceived -= TriggerRunMessageReceived;
+                        LogInfo($"鐩告満[{e.OldValue.SN}]绉婚櫎瑙﹀彂閫氳", LogInfoType.INFO);
+                        break;
+                }
+            }
+            catch { }
+        }
+
         private void VisionForm_Load(object sender, EventArgs e)
         {
             XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
diff --git a/LB_VisionProcesses/Cameras/BaseCamera.cs b/LB_VisionProcesses/Cameras/BaseCamera.cs
index 4f9d877..ccf0802 100644
--- a/LB_VisionProcesses/Cameras/BaseCamera.cs
+++ b/LB_VisionProcesses/Cameras/BaseCamera.cs
@@ -23,6 +23,11 @@
         /// 鐩告満鍚嶇О
         /// </summary>
         public string CameraName { get; set; } = string.Empty;
+
+        /// <summary>
+        /// 鐩告満纭Е鍙戣幏鍙栧浘鍍忚Е鍙戝搴旂殑妫�娴嬫祦绋�
+        /// </summary>
+        public Action<string, string> TriggerRunMessageReceived;
         public CameraBrand Brand { get; set; } = CameraBrand.UNSUPPORTED;
 
         public bool isGrabbing = false;
diff --git a/LB_VisionProcesses/Cameras/HRCameras/HRCamera.cs b/LB_VisionProcesses/Cameras/HRCameras/HRCamera.cs
index 48d15c7..31c56ed 100644
--- a/LB_VisionProcesses/Cameras/HRCameras/HRCamera.cs
+++ b/LB_VisionProcesses/Cameras/HRCameras/HRCamera.cs
@@ -1,4 +1,6 @@
-锘縰sing MVSDK_Net;
+锘縰sing HalconDotNet;
+using LB_SmartVisionCommon;
+using MVSDK_Net;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
@@ -26,6 +28,16 @@
         private Thread _callbackThread; // 鍥炶皟澶勭悊绾跨▼
         private List<IMVDefine.IMV_Frame> _frameList; // 鍥惧儚缂撳瓨鍒楄〃
         private readonly object _frameLock = new object(); // 甯х紦瀛橀攣
+        private IMVDefine.IMV_EPixelType type = IMVDefine.IMV_EPixelType.gvspPixelMono8;
+        private IMVDefine.IMV_PixelConvertParam stPixelConvertParam = new IMVDefine.IMV_PixelConvertParam();
+
+        HObject Hobj = new HObject();
+        IntPtr pTemp = IntPtr.Zero;
+        IntPtr pConvertDstBuffer = IntPtr.Zero;
+        int nConvertBufSize = 0;
+
+
+        private IMVDefine.IMV_FrameCallBack frameCallBack;
 
         // CopyMemory API澹版槑
         [System.Runtime.InteropServices.DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory")]
@@ -92,13 +104,15 @@
                 {
                     // 璁板綍鏃ュ織鎴栨姏鍑哄紓甯�
                     //throw new Exception($"鏋氫妇璁惧澶辫触锛岄敊璇爜锛歿result}");
-                    Debug.WriteLine("鏋氫妇璁惧澶辫触锛�");
+                    AsyncLogHelper.Error("鏋氫妇璁惧澶辫触锛�");
+                    System.Diagnostics.Debug.WriteLine("鏋氫妇璁惧澶辫触锛�");
                 }
             }
             catch (Exception ex)
             {
                 // 璁板綍閿欒鏃ュ織
                 System.Diagnostics.Debug.WriteLine($"鑾峰彇鐩告満鍒楄〃澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error($"鑾峰彇鐩告満鍒楄〃澶辫触锛歿ex.Message}");
                 throw;
             }
 
@@ -145,6 +159,7 @@
 
                 if (cameraIndex == -1)
                 {
+                    AsyncLogHelper.Error($"鏈壘鍒板簭鍒楀彿涓� {SN} 鐨勭浉鏈�");
                     throw new Exception($"鏈壘鍒板簭鍒楀彿涓� {SN} 鐨勭浉鏈�");
                 }
 
@@ -152,6 +167,7 @@
                 int result = _camera.IMV_CreateHandle(IMVDefine.IMV_ECreateHandleMode.modeByIndex, cameraIndex);
                 if (result != IMVDefine.IMV_OK)
                 {
+                    AsyncLogHelper.Error($"鍒涘缓璁惧鍙ユ焺澶辫触锛岄敊璇爜锛歿result}");
                     throw new Exception($"鍒涘缓璁惧鍙ユ焺澶辫触锛岄敊璇爜锛歿result}");
                 }
                 _handleCreated = true;
@@ -160,6 +176,7 @@
                 result = _camera.IMV_Open();
                 if (result != IMVDefine.IMV_OK)
                 {
+                    AsyncLogHelper.Error($"鎵撳紑鐩告満澶辫触锛岄敊璇爜锛歿result}");
                     throw new Exception($"鎵撳紑鐩告満澶辫触锛岄敊璇爜锛歿result}");
                 }
 
@@ -167,17 +184,121 @@
                 this.SN = SN;
                 isGrabbing = false;
 
-                // 璁剧疆缂撳瓨涓暟涓�8
-                _camera.IMV_SetBufferCount(8);
+                // 娉ㄥ唽鏁版嵁甯у洖璋冨嚱鏁�
+                // Register data frame callback function
+                frameCallBack = onGetFrame;
+                int res = _camera.IMV_AttachGrabbing(frameCallBack, IntPtr.Zero);
+                if (res != IMVDefine.IMV_OK)
+                {
+                    System.Diagnostics.Debug.WriteLine("Attach grabbing failed! ErrorCode:[{0}]", res);
+                    AsyncLogHelper.Error("Attach grabbing failed! ErrorCode:[{0}]" + res);
+                }
+                // 璁剧疆缂撳瓨涓暟涓�12
+                _camera.IMV_SetBufferCount(12);
 
                 return true;
             }
             catch (Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine($"鍒濆鍖栫浉鏈哄け璐ワ細{ex.Message}");
+                AsyncLogHelper.Error($"鍒濆鍖栫浉鏈哄け璐ワ細{ex.Message}");
                 return false;
             }
         }
+
+        // 鏁版嵁甯у洖璋冨嚱鏁�
+        // Data frame callback function
+        private void onGetFrame(ref IMVDefine.IMV_Frame frame, IntPtr pUser)
+        {
+            if (frame.frameHandle == IntPtr.Zero)
+            {
+                AsyncLogHelper.Info(SN + "frame is NULL");
+                return;
+            }
+            try
+            {
+                Bitmap bitmap = ConvertFrameToBitmap(frame);
+
+                // 閲婃斁甯ф暟鎹�
+                // release frame
+                _camera.IMV_ReleaseFrame(ref frame);
+                CallBackImg = (Bitmap)bitmap.Clone();
+                if (CallBackImg == null)
+                {
+                    return;
+                }
+                if (GetTriggerMode(out TriggerMode mode, out TriggerSource source))
+                {
+                    if (mode == TriggerMode.On && source != TriggerSource.Software)
+                        TriggerRunMessageReceived?.Invoke(SN, source.ToString());  // 瑙﹀彂杩愯浜嬩欢
+                }
+                bitmap.Dispose();
+            }
+            catch { }
+            AsyncLogHelper.Info(SN + "Get frame blockId = {0}" + frame.frameInfo.blockId);
+        }
+
+        /// <summary>
+        /// 鍥惧儚鏄惁涓篗ono鏍煎紡
+        /// </summary>
+        /// <param name="enType"></param>
+        /// <returns></returns>
+        private bool IsMonoPixelFormat(IMVDefine.IMV_EPixelType enType)
+        {
+            switch (enType)
+            {
+                case IMVDefine.IMV_EPixelType.gvspPixelMono8:
+                case IMVDefine.IMV_EPixelType.gvspPixelMono10:
+                case IMVDefine.IMV_EPixelType.gvspPixelMono10Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelMono12:
+                case IMVDefine.IMV_EPixelType.gvspPixelMono12Packed:
+                    return true;
+                default:
+                    return false;
+            }
+        }
+
+        /// <summary>
+        /// 鍥惧儚鏄惁涓哄僵鑹�
+        /// </summary>
+        /// <param name="enType"></param>
+        /// <returns></returns>
+        private bool IsColorPixelFormat(IMVDefine.IMV_EPixelType enType)
+        {
+            switch (enType)
+            {
+                case IMVDefine.IMV_EPixelType.gvspPixelRGB8:
+                case IMVDefine.IMV_EPixelType.gvspPixelBGR8:
+                case IMVDefine.IMV_EPixelType.gvspPixelRGBA8:
+                case IMVDefine.IMV_EPixelType.gvspPixelBGRA8:
+                case IMVDefine.IMV_EPixelType.gvspPixelYUV422_8:
+                case IMVDefine.IMV_EPixelType.gvspPixelYUV422_8_UYVY:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGR8:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayRG8:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGB8:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayBG8:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGB10:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGB10Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayBG10:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayBG10Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayRG10:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayRG10Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGR10:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGR10Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGB12:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGB12Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayBG12:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayBG12Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayRG12:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayRG12Packed:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGR12:
+                case IMVDefine.IMV_EPixelType.gvspPixelBayGR12Packed:
+                    return true;
+                default:
+                    return false;
+            }
+        }
+
 
         /// <summary>
         /// 鍏抽棴鐩告満璁惧
@@ -203,6 +324,7 @@
                     if (result != IMVDefine.IMV_OK)
                     {
                         System.Diagnostics.Debug.WriteLine($"鍏抽棴鐩告満澶辫触锛岄敊璇爜锛歿result}");
+                        AsyncLogHelper.Info(SN + $"鍏抽棴鐩告満澶辫触锛岄敊璇爜锛歿result}");
                     }
                 }
 
@@ -233,6 +355,7 @@
             catch (Exception ex)
             {
                 System.Diagnostics.Debug.WriteLine($"鍏抽棴鐩告満澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Info(SN + $"鍏抽棴鐩告満澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -251,7 +374,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 // 鍋滄鐜版湁閲囬泦
@@ -264,7 +388,8 @@
                 int result = _camera.IMV_StartGrabbing();
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"鍚姩閲囬泦澶辫触锛岄敊璇爜锛歿result}");
+                    AsyncLogHelper.Error(SN + $"鍚姩閲囬泦澶辫触锛岄敊璇爜锛歿result}");
+                    throw new Exception(SN + $"鍚姩閲囬泦澶辫触锛岄敊璇爜锛歿result}");
                 }
 
                 _isGrabbing = true;
@@ -280,7 +405,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鍚姩閲囬泦澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鍚姩閲囬泦澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鍚姩閲囬泦澶辫触锛歿ex.Message}");
                 _isGrabbing = false;
                 isGrabbing = false;
                 return false;
@@ -310,7 +436,8 @@
                 int result = _camera.IMV_StopGrabbing();
                 if (result != IMVDefine.IMV_OK)
                 {
-                    System.Diagnostics.Debug.WriteLine($"鍋滄閲囬泦澶辫触锛岄敊璇爜锛歿result}");
+                    System.Diagnostics.Debug.WriteLine(SN + $"鍋滄閲囬泦澶辫触锛岄敊璇爜锛歿result}");
+                    AsyncLogHelper.Info(SN + $"鍋滄閲囬泦澶辫触锛岄敊璇爜锛歿result}");
                 }
 
                 _isGrabbing = false;
@@ -331,7 +458,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鍋滄閲囬泦澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鍋滄閲囬泦澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鍋滄閲囬泦澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -346,7 +474,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 int result = _camera.IMV_ExecuteCommandFeature("TriggerSoftware");
@@ -354,7 +483,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"杞Е鍙戝け璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"杞Е鍙戝け璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"杞Е鍙戝け璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -375,7 +505,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 // 璁剧疆瑙﹀彂妯″紡
@@ -383,7 +514,8 @@
                 int result = _camera.IMV_SetEnumFeatureSymbol("TriggerMode", triggerMode);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"璁剧疆瑙﹀彂妯″紡澶辫触锛岄敊璇爜锛歿result}");
+                    AsyncLogHelper.Error(SN + $"璁剧疆瑙﹀彂妯″紡澶辫触锛岄敊璇爜锛歿result}");
+                    throw new Exception(SN + $"璁剧疆瑙﹀彂妯″紡澶辫触锛岄敊璇爜锛歿result}");
                 }
 
                 // 璁剧疆瑙﹀彂婧�
@@ -393,7 +525,8 @@
                     result = _camera.IMV_SetEnumFeatureSymbol("TriggerSource", triggerSource);
                     if (result != IMVDefine.IMV_OK)
                     {
-                        throw new Exception($"璁剧疆瑙﹀彂婧愬け璐ワ紝閿欒鐮侊細{result}");
+                        AsyncLogHelper.Error(SN + $"璁剧疆瑙﹀彂婧愬け璐ワ紝閿欒鐮侊細{result}");
+                        throw new Exception(SN + $"璁剧疆瑙﹀彂婧愬け璐ワ紝閿欒鐮侊細{result}");
                     }
                 }
 
@@ -401,7 +534,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆瑙﹀彂妯″紡澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆瑙﹀彂妯″紡澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆瑙﹀彂妯″紡澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -421,7 +555,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 // 鑾峰彇瑙﹀彂妯″紡
@@ -444,7 +579,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇瑙﹀彂妯″紡澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇瑙﹀彂妯″紡澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇瑙﹀彂妯″紡澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -460,7 +596,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 // 楠岃瘉鏇濆厜鏃堕棿鑼冨洿
@@ -468,32 +605,37 @@
                 int result = _camera.IMV_GetDoubleFeatureMin("ExposureTime", ref minExp);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"鑾峰彇鏇濆厜鏃堕棿鏈�灏忓�煎け璐ワ紝閿欒鐮侊細{result}");
+                    AsyncLogHelper.Error(SN + $"鑾峰彇鏇濆厜鏃堕棿鏈�灏忓�煎け璐ワ紝閿欒鐮侊細{result}");
+                    throw new Exception(SN + $"鑾峰彇鏇濆厜鏃堕棿鏈�灏忓�煎け璐ワ紝閿欒鐮侊細{result}");
                 }
 
                 result = _camera.IMV_GetDoubleFeatureMax("ExposureTime", ref maxExp);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"鑾峰彇鏇濆厜鏃堕棿鏈�澶у�煎け璐ワ紝閿欒鐮侊細{result}");
+                    AsyncLogHelper.Error(SN + $"鑾峰彇鏇濆厜鏃堕棿鏈�澶у�煎け璐ワ紝閿欒鐮侊細{result}");
+                    throw new Exception(SN + $"鑾峰彇鏇濆厜鏃堕棿鏈�澶у�煎け璐ワ紝閿欒鐮侊細{result}");
                 }
 
                 if (value < minExp || value > maxExp)
                 {
-                    throw new Exception($"鏇濆厜鏃堕棿瓒呭嚭鑼冨洿锛屾湁鏁堣寖鍥达細{minExp} - {maxExp}");
+                    AsyncLogHelper.Error(SN + $"鏇濆厜鏃堕棿瓒呭嚭鑼冨洿锛屾湁鏁堣寖鍥达細{minExp} - {maxExp}");
+                    throw new Exception(SN + $"鏇濆厜鏃堕棿瓒呭嚭鑼冨洿锛屾湁鏁堣寖鍥达細{minExp} - {maxExp}");
                 }
 
                 // 璁剧疆鏇濆厜鏃堕棿
                 result = _camera.IMV_SetDoubleFeatureValue("ExposureTime", value);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"璁剧疆鏇濆厜鏃堕棿澶辫触锛岄敊璇爜锛歿result}");
+                    AsyncLogHelper.Error(SN + $"璁剧疆鏇濆厜鏃堕棿澶辫触锛岄敊璇爜锛歿result}");
+                    throw new Exception(SN + $"璁剧疆鏇濆厜鏃堕棿澶辫触锛岄敊璇爜锛歿result}");
                 }
 
                 return true;
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆鏇濆厜鏃堕棿澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆鏇濆厜鏃堕棿澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆鏇濆厜鏃堕棿澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -511,7 +653,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 int result = _camera.IMV_GetDoubleFeatureValue("ExposureTime", ref value);
@@ -519,7 +662,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇鏇濆厜鏃堕棿澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇鏇濆厜鏃堕棿澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇鏇濆厜鏃堕棿澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -535,7 +679,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 string gainFeature = _camera.IMV_FeatureIsValid("Gain") ? "Gain" : "GainRaw";
@@ -545,13 +690,15 @@
                 int result = _camera.IMV_GetDoubleFeatureMin(gainFeature, ref minGain);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"鑾峰彇澧炵泭鏈�灏忓�煎け璐ワ紝閿欒鐮侊細{result}");
+                    AsyncLogHelper.Error(SN + $"鑾峰彇澧炵泭鏈�灏忓�煎け璐ワ紝閿欒鐮侊細{result}");
+                    throw new Exception(SN + $"鑾峰彇澧炵泭鏈�灏忓�煎け璐ワ紝閿欒鐮侊細{result}");
                 }
 
                 result = _camera.IMV_GetDoubleFeatureMax(gainFeature, ref maxGain);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"鑾峰彇澧炵泭鏈�澶у�煎け璐ワ紝閿欒鐮侊細{result}");
+                    AsyncLogHelper.Error(SN + $"鑾峰彇澧炵泭鏈�澶у�煎け璐ワ紝閿欒鐮侊細{result}");
+                    throw new Exception(SN + $"鑾峰彇澧炵泭鏈�澶у�煎け璐ワ紝閿欒鐮侊細{result}");
                 }
 
                 if (gain < minGain) gain = minGain;
@@ -561,14 +708,16 @@
                 result = _camera.IMV_SetDoubleFeatureValue(gainFeature, gain);
                 if (result != IMVDefine.IMV_OK)
                 {
-                    throw new Exception($"璁剧疆澧炵泭澶辫触锛岄敊璇爜锛歿result}");
+                    AsyncLogHelper.Error(SN + $"璁剧疆澧炵泭澶辫触锛岄敊璇爜锛歿result}");
+                    throw new Exception(SN + $"璁剧疆澧炵泭澶辫触锛岄敊璇爜锛歿result}");
                 }
 
                 return true;
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆澧炵泭澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆澧炵泭澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆澧炵泭澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -586,7 +735,8 @@
             {
                 if (_camera == null || !_camera.IMV_IsOpen())
                 {
-                    throw new Exception("鐩告満鏈墦寮�");
+                    AsyncLogHelper.Error(SN + "鐩告満鏈墦寮�");
+                    throw new Exception(SN + "鐩告満鏈墦寮�");
                 }
 
                 string gainFeature = _camera.IMV_FeatureIsValid("Gain") ? "Gain" : "GainRaw";
@@ -595,7 +745,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇澧炵泭澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇澧炵泭澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇澧炵泭澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -619,7 +770,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆瑙﹀彂鏋佹�уけ璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆瑙﹀彂鏋佹�уけ璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆瑙﹀彂鏋佹�уけ璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -647,7 +799,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇瑙﹀彂鏋佹�уけ璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇瑙﹀彂鏋佹�уけ璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇瑙﹀彂鏋佹�уけ璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -671,7 +824,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆瑙﹀彂婊ゆ尝澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆瑙﹀彂婊ゆ尝澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆瑙﹀彂婊ゆ尝澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -695,7 +849,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇瑙﹀彂婊ゆ尝澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇瑙﹀彂婊ゆ尝澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇瑙﹀彂婊ゆ尝澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -718,7 +873,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆瑙﹀彂寤舵椂澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆瑙﹀彂寤舵椂澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆瑙﹀彂寤舵椂澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -742,7 +898,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇瑙﹀彂寤舵椂澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇瑙﹀彂寤舵椂澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇瑙﹀彂寤舵椂澶辫触锛歿ex.Message}");
                 return false;
             }
         }
@@ -767,7 +924,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆淇″彿绾挎ā寮忓け璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆淇″彿绾挎ā寮忓け璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆淇″彿绾挎ā寮忓け璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -791,7 +949,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"璁剧疆淇″彿绾跨姸鎬佸け璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"璁剧疆淇″彿绾跨姸鎬佸け璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"璁剧疆淇″彿绾跨姸鎬佸け璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -820,7 +979,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑾峰彇淇″彿绾跨姸鎬佸け璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇淇″彿绾跨姸鎬佸け璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑾峰彇淇″彿绾跨姸鎬佸け璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -843,7 +1003,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鑷姩鐧藉钩琛″け璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鑷姩鐧藉钩琛″け璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"鑷姩鐧藉钩琛″け璐ワ細{ex.Message}");
                 return false;
             }
         }
@@ -880,14 +1041,16 @@
                         if ((uint)result != 0x80000001 && result != -119 && result != -102) // 瓒呮椂閿欒浠g爜
                         {
                             // 闈炶秴鏃堕敊璇�
-                            System.Diagnostics.Debug.WriteLine($"鑾峰彇鍥惧儚甯уけ璐ワ紝閿欒鐮侊細{result}");
+                            System.Diagnostics.Debug.WriteLine(SN + $"鑾峰彇鍥惧儚甯уけ璐ワ紝閿欒鐮侊細{result}");
+                            AsyncLogHelper.Error(SN + $"鑾峰彇鍥惧儚甯уけ璐ワ紝閿欒鐮侊細{result}");
                             Thread.Sleep(10); // 鍑洪敊鏃剁◢浣滅瓑寰�
                         }
                     }
                 }
                 catch (Exception ex)
                 {
-                    System.Diagnostics.Debug.WriteLine($"閲囬泦绾跨▼寮傚父锛歿ex.Message}");
+                    System.Diagnostics.Debug.WriteLine(SN + $"閲囬泦绾跨▼寮傚父锛歿ex.Message}");
+                    AsyncLogHelper.Error(SN + $"閲囬泦绾跨▼寮傚父锛歿ex.Message}");
                     Thread.Sleep(10);
                 }
 
@@ -918,7 +1081,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"澶勭悊鍥惧儚甯уけ璐ワ細{ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"澶勭悊鍥惧儚甯уけ璐ワ細{ex.Message}");
+                AsyncLogHelper.Error(SN + $"澶勭悊鍥惧儚甯уけ璐ワ細{ex.Message}");
             }
             finally
             {
@@ -957,7 +1121,8 @@
             }
             catch (Exception ex)
             {
-                System.Diagnostics.Debug.WriteLine($"鍥惧儚鏍煎紡杞崲澶辫触锛歿ex.Message}");
+                System.Diagnostics.Debug.WriteLine(SN + $"鍥惧儚鏍煎紡杞崲澶辫触锛歿ex.Message}");
+                AsyncLogHelper.Error(SN + $"鍥惧儚鏍煎紡杞崲澶辫触锛歿ex.Message}");
                 return null;
             }
         }
diff --git a/LB_VisionProcesses/Cameras/LBCameras/PHM6000Camera.cs b/LB_VisionProcesses/Cameras/LBCameras/PHM6000Camera.cs
index 0aba8c7..e615d81 100644
--- a/LB_VisionProcesses/Cameras/LBCameras/PHM6000Camera.cs
+++ b/LB_VisionProcesses/Cameras/LBCameras/PHM6000Camera.cs
@@ -266,6 +266,36 @@
             return false;
         }
 
+        public override bool StartWith_SoftTriggerModel()
+        {
+            throw new NotImplementedException();
+        }
+
+        public override bool StartWith_HardTriggerModel(TriggerSource hardtriggeritem = TriggerSource.Line0)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override bool GetImage(out Bitmap bitmap, int outtime = 3000)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override bool GetImageWithSoftTrigger(out Bitmap bitmap, int outtime = 3000)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override void SetCamConfig(CameraConfig config)
+        {
+            throw new NotImplementedException();
+        }
+
+        public override void GetCamConfig(out CameraConfig config)
+        {
+            throw new NotImplementedException();
+        }
+
         #endregion
     }
 

--
Gitblit v1.9.3