Browse Source

截图优化

BourneCao 3 years ago
parent
commit
c3a7119d23

+ 165 - 0
CarMeterSystem/CamerEs.cs

@@ -0,0 +1,165 @@
+using Common;
+using MeterPlugInLibrary;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CarMeterSystem
+{
+    public class CamerEs
+    {
+        #region
+        private bool m_bInitSDK = false;
+        private uint iLastErr = 0;
+        private Int32 m_lUserID = -1;
+        private Int32 m_lRealHandle = -1;
+        private Int32 i = 0;
+        private string str;
+        private long iSelIndex = 0;
+        private int[] iChannelNum = new int[96];
+
+        private CHCNetSDK.NET_DVR_DEVICEINFO_V30 DeviceInfo;
+        private CHCNetSDK.NET_DVR_IPPARACFG_V40 m_struIpParaCfgV40;
+        private CHCNetSDK.NET_DVR_IPCHANINFO m_struChanInfo;
+        private CHCNetSDK.NET_DVR_IPCHANINFO_V40 m_struChanInfoV40;
+        public delegate void MyDebugInfo(string str);
+        #endregion
+
+
+        internal loginParam _lg = null;
+        public CamerEs(loginParam lg) 
+        {
+            _lg = lg;
+
+            m_bInitSDK = CHCNetSDK.NET_DVR_Init();
+            if (m_bInitSDK == false)
+            {
+                MessageBox.Show("NET_DVR_Init error!");
+                return;
+            }
+            else
+            {
+                //保存SDK日志 To save the SDK log
+                CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\SdkLog\\", true);
+                for (int i = 0; i < 64; i++)
+                {
+                    iChannelNum[i] = -1;
+                }
+            }
+        }
+
+        public void Login(PictureBox pb)
+        {
+            List<loginParam> lt = new List<loginParam>();
+            if (_lg == null )
+            {
+                DebugInfo("请先载入摄像头信息");
+            }
+
+            if (m_lUserID < 0)
+            {
+                string DVRIPAddress = _lg.ip; //设备IP地址或者域名 Device IP
+                Int16 DVRPortNumber = (Int16)_lg.port;
+                string DVRUserName = _lg.userId;//设备登录用户名 User name to login
+                string DVRPassword = _lg.pwd;//设备登录密码 Password to login
+
+                //登录设备 Login the device
+                m_lUserID = CHCNetSDK.NET_DVR_Login_V30(DVRIPAddress, DVRPortNumber, DVRUserName, DVRPassword, ref DeviceInfo);
+                if (m_lUserID < 0)
+                {
+                    iLastErr = CHCNetSDK.NET_DVR_GetLastError();
+                    str = "NET_DVR_Login_V30 failed, error code= " + iLastErr; //登录失败,输出错误号 Failed to login and output the error code
+                    DebugInfo(str);
+                    return;
+                }
+                else
+                {
+                    //登录成功
+                    DebugInfo("NET_DVR_Login_V30 succ!");
+
+                    //加载预览信息
+                    CHCNetSDK.NET_DVR_PREVIEWINFO lpPreviewInfo = new CHCNetSDK.NET_DVR_PREVIEWINFO();
+                    lpPreviewInfo.hPlayWnd = pb.Handle;//预览窗口 live view window
+                    lpPreviewInfo.lChannel = 1;//预览的设备通道 the device channel number
+                    lpPreviewInfo.dwStreamType = 1;//码流类型:0-主码流,1-子码流,2-码流3,3-码流4,以此类推
+                    lpPreviewInfo.dwLinkMode = 0;//连接方式:0- TCP方式,1- UDP方式,2- 多播方式,3- RTP方式,4-RTP/RTSP,5-RSTP/HTTP 
+                    lpPreviewInfo.bBlocked = true; //0- 非阻塞取流,1- 阻塞取流
+                    lpPreviewInfo.dwDisplayBufNum = 15; //播放库显示缓冲区最大帧数
+
+                    IntPtr pUser = IntPtr.Zero;//用户数据 user data 
+                    m_lRealHandle = CHCNetSDK.NET_DVR_RealPlay_V40(m_lUserID, ref lpPreviewInfo, null/*RealData*/, pUser);
+                }
+            }
+        }
+
+        public void LoginOut()
+        {
+            //注销登录 Logout the device
+            if (m_lRealHandle >= 0)
+            {
+                DebugInfo("Please stop live view firstly"); //登出前先停止预览 Stop live view before logout
+                return;
+            }
+
+            if (!CHCNetSDK.NET_DVR_Logout(m_lUserID))
+            {
+                iLastErr = CHCNetSDK.NET_DVR_GetLastError();
+                str = "NET_DVR_Logout failed, error code= " + iLastErr;
+                DebugInfo(str);
+                return;
+            }
+            DebugInfo("NET_DVR_Logout succ!");
+            m_lUserID = -1;
+        }
+
+        public void CapturePictrue(string fileUrl)
+        {
+            Log.GetInstance().WriteLog(35, "完成快速仪表拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+            if (!CHCNetSDK.NET_DVR_CapturePictureBlock(m_lRealHandle, fileUrl, 100))
+            {
+                iLastErr = CHCNetSDK.NET_DVR_GetLastError();
+                str = "NET_DVR_CaptureJPEGPicture failed, error code= " + iLastErr;
+                DebugInfo(str);
+                return;
+            }
+            Log.GetInstance().WriteLog(35, "结束快速仪表拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+
+        }
+
+        #region
+        protected void DebugInfo(string strMsg)
+        {
+            try
+            {
+                string m_szRunPath;
+                m_szRunPath = System.Environment.CurrentDirectory;
+                if (System.IO.Directory.Exists(m_szRunPath + "\\log") == false)
+                {
+                    System.IO.Directory.CreateDirectory(m_szRunPath + "\\log");
+                }
+                string strDate = System.DateTime.Now.ToString("yyyyMMdd");
+                string strPathFile = m_szRunPath + "\\log\\" + strDate;
+                if (!Directory.Exists(strPathFile))//如果不存在就创建file文件夹
+                {
+                    Directory.CreateDirectory(strPathFile);
+                }
+                System.IO.TextWriter tw = new System.IO.StreamWriter(strPathFile + "\\视频_" + strDate + ".log", true);
+
+                tw.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
+                tw.WriteLine(str);
+                tw.WriteLine("\r\n");
+
+                tw.Close();
+            }
+            catch { }
+        }
+        #endregion
+
+    }
+}

+ 11 - 0
CarMeterSystem/CarMeterSystem.csproj

@@ -75,6 +75,7 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="CamerEs.cs" />
     <Compile Include="frmMatMsgInfo.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -93,6 +94,12 @@
     <Compile Include="frmOneYardToEnd2.designer.cs">
       <DependentUpon>frmOneYardToEnd2.cs</DependentUpon>
     </Compile>
+    <Compile Include="frmVoice.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="frmVoice.Designer.cs">
+      <DependentUpon>frmVoice.cs</DependentUpon>
+    </Compile>
     <Compile Include="frmWelcome_Jisco.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -108,6 +115,7 @@
     <Compile Include="Interface\HttpHelper.cs" />
     <Compile Include="Interface\JGLimsInterface.cs" />
     <Compile Include="Interface\JGLimsMsg.cs" />
+    <Compile Include="loginParam.cs" />
     <Compile Include="MyTest.cs" />
     <Compile Include="OptionCls\CarCache.cs" />
     <Compile Include="OptionCls\BaseDbCls.cs" />
@@ -175,6 +183,9 @@
     <EmbeddedResource Include="frmOneYardToEnd2.resx">
       <DependentUpon>frmOneYardToEnd2.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="frmVoice.resx">
+      <DependentUpon>frmVoice.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="frmWelcome_Jisco.resx">
       <DependentUpon>frmWelcome_Jisco.cs</DependentUpon>
     </EmbeddedResource>

+ 6 - 5
CarMeterSystem/OptionCls/CameraShotCls.cs

@@ -42,12 +42,13 @@ namespace CarMeterSystem.OptionCls
             {
                 //放在tempImg文件夹下面就进行图片的压缩操作,否则不进行图片压缩
                 //shot.CapPic(iCnt < 3 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\tempImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
-                shot.CapPic(iCnt < 1 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
+                
+                shot.CapPic(iCnt < 2 ? 0 : 1, PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, iCnt));
                 // 第一次抓拍为仪表重量
-                if(iCnt == 1)
-                {
-                    Log.GetInstance().WriteLog(35, "完成仪表拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
-                }
+                //if(iCnt == 1)
+                //{
+                //    Log.GetInstance().WriteLog(35, "完成仪表拍照    成功标识:" + PbCache.shotSuccess.ToString() + "车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+                //}
                 iCnt++;
             }
         }

+ 13 - 0
CarMeterSystem/frmOneYardToEnd.cs

@@ -75,6 +75,9 @@ namespace CarMeterSystem
 
         private ImageCurlControl imageCurlControl = new ImageCurlControl();
 
+        // 抓图用的界面 20220808 by BourneCao
+        private frmVoice frmVoice = new frmVoice();
+
         //lianDaWgt
 
         //=========== 2021-11-25 eason add ====================
@@ -115,6 +118,11 @@ namespace CarMeterSystem
                 lbPointName.Text = PbCache.sportInfo.baseSpotName;
                 ucCarMeterInfoJisco1.setMeterType(PbCache.bussinessTypeName);
                 tableLayoutPanelPromptMsg.CellBorderStyle = (TableLayoutPanelCellBorderStyle)BorderStyle.FixedSingle;
+
+                // 初始化截图界面
+                frmVoice.LoadVoiceInfo();
+                frmVoice.Show();
+                frmVoice.Hide();
             }
             catch (Exception ex)
             {
@@ -408,9 +416,13 @@ namespace CarMeterSystem
                     // 启动拍照
                     PbCache.tempImgId = Guid.NewGuid().ToString();
                     lg.WriteLog(35, "启动拍照    车号:" + PbCache.lockCarNo + ";重量:" + PbCache.lockWgt + ";时间:" + DateTime.Now.ToLongTimeString());
+                    // 先截取重量仪表截图
+                    frmVoice.CapturePictrue(PbCache.tempImgId + "_temp");
+                    // 后截取其它摄像头截图
                     _ = BeginInvoke(new Action(() => { shotImage(PbCache.tempImgId + "_temp"); }));
 
 
+
                     isStop = true;
                     #region 酒钢业务流程判断
                     if (isCompare)
@@ -2427,6 +2439,7 @@ namespace CarMeterSystem
                 PbCache.monitor.isOverWgt = "";
                 bRailwayActual = true; //为true时会重新查询一次计量数据
                 isShowRecover = true;//是否去查询“复磅”按钮的显示与否
+                isMeasureSuccess = false;
                 PbCache.Load();
                 //关闭一些线程及定时任务
                 timer1.Stop();

+ 61 - 0
CarMeterSystem/frmVoice.Designer.cs

@@ -0,0 +1,61 @@
+
+namespace CarMeterSystem
+{
+    partial class frmVoice
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+            this.SuspendLayout();
+            // 
+            // flowLayoutPanel1
+            // 
+            this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+            this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+            this.flowLayoutPanel1.Size = new System.Drawing.Size(390, 224);
+            this.flowLayoutPanel1.TabIndex = 1;
+            // 
+            // frmVoice
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(390, 224);
+            this.Controls.Add(this.flowLayoutPanel1);
+            this.Name = "frmVoice";
+            this.Text = "frmVoice";
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmVoice_FormClosing);
+            this.Load += new System.EventHandler(this.frmVoice_Load);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+    }
+}

+ 104 - 0
CarMeterSystem/frmVoice.cs

@@ -0,0 +1,104 @@
+using Common;
+using MeterPlugInLibrary;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace CarMeterSystem
+{
+    public partial class frmVoice : Form
+    {
+        public frmVoice()
+        {
+            InitializeComponent();
+        }
+
+        List<CamerEs> lc = new List<CamerEs>();
+        private void LoadVoice(List<loginParam> lt) 
+        {
+            int i = 1;
+            foreach (loginParam lp in lt) 
+            {
+                CamerEs c = new CamerEs(lp);
+                PictureBox pb = new PictureBox();
+                pb.Name = $"pb{i++}";
+                pb.Height = 100;
+                pb.BackColor = Color.Black;
+                pb.Dock = DockStyle.Top;
+                flowLayoutPanel1.Controls.Add(pb);
+                c.Login(pb);
+                lc.Add(c);
+            }
+        }
+
+        public void LogOut() 
+        {
+            foreach (CamerEs lp in lc) 
+            {
+                lp.LoginOut();
+            }
+        }
+
+        /// <summary>
+        /// 传入了值,则按传入的路径及Ip进行截图,否则则全部截图
+        /// </summary>
+        /// <param name="imgUrl"></param>
+        /// <param name="ip"></param>
+        public void CapturePictrue(string actualFirstNo, string imgUrl = default, string ip = default)
+        {
+            string strUrl = imgUrl ?? PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 1);
+            lc[0]?.CapturePictrue(strUrl);
+            /*
+             * 只截取第一张图片
+            if (!string.IsNullOrEmpty(ip))
+            {
+                string strUrl = imgUrl ?? PbCache.path + string.Format("\\imgShort\\formalImg\\{0}_{1}_{2}.jpg", PbCache.sportInfo.baseSpotNo, "C" + actualFirstNo, 1);
+                lc.Where(s => s._lg?.ip == ip).FirstOrDefault()?.CapturePictrue(strUrl);
+            }
+            else
+            {
+                string strUrl = imgUrl ?? $"{Environment.CurrentDirectory}/imgShort/formalImg";
+                int i = 1;
+                foreach (CamerEs lp in lc)
+                {
+
+                    //lp.CapturePictrue($"{strUrl}/{DateTime.Now.ToString("yyyyMMddHHmmss")}_{i++}.jpg");
+                }
+            }
+            */
+        }
+
+        internal void LoadVoiceInfo() 
+        {
+            List<MeterBaseVideoChild> lt = PbCache.videoChild;
+            List<loginParam> lp = new List<loginParam>();
+            
+            lp.Add(new loginParam { ip = lt[0].p_ip, port = int.Parse(lt[0].vdo_port), userId = lt[0].vdo_user, pwd = lt[0].vdo_pwd });
+           
+            LoadVoice(lp);
+            this.Hide();
+        }
+
+        private void frmVoice_Load(object sender, EventArgs e)
+        {
+            
+        }
+
+        private void frmVoice_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            try
+            {
+                LogOut();
+            }
+            catch { }
+        }
+    }
+}

+ 120 - 0
CarMeterSystem/frmVoice.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 29 - 0
CarMeterSystem/loginParam.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CarMeterSystem
+{
+    public class loginParam
+    {
+        /// <summary>
+        /// 账号
+        /// </summary>
+        public string userId { get; set; }
+
+        /// <summary>
+        /// 密码
+        /// </summary>
+        public string pwd { get; set; }
+        /// <summary>
+        /// ip
+        /// </summary>
+        public string ip { get; set; }
+        /// <summary>
+        /// 端口
+        /// </summary>
+        public int port { get; set; }
+    }
+}

+ 3 - 0
MeterPlugInLibrary/海康摄像头截图/CHCNetSDK.cs

@@ -16552,6 +16552,9 @@ namespace MeterPlugInLibrary
         [DllImport(@"HCNetSDK.dll")]
         public static extern bool NET_DVR_CapturePicture(Int32 lRealHandle, string sPicFileName);
 
+        [DllImport(@"HCNetSDK.dll")]
+        public static extern bool NET_DVR_CapturePictureBlock(Int32 lRealHandle, string sPicFileName, int dwTimeOut);
+
         //动态生成I帧
         [DllImport(@"HCNetSDK.dll")]
         public static extern bool NET_DVR_MakeKeyFrame(Int32 lUserID, Int32 lChannel);//主码流

+ 4 - 0
MeterPlugInLibrary/海康摄像头截图/HCNetSDK.cs

@@ -14409,6 +14409,10 @@ namespace StockMeterPlugInLibrary
         [DllImport("HCNetSDK.dll")]
         public static extern bool NET_DVR_CaptureJPEGPicture_NEW(int lUserID, int lChannel, ref NET_DVR_JPEGPARA lpJpegPara, byte[] sJpegPicBuffer, uint dwPicSize, ref uint lpSizeReturned);
 
+        // 20220808 by易鑫 有阻塞抓图
+        [DllImport("HCNetSDK.dll")]
+        public static extern bool NET_DVR_CapturePictureBlock(Int32 lRealHandle, string sPicFileName, int dwTimeOut);
+
         //2006-02-16
         [DllImport("HCNetSDK.dll")]
         public static extern int NET_DVR_GetRealPlayerIndex(int lRealHandle);