|
|
|
@ -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<SerilogHelper>();
|
|
|
|
|
_appConfig = App.ServiceProvider.GetService<AppConfig>();
|
|
|
|
|
_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;
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
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($"热成像通道关闭巡检录像成功");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|