|
|
@ -4,6 +4,7 @@ using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Windows;
|
|
|
|
using System.Windows;
|
|
|
@ -32,7 +33,8 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
private Int32 m_lRealHandle_2 = -1;
|
|
|
|
private Int32 m_lRealHandle_2 = -1;
|
|
|
|
public CHCNetSDK.NET_DVR_DEVICEINFO_V30 DeviceInfo;
|
|
|
|
public CHCNetSDK.NET_DVR_DEVICEINFO_V30 DeviceInfo;
|
|
|
|
public CHCNetSDK.NET_DVR_IPPARACFG_V40 m_struIpParaCfgV40;
|
|
|
|
public CHCNetSDK.NET_DVR_IPPARACFG_V40 m_struIpParaCfgV40;
|
|
|
|
private Int32 m_lTree = 0;
|
|
|
|
public CHCNetSDK.NET_DVR_PTZPOS m_struPtzCfg;
|
|
|
|
|
|
|
|
private bool bAuto = false;
|
|
|
|
|
|
|
|
|
|
|
|
private string DVRIPAddress = "192.168.1.64"; //设备IP地址或者域名 Device IP
|
|
|
|
private string DVRIPAddress = "192.168.1.64"; //设备IP地址或者域名 Device IP
|
|
|
|
private Int16 DVRPortNumber = 8000; //设备服务端口号 Device Port
|
|
|
|
private Int16 DVRPortNumber = 8000; //设备服务端口号 Device Port
|
|
|
@ -59,7 +61,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//保存SDK日志 To save the SDK log
|
|
|
|
//保存SDK日志 To save the SDK log
|
|
|
|
CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\SdkLog\\", true);
|
|
|
|
CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\SdkLog\\", true);
|
|
|
|
DebugInfo("热成像双光谱微型云台初始化成功 error!");
|
|
|
|
DebugInfo("热成像双光谱微型云台初始化成功!");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Open_Device();
|
|
|
|
Open_Device();
|
|
|
@ -203,5 +205,104 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
{
|
|
|
|
{
|
|
|
|
serilogHelper.Camera(str);
|
|
|
|
serilogHelper.Camera(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnUp_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.TILT_UP, 0, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnUp_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.TILT_UP, 1, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnDown_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.TILT_DOWN, 0, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnDown_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.TILT_DOWN, 1, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnLeft_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, (uint)CHCNetSDK.PAN_LEFT, 0, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnLeft_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.PAN_LEFT, 1, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnRight_MouseDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.PAN_RIGHT, 0, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnRight_MouseUp(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.PAN_RIGHT, 1, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btn_ptz_set_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bAuto)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.PAN_AUTO, 1, 4);
|
|
|
|
|
|
|
|
btnAuto.Text = "Auto";
|
|
|
|
|
|
|
|
bAuto = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float wPanPos, wTiltPos, wZoomPos;
|
|
|
|
|
|
|
|
var flag = 0;
|
|
|
|
|
|
|
|
m_struPtzCfg.wAction = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_struPtzCfg.wPanPos = (ushort)(Convert.ToUInt16("20", 16));
|
|
|
|
|
|
|
|
m_struPtzCfg.wTiltPos = (ushort)(Convert.ToUInt16("4", 16));
|
|
|
|
|
|
|
|
m_struPtzCfg.wZoomPos = (ushort)(Convert.ToUInt16("10", 16));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (flag == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Int32 nSize = Marshal.SizeOf(m_struPtzCfg);
|
|
|
|
|
|
|
|
IntPtr ptrPtzCfg = Marshal.AllocHGlobal(nSize);
|
|
|
|
|
|
|
|
Marshal.StructureToPtr(m_struPtzCfg, ptrPtzCfg, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!CHCNetSDK.NET_DVR_SetDVRConfig(m_lUserID, CHCNetSDK.NET_DVR_SET_PTZPOS, 1, ptrPtzCfg, (UInt32)nSize))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var str = "云台回零加载异常, error code= " + CHCNetSDK.NET_DVR_GetLastError();
|
|
|
|
|
|
|
|
//设置POS参数失败
|
|
|
|
|
|
|
|
DebugInfo(str);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DebugInfo("云台回零加载成功!");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Marshal.FreeHGlobal(ptrPtzCfg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btn_auto_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!bAuto)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.PAN_AUTO, 0, 4);
|
|
|
|
|
|
|
|
btnAuto.Text = "Stop";
|
|
|
|
|
|
|
|
bAuto = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CHCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle_1, CHCNetSDK.PAN_AUTO, 1, 4);
|
|
|
|
|
|
|
|
btnAuto.Text = "Auto";
|
|
|
|
|
|
|
|
bAuto = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|