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); + } + } }