From 7c176833a55c255a2bfd625b1efccbfd6b415e45 Mon Sep 17 00:00:00 2001 From: wenjy Date: Thu, 31 Oct 2024 18:12:26 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=B7=BB=E5=8A=A0=E6=9C=80?= =?UTF-8?q?=E9=AB=98=E6=B8=A9=E5=BA=A6=E6=8A=A5=E8=AD=A6=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.WPF/Page/IndexControl.xaml.cs | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/SlnMesnac.WPF/Page/IndexControl.xaml.cs b/SlnMesnac.WPF/Page/IndexControl.xaml.cs index d59888f..ad4737f 100644 --- a/SlnMesnac.WPF/Page/IndexControl.xaml.cs +++ b/SlnMesnac.WPF/Page/IndexControl.xaml.cs @@ -5,6 +5,7 @@ using SlnMesnac.WPF.ViewModel; using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -40,6 +41,7 @@ namespace SlnMesnac.WPF.Page public CHCNetSDK.NET_DVR_PTZPOS m_struPtzCfg; private bool bAuto = false; private CHCNetSDK.RemoteConfigCallback _callback; + private CHCNetSDK.MSGCallBack_V31 m_falarmData_V31 = null; private string DVRIPAddress = "192.168.1.64"; //设备IP地址或者域名 Device IP private Int16 DVRPortNumber = 8000; //设备服务端口号 Device Port @@ -130,6 +132,30 @@ namespace SlnMesnac.WPF.Page realTemperature.fAverageTemperature = (float)Math.Round(ret.struLinePolygonThermCfg.fAverageTemperature, 1); realTemperature.fTemperatureDiff = (float)Math.Round(ret.struLinePolygonThermCfg.fTemperatureDiff, 1); indexControlViewModel.RefreshRealTemperature(realTemperature); + + string sJpegPicFileName = $"F:\\桌面\\赛轮智慧热电项目\\日志信息\\picture\\{DateTime.Now.ToString("yyyyMMddHHmmssffff")}.jpg"; + + if(realTemperature.fMaxTemperature > 65) + { + int lChannel = 2; + + CHCNetSDK.NET_DVR_JPEGPARA lpJpegPara = new CHCNetSDK.NET_DVR_JPEGPARA(); + lpJpegPara.wPicQuality = 0; //图像质量 Image quality + lpJpegPara.wPicSize = 0xff; //抓图分辨率 Picture size: 2- 4CIF,0xff- Auto(使用当前码流分辨率),抓图分辨率需要设备支持,更多取值请参考SDK文档 + + //JPEG抓图 Capture a JPEG picture + if (!CHCNetSDK.NET_DVR_CaptureJPEGPicture(m_lUserID, lChannel, ref lpJpegPara, sJpegPicFileName)) + { + var str = "NET_DVR_CaptureJPEGPicture failed, error code= " + NET_DVR_GetLastError(); + DebugInfo(str); + return; + } + else + { + var str = "Successful to capture the JPEG file and the saved file is " + sJpegPicFileName; + DebugInfo(str); + } + } }