diff --git a/SlnMesnac.Config/AppConfig.cs b/SlnMesnac.Config/AppConfig.cs
index 1cfc66e..4edd9eb 100644
--- a/SlnMesnac.Config/AppConfig.cs
+++ b/SlnMesnac.Config/AppConfig.cs
@@ -37,6 +37,21 @@ namespace SlnMesnac.Config
///
public string logPath { get; set; }
+ ///
+ /// 可见光图像保存路径
+ ///
+ public string visibleRangePath { get; set; }
+
+ ///
+ /// 热成像图像保存路径
+ ///
+ public string infraredImagePath { get; set; }
+
+ ///
+ /// 录像保存路径
+ ///
+ public string videoFilePath { get; set; }
+
///
/// Sql连接配置
///
diff --git a/SlnMesnac.WPF/Page/IndexControl.xaml b/SlnMesnac.WPF/Page/IndexControl.xaml
index 136c402..1182319 100644
--- a/SlnMesnac.WPF/Page/IndexControl.xaml
+++ b/SlnMesnac.WPF/Page/IndexControl.xaml
@@ -566,7 +566,7 @@ Canvas.Left="175" Canvas.Top="155" Stroke="Transparent" StrokeThickness="1">
-
+
diff --git a/SlnMesnac.WPF/Page/IndexControl.xaml.cs b/SlnMesnac.WPF/Page/IndexControl.xaml.cs
index ad4737f..c53fa27 100644
--- a/SlnMesnac.WPF/Page/IndexControl.xaml.cs
+++ b/SlnMesnac.WPF/Page/IndexControl.xaml.cs
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
+using SlnMesnac.Config;
using SlnMesnac.Model.dto;
using SlnMesnac.Serilog;
using SlnMesnac.WPF.ViewModel;
@@ -31,6 +32,7 @@ namespace SlnMesnac.WPF.Page
{
private IndexControlViewModel indexControlViewModel = new IndexControlViewModel();
private SerilogHelper serilogHelper = null;
+ private AppConfig _appConfig = null;
private bool m_bInitSDK = false;
private Int32 m_lUserID = -1;
@@ -53,6 +55,7 @@ namespace SlnMesnac.WPF.Page
InitializeComponent();
this.DataContext = indexControlViewModel;
serilogHelper = App.ServiceProvider.GetService();
+ _appConfig = App.ServiceProvider.GetService();
_callback = new CHCNetSDK.RemoteConfigCallback(GetThermInfoCallback);
Task.Run(() =>
@@ -133,27 +136,37 @@ namespace SlnMesnac.WPF.Page
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文档
+ string sJpegPicFileName = $"{DateTime.Now.ToString("yyyyMMddHHmmssffff")}.jpg";
+ for (int i = 1; 1 < 3; i++){
+ CHCNetSDK.NET_DVR_JPEGPARA lpJpegPara = new CHCNetSDK.NET_DVR_JPEGPARA();
+ lpJpegPara.wPicQuality = 0;
+ lpJpegPara.wPicSize = 0xff;
+ var path = string.Empty;
+ if (i == 1)
+ {
+ path = $"{_appConfig.visibleRangePath}\\{sJpegPicFileName}";
+ }
+ else
+ {
+ path = $"{_appConfig.infraredImagePath}\\{sJpegPicFileName}";
+ }
- //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);
+ //JPEG抓图 Capture a JPEG picture
+ if (!CHCNetSDK.NET_DVR_CaptureJPEGPicture(m_lUserID, i, ref lpJpegPara, path))
+ {
+ var str = "高温报警,图像信息保存失败, error code= " + NET_DVR_GetLastError();
+ DebugInfo(str);
+ return;
+ }
+ else
+ {
+ var str = "高温报警,图像信息保存成功: " + path;
+ DebugInfo(str);
+ }
}
}
}
@@ -375,5 +388,90 @@ namespace SlnMesnac.WPF.Page
bAuto = false;
}
}
+
+ private bool is_automatic = false;
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void btn_automatic_MouseDown(object sender, MouseButtonEventArgs e)
+ {
+
+
+ if (!is_automatic)
+ {
+ MessageBox.Show("巡检模式开启");
+ btn_automatic.Background = new SolidColorBrush(Colors.LightBlue);
+ is_automatic = true;
+ string fileName = $"{DateTime.Now.ToString("yyyyMMddHHmmssffff")}.mp4";
+ Task.Run(() =>
+ {
+ var url = $"{_appConfig.videoFilePath}\\可见光\\{fileName}";
+ CHCNetSDK.NET_DVR_MakeKeyFrame(m_lUserID, 1);
+ if (!CHCNetSDK.NET_DVR_SaveRealData(m_lRealHandle_1, url))
+ {
+ var str = "可见光通道开启巡检录像失败, error code= " + NET_DVR_GetLastError();
+ DebugInfo(str);
+ return;
+ }
+ else
+ {
+ DebugInfo($"可见光通道开启巡检录像成功");
+ }
+ });
+
+ Task.Run(() =>
+ {
+ var url = $"{_appConfig.videoFilePath}\\热成像\\{fileName}";
+ CHCNetSDK.NET_DVR_MakeKeyFrame(m_lUserID, 2);
+ if (!CHCNetSDK.NET_DVR_SaveRealData(m_lRealHandle_2, url))
+ {
+ var str = "热成像通道开启巡检录像失败, error code= " + NET_DVR_GetLastError();
+ DebugInfo(str);
+ return;
+ }
+ else
+ {
+ DebugInfo($"热成像通道开启巡检录像成功");
+ }
+ });
+ }
+ else
+ {
+ //MessageBox.Show("巡检模式关闭");
+ btn_automatic.Background = new SolidColorBrush(Colors.Transparent);
+ is_automatic = false;
+
+
+ Task.Run(() =>
+ {
+ if (!CHCNetSDK.NET_DVR_StopSaveRealData(m_lRealHandle_1))
+ {
+ var str = "可见光通道关闭巡检录像失败, error code= " + NET_DVR_GetLastError();
+ DebugInfo(str);
+ return;
+ }
+ else
+ {
+ DebugInfo($"可见光通道关闭巡检录像成功");
+ }
+ });
+
+ Task.Run(() =>
+ {
+ if (!CHCNetSDK.NET_DVR_StopSaveRealData(m_lRealHandle_2))
+ {
+ var str = "热成像通道关闭巡检录像失败, error code= " + NET_DVR_GetLastError();
+ DebugInfo(str);
+ return;
+ }
+ else
+ {
+ DebugInfo($"热成像通道关闭巡检录像成功");
+ }
+ });
+ }
+ }
}
}
diff --git a/SlnMesnac.WPF/appsettings.json b/SlnMesnac.WPF/appsettings.json
index 1f18630..9ec5c2a 100644
--- a/SlnMesnac.WPF/appsettings.json
+++ b/SlnMesnac.WPF/appsettings.json
@@ -9,6 +9,9 @@
"AllowedHosts": "*",
"AppConfig": {
"logPath": "F:\\桌面\\赛轮智慧热电项目\\日志信息",
+ "visibleRangePath": "F:\\桌面\\赛轮智慧热电项目\\日志信息\\可见光图像",
+ "infraredImagePath": "F:\\桌面\\赛轮智慧热电项目\\日志信息\\红外热成像",
+ "videoFilePath": "F:\\桌面\\赛轮智慧热电项目\\日志信息\\巡检录像",
"SqlConfig": [
{
"configId": "mes",