Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- namespace DVRtest
- {
- class Program
- {
- [STAThread]
- static void Main(string[] args)
- {
- long userid = 0;
- _net_sdk_deviceinfo dinfo = new _net_sdk_deviceinfo();
- short port = 6036;
- try
- {
- if (DVR.NET_SDK_Init())
- {
- Console.WriteLine("ok");
- userid = DVR.NET_SDK_Login("192.168.1.132", port, "admin", "123456", out dinfo);
- userid.ToString();
- }
- else
- {
- Console.WriteLine("err");
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- Console.ReadKey();
- }
- }
- public class DVR
- {
- [DllImport("DVR_NET_SDK.dll", CallingConvention = CallingConvention.Cdecl)]
- public static extern long NET_SDK_Login([MarshalAs(UnmanagedType.LPStr)] string sDVRIP, short wDVRPort, [MarshalAs(UnmanagedType.LPStr)] string sUserName, [MarshalAs(UnmanagedType.LPStr)] string sPassword, out _net_sdk_deviceinfo devinfo);
- [DllImport("DVR_NET_SDK.dll", CallingConvention = CallingConvention.Cdecl)]
- public static extern bool NET_SDK_CapturePicture_Other(short userID, short channel, StringBuilder filename);
- [DllImport("DVR_NET_SDK.dll", CallingConvention = CallingConvention.Cdecl)]
- public static extern bool NET_SDK_Init();
- //public static extern bool NET_SDK_GetSDKVersion();
- }
- public struct _net_sdk_deviceinfo
- {
- byte localVideoInputNum; //±ľµŘĘÓƵĘäČëͨµŔĘýÄż
- byte audioInputNum; //ŇôƵĘäČëͨµŔĘýÄż
- byte sensorInputNum; //´«¸ĐĆ÷ĘäČëͨµŔĘýÄż
- byte sensorOutputNum; //ĽĚµçĆ÷ĘäłöĘýÄż
- uint displayResolutionMask; //ĽŕĘÓĆ÷żÉѡÔńµÄ·Ö±ćÂĘ
- byte videoOuputNum; //ĘÓƵĘäłöĘýÄżŁ¨Ľ°Ö§łÖ»Ř·Ĺ×î´óͨµŔĘýŁ©
- byte netVideoOutputNum; //ÍřÂç»Ř·Ĺ×î´óͨµŔĘýÄż
- byte netVideoInputNum; //Ęý×ÖĐźŽÓČëͨµŔĘýÄż
- byte IVSNum; //ÖÇÄÜ·ÖÎöͨµŔĘýÄż
- byte presetNumOneCH; //Ăż¸öͨµŔÔ¤ÖõăĘýÄż
- byte cruiseNumOneCH; //Ăż¸öͨµŔѲş˝ĎßĘýÄż
- byte presetNumOneCruise; //Ăż¸öѲş˝ĎßµÄÔ¤ÖõăĘýÄż
- byte trackNumOneCH; //Ăż¸öͨµŔąěĽŁĘýÄż
- byte userNum; //ÓĂ»§ĘýÄż
- byte netClientNum; //×î¶ŕżÍ»§¶ËĘýÄż
- byte netFirstStreamNum; //Ö÷ÂëÁ÷´«ĘäµÄͨµŔ×î´óĘýÄżŁ¬Ľ´Í¬Ę±żÉŇÔÓĐĽ¸¸öżÍ»§¶Ë˛éż´Ö÷ÂëÁ÷
- byte deviceType; //É豸ŔŕĐÍ
- byte doblueStream; //ĘÇ·ńÓĐĚáą©Ë«ÂëÁ÷
- byte audioStream; //ĘÇ·ńÓĐĚáą©ŇôƵÁ÷
- byte talkAudio; //ĘÇ·ńÓжԽ˛ą¦ÄÜ: 1±íĘľÓжԽ˛ą¦ÄÜ;0±íʾûÓĐ
- byte bPasswordCheck; //˛Ů×÷ĘÇ·ńŇŞĘäČëĂÜÂë
- byte defBrightness; //ȱʡÁÁ¶Č
- byte defContrast; //ȱʡ¶Ô±Č¶Č
- byte defSaturation; //ȱʡ±ĄşÍ¶Č
- byte defHue; //ȱʡɫµ÷
- short videoInputNum; //ĘÓƵĘäČëͨµŔĘýÄżŁ¨±ľµŘĽÓÍřÂ磩
- short deviceID; //É豸IDşĹ
- uint videoFormat; //ϵͳµ±Ç°ÖĆĘ˝
- //ĽŮČçĘÇFUNC_REMOTE_UPGRADE¶ÔÓ¦µÄą¦ÄÜŁ¬ÄÇĂ´µÚFUNC_REMOTE_UPGRADE¸ö±ČĚŘÎŞ1Ł¬·ńÔňÎŞÁ㡣
- uint function; //ą¦ÄÜĂčĘö
- uint deviceIP; //É豸ÍřÂçµŘÖ·
- byte deviceMAC; //É豸ÎďŔíµŘÖ·
- ushort devicePort; //É豸¶ËżÚ
- uint buildDate; //´´˝¨ČŐĆÚ:year<<16 + month<<8 + mday
- uint buildTime; //´´˝¨Ę±Ľä:hour<<16 + min<<8 + sec
- char deviceName; //É豸ĂűłĆ
- char firmwareVersion; //ąĚĽţ°ć±ľ
- char kernelVersion; //Äں˰汾
- char hardwareVersion; //Ó˛Ľţ°ć±ľ
- char MCUVersion; //µĄĆ¬»ú°ć±ľ
- };
- enum status
- {
- NET_SDK_SUCCESS,
- NET_SDK_PASSWORD_ERROR,
- NET_SDK_NOENOUGH_AUTH,
- NET_SDK_NOINIT,
- NET_SDK_CHANNEL_ERROR,
- NET_SDK_OVER_MAXLINK,
- NET_SDK_LOGIN_REFUSED,
- NET_SDK_VERSION_NOMATCH,
- NET_SDK_NETWORK_FAIL_CONNECT,
- NET_SDK_NETWORK_NOT_CONNECT,
- NET_SDK_NETWORK_SEND_ERROR,
- NET_SDK_NETWORK_RECV_ERROR,
- NET_SDK_NETWORK_RECV_TIMEOUT,
- NET_SDK_NETWORK_ERRORDATA,
- NET_SDK_ORDER_ERROR,
- NET_SDK_OPER_BY_OTHER,
- NET_SDK_OPER_NOPERMIT,
- NET_SDK_COMMAND_TIMEOUT,
- NET_SDK_ERROR_SERIALPORT,
- NET_SDK_ERROR_ALARMPORT,
- NET_SDK_PARAMETER_ERROR,
- NET_SDK_CHAN_EXCEPTION,
- NET_SDK_NODISK,
- NET_SDK_ERROR_DISKNUM,
- NET_SDK_DISK_FULL,
- NET_SDK_DISK_ERROR,
- NET_SDK_NOSUPPORT,
- NET_SDK_BUSY,
- NET_SDK_MODIFY_FAIL,
- NET_SDK_PASSWORD_FORMAT_ERROR,
- NET_SDK_DISK_FORMATING,
- NET_SDK_DVR_NORESOURCE,
- NET_SDK_DVR_OPRATE_FAILED,
- NET_SDK_OPEN_HOSTSOUND_FAIL,
- NET_SDK_DVR_VOICEOPENED,
- NET_SDK_TIME_INPUTERROR,
- NET_SDK_NOSPECFILE,
- NET_SDK_CREATEFILE_ERROR,
- NET_SDK_FILEOPENFAIL,
- NET_SDK_OPERNOTFINISH,
- NET_SDK_GETPLAYTIMEFAIL,
- NET_SDK_PLAYFAIL,
- NET_SDK_FILEFORMAT_ERROR,
- NET_SDK_DIR_ERROR,
- NET_SDK_ALLOC_RESOURCE_ERROR,
- NET_SDK_AUDIO_MODE_ERROR,
- NET_SDK_NOENOUGH_BUF,
- NET_SDK_CREATESOCKET_ERROR,
- NET_SDK_SETSOCKET_ERROR,
- NET_SDK_MAX_NUM,
- NET_SDK_USERNOTEXIST,
- NET_SDK_WRITEFLASHERROR,
- NET_SDK_UPGRADEFAIL,
- NET_SDK_CARDHAVEINIT,
- NET_SDK_PLAYERFAILED,
- NET_SDK_MAX_USERNUM,
- NET_SDK_GETLOCALIPANDMACFAIL,
- NET_SDK_NOENCODEING,
- NET_SDK_IPMISMATCH,
- NET_SDK_MACMISMATCH,
- NET_SDK_UPGRADELANGMISMATCH,
- NET_SDK_MAX_PLAYERPORT,
- NET_SDK_NOSPACEBACKUP,
- NET_SDK_NODEVICEBACKUP,
- NET_SDK_PICTURE_BITS_ERROR,
- NET_SDK_PICTURE_DIMENSION_ERROR,
- NET_SDK_PICTURE_SIZ_ERROR,
- NET_SDK_LOADPLAYERSDKFAILED,
- NET_SDK_LOADPLAYERSDKPROC_ERROR,
- NET_SDK_LOADDSSDKFAILED,
- NET_SDK_LOADDSSDKPROC_ERROR,
- NET_SDK_DSSDK_ERROR,
- NET_SDK_VOICEMONOPOLIZE,
- NET_SDK_JOINMULTICASTFAILED,
- NET_SDK_CREATEDIR_ERROR,
- NET_SDK_BINDSOCKET_ERROR,
- NET_SDK_SOCKETCLOSE_ERROR,
- NET_SDK_USERID_ISUSING,
- NET_SDK_PROGRAM_EXCEPTION,
- NET_SDK_WRITEFILE_FAILED,
- NET_SDK_FORMAT_READONLY,
- NET_SDK_WITHSAMEUSERNAME,
- NET_SDK_DEVICETYPE_ERROR,
- NET_SDK_LANGUAGE_ERROR,
- NET_SDK_PARAVERSION_ERROR,
- NET_SDK_FILE_SUCCESS,
- NET_SDK_FILE_NOFIND,
- NET_SDK_NOMOREFILE,
- NET_SDK_FILE_EXCEPTION,
- NET_SDK_TRY_LATER,
- NET_SDK_ERROR,
- }
- enum NET_DEVICE_STATUS
- {
- NET_DEVICE_STATUS_CONNECTED,
- NET_DEVICE_STATUS_DISCONNECT,
- };
- enum NET_SDK_STREAM_TYPE
- {
- NET_SDK_MAIN_STREAM,
- NET_SDK_SUB_STREAM,
- };
- enum NET_SDK_PLAYCTRL_TYPE
- {
- NET_SDK_PLAYCTRL_PAUSE,
- NET_SDK_PLAYCTRL_FF,
- NET_SDK_PLAYCTRL_REW,
- NET_SDK_PLAYCTRL_RESUME,
- NET_SDK_PLAYCTRL_STOP,
- NET_SDK_PLAYCTRL_FRAME,
- NET_SDK_PLAYCTRL_NORMAL,
- NET_SDK_PLAYCTRL_STARTAUDIO,
- NET_SDK_PLAYCTRL_STOPAUDIO,
- NET_SDK_PLAYCTRL_AUDIOVOLUME,
- NET_SDK_PLAYCTRL_SETPOS,
- };
- enum NET_SDK_RPB_SPEED
- {
- NET_SDK_RPB_SPEED_1_32X = 1,
- NET_SDK_RPB_SPEED_1_16X,
- NET_SDK_RPB_SPEED_1_8X, //1/8
- NET_SDK_RPB_SPEED_1_4X, //1/4
- NET_SDK_RPB_SPEED_1_2X, //1/2
- NET_SDK_RPB_SPEED_1X, //1
- NET_SDK_RPB_SPEED_2X,
- NET_SDK_RPB_SPEED_4X,
- NET_SDK_RPB_SPEED_8X,
- NET_SDK_RPB_SPEED_16X,
- NET_SDK_RPB_SPEED_32X,
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement