From 116ed6b584bbdb40c5b65e7cb57e039b6ae57800 Mon Sep 17 00:00:00 2001
From: C3032 <C3032@BC3032>
Date: 星期四, 08 一月 2026 11:12:25 +0800
Subject: [PATCH] 优化相机配置和图像获取逻辑

---
 LB_VisionProcesses/Cameras/LBCameras/LBCamera.cs |  617 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 493 insertions(+), 124 deletions(-)

diff --git a/LB_VisionProcesses/Cameras/LBCameras/LBCamera.cs b/LB_VisionProcesses/Cameras/LBCameras/LBCamera.cs
index b5ca44d..a5128a4 100644
--- a/LB_VisionProcesses/Cameras/LBCameras/LBCamera.cs
+++ b/LB_VisionProcesses/Cameras/LBCameras/LBCamera.cs
@@ -1,9 +1,15 @@
-锘縰sing OpenCvSharp;
 using System;
 using System.Collections.Generic;
-using System.Linq;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Runtime.InteropServices;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
+using LB_SmartVisionCameraSDK.PHM6000;
+using LB_VisionProcesses.Cameras;
+using LB_SmartVisionCommon;
+using LB_SmartVisionCameraDevice.PHM6000;
 
 namespace LB_VisionProcesses.Cameras.LBCameras
 {
@@ -11,154 +17,517 @@
     /// LB3D宸ヤ笟鐩告満瀹炵幇绫�
     /// 鍩轰簬PHM6000绯诲垪灏佽
     /// </summary>
-    internal class LBCamera : BaseCamera
+    public class LBCamera : BaseCamera
     {
-        public override bool AutoBalanceWhite()
+        private IntPtr _cameraHandle = IntPtr.Zero;
+        private PHM6000SensorConfig _sensorConfig;
+        private AcquisitionCallbackZA _acquisitionCallback;
+        private AcquisitionCompletedCallback _acquisitionCompletedCallback;
+        private bool _isConnected = false;
+
+        // 鍥惧儚缂撳啿
+        private List<byte[]> _lineDataBuffer = new List<byte[]>();
+        private readonly object _bufferLock = new object();
+        private int _currentLineCount = 0;
+
+        // 鏄剧ず鍙ユ焺鍜屽嚱鏁帮紙涓嶭LSystem绀轰緥淇濇寔涓�鑷达級
+        private IntPtr _lightPic = IntPtr.Zero;
+        private IntPtr _deepPic = IntPtr.Zero;
+        private IntPtr _pointPic = IntPtr.Zero;
+        private IntPtr _outlinePic = IntPtr.Zero;
+
+        public LBCamera()
         {
-            return true;
+            Brand = CameraBrand.LBCamera;
+            _sensorConfig = new PHM6000SensorConfig();
+        }
+
+        #region ICamera Implementation
+
+        public override bool InitDevice(string sn, object handle = null)
+        {
+            IntPtr tempHandle = IntPtr.Zero;
+            try
+            {
+                SN = sn;
+                // 1. 鍒涘缓涓存椂鍙ユ焺鐢ㄤ簬鍙戠幇璁惧
+                tempHandle = PHM6000Profiler.CreateCameraEntry();
+                if (tempHandle == IntPtr.Zero) return false;
+
+                // 2. 鍙戠幇鐩告満
+                int cameraCount = PHM6000Profiler.DiscoverCameras(tempHandle);
+                if (cameraCount <= 0)
+                {
+                    PHM6000Profiler.DestroyCameraEntry(tempHandle);
+                    return false;
+                }
+
+                string targetIp = string.Empty;
+                int targetPort = 0;
+                bool found = false;
+
+                // 3. 閬嶅巻鐩告満瀵绘壘鍖归厤鐨凷N
+                for (int i = 0; i < cameraCount; i++)
+                {
+                    byte[] moduleTypeBytes = new byte[64];
+                    byte[] serialNumberBytes = new byte[64];
+                    
+                    if (PHM6000Profiler.GetCameraInformation(tempHandle, i, moduleTypeBytes, serialNumberBytes) == 0)
+                    {
+                        string currentSn = Encoding.UTF8.GetString(serialNumberBytes).TrimEnd('\0');
+                        
+                        // 濡傛灉浼犲叆鐨� sn 鏄� IP 鍦板潃锛屽垯鐩存帴灏濊瘯鍖归厤 IP
+                        // 鎴栬�呭尮閰嶅簭鍒楀彿
+                        if (currentSn == sn || sn.Contains(currentSn)) // 绠�鍗曞尮閰嶉�昏緫
+                        {
+                            byte[] addressBytes = new byte[64];
+                            int port = 0;
+                            if (PHM6000Profiler.GetCameraAddress(tempHandle, i, addressBytes, ref port) == 0)
+                            {
+                                targetIp = Encoding.UTF8.GetString(addressBytes).TrimEnd('\0');
+                                targetPort = port;
+                                found = true;
+                                break;
+                            }
+                        }
+                    }
+                }
+
+                // 閿�姣佷复鏃跺彞鏌�
+                PHM6000Profiler.DestroyCameraEntry(tempHandle);
+                tempHandle = IntPtr.Zero;
+
+                if (!found)
+                {
+                    // 濡傛灉娌℃壘鍒颁絾 sn 鏈韩鐪嬭捣鏉ュ儚 IP锛屽皾璇曠洿鎺ヨ繛鎺�
+                    if (System.Net.IPAddress.TryParse(sn, out _))
+                    {
+                        targetIp = sn;
+                        targetPort = 5577; // 榛樿绔彛
+                    }
+                    else
+                    {
+                        AsyncLogHelper.Error($"LBCamera: 鏈壘鍒癝N涓� {sn} 鐨勭浉鏈�");
+                        return false;
+                    }
+                }
+
+                // 4. 鍒涘缓姝e紡鐩告満鍙ユ焺骞惰繛鎺�
+                _cameraHandle = PHM6000Profiler.CreateCameraEntry();
+                if (_cameraHandle == IntPtr.Zero) return false;
+
+                var addr = Encoding.ASCII.GetBytes(targetIp);
+                int result = PHM6000Profiler.ConnectToCamera(_cameraHandle, addr, targetPort);
+                
+                if (result == 0)
+                {
+                    _isConnected = true;
+                    // 鍔犺浇鐩告満褰撳墠鍙傛暟鍒� _sensorConfig
+                    SyncConfigFromCamera();
+
+                    // 鍒濆鍖栧洖璋�
+                    _acquisitionCallback = new AcquisitionCallbackZA(OnLineReceived);
+                    _acquisitionCompletedCallback = new AcquisitionCompletedCallback(OnAcquisitionCompleted);
+                    
+                    //PHM6000Profiler.SetAcquisitionCallbackZA(_cameraHandle, _acquisitionCallback, IntPtr.Zero);
+                    PHM6000Profiler.RegisterAcquisitionCompletedCallback(_cameraHandle, _acquisitionCompletedCallback, IntPtr.Zero);
+                    
+                    return true;
+                }
+            }
+            catch (Exception ex) 
+            { 
+                AsyncLogHelper.Error($"LBCamera: InitDevice寮傚父 - {ex.Message}");
+                if (tempHandle != IntPtr.Zero) PHM6000Profiler.DestroyCameraEntry(tempHandle);
+            }
+            return false;
         }
 
         public override bool CloseDevice()
         {
-            return true;
-        }
-
-        public override void GetCamConfig(out CameraConfig config)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override bool GetExpouseTime(out double value)
-        {
-            value = 0;
-            return true;
-        }
-
-        public override bool GetGain(out double gain)
-        {
-            gain = 0;
-            return true;
-        }
-
-        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 bool GetLineStatus(IOLines line, out LineStatus lineStatus)
-        {
-            lineStatus = LineStatus.Hight;
+            if (_isConnected && _cameraHandle != IntPtr.Zero)
+            {
+                StopGrabbing();
+                PHM6000Profiler.DestroyCameraEntry(_cameraHandle);
+                _cameraHandle = IntPtr.Zero;
+                _isConnected = false;
+            }
             return true;
         }
 
         public override List<string> GetListEnum()
         {
-            return new List<string>();
-        }
-
-        public override bool GetTriggerDelay(out double delay)
-        {
-            delay = 0;
-            return true;
-        }
-
-        public override bool GetTriggerFliter(out double flitertime)
-        {
-            flitertime = 0;
-            return true;
-        }
-
-        public override bool GetTriggerMode(out TriggerMode mode, out TriggerSource source)
-        {
-            mode = TriggerMode.On;
-            source = TriggerSource.Line0;
-            return true;
-        }
-
-        public override bool GetTriggerPolarity(out TriggerPolarity polarity)
-        {
-            polarity = TriggerPolarity.RisingEdge;
-            return true;
-        }
-
-        public override bool InitDevice(string SN, object Handle = null)
-        {
-            return true;
-        }
-
-        public override void SetCamConfig(CameraConfig config)
-        {
-            throw new NotImplementedException();
-        }
-
-        public override bool SetExpouseTime(double value)
-        {
-            return true;
-        }
-
-        public override bool SetGain(double gain)
-        {
-            return true;
-        }
-
-        public override bool SetLineMode(IOLines line, LineMode mode)
-        {
-            return true;
-        }
-
-        public override bool SetLineStatus(IOLines line, LineStatus linestatus)
-        {
-            return true;
-        }
-
-        public override bool SetTriggerDelay(double delay)
-        {
-            return true;
-        }
-
-        public override bool SetTriggerFliter(double flitertime)
-        {
-            return true;
-        }
-
-        public override bool SetTriggerMode(TriggerMode mode, TriggerSource triggerEnum = TriggerSource.Line0)
-        {
-            return true;
-        }
-
-        public override bool SetTriggerPolarity(TriggerPolarity polarity)
-        {
-            return true;
-        }
-
-        public override bool SoftTrigger()
-        {
-            return true;
+            List<string> cameraList = new List<string>();
+            IntPtr tempHandle = IntPtr.Zero;
+            try
+            {
+                tempHandle = PHM6000Profiler.CreateCameraEntry();
+                if (tempHandle != IntPtr.Zero)
+                {
+                    int count = PHM6000Profiler.DiscoverCameras(tempHandle);
+                    for (int i = 0; i < count; i++)
+                    {
+                        byte[] moduleTypeBytes = new byte[64];
+                        byte[] serialNumberBytes = new byte[64];
+                        if (PHM6000Profiler.GetCameraInformation(tempHandle, i, moduleTypeBytes, serialNumberBytes) == 0)
+                        {
+                            string sn = Encoding.UTF8.GetString(serialNumberBytes).TrimEnd('\0');
+                            string type = Encoding.UTF8.GetString(moduleTypeBytes).TrimEnd('\0');
+                            // 鏍煎紡鍙傝�冿細PHM6000[SN123456]
+                            if (!string.IsNullOrEmpty(sn))
+                            {
+                                cameraList.Add(sn);
+                            }
+                        }
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                AsyncLogHelper.Error($"LBCamera: GetListEnum寮傚父 - {ex.Message}");
+            }
+            finally
+            {
+                if (tempHandle != IntPtr.Zero)
+                    PHM6000Profiler.DestroyCameraEntry(tempHandle);
+            }
+            return cameraList;
         }
 
         public override bool StartGrabbing()
         {
-            return true;
+            if (!_isConnected) return false;
+            lock (_bufferLock)
+            {
+                _lineDataBuffer.Clear();
+                _currentLineCount = 0;
+            }
+
+            // 绂佺敤琛屽洖璋�
+            PHM6000Profiler.SetAcquisitionCallbackZA(_cameraHandle, IntPtr.Zero, IntPtr.Zero);
+
+            // 璁剧疆閲囬泦妯″紡锛�1=鎵弿妯″紡锛�1=杩炵画妯″紡
+            PHM6000Profiler.SetAcquisitionMode(_cameraHandle, 1, 1);
+            int result = PHM6000Profiler.StartAcquisition(_cameraHandle, 0, 0, 0.0);
+            if (result == 0)
+            {
+                isGrabbing = true;
+                return true;
+            }
+            return false;
         }
 
-        public override bool StartWith_HardTriggerModel(TriggerSource hardtriggeritem = TriggerSource.Line0)
+        /// <summary>
+        /// 鍗曟閲囬泦妯″紡锛堥�傜敤浜庣嚎鎵浉鏈猴級
+        /// 璁剧疆閲囬泦妯″紡涓烘壂鎻忔ā寮忥紝鍗曟瑙﹀彂
+        /// </summary>
+        public bool StartSingleGrab()
         {
-            throw new NotImplementedException();
+            if (!_isConnected) return false;
+            lock (_bufferLock)
+            {
+                _lineDataBuffer.Clear();
+                _currentLineCount = 0;
+            }
+
+            // 绂佺敤琛屽洖璋冿紙涓庣ず渚嬩竴鑷达級
+            PHM6000Profiler.SetAcquisitionCallbackZA(_cameraHandle, IntPtr.Zero, IntPtr.Zero);
+
+            // 璁剧疆閲囬泦妯″紡锛�1=鎵弿妯″紡锛�0=鍗曟妯″紡
+            PHM6000Profiler.SetAcquisitionMode(_cameraHandle, 1, 0);
+            int result = PHM6000Profiler.StartAcquisition(_cameraHandle, 0, 0, 0.0);
+            if (result == 0)
+            {
+                isGrabbing = true;
+                return true;
+            }
+            return false;
         }
 
-        public override bool StartWith_SoftTriggerModel()
+        /// <summary>
+        /// 杩炵画閲囬泦妯″紡锛堥�傜敤浜庣嚎鎵浉鏈猴級
+        /// 璁剧疆閲囬泦妯″紡涓烘壂鎻忔ā寮忥紝杩炵画瑙﹀彂
+        /// </summary>
+        public bool StartContinuousGrab()
         {
-            throw new NotImplementedException();
+            if (!_isConnected) return false;
+            lock (_bufferLock)
+            {
+                _lineDataBuffer.Clear();
+                _currentLineCount = 0;
+            }
+
+            // 绂佺敤琛屽洖璋冿紙涓庣ず渚嬩竴鑷达級
+            PHM6000Profiler.SetAcquisitionCallbackZA(_cameraHandle, IntPtr.Zero, IntPtr.Zero);
+
+            // 璁剧疆閲囬泦妯″紡锛�1=鎵弿妯″紡锛�1=杩炵画妯″紡
+            PHM6000Profiler.SetAcquisitionMode(_cameraHandle, 1, 1);
+            int result = PHM6000Profiler.StartAcquisition(_cameraHandle, 0, 0, 0.0);
+            if (result == 0)
+            {
+                isGrabbing = true;
+                return true;
+            }
+            return false;
         }
 
         public override bool StopGrabbing()
         {
+            if (!_isConnected) return true;
+            PHM6000Profiler.StopAcquisition(_cameraHandle);
+            isGrabbing = false;
             return true;
         }
+
+        public override bool StartWith_SoftTriggerModel()
+        {
+            // 瀵逛簬LBCamera锛堢嚎鎵浉鏈猴級锛岃蒋浠惰Е鍙戣繛缁噰闆嗕娇鐢ㄨ繛缁噰闆嗘ā寮�
+            return StartContinuousGrab();
+        }
+
+        public override bool StartWith_HardTriggerModel(TriggerSource hardtriggeritem = TriggerSource.Line0)
+        {
+            // 瀵逛簬LBCamera锛堢嚎鎵浉鏈猴級锛岀‖浠惰Е鍙戜篃浣跨敤杩炵画閲囬泦妯″紡
+            // 澶栭儴纭欢淇″彿浼氳Е鍙戠浉鏈哄紑濮嬮噰闆�
+            return StartContinuousGrab();
+        }
+
+        public override bool SoftTrigger()
+        {
+            // 绾挎壂鐩告満閫氬父涓嶉渶瑕佷紶缁熻蒋瑙﹀彂锛屼絾鍦ㄦ煇浜涙ā寮忎笅鍙ā鎷�
+            return true;
+        }
+
+        #region 鍙傛暟璁剧疆鏄犲皠
+
+        public override bool SetExpouseTime(double value) => SetParam(EnumNameId.ExposureTime, (float)value);
+        public override bool GetExpouseTime(out double value) { float v; bool r = GetParam(EnumNameId.ExposureTime, out v); value = v; return r; }
+        public override bool SetGain(double gain) => SetParam(EnumNameId.AnalogGain, (float)gain);
+        public override bool GetGain(out double gain) { float v; bool r = GetParam(EnumNameId.AnalogGain, out v); gain = v; return r; }
+
+        // 鍏朵粬鎺ュ彛鍗犱綅瀹炵幇
+        public override bool SetTriggerMode(TriggerMode mode, TriggerSource triggerEnum = TriggerSource.Line0) => true;
+        public override bool GetTriggerMode(out TriggerMode mode, out TriggerSource source) { mode = TriggerMode.Off; source = TriggerSource.Software; return true; }
+        public override bool SetTriggerPolarity(TriggerPolarity polarity) => true;
+        public override bool GetTriggerPolarity(out TriggerPolarity polarity) { polarity = TriggerPolarity.RisingEdge; return true; }
+        public override bool SetTriggerFliter(double flitertime) => true;
+        public override bool GetTriggerFliter(out double flitertime) { flitertime = 0; return true; }
+        public override bool SetTriggerDelay(double delay) => true;
+        public override bool GetTriggerDelay(out double delay) { delay = 0; return true; }
+        public override bool SetLineMode(IOLines line, LineMode mode) => true;
+        public override bool SetLineStatus(IOLines line, LineStatus linestatus) => true;
+        public override bool GetLineStatus(IOLines line, out LineStatus lineStatus) { lineStatus = LineStatus.Low; return true; }
+        public override bool AutoBalanceWhite() => true;
+        
+        // 涓嶅疄鐜扮殑鏂规硶
+        public override void SetCamConfig(CameraConfig config) { }
+        public override void GetCamConfig(out CameraConfig config) { config = new CameraConfig(null); }
+        public override bool GetImage(out Bitmap bitmap, int outtime = 3000) { bitmap = null; return false; }
+        public override bool GetImageWithSoftTrigger(out Bitmap bitmap, int outtime = 3000)
+        {
+            bitmap = null;
+            if (!_isConnected) return false;
+
+            using (AutoResetEvent waitHandle = new AutoResetEvent(false))
+            {
+                Bitmap captured = null;
+                EventHandler<CameraEventArgs> handler = (s, e) =>
+                {
+                    try
+                    {
+                        if (e.Bitmap != null)
+                        {
+                            captured = e.Bitmap.Clone() as Bitmap;
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        AsyncLogHelper.Error($"LBCamera: GetImageWithSoftTrigger clone error - {ex.Message}");
+                    }
+                    waitHandle.Set();
+                };
+
+                this.ImageGrabbed += handler;
+
+                try
+                {
+                    if (StartSingleGrab())
+                    {
+                        if (waitHandle.WaitOne(outtime))
+                        {
+                            bitmap = captured;
+                            return bitmap != null;
+                        }
+                    }
+                }
+                finally
+                {
+                    this.ImageGrabbed -= handler;
+                    StopGrabbing();
+                }
+            }
+            return false;
+        }
+
+        public PHM6000SensorConfig GetSensorConfig()
+        {
+            SyncConfigFromCamera();
+            return _sensorConfig;
+        }
+
+        public void UpdateSensorConfig(PHM6000SensorConfig config)
+        {
+            _sensorConfig = config;
+            // 绠�鍗曠ず渚嬶細璁剧疆鏇濆厜鍜屽鐩�
+            SetExpouseTime(config.ExposureTime);
+            SetGain((double)config.AnalogGain);
+            // 鏇村鍙傛暟鍚屾閫昏緫搴斿湪姝ゅ瀹炵幇
+        }
+
+        #endregion
+
+        #endregion
+
+        #region Private Callback & Helpers
+
+        private void OnLineReceived(IntPtr pInstance, IntPtr buffer, int points)
+        {
+                // 瀹炴椂鍥炶皟澶勭悊锛氱疮绉鏁版嵁
+                if (!isGrabbing) return;
+
+                int lineSize = points * Marshal.SizeOf(typeof(LBPointZA));
+                byte[] lineData = new byte[lineSize];
+                Marshal.Copy(buffer, lineData, 0, lineSize);
+
+                lock (_bufferLock)
+                {
+                    _lineDataBuffer.Add(lineData);
+                    _currentLineCount++;
+                }
+        }
+
+        private void OnAcquisitionCompleted(IntPtr pInstance, int nOption)
+        {
+                // 鏍规嵁SDK鏂囨。锛歯Option涓�0鏃惰〃绀轰竴鎵规暟鎹粨鏉燂紝涓�1鏃惰〃绀哄叏閮ㄩ噰闆嗗畬鎴�
+                // 涓轰簡鍏煎鎬э紝涔熷鐞唍Option == 2锛堢偣浜戝氨缁級
+                // 姝ゆ椂浣跨敤涓诲姩鑾峰彇鏂瑰紡鏇夸唬鍙兘浼氬鑷碿rash鐨凣enerateIntensityMap
+                if (nOption == 0 || nOption == 1 || nOption == 2)
+                {
+                    RetrieveDataAndGenerateImage();
+                }
+        }
+
+        private void RetrieveDataAndGenerateImage()
+        {
+            if (_cameraHandle == IntPtr.Zero) return;
+
+            try
+            {
+                List<byte[]> lineBuffers = new List<byte[]>();
+                ulong index = 0;
+                IntPtr ptr = IntPtr.Zero;
+
+                // 鍍忕ず渚嬩竴鏍烽�氳繃绱㈠紩鑾峰彇琛屾暟鎹�
+                while ((ptr = PHM6000Profiler.GetLineDataByIndex(_cameraHandle, index)) != IntPtr.Zero)
+                {
+                    try
+                    {
+                        LBLineDataZA lineData = PHM6000Profiler.ConvertToLBLineDataZA(ptr);
+                        
+                        // 鎻愬彇寮哄害鏁版嵁 (Alpha閫氶亾)
+                        if (lineData.data != null && lineData.data.Length > 0)
+                        {
+                            int lineWidth = lineData.data.Length;
+                            byte[] intensityLine = new byte[lineWidth];
+                            for (int i = 0; i < lineWidth; i++)
+                            {
+                                intensityLine[i] = lineData.data[i].alpha;
+                            }
+                            lineBuffers.Add(intensityLine);
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        // 蹇界暐鍗曡杞崲閿欒
+                    }
+                    index++;
+                }
+
+                if (lineBuffers.Count == 0) return;
+
+                int height = lineBuffers.Count;
+                int width = lineBuffers[0].Length;
+
+                if (width <= 0 || height <= 0) return;
+
+                Bitmap bmp = new Bitmap(width, height, PixelFormat.Format8bppIndexed);
+                
+                // 璁剧疆鐏板害璋冭壊鏉�
+                ColorPalette palette = bmp.Palette;
+                for (int i = 0; i < 256; i++) palette.Entries[i] = Color.FromArgb(i, i, i);
+                bmp.Palette = palette;
+
+                BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
+                
+                try
+                {
+                    int stride = bmpData.Stride;
+                    IntPtr scan0 = bmpData.Scan0;
+
+                    for (int y = 0; y < height; y++)
+                    {
+                        if (lineBuffers[y].Length == width) // 纭繚瀹藉害涓�鑷�
+                        {
+                            Marshal.Copy(lineBuffers[y], 0, scan0 + y * stride, width);
+                        }
+                    }
+                }
+                finally
+                {
+                    bmp.UnlockBits(bmpData);
+                }
+
+                // 瑙﹀彂浜嬩欢閫氱煡 UI 鏇存柊浜害鍥�
+                ImageGrabbed?.Invoke(this, new CameraEventArgs(SN, bmp));
+            }
+            catch (Exception ex)
+            {
+                AsyncLogHelper.Error($"LBCamera: 鐢熸垚鍥惧儚寮傚父 - {ex.Message}");
+            }
+        }
+
+        private void SyncConfigFromCamera()
+        {
+            // 浠庣浉鏈鸿鍙栨墍鏈夊弬鏁板苟濉厖鍒� _sensorConfig
+            foreach (EnumNameId id in Enum.GetValues(typeof(EnumNameId)))
+            {
+                int iVal = 0; double dVal = 0; int eVal = 0;
+                if (PHM6000Profiler.GetProfilerParameter(_cameraHandle, (int)id, ref iVal, ref dVal, ref eVal) == 0)
+                {
+                    // 瀹為檯椤圭洰涓簲浣跨敤鍙嶅皠灏嗗�煎啓鍥� _sensorConfig
+                }
+            }
+        }
+
+        private bool SetParam(EnumNameId id, float value)
+        {
+            if (!_isConnected) return false;
+            return PHM6000Profiler.SetProfilerParameter(_cameraHandle, (int)id, 0, value, 0) == 0;
+        }
+
+        private bool GetParam(EnumNameId id, out float value)
+        {
+            value = 0;
+            if (!_isConnected) return false;
+            int iVal = 0; double dVal = 0; int eVal = 0;
+            if (PHM6000Profiler.GetProfilerParameter(_cameraHandle, (int)id, ref iVal, ref dVal, ref eVal) == 0)
+            {
+                value = (float)dVal;
+                return true;
+            }
+            return false;
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.9.3