昨天上传了一个海康解码器视频上大屏的代码事例 因为最近也在弄大华的设备 所以也传一份事例 希望对大家有帮助 有问题或建议可私信我
同样的 传调用代码 及结构定义
1.调用代码
/// <视频上墙>
/// 视频上墙
/// 视频上墙>
///
public int VideoWall(string ip,int decoderID,string DecoderIP,string Name)
{
int res = 0;
try
{
int LoginID = 0;
int error = 0;
//是否已经注册过该设备(虚拟表中存在 则表明已经注册过)
DataRow[] loginRow = dlo.Select("IP='" + DecoderIP + "'");
//虚拟表中不存在(未注册)
if (loginRow.Count() == 0)
{
LoginID = DHClient.DHLogin(DecoderIP, 37777, "admin", "admin", out DHdeviceInfo, out error);
if (LoginID > 0)
{
//将注册的设备ip和注册的返回值加到虚拟表中
loRow = dlo.NewRow();
loRow["IP"] = DecoderIP;
loRow["LoginID"] = LoginID;
dlo.Rows.Add(loRow);
}
else
{
MessageBox.Show("解码器注册失败,请检查设备或网络状况", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return 0;
}
}
//虚拟表中存在
else if (loginRow.Count() > 0)
{
//读取出注册设备返回的id
LoginID = int.Parse(loginRow[0]["LoginID"].ToString());
}
if (LoginID > 0)
{
//查询解码器信息
DEV_DECODER_INFO lpdecoder_info = new DEV_DECODER_INFO();
bool ress = DHClient.DHQueryDecoderInfo(LoginID, out lpdecoder_info, 2000);
//添加视频上墙需要的设备信息
DEV_ENCODER_INFO lpencoder_info = new DEV_ENCODER_INFO();
lpencoder_info.byDecoderID = (byte)decoderID;
lpencoder_info.szDevIpEx = new byte[64];
lpencoder_info.szDevPwd = new byte[16];
lpencoder_info.szDevUser = new byte[16];
lpencoder_info.wDevPort = 37777;
lpencoder_info.nDevChannel = Convert.ToInt32(ip.Split(';')[1]); //通道
lpencoder_info.nStreamType = 0; //主码流
lpencoder_info.bDevChnEnable = 1;
lpencoder_info.byConnType = 0; //TCP
lpencoder_info.byWorkMode = 0; //直连
// System.Text.Encoding.Default.GetBytes(camip).CopyTo(lpencoder_info.szDevIpEx, 0);
System.Text.Encoding.Default.GetBytes(ip.Split(';')[0]).CopyTo(lpencoder_info.szDevIpEx, 0);
System.Text.Encoding.Default.GetBytes("admin").CopyTo(lpencoder_info.szDevPwd, 0);
System.Text.Encoding.Default.GetBytes("admin").CopyTo(lpencoder_info.szDevUser
//视频上墙
res = DHClient.DHSwitchDecTVEncoder(LoginID, decoderID, ref lpencoder_info, IntPtr.Zero);
}
}
catch (Exception ex)
{
fmessage.MessageRecord(ex.Message);
}
//设置成功 返回1
if (res > 0)
{
return 1;
}
//设置失败 返回0
else
{
return 0;
}
}
程序中 注册的ip会被储存到一个DataTable中 所以 代码中会出现查询LoginID 亲测可用
2.结构体 及调用方法的声明
/*
* ************************************************************************
*
* $Id: DaHuaSDKStruct.cs 6914 2012-11-09 04:58:08Z liu_hai $
*
* SDK
* 大华网络SDK(C#版)
*
* Copyright(c)1992-2012, ZheJiang Dahua Technology Stock Co.Ltd.
* All Rights Reserved
* 版 本 号:0.01
* 文件名称:DaHuaSDKStruct.cs
* 功能说明:原始封装[在现有的SDK(C++版)上再一次封装,基本与原C++接口对应]
* 作 者:刘海
* 作成日期:2012年5月26日
* 修改日志: 日期 版本号 作者 变更事由
* 2012年5月26日 0.01 刘海 新建作成
*
* ************************************************************************
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Net;
namespace Decoder
{
#region << 结构定义 >>
///
/// 录像文件信息
///
public struct NET_RECORDFILE_INFO
{
///
/// 通道号
///
public uint ch;
///
/// 文件名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] filename;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] filename;
//public string filename;
///
/// 文件长度
///
public uint size;
///
/// 开始时间
///
public NET_TIME starttime;
///
/// 结束时间
///
public NET_TIME endtime;
///
/// 磁盘号
///
public uint driveno;
///
/// 起始簇号
///
public uint startcluster;
///
/// 录像文件类型 0:普通录像;1:报警录
///
public int nRecordFileType;
}
///
/// 错误内容
///
public struct OPERATION_INFO
{
///
/// 错误代码
///
public string errCode;
///
/// 错误描述
///
public string errMessage;
///
/// 按自定义格式返回错误内容字符串
///
/// 错误内容字符串格式:errcode代替错误代码;errmsg代替错误描述
///
public string ToString(string FormatStyle)
{
string returnValue = FormatStyle;
if (returnValue.Length == 0)
{
returnValue = "errcode:errmsg!";
}
returnValue = returnValue.ToUpper();
returnValue = returnValue.Replace("ERRCODE", errCode).Replace("ERRMSG", errMessage);
return returnValue;
}
}
///
/// 设备状态信息
///
public struct NET_CLIENT_STATE
{
///
/// 通道数
///
public int channelcount;
///
/// 报警输入数
///
public int alarminputcount;
///
/// 外部报警
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] alarm;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] alarm;
///
/// 动态检测
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] motiondection;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] motiondection;
///
/// 视频丢失
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] videolost;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] videolost;
}
///
/// 设备通道状态信息
///
public struct NET_DEV_CHANNELSTATE
{
///
/// 通道是否在录像,0-不录像,1-录像
///
public byte byRecordStatic;
///
/// 连接的信号状态,0-正常,1-信号丢失
///
public byte bySignalStatic;
///
/// 通道硬件状态,0-正常,1-异常,例如DSP死掉
///
public byte byHardwareStatic;
///
/// 暂时无效
///
public char reserve;
///
/// 实际码率,暂时无效
///
public UInt32 dwBitRate;
///
/// 客户端连接的个数, 暂时无效
///
public UInt32 dwLinkNum;
///
/// 客户端的IP地址,暂时无效
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public UInt32[] dwClientIP;
}
///
/// 设备硬盘状态信息
///
public struct NET_DEV_DISKSTATE
{
///
/// 硬盘的容量
///
public UInt32 dwVolume;
///
/// 硬盘的剩余空间
///
public UInt32 dwFreeSpace;
///
/// 硬盘的状态,休眠,活动,不正常等
///
public UInt32 dwStatus;
}
///
/// 设备工作状态信息
///
public struct NET_DEV_WORKSTATE
{
///
/// 设备状态0x00 正常,0x01 CPU占用过高, 0x02 硬件错误
///
public UInt32 dwDeviceStatic;
///
/// 设备暂时不支持
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public NET_DEV_DISKSTATE[] stHardDiskStatic;
///
/// 通道的状态
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public NET_DEV_CHANNELSTATE[] stChanStatic;
///
/// 报警端口的状态0-无报警,1-有报警
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] byAlarmInStatic;
///
/// 报警输出端口的状态0-无输出,1-有输出
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] byAlarmOutStatic;
///
/// 本地显示状态0-正常,1-不正常
///
public UInt32 dwLocalDisplay;
}
///
/// 串口协议信息(232和485
///
public struct PROTOCOL_INFO
{
///
/// 协议名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 12)]
//public char[] protocolname;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public byte[] protocolname;
///
/// 波特率
///
public uint baudbase;
///
/// 数据位
///
public char databits;
///
/// 停止位
///
public char stopbits;
///
/// 校验位
///
public char parity;
///
/// 暂不支持
///
public char reserve;
}
///
/// 报警IO控制(报警输出和报警输入使能)
///
public struct ALARM_CONTROL
{
///
/// 端口序号
///
public ushort index;
///
/// 端口状态
///
public ushort state;
}
public struct OPR_RIGHT
{
public UInt32 dwID;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] name;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] memo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] memo;
}
///
/// 用户信息
///
public struct USER_INFO
{
public UInt32 dwID;
public UInt32 dwGroupID;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 8)]
//public char[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] name;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 8)]
//public char[] passWord;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] passWord;
public UInt32 dwRightNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
public UInt32[] rights;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] memo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] memo;
///
/// 本用户是否允许复用:1.复用;0:不复用;
///
public UInt32 dwReusable;
public USER_INFO(string st)
{
dwID = new UInt32();
dwGroupID = new UInt32();
dwRightNum = new UInt32();
dwReusable = new UInt32();
name = new byte[8];
passWord = new byte[8];
rights = new UInt32[100];
memo = new byte[32];
}
}
///
/// 用户组结构
///
public struct USER_GROUP_INFO
{
public UInt32 dwID;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 8)]
//public char[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] name;
public UInt32 dwRightNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
public UInt32[] rights;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] memo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] memo;
public USER_GROUP_INFO(string strP)
{
dwID = new UInt32();
name = new byte[8];
dwRightNum = new UInt32();
rights = new UInt32[100];
memo = new byte[32];
}
}
///
/// 用户信息配置结构
///
public struct USER_MANAGE_INFO
{
public UInt32 dwRightNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
public OPR_RIGHT[] rightList;
public UInt32 dwGroupNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public USER_GROUP_INFO[] groupList;
public UInt32 dwUserNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 200)]
public USER_INFO[] userList;
///
/// 特殊信息:1.支持用户复用;0.不支持用户复用;
///
public UInt32 dwSpecial;
}
///
/// 日志结构
///
public struct DH_LOG_ITEM
{
///
/// 日期
///
public NET_TIME time;
///
/// 类型
///
public UInt16 type;
///
/// 保留
///
public byte reserved;
///
/// 数据
///
public byte data;
///
/// 内容
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] context;
}
///
/// 查询硬盘信息的返回数据结构
///
public struct DH_HARDDISK_STATE
{
///
/// 硬盘个数
///
public UInt32 dwDiskNum;
///
/// 各硬盘信息
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public NET_DEV_DISKSTATE[] stDisks;
}
///
/// 音频数据的格式结构
///
public struct DH_AUDIO_FORMAT
{
///
/// 编码类型,0-PCM
///
public byte byFormatTag;
///
/// 声道数
///
public UInt16 nChannels;
///
/// 采样深度
///
public UInt16 wBitsPerSample;
///
/// 采样率
///
public UInt32 nSamplesPerSec;
}
///
/// 版本信息
/// 关于时间的数据组织是:yyyymmdd
///
public struct DH_VERSION_INFO
{
///
/// 版本号:高16位表示主版本号,低16位表示次版本号
///
public UInt32 dwSoftwareVersion;
///
/// 创建时间
///
public UInt32 dwSoftwareBuildDate;
///
/// DSP版本号
///
public UInt32 dwDspSoftwareVersion;
///
/// DSP版本创建时间
///
public UInt32 dwDspSoftwareBuildDate;
///
/// 面板版本
///
public UInt32 dwPanelVersion;
///
/// 面板软件创建日期
///
public UInt32 dwPanelSoftwareBuildDate;
///
/// 硬件版本
///
public UInt32 dwHardwareVersion;
///
/// 硬件制作日期
///
public UInt32 dwHardwareDate;
///
/// Web版本
///
public UInt32 dwWebVersion;
///
/// Web创建日期
///
public UInt32 dwWebBuildDate;
}
///
/// DSP能力描述
///
public struct DH_DSP_ENCODECAP
{
///
/// 视频制式掩码,按位表示设备能够支持的视频制式
///
public UInt32 dwVideoStandardMask;
///
/// 分辨率掩码,按位表示设备能够支持的分辨率设置
///
public UInt32 dwImageSizeMask;
///
/// 编码模式掩码,按位表示设备能够支持的编码模式设置
///
public UInt32 dwEncodeModeMask;
///
/// 按位表示设备支持的多媒体功能 第一位表示支持主码流,第二位表示支持辅码流1,第三位表示支持辅码流2,第四位表示支持jpg抓图
///
public UInt32 dwStreamCap;
///
/// 表示主码流为各分辨率时,支持的辅码流分辨率掩码
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public UInt32[] dwImageSizeMask_Assi;
///
/// DSP 支持的最高编码能力
///
public UInt32 dwMaxEncodePower;
///
/// 每块 DSP 支持最多输入视频通道数
///
public UInt16 wMaxSupportChannel;
///
/// DSP 每通道的最大编码设置是否同步 0-不同步, 1-同步
///
public UInt16 wChannelMaxSetSync;
}
///
/// 设备信息配置
///
public struct DHDEV_SYSTEM_ATTR_CFG
{
///
///
///
public UInt32 dwSize;
/*下面是设备的只读部分*/
///
/// 版本
///
public DH_VERSION_INFO stVersion;
///
/// DSP能力描述
///
public DH_DSP_ENCODECAP stDspEncodeCap;
///
/// 序列号
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
public byte[] szDevSerialNo;
///
/// 序列号转成字符串
///
///
public string DevSerialNo()
{
string result = "";
foreach (byte bt in szDevSerialNo)
{
result += bt.ToString("D");
}
return result;
}
///
/// 设备类型,见枚举NET_DEVICE_TYPE
///
public byte byDevType;
///
/// 显示标准备的设备类型描述
///
///
public string DevType()
{
string result = "";
switch (int.Parse(byDevType.ToString()))
{
case (int)NET_DEVICE_TYPE.NET_DVR_DDNS:
result = "DDNS服务器";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MEPG4_SH2:
result = "MPEG4视豪录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MEPG4_ST2:
result = "MPEG4视通录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG1_2:
result = "MPEG1二路录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG1_8:
result = "MPEG4八路录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG4_16:
result = "MPEG4十六录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG4_8:
result = "MPEG4八路录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG4_GBE:
result = "MPEG4视通二代增强型录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG4_NVSII:
result = "MPEG4网络视频服务器II代";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_MPEG4_SX2:
result = "MPEG4视新十六路录像机";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_NONREALTIME:
result = "非实时";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_NONREALTIME_MACE:
result = "非实时MACE";
break;
case (int)NET_DEVICE_TYPE.NET_DVR_STD_NEW:
result = "新标准配置协议";
break;
case (int)NET_DEVICE_TYPE.NET_NVS_MPEG1:
result = "网络视频服务器";
break;
case (int)NET_DEVICE_TYPE.NET_PRODUCT_NONE:
result = "无";
break;
}
return result;
}
///
/// 设备详细型号,字符串格式,可能为空
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szDevType;
///
/// 视频口数量
///
public byte byVideoCaptureNum;
///
/// 音频口数量
///
public byte byAudioCaptureNum;
///
/// NSP
///
public byte byTalkInChanNum;
///
/// NSP
///
public byte byTalkOutChanNum;
///
/// NSP
///
public byte byDecodeChanNum;
///
/// 报警输入口数
///
public byte byAlarmInNum;
///
/// 报警输出口数
///
public byte byAlarmOutNum;
///
/// 网络口数
///
public byte byNetIONum;
///
/// USB口数量
///
public byte byUsbIONum;
///
/// IDE数量
///
public byte byIdeIONum;
///
/// 串口数量
///
public byte byComIONum;
///
/// 并口数量
///
public byte byLPTIONum;
///
/// NSP
///
public byte byVgaIONum;
///
/// NSP
///
public byte byIdeControlNum;
///
/// NSP
///
public byte byIdeControlType;
///
/// NSP,扩展描述
///
public byte byCapability;
///
/// 视频矩阵输出口数
///
public byte byMatrixOutNum;
/*下面是设备的可写部分*/
///
/// 硬盘满处理方式(覆盖、停止)
///
public byte byOverWrite;
///
/// 录像打包长度
///
public byte byRecordLen;
///
/// NSP
///
public byte byStartChanNo;
///
/// 设备编号,用于遥控
///
public UInt16 wDevNo;
///
/// 视频制式
///
public byte byVideoStandard;
///
/// 日期格式
///
public byte byDateFormat;
///
/// 日期分割符(0-".", 1-"-", 2-"/")
///
public byte byDateSprtr;
///
/// 时间格式 (0-24小时,1-12小时)
///
public byte byTimeFmt;
///
/// 保留字
///
public byte byReserved;
}
///
/// 时间段结构
///
public struct DH_TSECT
{
public bool bEnable;
public int iBeginHour;
public int iBeginMin;
public int iBeginSec;
public int iEndHour;
public int iEndMin;
public int iEndSec;
}
///
/// 时间段结构[长度6]
///
public struct DH_REC_TSECT
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public DH_TSECT[] sTSECT;
}
///
/// 区域:各边距按整长8192的比例
///
public struct DH_RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
///
/// OSD属性结构
///
public struct DH_ENCODE_WIDGET
{
///
/// 物件的前景RGB,和透明度
///
public UInt32 rgbaFrontground;
///
/// 物件的后景RGB,和透明度
///
public UInt32 rgbaBackground;
///
/// 位置
///
public DH_RECT rcRect;
///
/// 物件显示
///
public byte bShow;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved;
}
///
/// 通道音视频属性
///
public struct DH_VIDEOENC_OPT
{
//视频参数
///
/// 视频使能:1-打开,0-关闭
///
public byte byVideoEnable;
///
/// 码流控制,参照常量定义
///
public byte byBitRateControl;
///
/// 帧率
///
public byte byFramesPerSec;
///
/// 编码模式,参照常量定义
///
public byte byEncodeMode;
///
/// 分辨率参,参照常量定义
///
public byte byImageSize;
///
/// 档次1-6
///
public byte byImageQlty;
///
/// 限码流参数, 范围:50~4*1024 (k)
///
public UInt16 wLimitStream;
//音频参数
///
/// 音频使能:1-打开,0-关闭
///
public byte byAudioEnable;
///
/// 编码类型,如PCM
///
public byte wFormatTag;
///
/// 声道数
///
public UInt16 nChannels;
///
/// 采样深度
///
public UInt16 wBitsPerSample;
///
/// 采样率
///
public UInt32 nSamplesPerSec;
///
/// 保留字
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] reserved;
}
///
/// 画面颜色属性
///
public struct DH_COLOR_CFG
{
public DH_TSECT stSect;
///
/// 亮度 0-100
///
public byte byBrightness;
///
/// 对比度 0-100
///
public byte byContrast;
///
/// 饱和度 0-100
///
public byte bySaturation;
///
/// 色度 0-100
///
public byte byHue;
///
/// 增益使能
///
public byte byGainEn;
///
/// 增益 0-100
///
public byte byGain;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved;
}
///
/// 图像通道属性结构体
///
public struct DHDEV_CHANNEL_CFG
{
public UInt32 dwSize;
///
///
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szChannelName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szChannelName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public DH_VIDEOENC_OPT[] stMainVideoEncOpt;
///
/// 通常指网传码流
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public DH_VIDEOENC_OPT[] stAssiVideoEncOpt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public DH_COLOR_CFG[] stColorCfg;
public DH_ENCODE_WIDGET stTimeOSD;
public DH_ENCODE_WIDGET stChannelOSD;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public DH_ENCODE_WIDGET[] stBlindCover;
///
/// 区域遮盖开关,0x00不使能遮盖,0x01仅遮盖,设备本地预览,0x10仅遮盖录像(及网络预览),0x11都遮盖
///
public byte byBlindEnable;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved;
}
///
/// 预览图像参数
///
public struct DHDEV_PREVIEW_CFG
{
public UInt32 dwSize;
public DH_VIDEOENC_OPT stPreView;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public DH_COLOR_CFG[] stColorCfg;
}
///
/// 语音对讲音频属性
///
public struct DHDEV_TALK_CFG
{
#region << 音频输入参数 >>
///
/// 编码类型,如PCM
///
public byte byInFormatTag;
///
/// 声道数
///
public byte byInChannels;
///
/// 采样深度
///
public UInt16 wInBitsPerSample;
///
/// 采样率
///
public UInt32 dwInSamplesPerSec;
#endregion
#region << 音频输出参数 >>
///
/// 编码类型,如PCM
///
public byte byOutFormatTag;
///
/// 声道数
///
public byte byOutChannels;
///
/// 采样深度
///
public UInt16 wOutBitsPerSample;
///
/// 采样率
///
public UInt32 dwOutSamplesPerSec;
#endregion
}
///
/// 定时录像
///
public struct DHDEV_RECORD_CFG
{
public UInt32 dwSize;
///
/// 时间段结构
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stSect;
///
/// 预录时间,单位是s,0表示不预录
///
public byte byPreRecordLen;
///
/// 录像冗余开关
///
public byte byRedundancyEn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved;
}
///
/// 报警配置
///
public struct DH_PTZ_LINK
{
public int iType;
public int iValue;
}
///
/// 消息触发配置
/// 消息处理方式,可以同时多种处理方式,包括
/// 0x00000001 - 网络:上传管理服务器
/// 0x00000002 - 录像:触发
/// 0x00000004 - 云台联动
/// 0x00000008 - 发送邮件
/// 0x00000010 - 设备本地报警轮巡
/// 0x00000020 - 设备提示使能
/// 0x00000040 - 设备报警输出使能
/// 0x00000080 - Ftp上传使能
/// 0x00000100 - 蜂鸣
/// 0x00000200 - 语音提示
/// 0x00000400 - 抓图使能
///
public struct DH_MSG_HANDLE
{
///
/// 当前报警所支持的处理方式,按位掩码表示
///
public UInt32 dwActionMask;
///
/// 触发动作,按位掩码表示,具体动作所需要的参数在各自的配置中体现
///
public UInt32 dwActionFlag;
///
/// 报警触发的输出通道,为 1 表示触发该输出
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] byRelAlarmOut;
///
/// 报警持续时间
///
public UInt32 dwDuration;
///
/// 联动录像 , 报警触发的录像通道,为1表示触发该通道
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] byRecordChannel;
///
/// 录像持续时间
///
public UInt32 dwRecLatch;
///
/// 抓图通道
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] bySnap;
///
/// 轮巡通道
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] byTour;
///
/// 云台联动
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_PTZ_LINK[] struPtzLink;
}
///
/// 外部报警
///
public struct DH_ALARMIN_CFG
{
///
/// 报警器类型,0:常闭,1:常开
///
public byte byAlarmType;
///
/// 报警使能
///
public byte byAlarmEn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struHandle;
}
///
/// 检测区域[长度16]
///
public struct DH_DETECT
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] Detected;
}
///
/// 动态检测
///
public struct DH_MOTION_DETECT_CFG
{
///
/// 动态检测报警使能
///
public byte byMotionEn;
public byte byReserved;
///
/// 灵敏度
///
public UInt16 wSenseLevel;
///
/// 动态检测区域的行数
///
public UInt16 wMotionRow;
///
/// 动态检测区域的列数
///
public UInt16 wMotionCol;
///
/// 检测区域,共32*32块区域
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public DH_DETECT[] byDetected;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struHandle;
}
///
/// 视频丢失报警
///
public struct DH_VIDEO_LOST_CFG
{
///
/// 视频丢失报警使能
///
public byte byAlarmEn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struHandle;
}
///
/// 图像遮挡报警
///
public struct DH_BLIND_CFG
{
///
/// 使能
///
public byte byBlindEnable;
///
/// 灵敏度1-6
///
public byte byBlindLevel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struHandle;
}
///
/// 硬盘消息(内部报警)
///
public struct DH_DISK_ALARM_CFG
{
///
/// 无硬盘时报警
///
public byte byNoDiskEn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved_1;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stNDSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struNDHandle;
///
/// 硬盘低容量时报警
///
public byte byLowCapEn;
///
/// 容量阀值 0-99
///
public byte byLowerLimit;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved_2;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stLCSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struLCHandle;
///
/// 硬盘故障报警
///
public byte byDiskErrEn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved_3;
///
/// NSP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
public DH_REC_TSECT[] stEDSect;
///
/// 处理方式
///
public DH_MSG_HANDLE struEDHandle;
}
public struct DH_NETBROKEN_ALARM_CFG
{
public byte byEnable;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved;
public DH_MSG_HANDLE struHandle;
}
///
/// 报警布防
///
public struct DHDEV_ALARM_SCHEDULE
{
public UInt32 dwSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_ALARMIN_CFG[] struLocalAlmIn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_ALARMIN_CFG[] struNetAlmIn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_MOTION_DETECT_CFG[] struMotion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_VIDEO_LOST_CFG[] struVideoLost;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_BLIND_CFG[] struBlind;
public DH_DISK_ALARM_CFG struDiskAlarm;
public DH_NETBROKEN_ALARM_CFG struNetBrokenAlarm;
}
///
/// 以太网配置
///
public struct DH_ETHERNET
{
///
/// DVR IP 地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sDevIPAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sDevIPAddr;
///
/// DVR IP 地址掩码
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sDevIPMask;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sDevIPMask;
///
/// 网关地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sGatewayIP;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sGatewayIP;
///
/// NSP
/// 10M/100M 自适应,索引
/// 1-10MBase - T
/// 2-10MBase-T 全双工
/// 3-100MBase - TX
/// 4-100M 全双工
/// 5-10M/100M 自适应
///
public UInt32 dwNetInterface;
///
/// MAC地址,只读
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 40)]
//public char[] byMACAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]
public byte[] byMACAddr;
}
///
/// 远程主机配置
///
public struct DH_REMOTE_HOST
{
///
/// 连接使能
///
public byte byEnable;
public byte byReserved;
///
/// 远程主机端口
///
public UInt16 wHostPort;
///
/// 远程主机 IP 地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sHostIPAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sHostIPAddr;
///
/// 远程主机 用户名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 64)]
//public char[] sHostUser;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] sHostUser;
///
/// 远程主机 密码
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] sHostPassword;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] sHostPassword;
}
///
/// 邮件配置
///
public struct DH_MAIL_CFG
{
///
/// 邮件服务器IP地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sMailIPAddr;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
public byte[] sMailIPAddr;
///
/// 邮件服务器端口
///
public UInt16 wMailPort;
///
/// 保留
///
public UInt16 wReserved;
///
/// 发送地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] sSenderAddr;
[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
public byte[] sSenderAddr;
///
/// 用户名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sUserName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sUserName;
/
/ 用户名的字符串
/
/
//public string UserName()
//{
// string result = "";
// foreach (char chr in sUserName)
// {
// if (chr != '\0')
// {
// result += chr.ToString();
// }
// }
// return result;
//}
///
/// 用户密码
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sUserPsw;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sUserPsw;
/
/ 用户密码的字符串
/
/
//public string UserPsw()
//{
// string result = "";
// foreach (char chr in sUserPsw)
// {
// if (chr != '\0')
// {
// result += chr.ToString();
// }
// }
// return result;
//}
///
/// 目的地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] sDestAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] sDestAddr;
///
/// 抄送地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] sCcAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] sCcAddr;
///
/// 抄送地址的字符串
///
///
public string CcAddr()
{
string result = "";
foreach (char chr in sCcAddr)
{
if (chr != '\0')
{
result += chr.ToString();
}
}
return result;
}
///
/// 暗抄地址
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] sBccAddr;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] sBccAddr;
///
/// 暗抄地址的字符串
///
///
public string BccAddr()
{
string result = "";
foreach (char chr in sBccAddr)
{
if (chr != '\0')
{
result += chr.ToString();
}
}
return result;
}
///
/// 标题
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 64)]
//public char[] sSubject;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] sSubject;
///
/// 标题的字符串
///
///
public string Subject()
{
string result = "";
foreach (byte chr in sSubject)
{
if (chr != '\0')
{
result += (char)chr;
}
}
return result;
}
}
///
/// 网络配置结构体
///
public struct DHDEV_NET_CFG
{
public UInt32 dwSize;
///
/// 设备主机名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sDevName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sDevName;
///
/// 设备主机名的字符串表达
///
/// 主机名的字符串
public string DevName()
{
string result = "";
foreach (char chr in sDevName)
{
if (chr != '\0')
{
result += chr.ToString();
}
}
return result;
}
///
/// TCP最大连接数(一般指视频数据请求数)
///
public UInt16 wTcpMaxConnectNum;
///
/// TCP帧听端口
///
public UInt16 wTcpPort;
///
/// UDP侦听端口
///
public UInt16 wUdpPort;
///
/// HTTP端口号
///
public UInt16 wHttpPort;
///
/// HTTPS端口号
///
public UInt16 wHttpsPort;
///
/// SSL端口号
///
public UInt16 wSslPort;
///
/// 以太网口
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public DH_ETHERNET[] stEtherNet;
///
/// 报警服务器
///
public DH_REMOTE_HOST struAlarmHost;
///
/// 日志服务器
///
public DH_REMOTE_HOST struLogHost;
///
/// SMTP服务器
///
public DH_REMOTE_HOST struSmtpHost;
///
/// 多播组
///
public DH_REMOTE_HOST struMultiCast;
///
/// NFS服务器
///
public DH_REMOTE_HOST struNfs;
///
/// PPPoE服务器
///
public DH_REMOTE_HOST struPppoe;
///
/// PPPoE注册返回的IP
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] sPppoeIP;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] sPppoeIP;
///
/// DDNS服务器
///
public DH_REMOTE_HOST struDdns;
///
/// DDNS主机名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 64)]
//public char[] sDdnsHostName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] sDdnsHostName;
///
/// DNS服务器
///
public DH_REMOTE_HOST struDns;
///
/// 邮件配置
///
public DH_MAIL_CFG struMail;
}
///
/// 串口基本属性
///
public struct DH_COMM_PROP
{
///
/// 数据位 0:5;1:6;2:7;3-8;
///
public byte byDataBit;
///
/// 停止位 0:1位;1:1.5位; 2:2位;
///
public byte byStopBit;
///
/// 校验位 0:不校验;1:奇校验; 2:偶校验;
///
public byte byParity;
///
/// 波特率 0:300;1:600;2:1200;3:2400;4:4800;5:9600;6:19200;7:38400;8:57600;9:115200;
///
public byte byBaudRate;
}
///
/// 485解码器配置
///
public struct DH_485_CFG
{
public DH_COMM_PROP struComm;
///
/// 协议类型 保存协议的下标,动态变化
///
public UInt16 wProtocol;
///
/// 解码器地址:0 - 255
///
public UInt16 wDecoderAddress;
}
///
/// 232串口配置
///
public struct DH_RS232_CFG
{
public DH_COMM_PROP struComm;
public byte byFunction; // 串口功能,对应串口配置取到的功能名列表
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved;
}
///
/// 协议名
///
public struct DH_PROANDFUN_NAME
{
///
/// 协议名[长度16]
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] ProName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] ProName;
}
///
/// 串口配置结构体
///
public struct DHDEV_COMM_CFG
{
///
/// 解码器协议
///
public UInt32 dwSize;
///
/// 协议个数
///
public UInt32 dwDecProListNum;
///
/// 协议名列表100
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
public DH_PROANDFUN_NAME[] DecProName;
///
/// 各解码器当前属性
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_485_CFG[] stDecoder;
///
/// 232功能个数
///
public UInt32 dw232FuncNameNum;
///
/// 功能名列表10*16
///
[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 10)]
public DH_PROANDFUN_NAME[] s232FuncName;
///
/// 各232串口当前属性
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public DH_RS232_CFG[] st232;
}
///
/// 自动维护属性
///
public struct DHDEV_AUTOMT_CFG
{
///
/// 自动重启
///
public UInt32 dwSize;
///
/// 自动重启日期设定 0:从不;1:每天;2:每星期日;3:每星期一;......
///
public byte byAutoRebootDay;
///
/// 自动重启时间设定 0:0:00;1:1:00;........23:23:00;
///
public byte byAutoRebootTime;
///
/// 自动删除文件 0:从不;1:24H;2:48H;3:72H;4:96H:5:一周;6:一月
///
public byte byAutoDeleteFilesTime;
///
/// 保留位
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
public byte[] reserved;
}
///
/// 本机控制策略配置
///
public struct DH_VIDEOGROUP_CFG
{
///
/// 视频输出 0:无效;1:设备通道数表示对应通道;设备通道数+1代表all;
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] byVideoOut;
///
/// 轮巡间隔,单位秒, 5-300
///
public int iInterval;
///
/// 是否轮巡
///
public byte byEnableTour;
///
/// 联动报警通道 0:无效;1:报警通道数表示对应通道;报警通道数+1代表1-4;报警通道数+2代表5-8...;参考本地界面
///
public byte byAlarmChannel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved;
}
///
/// 本机矩阵控制策略配置
///
public struct DHDEV_VIDEO_MATRIX_CFG
{
public UInt32 dwSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public DH_VIDEOGROUP_CFG[] struVideoGroup;
}
///
/// ddns配置
///
public struct DH_DDNS_SERVER_CFG
{
///
/// ddns服务器id号
///
public UInt32 dwId;
///
/// 使能,同一时间只能有一个ddns服务器处于使能状态
///
public bool bEnable;
///
/// 服务器类型,希网..
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szServerType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szServerType;
///
/// 服务器ip
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] szServerIp;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] szServerIp;
///
/// 服务器端口
///
public UInt32 dwServerPort;
///
/// dvr域名如jecke.3322.org
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 256)]
//public char[] szDomainName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public byte[] szDomainName;
///
/// 用户名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szUserName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szUserName;
///
/// 密码
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szUserPsw;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szUserPsw;
///
/// 服务器别名,如"dahua ddns"
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szAlias;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szAlias;
}
///
/// 多ddns配置
///
public struct DHDEV_MULTI_DDNS_CFG
{
public UInt32 dwSize;
public UInt32 dwDdnsServerNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public DH_DDNS_SERVER_CFG[] struDdnsServer;
}
///
/// 抓图功能配置
///
public struct DHDEV_SNAP_CFG
{
public UInt32 dwSize;
///
/// 定时抓图开关(报警抓图开关在各报警联动配置中体现)
///
public byte bTimingEnable;
public byte bReserved;
///
/// 定时抓图时间间隔,单位为秒,目前设备支持最大的抓图时间间隔为30分钟
///
public ushort PicTimeInterval;
///
/// 抓图编码配置,现支持其中的分辨率、画质、帧率设置,帧率在这里是负数,表示一秒抓图的次数。
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public DH_VIDEOENC_OPT[] struSnapEnc;
}
///
/// web路径配置
///
public struct DHDEV_URL_CFG
{
public UInt32 dwSize;
///
/// 是否抓图
///
public bool bSnapEnable;
///
/// 抓图周期
///
public int iSnapInterval;
///
/// HTTP主机IP
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] szHostIp;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] szHostIp;
public UInt16 wHostPort;
///
/// 状态消息发送间隔
///
public int iMsgInterval;
///
/// 状态消息上传URL
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] szUrlState;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] szUrlState;
///
/// 图片上传URL
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 128)]
//public char[] szUrlImage;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] szUrlImage;
///
/// 机器的web编号
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 48)]
//public char[] szDevId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
public byte[] szDevId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] byReserved;
}
///
///
///
public struct struPeriod
{
///
/// 该时间段内的“使能”无效,可忽略
///
public DH_TSECT struSect;
///
/// 上传动态检测录像
///
public bool bMdEn;
///
/// 上传外部报警录像
///
public bool bAlarmEn;
///
/// 上传普通定时录像
///
public bool bTimerEn;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public UInt32[] dwRev;
}
///
/// FTP上传配置
///
public struct DH_FTP_UPLOAD_CFG
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public struPeriod[] Period;
}
///
/// FTP上传配置
///
public struct DHDEV_FTP_PROTO_CFG
{
public UInt32 dwSize;
///
/// 是否启用
///
public bool bEnable;
///
/// 主机IP
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] szHostIp;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] szHostIp;
///
/// 主机端口
///
public UInt32 wHostPort;
///
/// FTP目录路径
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 240)]
//public char[] szDirName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 240)]
public byte[] szDirName;
///
/// 用户名
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 64)]
//public char[] szUserName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] szUserName;
///
/// 密码
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 64)]
//public char[] szPassword;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public byte[] szPassword;
///
/// 文件长度
///
public int iFileLen;
///
/// 相邻文件时间间隔
///
public int iInterval;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)]
public DH_FTP_UPLOAD_CFG[] struUploadCfg;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)]
public byte[] reserved;
}
///
/// 平台接入配置 - U网通平台
///
public struct DH_INTERVIDEO_UCOM_CHN_CFG
{
public bool bChnEn;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szChnId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szChnId;
}
///
/// 平台接入配置 - U网通平台
///
public struct DHDEV_INTERVIDEO_UCOM_CFG
{
public UInt32 dwSize;
///
/// 接入功能使能与否 0:使能
///
public bool bFuncEnable;
///
/// 心跳使能与否
///
public bool bAliveEnable;
///
/// 心跳周期,单位秒,0-3600
///
public UInt32 dwAlivePeriod;
///
/// CMS的IP
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] szServerIp;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] szServerIp;
///
/// CMS的Port
///
public UInt16 wServerPort;
///
/// 注册密码
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 16)]
//public char[] szRegPwd;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] szRegPwd;
///
/// 设备id
///
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szDeviceId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szDeviceId;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szUserName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szUserName;
//[MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.ByValTStr, SizeConst = 32)]
//public char[] szPassWord;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] szPassWord;
///
/// 通道id,en
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public DH_INTERVIDEO_UCOM_CHN_CFG[] struChnInfo;
}
// IP信息扩展
public struct DHDEV_IPIFILTER_INFO_EX
{
///
/// IP个数
///
public UInt32 dwIPNum;
///
/// IP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512 * 16)]
public byte[] SZIP;
///
/// 保留
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] byReserve;
} ;
// IP过滤配置结构体扩展
public struct DHDEV_IPIFILTER_CFG_EX
{
public UInt32 dwSize;
///
/// 使能
///
public UInt32 dwEnable;
///
/// 当前名单类型:0:白名单 1:黑名单(设备只能使一种名单生效,或者是白名单或者是黑名单)
///
public UInt32 dwType;
///
/// 黑名单
///
public DHDEV_IPIFILTER_INFO_EX BannedIP;
///
/// 白名单
///
public DHDEV_IPIFILTER_INFO_EX TrustIP;
///
/// 保留
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public byte[] byReserve;
}
// MAC,IP过滤信息
public struct MACIP_INFO
{
///
/// 使用时,用初始化为本结构体大小
///
public UInt32 dwSize;
///
/// MAC
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]
public byte[] szMac;
///
/// IP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] szIp;
}
// MAC,IP过滤配置结构体
public struct DHDEV_MACIPFILTER_CFG
{
///
/// 使用时,用初始化为本结构体大小
///
public UInt32 dwSize;
///
/// 使能
///
public UInt32 dwEnable;
///
/// 当前名单类型:0:白名单 1:黑名单(设备只能使一种名单生效,或者是白名单或者是黑名单)
///
public UInt32 dwType;
///
/// 黑名单MAC,IP个数(MAC,IP一一对应)
///
public UInt32 dwBannedMacIpNum;
///
/// 黑名单Mac,IP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
public MACIP_INFO[] stuBannedMacIp;
///
/// 白名单MAC,IP个数(MAC,IP一一对应)
///
public UInt32 dwTrustMacIpNum;
///
/// 白名单Mac,IP
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
public MACIP_INFO[] stuTrustMacIp;
}
///
/// 具体密钥信息36个字节
///
public struct ENCRYPT_KEY_INFO
{
///
/// 是否加密0:不加密, 1:加密
///
public byte byEncryptEnable;
///
/// 保留
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved;
///
/// union
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] byKey;
//public ENCRYPT_TYPE_UNION stuEncryptTypeUinon;
}
///
/// 加密算法参数
///
public struct ALGO_PARAM_INFO
{
///
/// 密钥长度,当前为AES算法类型时,表示密钥位数(目前支持128,192,256位三种,
/// 如: wEncryptLenth为128,则密钥信息ENCRYPT_KEY_INFO里的byAesKey[0]~[15])
/// 为DES算法类型时,密钥长度固定为64位
/// 为3DES算法类型时,表示密钥的个数(2或3个密钥)
///
public UInt16 wEncryptLenth;
///
/// 工作模式,参考枚举类型 EM_ENCRYPT_ALOG_WORKMODE
///
public byte byAlgoWorkMode;
///
/// 保留字段
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)]
public byte[] reserved;
}
///
/// 码流加密配置信息
///
public struct DHEDV_STREAM_ENCRYPT
{
///
/// 加密算法类型:00: AES、01:DES、02: 3DES
///
public byte byEncrptAlgoType;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] byReserved1;
///
/// 加密算法参数
///
public ALGO_PARAM_INFO stuEncrptAlgoparam;
///
/// 各通道的密钥信息
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public ENCRYPT_KEY_INFO[] stuEncryptKeys;
///
/// 保留
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1388)]
public byte[] reserved2;
}
#endregion
#region <<物体的检测模块配置--相关结构体>>
///
/// 区域顶点信息
///
public struct CFG_POLYGON
{
public Int32 nX; //0~8191
public Int32 nY;
}
///
/// Size
///
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Auto)]
public struct CFG_SIZE
{
///
/// 宽或面积(C++中是用union表示的)
///
[FieldOffset(0)]
public float nWidth;
[FieldOffset(0)]
public float nArea;
///
/// 高
///
[FieldOffset(4)]
public float nHeight;
}
///
/// 区域信息
///
public struct CFG_REGION
{
public Int32 nPointNum;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public CFG_POLYGON[] stuPolygon;
}
///
/// 校准框信息
///
public struct CFG_CALIBRATEBOX_INFO
{
///
/// 校准框中心点坐标(点的坐标归一化到[0,8191]区间)
///
public CFG_POLYGON stuCenterPoint;
///
/// 相对基准校准框的比率(比如1表示基准框大小,0.5表示基准框大小的一半)
///
public float fRatio;
}
///
/// 尺寸过滤器
///
public struct CFG_SIZEFILTER_INFO
{
///
/// 校准框个数
///
public Int32 nCalibrateBoxNum;
///
/// 校准框(远端近端标定模式下有效)
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public CFG_CALIBRATEBOX_INFO[] stuCalibrateBoxs;
///
/// 计量方式参数是否有效
///
public byte bMeasureModeEnable;
///
/// 计量方式,0-像素,不需要远端、近端标定, 1-实际长度,单位:米, 2-远端近端标定后的像素
///
public byte bMeasureMode;
///
/// 过滤类型参数是否有效
///
public byte bFilterTypeEnable;
// ByArea,ByRatio仅作兼容,使用独立的ByArea和ByRatio选项代替 2012/03/06
///
/// 过滤类型:0:"ByLength",1:"ByArea", 2"ByWidthHeight"
///
public byte bFilterType;
///
/// 保留字段
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] bReserved;
///
/// 物体最小尺寸参数是否有效
///
public byte bFilterMinSizeEnable;
///
/// 物体最大尺寸参数是否有效
///
public byte bFilterMaxSizeEnable;
///
/// 物体最小尺寸 "ByLength"模式下表示宽高的尺寸,"ByArea"模式下宽表示面积,高无效(远端近端标定模式下表示基准框的宽高尺寸)。
///
public CFG_SIZE stuFilterMinSize;
///
/// 物体最大尺寸 "ByLength"模式下表示宽高的尺寸,"ByArea"模式下宽表示面积,高无效(远端近端标定模式下表示基准框的宽高尺寸)。
///
public CFG_SIZE stuFilterMaxSize;
public byte abByArea;
public byte abMinArea;
public byte abMaxArea;
public byte abMinAreaSize;
public byte abMaxAreaSize;
///
/// 是否按面积过滤 通过能力ComplexSizeFilter判断是否可用
///
public byte bByArea;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] bReserved1;
///
/// 最小面积
///
public Int32 nMinArea;
///
/// 最大面积
///
public Int32 nMaxArea;
///
/// 最小面积矩形框尺寸 "计量方式"为"像素"时,表示最小面积矩形框的宽高尺寸;"计量方式"为"远端近端标定模式"时,表示基准框的最小宽高尺寸;
///
public CFG_SIZE stuMinAreaSize;
///
/// 最大面积矩形框尺寸, 同上
///
public CFG_SIZE stuMaxAreaSize;
public byte abByRatio;
public byte abMinRatio;
public byte abMaxRatio;
public byte abMinRatioSize;
public byte abMaxRatioSize;
///
/// 是否按宽高比过滤 通过能力ComplexSizeFilter判断是否可用
///
public byte bByRatio;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public byte[] bReserved2;
///
/// 最小宽高比
///
public double dMinRatio;
///
/// 最大宽高比
///
public double dMaxRatio;
///
/// 最小宽高比矩形框尺寸,最小宽高比对应矩形框的宽高尺寸。
///
public CFG_SIZE stuMinRatioSize;
///
/// 最大宽高比矩形框尺寸,同上
///
public CFG_SIZE stuMaxRatioSize;
///
/// 面积校准框个数
///
public Int32 nAreaCalibrateBoxNum;
///
/// 面积校准框
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public CFG_CALIBRATEBOX_INFO[] stuAreaCalibrateBoxs;
///
/// 宽高校准框个数
///
public Int32 nRatioCalibrateBoxs;
///
/// 宽高校准框个数
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public CFG_CALIBRATEBOX_INFO[] stuRatioCalibrateBoxs;
///
/// 长宽过滤使能参数是否有效
///
public byte abBySize;
///
/// 长宽过滤使能
///
public byte bBySize;
};
// 各种物体特定的过滤器
public struct CFG_OBJECT_SIZEFILTER_INFO
{
///
/// 物体类型
///
[MarshalAs(UnmanagedType.ByValArray, SizeConst =