更新
本文会随着后续实践文章有相应的改动,请及时更新!
2010-12-21 HCNetSDK2010-12-21.rar
主要更新了SerialDataCallBack委托的pRecvDataBuffer参数数据类型,由string改为byte[],这里感谢badnewfish实践后指出,欢迎大家积极反馈!
2009-10-31 HCNetSDK2009-10-31.rar
主要更新了大部分结构体中byte[]初始大小指定,加上了[MarshalAs(UnmanagedType.ByValArray, SizeConst = HCNetSDK.SERIALNO_LEN)]类似的标记。
2009-10-24 HCNetSDK.cs
正文
一、代码截图
二、 部分代码
由于代码过长(超过1W行),这里就不贴全部了,大家直接在更新下面下载最新的SDK即可。
///
设置码流速度
/// </summary>
public const int NET_DVR_SETSPEED = 24 ;
/// <summary>
/// 保持与设备的心跳(如果回调阻塞,建议2秒发送一次)
/// </summary>
public const int NET_DVR_KEEPALIVE = 25 ;
// 远程按键定义如下:
/* key value send to CONFIG program */
public const int KEY_CODE_1 = 1 ;
public const int KEY_CODE_2 = 2 ;
public const int KEY_CODE_3 = 3 ;
public const int KEY_CODE_4 = 4 ;
public const int KEY_CODE_5 = 5 ;
public const int KEY_CODE_6 = 6 ;
public const int KEY_CODE_7 = 7 ;
public const int KEY_CODE_8 = 8 ;
public const int KEY_CODE_9 = 9 ;
public const int KEY_CODE_0 = 10 ;
public const int KEY_CODE_POWER = 11 ;
public const int KEY_CODE_MENU = 12 ;
public const int KEY_CODE_ENTER = 13 ;
public const int KEY_CODE_CANCEL = 14 ;
public const int KEY_CODE_UP = 15 ;
public const int KEY_CODE_DOWN = 16 ;
public const int KEY_CODE_LEFT = 17 ;
public const int KEY_CODE_RIGHT = 18 ;
public const int KEY_CODE_EDIT = 19 ;
public const int KEY_CODE_ADD = 20 ;
public const int KEY_CODE_MINUS = 21 ;
public const int KEY_CODE_PLAY = 22 ;
public const int KEY_CODE_REC = 23 ;
public const int KEY_CODE_PAN = 24 ;
public const int KEY_CODE_M = 25 ;
public const int KEY_CODE_A = 26 ;
public const int KEY_CODE_F1 = 27 ;
public const int KEY_CODE_F2 = 28 ;
/* for PTZ control */
public const int KEY_PTZ_UP_START = KEY_CODE_UP;
public const int KEY_PTZ_UP_STOP = 32 ;
public const int KEY_PTZ_DOWN_START = KEY_CODE_DOWN;
public const int KEY_PTZ_DOWN_STOP = 33 ;
public const int KEY_PTZ_LEFT_START = KEY_CODE_LEFT;
public const int KEY_PTZ_LEFT_STOP = 34 ;
public const int KEY_PTZ_RIGHT_START = KEY_CODE_RIGHT;
public const int KEY_PTZ_RIGHT_STOP = 35 ;
/// <summary>
/// 光圈+
/// </summary>
public const int KEY_PTZ_AP1_START = KEY_CODE_EDIT; /* 光圈+ */
public const int KEY_PTZ_AP1_STOP = 36 ;
/// <summary>
/// 光圈-
/// </summary>
public const int KEY_PTZ_AP2_START = KEY_CODE_PAN; /* 光圈- */
public const int KEY_PTZ_AP2_STOP = 37 ;
/// <summary>
/// 聚焦+
/// </summary>
public const int KEY_PTZ_FOCUS1_START = KEY_CODE_A; /* 聚焦+ */
public const int KEY_PTZ_FOCUS1_STOP = 38 ;
/// <summary>
/// 聚焦-
/// </summary>
public const int KEY_PTZ_FOCUS2_START = KEY_CODE_M; /* 聚焦- */
public const int KEY_PTZ_FOCUS2_STOP = 39 ;
/// <summary>
/// 变倍+
/// </summary>
public const int KEY_PTZ_B1_START = 40 ; /* 变倍+ */
public const int KEY_PTZ_B1_STOP = 41 ;
/// <summary>
/// 变倍-
/// </summary>
public const int KEY_PTZ_B2_START = 42 ; /* 变倍- */
public const int KEY_PTZ_B2_STOP = 43 ;
// 9000新增
public const int KEY_CODE_11 = 44 ;
public const int KEY_CODE_12 = 45 ;
public const int KEY_CODE_13 = 46 ;
public const int KEY_CODE_14 = 47 ;
public const int KEY_CODE_15 = 48 ;
public const int KEY_CODE_16 = 49 ;
/// <summary>
/// 获取网络应用参数 EMAIL
/// </summary>
public const int NET_DVR_GET_EMAILCFG = 228 ; //
/// <summary>
/// 设置网络应用参数 EMAIL
/// </summary>
public const int NET_DVR_SET_EMAILCFG = 229 ; //
// 对应NET_DVR_EMAILCFG结构
//
public const int NET_DVR_GET_ALLHDCFG = 300 ; //
#region DS9000新增命令(_V30)
// 设备编码类型配置(NET_DVR_COMPRESSION_AUDIO结构)
/// <summary>
/// 获取设备语音对讲编码参数
/// </summary>
public const int NET_DVR_GET_COMPRESSCFG_AUD = 1058 ; //
/// <summary>
/// 设置设备语音对讲编码参数
/// </summary>
public const int NET_DVR_SET_COMPRESSCFG_AUD = 1059 ; //
#endregion
/// <summary>
/// 预览异常
/// </summary>
public const int NET_DVR_REALPLAYEXCEPTION = 111 ; //
/// <summary>
/// 预览时连接断开
/// </summary>
public const int NET_DVR_REALPLAYNETCLOSE = 112 ; //
/// <summary>
/// 预览5s没有收到数据
/// </summary>
public const int NET_DVR_REALPLAY5SNODATA = 113 ; //
/// <summary>
/// 预览重连
/// </summary>
public const int NET_DVR_REALPLAYRECONNECT = 114 ; //
/// <summary>
/// 回放数据播放完毕
/// </summary>
public const int NET_DVR_PLAYBACKOVER = 101 ; //
/// <summary>
/// 回放异常
/// </summary>
public const int NET_DVR_PLAYBACKEXCEPTION = 102 ; //
/// <summary>
/// 回放时候连接断开
/// </summary>
public const int NET_DVR_PLAYBACKNETCLOSE = 103 ; //
/// <summary>
/// 回放5s没有收到数据
/// </summary>
public const int NET_DVR_PLAYBACK5SNODATA = 104 ;
#region DS-6001D/F
/// <summary>
/// DS-6001D Decoder
/// NET_DVR_DECODERINFO, *LPNET_DVR_DECODERINFO;
/// </summary>
public struct NET_DVR_DECODERINFO
{
/// <summary>
/// 解码设备连接的服务器IP
/// public byte byEncoderIP[16];
/// </summary>
public byte [] byEncoderIP;
/// <summary>
/// 解码设备连接的服务器的用户名
/// public byte byEncoderUser[16];
/// </summary>
public byte [] byEncoderUser;
/// <summary>
/// 解码设备连接的服务器的密码
/// public byte byEncoderPasswd[16];
/// </summary>
public byte [] byEncoderPasswd;
/// <summary>
/// 解码设备连接服务器的连接模式
/// </summary>
public const int NET_DVR_SETSPEED = 24 ;
/// <summary>
/// 保持与设备的心跳(如果回调阻塞,建议2秒发送一次)
/// </summary>
public const int NET_DVR_KEEPALIVE = 25 ;
// 远程按键定义如下:
/* key value send to CONFIG program */
public const int KEY_CODE_1 = 1 ;
public const int KEY_CODE_2 = 2 ;
public const int KEY_CODE_3 = 3 ;
public const int KEY_CODE_4 = 4 ;
public const int KEY_CODE_5 = 5 ;
public const int KEY_CODE_6 = 6 ;
public const int KEY_CODE_7 = 7 ;
public const int KEY_CODE_8 = 8 ;
public const int KEY_CODE_9 = 9 ;
public const int KEY_CODE_0 = 10 ;
public const int KEY_CODE_POWER = 11 ;
public const int KEY_CODE_MENU = 12 ;
public const int KEY_CODE_ENTER = 13 ;
public const int KEY_CODE_CANCEL = 14 ;
public const int KEY_CODE_UP = 15 ;
public const int KEY_CODE_DOWN = 16 ;
public const int KEY_CODE_LEFT = 17 ;
public const int KEY_CODE_RIGHT = 18 ;
public const int KEY_CODE_EDIT = 19 ;
public const int KEY_CODE_ADD = 20 ;
public const int KEY_CODE_MINUS = 21 ;
public const int KEY_CODE_PLAY = 22 ;
public const int KEY_CODE_REC = 23 ;
public const int KEY_CODE_PAN = 24 ;
public const int KEY_CODE_M = 25 ;
public const int KEY_CODE_A = 26 ;
public const int KEY_CODE_F1 = 27 ;
public const int KEY_CODE_F2 = 28 ;
/* for PTZ control */
public const int KEY_PTZ_UP_START = KEY_CODE_UP;
public const int KEY_PTZ_UP_STOP = 32 ;
public const int KEY_PTZ_DOWN_START = KEY_CODE_DOWN;
public const int KEY_PTZ_DOWN_STOP = 33 ;
public const int KEY_PTZ_LEFT_START = KEY_CODE_LEFT;
public const int KEY_PTZ_LEFT_STOP = 34 ;
public const int KEY_PTZ_RIGHT_START = KEY_CODE_RIGHT;
public const int KEY_PTZ_RIGHT_STOP = 35 ;
/// <summary>
/// 光圈+
/// </summary>
public const int KEY_PTZ_AP1_START = KEY_CODE_EDIT; /* 光圈+ */
public const int KEY_PTZ_AP1_STOP = 36 ;
/// <summary>
/// 光圈-
/// </summary>
public const int KEY_PTZ_AP2_START = KEY_CODE_PAN; /* 光圈- */
public const int KEY_PTZ_AP2_STOP = 37 ;
/// <summary>
/// 聚焦+
/// </summary>
public const int KEY_PTZ_FOCUS1_START = KEY_CODE_A; /* 聚焦+ */
public const int KEY_PTZ_FOCUS1_STOP = 38 ;
/// <summary>
/// 聚焦-
/// </summary>
public const int KEY_PTZ_FOCUS2_START = KEY_CODE_M; /* 聚焦- */
public const int KEY_PTZ_FOCUS2_STOP = 39 ;
/// <summary>
/// 变倍+
/// </summary>
public const int KEY_PTZ_B1_START = 40 ; /* 变倍+ */
public const int KEY_PTZ_B1_STOP = 41 ;
/// <summary>
/// 变倍-
/// </summary>
public const int KEY_PTZ_B2_START = 42 ; /* 变倍- */
public const int KEY_PTZ_B2_STOP = 43 ;
// 9000新增
public const int KEY_CODE_11 = 44 ;
public const int KEY_CODE_12 = 45 ;
public const int KEY_CODE_13 = 46 ;
public const int KEY_CODE_14 = 47 ;
public const int KEY_CODE_15 = 48 ;
public const int KEY_CODE_16 = 49 ;
/// <summary>
/// 获取网络应用参数 EMAIL
/// </summary>
public const int NET_DVR_GET_EMAILCFG = 228 ; //
/// <summary>
/// 设置网络应用参数 EMAIL
/// </summary>
public const int NET_DVR_SET_EMAILCFG = 229 ; //
// 对应NET_DVR_EMAILCFG结构
//
public const int NET_DVR_GET_ALLHDCFG = 300 ; //
#region DS9000新增命令(_V30)
// 设备编码类型配置(NET_DVR_COMPRESSION_AUDIO结构)
/// <summary>
/// 获取设备语音对讲编码参数
/// </summary>
public const int NET_DVR_GET_COMPRESSCFG_AUD = 1058 ; //
/// <summary>
/// 设置设备语音对讲编码参数
/// </summary>
public const int NET_DVR_SET_COMPRESSCFG_AUD = 1059 ; //
#endregion
/// <summary>
/// 预览异常
/// </summary>
public const int NET_DVR_REALPLAYEXCEPTION = 111 ; //
/// <summary>
/// 预览时连接断开
/// </summary>
public const int NET_DVR_REALPLAYNETCLOSE = 112 ; //
/// <summary>
/// 预览5s没有收到数据
/// </summary>
public const int NET_DVR_REALPLAY5SNODATA = 113 ; //
/// <summary>
/// 预览重连
/// </summary>
public const int NET_DVR_REALPLAYRECONNECT = 114 ; //
/// <summary>
/// 回放数据播放完毕
/// </summary>
public const int NET_DVR_PLAYBACKOVER = 101 ; //
/// <summary>
/// 回放异常
/// </summary>
public const int NET_DVR_PLAYBACKEXCEPTION = 102 ; //
/// <summary>
/// 回放时候连接断开
/// </summary>
public const int NET_DVR_PLAYBACKNETCLOSE = 103 ; //
/// <summary>
/// 回放5s没有收到数据
/// </summary>
public const int NET_DVR_PLAYBACK5SNODATA = 104 ;
#region DS-6001D/F
/// <summary>
/// DS-6001D Decoder
/// NET_DVR_DECODERINFO, *LPNET_DVR_DECODERINFO;
/// </summary>
public struct NET_DVR_DECODERINFO
{
/// <summary>
/// 解码设备连接的服务器IP
/// public byte byEncoderIP[16];
/// </summary>
public byte [] byEncoderIP;
/// <summary>
/// 解码设备连接的服务器的用户名
/// public byte byEncoderUser[16];
/// </summary>
public byte [] byEncoderUser;
/// <summary>
/// 解码设备连接的服务器的密码
/// public byte byEncoderPasswd[16];
/// </summary>
public byte [] byEncoderPasswd;
/// <summary>
/// 解码设备连接服务器的连接模式
本文转自over140 51CTO博客,原文链接:http://blog.51cto.com/over140/586618,如需转载请自行联系原作者