C# 海康DVR客户端开发系列(2)—— 封装API
從上篇文章(10月4日)到本篇文章截止到今天(10月22日)一直在做這個SDK翻譯工作,耗時2周半,代碼超過1萬行,約有三分之二的行數是注釋。由于工作忙也只能一天抽出那么半個小時一個小時來整理,所以對關注此系列文章的朋友說句:“抱歉,讓大家久等了”。
臨時決定本系列使用WPF來做例子(買了一本WPF沒讀 - - #,所以......),藉此學習下WPF,也進一步熟悉.Net Framework 3.5,落伍的“老兵”奮起追擊下相對于“老兵”而言的新技術 :)??
其實這篇文章在10月22日就寫好了,但是想和視頻預覽文章一起發布,比較麻煩的是我這邊朋友的DVR一直不穩定,一直拖延到今天還是不行,所以還是把本文先發了。因此尋求能提供DVR設備的廠家或者提供DVR遠程訪問地址的朋友,以支持此系列能順利的完成,在這里先謝謝了!我的聯系方式:13811821337、over140@gmail.com
提醒
歡迎轉載,但請保留博客園(www.cnblogs.com)、農民伯伯(over140.cnblogs.com)的出處,謝謝合作:)
系列
1. C# 海康DVR客戶端開發系列(1)——準備
2. C# 海康DVR客戶端開發系列(2)—— 封裝API
更新
本文會隨著后續實踐文章有相應的改動,請及時更新!
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
?
正文一、代碼截圖
? VS?
二、 部分代碼
由于代碼過長(超過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?byte?bySendMode;
????????????///?<summary>
????????????///?解碼設備連接的服務器的通道號
????????????///?</summary>
????????????public?byte?byEncoderChannel;
????????????///?<summary>
????????????///?解碼設備連接的服務器的端口號
????????????///?</summary>
????????????public?ushort?wEncoderPort;
????????????///?<summary>
????????????///?保留
????????????///?????public?byte?reservedData[4];
????????????///?</summary>
????????????public?byte[]?reservedData;
????????}
????????///?<summary>
????????///?NET_DVR_DECODERSTATE,?*LPNET_DVR_DECODERSTATE;
????????///?</summary>
????????public?struct?NET_DVR_DECODERSTATE
????????{
????????????///?<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?byte?byEncoderChannel;
????????????///?<summary>
????????????///?解碼設備連接的服務器的連接模式
????????????///?</summary>
????????????public?byte?bySendMode;
????????????///?<summary>
????????????///?解碼設備連接的服務器的端口號
????????????///?</summary>
????????????public?ushort?wEncoderPort;
????????????///?<summary>
????????????///?解碼設備連接服務器的狀態
????????????///?</summary>
????????????public?uint?dwConnectState;
????????????///?<summary>
????????????///?保留
????????????///?????public?byte?reservedData[4];
????????????///?</summary>
????????????public?byte[]?reservedData;
????????}
????????#region?解碼設備控制碼定義
????????public?const?int?NET_DEC_STARTDEC?=?1;
????????public?const?int?NET_DEC_STOPDEC?=?2;
????????public?const?int?NET_DEC_STOPCYCLE?=?3;
????????public?const?int?NET_DEC_CONTINUECYCLE?=?4;
????????#endregion
????????#endregion
????????///?<summary>
????????///?????NET_DVR_EMAILPARA,?*LPNET_DVR_EMAILPARA;
????????///?</summary>
????????public?struct?NET_DVR_EMAILPARA
????????{
????????????///?<summary>
????????????///?郵件賬號
????????????///?????public?byte?sUsername[64];
????????????///?</summary>
????????????public?string?sUsername;
????????????///?<summary>
????????????///?郵件密碼
????????????///?????public?byte?sPassword[64];
????????????///?</summary>
????????????public?string?sPassword;
????????????///?<summary>
????????????///?????public?byte?sSmtpServer[64];
????????????///?</summary>
????????????public?string?sSmtpServer;
????????????///?<summary>
????????????///?????public?byte?sPop3Server[64];
????????????///?</summary>
????????????public?string?sPop3Server;
????????????///?<summary>
????????????///?郵件地址
????????????///?????public?byte?sMailAddr[64];
????????????///?</summary>
????????????public?string?sMailAddr;
????????????///?<summary>
????????????///?上傳報警/異常等的email
????????????///?????public?byte?sEventMailAddr1[64];
????????????///?</summary>
????????????public?byte[]?sEventMailAddr1;
????????????///?<summary>
????????????///?????public?byte?sEventMailAddr2[64];
????????????///?</summary>
????????????public?byte[]?sEventMailAddr2;
????????????///?<summary>
????????????///?????public?byte?res[16];
????????????///?</summary>
????????????public?byte[]?res;
????????}
????????///?<summary>
????????///?NET_DVR_NETCFG_OTHER,?*LPNET_DVR_NETCFG_OTHER;
????????///?</summary>
????????public?struct?NET_DVR_NETCFG_OTHER
????????{
????????????public?uint?dwSize;
????????????///?<summary>
????????????///?????char????sFirstDNSIP[16];
????????????///?</summary>
????????????public?string?sFirstDNSIP;
????????????///?<summary>
????????????///?????char????sSecondDNSIP[16];
????????????///?</summary>
????????????public?string?sSecondDNSIP;
????????????///?<summary>
????????????///?char????sRes[32];
????????????///?</summary>
????????????public?string?sRes;
????????}
????????///?<summary>
????????///?連接的通道配置?2007-11-05
????????///?????NET_DVR_MATRIX_DECCHANINFO,?*LPNET_DVR_MATRIX_DECCHANINFO;
????????///?</summary>
????????public?struct?NET_DVR_MATRIX_DECCHANINFO
????????{
????????????///?<summary>
????????????///?是否啟用?0-否?1-啟用
????????????///?</summary>
????????????public?uint?dwEnable;
????????????///?<summary>
????????????///?輪循解碼通道信息
????????????///?</summary>
????????????public?NET_DVR_MATRIX_DECINFO?struDecChanInfo;
????????}
????????///?<summary>
????????///?壓縮參數?
????????///?????NET_DVR_COMPRESSIONCFG_NEW,?*LPNET_DVR_COMPRESSIONCFG_NEW;
????????///?</summary>
????????public?struct?NET_DVR_COMPRESSIONCFG_NEW
????????{
????????????public?uint?dwSize;
????????????///?<summary>
????????????///?定時錄像
????????????///?</summary>
????????????public?NET_DVR_COMPRESSION_INFO_EX?struLowCompression;
????????????///?<summary>
????????????///?事件觸發錄像
????????????///?</summary>
????????????public?NET_DVR_COMPRESSION_INFO_EX?struEventCompression;
????????}
????????///?<summary>
????????///?抓圖模式
????????///?</summary>
????????public?enum?CAPTURE_MODE
????????{
????????????///?<summary>
????????????///?BMP模式
????????????///?</summary>
????????????BMP_MODE?=?0,????????//
????????????///?<summary>
????????????///?JPEG模式?
????????????///?</summary>
????????????JPEG_MODE?=?1????????//
????????}
????????///?<summary>
????????///?實時聲音模式
????????///?</summary>
????????public?enum?REALSOUND_MODE
????????{
????????????///?<summary>
????????????///?獨占模式
????????????///?</summary>
????????????MONOPOLIZE_MODE?=?1,
????????????///?<summary>
????????????///?共享模式
????????????///?</summary>
????????????SHARE_MODE?=?2
????????}
????????///?<summary>
????????///?錄象文件參數(帶卡號)
????????///?????NET_DVR_FINDDATA_CARD,?*LPNET_DVR_FINDDATA_CARD;
????????///?</summary>
????????public?struct?NET_DVR_FINDDATA_CARD
????????{
????????????///?<summary>
????????????///?文件名
????????????///?????char?sFileName[100];
????????????///?</summary>
????????????public?string?sFileName;
????????????///?<summary>
????????????///?文件的開始時間
????????????///?</summary>
????????????public?NET_DVR_TIME?struStartTime;
????????????///?<summary>
????????????///?文件的結束時間
????????????///?</summary>
????????????public?NET_DVR_TIME?struStopTime;
????????????///?<summary>
????????????///?文件的大小
????????????///?</summary>
????????????public?uint?dwFileSize;
????????????///?<summary>
????????????///?卡號?
????????????///?????char?sCardNum[32];
????????????///?</summary>
????????????public?char?sCardNum;
????????}
????????///?<summary>
????????///?設置重新連接間隔
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_SetReconnect(DWORD?dwInterval?=?30000,?BOOL?bEnableRecon?=?TRUE);
????????///?</summary>
????????///?<param?name="dwInterval"></param>
????????///?<param?name="bEnableRecon"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_SetReconnect(uint?dwInterval,?bool?bEnableRecon);
????????///?<summary>
????????///?通過IPSever獲取設備動態IP地址[Ex]
????????///?????NET_DVR_API?BOOL??__stdcall?NET_DVR_GetDVRIPByResolveSvr_EX(char?*sServerIP,?WORD?wServerPort,?unsigned?char?*sDVRName,?WORD?wDVRNameLen,?BYTE?*sDVRSerialNumber,?WORD?wDVRSerialLen,?char*?sGetIP,?DWORD?*dwPort);
????????///?</summary>
????????///?<param?name="sServerIP"></param>
????????///?<param?name="wServerPort"></param>
????????///?<param?name="sDVRName"></param>
????????///?<param?name="wDVRNameLen"></param>
????????///?<param?name="sDVRSerialNumber"></param>
????????///?<param?name="wDVRSerialLen"></param>
????????///?<param?name="sGetIP"></param>
????????///?<param?name="dwPort"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_GetDVRIPByResolveSvr_EX(string?sServerIP,?ushort?wServerPort,?string?sDVRName,?ushort?wDVRNameLen,?string?sDVRSerialNumber,?ushort?wDVRSerialLen,?StringBuilder?sGetIP,?ref?uint?dwPort);
????????///?<summary>
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_PTZControlWithSpeed_EX(LONG?lRealHandle,?DWORD?dwPTZCommand,?DWORD?dwStop,?DWORD?dwSpeed);
????????///?</summary>
????????///?<param?name="lRealHandle"></param>
????????///?<param?name="dwPTZCommand"></param>
????????///?<param?name="dwStop"></param>
????????///?<param?name="dwSpeed"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_PTZControlWithSpeed_EX(int?lRealHandle,?uint?dwPTZCommand,?uint?dwStop,?uint?dwSpeed);
????????///?<summary>
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_PTZMltTrack(LONG?lRealHandle,DWORD?dwPTZTrackCmd,?DWORD?dwTrackIndex);
????????///?</summary>
????????///?<param?name="lRealHandle"></param>
????????///?<param?name="dwPTZTrackCmd"></param>
????????///?<param?name="dwTrackIndex"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_PTZMltTrack(int?lRealHandle,?uint?dwPTZTrackCmd,?uint?dwTrackIndex);
????????///?<summary>
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_PTZMltTrack_Other(LONG?lUserID,LONG?lChannel,DWORD?dwPTZTrackCmd,?DWORD?dwTrackIndex);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<param?name="dwPTZTrackCmd"></param>
????????///?<param?name="dwTrackIndex"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_PTZMltTrack_Other(int?lUserID,?int?lChannel,?uint?dwPTZTrackCmd,?uint?dwTrackIndex);
????????///?<summary>
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_PTZMltTrack_EX(LONG?lRealHandle,DWORD?dwPTZTrackCmd,?DWORD?dwTrackIndex);
????????///?</summary>
????????///?<param?name="lRealHandle"></param>
????????///?<param?name="dwPTZTrackCmd"></param>
????????///?<param?name="dwTrackIndex"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_PTZMltTrack_EX(int?lRealHandle,?uint?dwPTZTrackCmd,?uint?dwTrackIndex);
????????///?<summary>
????????///?NET_DVR_API?LONG?__stdcall?NET_DVR_FindNextFile_Card(LONG?lFindHandle,?LPNET_DVR_FINDDATA_CARD?lpFindData);
????????///?</summary>
????????///?<param?name="lFindHandle"></param>
????????///?<param?name="lpFindData"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?int?NET_DVR_FindNextFile_Card(int?lFindHandle,?NET_DVR_FINDDATA_CARD?lpFindData);
????????///?<summary>
????????///?NET_DVR_API?LONG?__stdcall?NET_DVR_FindFile_Card(LONG?lUserID,?LONG?lChannel,?DWORD?dwFileType,?LPNET_DVR_TIME?lpStartTime,?LPNET_DVR_TIME?lpStopTime);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<param?name="dwFileType"></param>
????????///?<param?name="lpStartTime"></param>
????????///?<param?name="lpStopTime"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?int?NET_DVR_FindFile_Card(int?lUserID,?int?lChannel,?uint?dwFileType,?NET_DVR_TIME?lpStartTime,?NET_DVR_TIME?lpStopTime);
????????///?<summary>
????????///?NET_DVR_API?int????__stdcall?NET_DVR_GetPlayBackPos(LONG?lPlayHandle);
????????///?</summary>
????????///?<param?name="lPlayHandle"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?int?NET_DVR_GetPlayBackPos(int?lPlayHandle);
????????//解碼設備DS-6001D/DS-6001F
????????///?<summary>
????????///?NET_DVR_API?BOOL?__stdcall?NET_DVR_StartDecode(LONG?lUserID,?LONG?lChannel,?LPNET_DVR_DECODERINFO?lpDecoderinfo);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<param?name="lpDecoderinfo"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_StartDecode(int?lUserID,?int?lChannel,?NET_DVR_DECODERINFO?lpDecoderinfo);
????????///?<summary>
????????///?NET_DVR_API?BOOL?__stdcall?NET_DVR_StopDecode(LONG?lUserID,?LONG?lChannel);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_StopDecode(int?lUserID,?int?lChannel);
????????///?<summary>
????????///?NET_DVR_API?BOOL?__stdcall?NET_DVR_GetDecoderState(LONG?lUserID,?LONG?lChannel,?LPNET_DVR_DECODERSTATE?lpDecoderState);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<param?name="lpDecoderState"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_GetDecoderState(int?lUserID,?int?lChannel,?NET_DVR_DECODERSTATE?lpDecoderState);
????????///?<summary>
????????///?保存參數
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_SaveConfig(LONG?lUserID);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_SaveConfig(int?lUserID);
????????///?<summary>
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_SetVideoEffect(LONG?lUserID,?LONG?lChannel,?DWORD?dwBrightValue,?DWORD?dwContrastValue,?DWORD?dwSaturationValue,?DWORD?dwHueValue);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<param?name="dwBrightValue"></param>
????????///?<param?name="dwContrastValue"></param>
????????///?<param?name="dwSaturationValue"></param>
????????///?<param?name="dwHueValue"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_SetVideoEffect(int?lUserID,?int?lChannel,?uint?dwBrightValue,?uint?dwContrastValue,?uint?dwSaturationValue,?uint?dwHueValue);
????????///?<summary>
????????///?????NET_DVR_API?BOOL?__stdcall?NET_DVR_GetVideoEffect(LONG?lUserID,?LONG?lChannel,?DWORD?*pBrightValue,?DWORD?*pContrastValue,?DWORD?*pSaturationValue,?DWORD?*pHueValue);
????????///?</summary>
????????///?<param?name="lUserID"></param>
????????///?<param?name="lChannel"></param>
????????///?<param?name="pBrightValue"></param>
????????///?<param?name="pContrastValue"></param>
????????///?<param?name="pSaturationValue"></param>
????????///?<param?name="pHueValue"></param>
????????///?<returns></returns>
????????[DllImport("HCNetSDK.dll")]
????????public?static?extern?bool?NET_DVR_GetVideoEffect(int?lUserID,?int?lChannel,?out?uint?pBrightValue,?out?uint?pContrastValue,?out?uint?pSaturationValue,?out?uint?pHueValue); 三、下章預告
實現最基本的連接服務器并預覽圖像的功能。
結束語
首先我必須強調本章的翻譯是一個體力活!本章可能會再隨后的文章不斷的更新,主要是數據類型對應可能有問題,這里也是憑經驗來進行對應了,也歡迎有朋友盡早的向我提交勘誤,我好及時的更新文章。
總結
以上是生活随笔為你收集整理的C# 海康DVR客户端开发系列(2)—— 封装API的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在Flex3中使用Runtime Sha
- 下一篇: 30个最常用css选择器解析