commit 507f5b408df39cb7e33fa2c95b0c0b14493a295e Author: Z Date: Wed Apr 17 09:20:15 2024 +0800 init proj diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e7f867f --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +#EGSave-Specific ignores +SaveData/ + +#Csharp Build +bin/ + +#CSharp Cache +obj/ + +#VS cache +.vs/ +.vscode/ \ No newline at end of file diff --git a/AlgorithmTCP.cs b/AlgorithmTCP.cs new file mode 100644 index 0000000..a31bd2f --- /dev/null +++ b/AlgorithmTCP.cs @@ -0,0 +1,45 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class AlgorithmTCP + { + static Socket socket_commu; + public static string Connect(string picPath, string targetname) + { + //IP地址192.168.1.32 + Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPAddress serverAddress = IPAddress.Parse("192.168.10.104"); + int port = 20000; + client.Connect(new IPEndPoint(serverAddress, port)); + Console.WriteLine("连接成功"); + //发送图片地址和识别目标名字 + var json = new + { + picadress = picPath, + targetname = targetname + }; + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(json); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + socket_commu.Send(dataBytes); + + + //等待算法识别结果 + //接收数据 + byte[] buffer = new byte[1024 * 1024]; + int bytesRead = socket_commu.Receive(buffer); + //将接收到的数据转换为字符串 + string result = Encoding.UTF8.GetString(buffer, 0, bytesRead); + return result; + } + } +} diff --git a/Camera/CHCNetSDK.cs b/Camera/CHCNetSDK.cs new file mode 100644 index 0000000..69fb9ab --- /dev/null +++ b/Camera/CHCNetSDK.cs @@ -0,0 +1,20747 @@ +using System; +using System.Runtime.InteropServices; +namespace Guidaoji.Camera +{ + /// + /// CHCNetSDK ժҪ˵ + /// + public class CHCNetSDK + { + public CHCNetSDK() + { + // + // TODO: ڴ˴ӹ캯߼ + // + } + + //SDK + public const int SDK_PLAYMPEG4 = 1;//ſ + public const int SDK_HCNETSDK = 2;// + + public const int NAME_LEN = 32;//û + public const int PASSWD_LEN = 16;//볤 + public const int GUID_LEN = 16; //GUID + public const int DEV_TYPE_NAME_LEN = 24; //豸Ƴ + public const int MAX_NAMELEN = 16;//DVRص½ + public const int MAX_RIGHT = 32;//豸ֵ֧Ȩޣ1-12ʾȨޣ13-32ʾԶȨޣ + public const int SERIALNO_LEN = 48;//кų + public const int MACADDR_LEN = 6;//macַ + public const int MAX_ETHERNET = 2;//豸̫ + public const int MAX_NETWORK_CARD = 4; //豸Ŀ + public const int PATHNAME_LEN = 128;//· + + public const int MAX_NUMBER_LEN = 32; //󳤶 + public const int MAX_NAME_LEN = 128; //豸󳤶 + + + public const int MAX_TIMESEGMENT = 4;//8000豸ʱ + public const int MAX_ICR_NUM = 8; //ץĻ˹ƬԤõ + + public const int MAX_SHELTERNUM = 4;//8000豸ڵ + public const int PHONENUMBER_LEN = 32;//pppoeź󳤶 + + public const int MAX_DISKNUM = 16;//8000豸Ӳ + public const int MAX_DISKNUM_V10 = 8;//1.2汾֮ǰ汾 + + public const int MAX_WINDOW_V30 = 32;//9000豸ʾ󲥷Ŵ + public const int MAX_WINDOW = 16;//8000豸Ӳ + public const int MAX_VGA_V30 = 4;//9000豸ɽVGA + public const int MAX_VGA = 1;//8000豸ɽVGA + + public const int MAX_USERNUM_V30 = 32;//9000豸û + public const int MAX_USERNUM = 16;//8000豸û + public const int MAX_EXCEPTIONNUM_V30 = 32;//9000豸쳣 + public const int MAX_EXCEPTIONNUM = 16;//8000豸쳣 + public const int MAX_LINK = 6;//8000豸ͨƵ + public const int MAX_ITC_EXCEPTIONOUT = 32;//ץĻ󱨾 + + public const int MAX_DECPOOLNUM = 4;//·ÿͨѭ + public const int MAX_DECNUM = 4;//·ͨʵֻһ + public const int MAX_TRANSPARENTNUM = 2;//·͸ͨ + public const int MAX_CYCLE_CHAN = 16; //·ѭͨ + public const int MAX_CYCLE_CHAN_V30 = 64;//ѯͨչ + public const int MAX_DIRNAME_LENGTH = 80;//Ŀ¼ + + public const int MAX_STRINGNUM_V30 = 8;//9000豸OSDַ + public const int MAX_STRINGNUM = 4;//8000豸OSDַ + public const int MAX_STRINGNUM_EX = 8;//8000չ + public const int MAX_AUXOUT_V30 = 16;//9000豸 + public const int MAX_AUXOUT = 4;//8000豸 + public const int MAX_HD_GROUP = 16;//9000豸Ӳ + public const int MAX_NFS_DISK = 8; //8000豸NFSӲ + + public const int IW_ESSID_MAX_SIZE = 32;//WIFISSIDų + public const int IW_ENCODING_TOKEN_MAX = 32;//WIFIֽ + public const int WIFI_WEP_MAX_KEY_COUNT = 4; + public const int WIFI_WEP_MAX_KEY_LENGTH = 33; + public const int WIFI_WPA_PSK_MAX_KEY_LENGTH = 63; + public const int WIFI_WPA_PSK_MIN_KEY_LENGTH = 8; + public const int WIFI_MAX_AP_COUNT = 20; + public const int MAX_SERIAL_NUM = 64;//ֵ֧͸ͨ· + public const int MAX_DDNS_NUMS = 10;//9000豸ddns + public const int MAX_EMAIL_ADDR_LEN = 48;//emailַ + public const int MAX_EMAIL_PWD_LEN = 32;//email볤 + + public const int MAXPROGRESS = 100;//طʱٷ + public const int MAX_SERIALNUM = 2;//8000豸ֵ֧Ĵ 1-232 2-485 + public const int CARDNUM_LEN = 20;//ų + public const int CARDNUM_LEN_OUT = 32; //ⲿṹ忨ų + public const int MAX_VIDEOOUT_V30 = 4;//9000豸Ƶ + public const int MAX_VIDEOOUT = 2;//8000豸Ƶ + + public const int MAX_PRESET_V30 = 256;// 9000豸ֵ̨֧Ԥõ + public const int MAX_TRACK_V30 = 256;// 9000豸ֵ̨֧켣 + public const int MAX_CRUISE_V30 = 256;// 9000豸ֵ̨֧Ѳ + public const int MAX_PRESET = 128;// 8000豸ֵ̨֧Ԥõ + public const int MAX_TRACK = 128;// 8000豸ֵ̨֧켣 + public const int MAX_CRUISE = 128;// 8000豸ֵ̨֧Ѳ + + public const int CRUISE_MAX_PRESET_NUMS = 32;// һѲѲ + + public const int MAX_SERIAL_PORT = 8;//9000豸֧232 + public const int MAX_PREVIEW_MODE = 8;// 豸֧ԤģʽĿ 1,4,9,16.... + public const int MAX_MATRIXOUT = 16;// ģ + public const int LOG_INFO_LEN = 11840; // ־Ϣ + public const int DESC_LEN = 16;// ַ̨ + public const int PTZ_PROTOCOL_NUM = 200;// 9000ֵ̨֧Э + + public const int MAX_AUDIO = 1;//8000Խͨ + public const int MAX_AUDIO_V30 = 2;//9000Խͨ + public const int MAX_CHANNUM = 16;//8000豸ͨ + public const int MAX_ALARMIN = 16;//8000豸󱨾 + public const int MAX_ALARMOUT = 4;//8000豸󱨾 + //9000 IPC + public const int MAX_ANALOG_CHANNUM = 32;//32ģͨ + public const int MAX_ANALOG_ALARMOUT = 32; //32·ģⱨ + public const int MAX_ANALOG_ALARMIN = 32;//32·ģⱨ + + public const int MAX_IP_DEVICE = 32;//IP豸 + public const int MAX_IP_DEVICE_V40 = 64;//IP豸 + public const int MAX_IP_CHANNEL = 32;//IPͨ + public const int MAX_IP_ALARMIN = 128;//౨ + public const int MAX_IP_ALARMOUT = 64;//౨ + public const int MAX_IP_ALARMIN_V40 = 4096; //౨ + public const int MAX_IP_ALARMOUT_V40 = 4096; //౨ + + public const int MAX_RECORD_FILE_NUM = 20; // ÿɾ߿¼ļ + + //SDK_V31 ATM + public const int MAX_ATM_NUM = 1; + public const int MAX_ACTION_TYPE = 12; + public const int ATM_FRAMETYPE_NUM = 4; + public const int MAX_ATM_PROTOCOL_NUM = 1025; + public const int ATM_PROTOCOL_SORT = 4; + public const int ATM_DESC_LEN = 32; + // SDK_V31 ATM + + /* ֵ֧ͨ ģIP֧ */ + public const int MAX_CHANNUM_V30 = MAX_ANALOG_CHANNUM + MAX_IP_CHANNEL;//64 + public const int MAX_ALARMOUT_V30 = MAX_ANALOG_ALARMOUT + MAX_IP_ALARMOUT;//96 + public const int MAX_ALARMIN_V30 = MAX_ANALOG_ALARMIN + MAX_IP_ALARMIN;//160 + + public const int MAX_CHANNUM_V40 = 512; + public const int MAX_ALARMOUT_V40 = MAX_IP_ALARMOUT_V40 + MAX_ANALOG_ALARMOUT;//4128 + public const int MAX_ALARMIN_V40 = MAX_IP_ALARMIN_V40 + MAX_ANALOG_ALARMOUT;//4128 + public const int MAX_MULTI_AREA_NUM = 24; + + public const int MAX_HUMAN_PICTURE_NUM = 10; //Ƭ + public const int MAX_HUMAN_BIRTHDATE_LEN = 10; + + public const int MAX_LAYERNUMS = 32; + + public const int MAX_ROIDETECT_NUM = 8; //ֵ֧ROI + public const int MAX_LANERECT_NUM = 5; //ʶ + public const int MAX_FORTIFY_NUM = 10; //󲼷 + public const int MAX_INTERVAL_NUM = 4; //ʱ + public const int MAX_CHJC_NUM = 3; //ʡݼַ + public const int MAX_VL_NUM = 5; //Ȧ + public const int MAX_DRIVECHAN_NUM = 16; //󳵵 + public const int MAX_COIL_NUM = 3; //Ȧ + public const int MAX_SIGNALLIGHT_NUM = 6; //źŵƸ + public const int LEN_32 = 32; + public const int LEN_31 = 31; + public const int MAX_CABINET_COUNT = 8; //ֻ֧ + public const int MAX_ID_LEN = 48; + public const int MAX_PARKNO_LEN = 16; + public const int MAX_ALARMREASON_LEN = 32; + public const int MAX_UPGRADE_INFO_LEN= 48; //ȡļƥϢ(ģ) + public const int MAX_CUSTOMDIR_LEN = 32; //ԶĿ¼ + + public const int MAX_TRANSPARENT_CHAN_NUM = 4; //ÿ͸ͨ + public const int MAX_TRANSPARENT_ACCESS_NUM = 4; //ÿ˿ + + //ITS + public const int MAX_PARKING_STATUS = 8; //λ״̬ 0޳1г2ѹ(ȼ), 3⳵λ + public const int MAX_PARKING_NUM = 4; //һͨ4λ (ҳλ 03) + + public const int MAX_ITS_SCENE_NUM = 16; //󳡾 + public const int MAX_SCENE_TIMESEG_NUM = 16; //󳡾ʱ + public const int MAX_IVMS_IP_CHANNEL = 128; //IPͨ + public const int DEVICE_ID_LEN = 48; //豸ų + public const int MONITORSITE_ID_LEN = 48; //ų + public const int MAX_AUXAREA_NUM = 16; //Ŀ + public const int MAX_SLAVE_CHANNEL_NUM = 16; //ͨ + + public const int MAX_SCH_TASKS_NUM = 10; + + public const int MAX_SERVERID_LEN = 64; //IDij + public const int MAX_SERVERDOMAIN_LEN = 128; //󳤶 + public const int MAX_AUTHENTICATEID_LEN = 64; //֤ID󳤶 + public const int MAX_AUTHENTICATEPASSWD_LEN = 32; //֤󳤶 + public const int MAX_SERVERNAME_LEN = 64; //û + public const int MAX_COMPRESSIONID_LEN = 64; //ID󳤶 + public const int MAX_SIPSERVER_ADDRESS_LEN = 128; //SIPַ֧IPַ + //ѹ߱ + public const int MAX_PlATE_NO_LEN = 32; //ƺ󳤶 2013-09-27 + public const int UPNP_PORT_NUM = 12; //upnp˿ӳ˿Ŀ + + + public const int MAX_LOCAL_ADDR_LEN = 96; //SOCKS󱾵θ + public const int MAX_COUNTRY_NAME_LEN = 4; //ҼдƳ + + public const int THERMOMETRY_ALARMRULE_NUM = 40; //ȳ񱨾 + + public const int ACS_CARD_NO_LEN = 32; //Žų + public const int MAX_ID_NUM_LEN = 32; //֤ų + public const int MAX_ID_NAME_LEN = 128; // + public const int MAX_ID_ADDR_LEN = 280; //סַ + public const int MAX_ID_ISSUING_AUTHORITY_LEN = 128; //ǩس + + public const int MAX_CARD_RIGHT_PLAN_NUM = 4; //Ȩƻ + public const int MAX_GROUP_NUM_128 = 128; //Ⱥ + public const int MAX_CARD_READER_NUM = 64; // + public const int MAX_SNEAK_PATH_NODE = 8; // + public const int MAX_MULTI_DOOR_INTERLOCK_GROUP = 8; //Ż + public const int MAX_INTER_LOCK_DOOR_NUM = 8; //һŻ + public const int MAX_CASE_SENSOR_NUM = 8; //case sensor + public const int MAX_DOOR_NUM_256 = 256; // + public const int MAX_READER_ROUTE_NUM = 16; //ˢѭ· + public const int MAX_FINGER_PRINT_NUM = 10; //ָƸ + public const int MAX_CARD_READER_NUM_512 = 512; // + public const int NET_SDK_MULTI_CARD_GROUP_NUM_20 = 20; //ؿ + public const int CARD_PASSWORD_LEN = 8; //볤 + public const int MAX_DOOR_CODE_LEN = 8; //볤 + public const int MAX_LOCK_CODE_LEN = 8; //볤 + + public const int MAX_NOTICE_NUMBER_LEN = 32; //󳤶 + public const int MAX_NOTICE_THEME_LEN = 64; //󳤶 + public const int MAX_NOTICE_DETAIL_LEN = 1024; //󳤶 + public const int MAX_NOTICE_PIC_NUM = 6; //ϢͼƬ + public const int MAX_DEV_NUMBER_LEN = 32; //豸󳤶 + public const int LOCK_NAME_LEN = 32; // + + public const int GROUP_NAME_LEN = 32; //ȺƳ + public const int GROUP_COMBINATION_NUM = 8; //Ⱥ + public const int MULTI_CARD_GROUP_NUM = 4; //ؿ + + public const int NET_SDK_EMPLOYEE_NO_LEN = 32; //ų + public const int NET_SDK_UUID_LEN = 36; //UUID + public const int NET_SDK_EHOME_KEY_LEN = 32; //EHome Key + + public const int NET_DEV_NAME_LEN = 64; //豸Ƴ + public const int NET_DEV_TYPE_NAME_LEN = 64; //豸Ƴ + + public const int VCA_MAX_POLYGON_POINT_NUM = 10;//֧10Ķ + public const int MAX_RULE_NUM = 8;// + public const int MAX_TARGET_NUM = 30;//Ŀ + public const int MAX_CALIB_PT = 6;//궨 + public const int MIN_CALIB_PT = 4;//С궨 + public const int MAX_TIMESEGMENT_2 = 2;//ʱ + public const int MAX_LICENSE_LEN = 16;//ƺ󳤶 + public const int MAX_PLATE_NUM = 3;//Ƹ + public const int MAX_MASK_REGION_NUM = 4;//ĸ + public const int MAX_SEGMENT_NUM = 6;//궨Ŀ + public const int MIN_SEGMENT_NUM = 3;//궨СĿ + public const int MAX_CATEGORY_LEN = 8; //ƸϢַ + public const int SERIAL_NO_LEN = 16; //λ + public const int ILLEGAL_LEN = 32; //Υ볤 + + //ӷʽ + public const int NORMALCONNECT = 1; + public const int MEDIACONNECT = 2; + + //豸ͺ() + public const int HCDVR = 1; + public const int MEDVR = 2; + public const int PCDVR = 3; + public const int HC_9000 = 4; + public const int HF_I = 5; + public const int PCNVR = 6; + public const int HC_76NVR = 8; + + //NVR + public const int DS8000HC_NVR = 0; + public const int DS9000HC_NVR = 1; + public const int DS8000ME_NVR = 2; + + /*******************ȫִ begin**********************/ + public const int NET_DVR_NOERROR = 0;//ûд + public const int NET_DVR_PASSWORD_ERROR = 1;//û + public const int NET_DVR_NOENOUGHPRI = 2;//Ȩ޲ + public const int NET_DVR_NOINIT = 3;//ûгʼ + public const int NET_DVR_CHANNEL_ERROR = 4;//ͨŴ + public const int NET_DVR_OVER_MAXLINK = 5;//ӵDVRĿͻ˸ + public const int NET_DVR_VERSIONNOMATCH = 6;//汾ƥ + public const int NET_DVR_NETWORK_FAIL_CONNECT = 7;//ӷʧ + public const int NET_DVR_NETWORK_SEND_ERROR = 8;//ʧ + public const int NET_DVR_NETWORK_RECV_ERROR = 9;//ӷʧ + public const int NET_DVR_NETWORK_RECV_TIMEOUT = 10;//ӷݳʱ + public const int NET_DVR_NETWORK_ERRORDATA = 11;//͵ + public const int NET_DVR_ORDER_ERROR = 12;//ô + public const int NET_DVR_OPERNOPERMIT = 13;//޴Ȩ + public const int NET_DVR_COMMANDTIMEOUT = 14;//DVRִгʱ + public const int NET_DVR_ERRORSERIALPORT = 15;//ںŴ + public const int NET_DVR_ERRORALARMPORT = 16;//˿ڴ + public const int NET_DVR_PARAMETER_ERROR = 17;// + public const int NET_DVR_CHAN_EXCEPTION = 18;//ͨڴ״̬ + public const int NET_DVR_NODISK = 19;//ûӲ + public const int NET_DVR_ERRORDISKNUM = 20;//Ӳ̺Ŵ + public const int NET_DVR_DISK_FULL = 21;//Ӳ + public const int NET_DVR_DISK_ERROR = 22;//Ӳ̳ + public const int NET_DVR_NOSUPPORT = 23;//֧ + public const int NET_DVR_BUSY = 24;//æ + public const int NET_DVR_MODIFY_FAIL = 25;//޸IJɹ + public const int NET_DVR_PASSWORD_FORMAT_ERROR = 26;//ʽȷ + public const int NET_DVR_DISK_FORMATING = 27;//Ӳڸʽ + public const int NET_DVR_DVRNORESOURCE = 28;//DVRԴ + public const int NET_DVR_DVROPRATEFAILED = 29;//DVRʧ + public const int NET_DVR_OPENHOSTSOUND_FAIL = 30;//PCʧ + public const int NET_DVR_DVRVOICEOPENED = 31;//Խռ + public const int NET_DVR_TIMEINPUTERROR = 32;//ʱ벻ȷ + public const int NET_DVR_NOSPECFILE = 33;//طʱûָļ + public const int NET_DVR_CREATEFILE_ERROR = 34;//ļ + public const int NET_DVR_FILEOPENFAIL = 35;//ļ + public const int NET_DVR_OPERNOTFINISH = 36; //ϴεIJû + public const int NET_DVR_GETPLAYTIMEFAIL = 37;//ȡǰŵʱ + public const int NET_DVR_PLAYFAIL = 38;//ų + public const int NET_DVR_FILEFORMAT_ERROR = 39;//ļʽȷ + public const int NET_DVR_DIR_ERROR = 40;//· + public const int NET_DVR_ALLOC_RESOURCE_ERROR = 41;//Դ + public const int NET_DVR_AUDIO_MODE_ERROR = 42;//ģʽ + public const int NET_DVR_NOENOUGH_BUF = 43;//̫С + public const int NET_DVR_CREATESOCKET_ERROR = 44;//SOCKET + public const int NET_DVR_SETSOCKET_ERROR = 45;//SOCKET + public const int NET_DVR_MAX_NUM = 46;//ﵽ + public const int NET_DVR_USERNOTEXIST = 47;//û + public const int NET_DVR_WRITEFLASHERROR = 48;//дFLASH + public const int NET_DVR_UPGRADEFAIL = 49;//DVRʧ + public const int NET_DVR_CARDHAVEINIT = 50;//뿨Ѿʼ + public const int NET_DVR_PLAYERFAILED = 51;//òſijʧ + public const int NET_DVR_MAX_USERNUM = 52;//豸ûﵽ + public const int NET_DVR_GETLOCALIPANDMACFAIL = 53;//ÿͻ˵IPַַʧ + public const int NET_DVR_NOENCODEING = 54;//ͨûб + public const int NET_DVR_IPMISMATCH = 55;//IPַƥ + public const int NET_DVR_MACMISMATCH = 56;//MACַƥ + public const int NET_DVR_UPGRADELANGMISMATCH = 57;//ļԲƥ + public const int NET_DVR_MAX_PLAYERPORT = 58;//·ﵽ + public const int NET_DVR_NOSPACEBACKUP = 59;//豸û㹻ռб + public const int NET_DVR_NODEVICEBACKUP = 60;//ûҵָı豸 + public const int NET_DVR_PICTURE_BITS_ERROR = 61;//ͼλ24ɫ + public const int NET_DVR_PICTURE_DIMENSION_ERROR = 62;//ͼƬ*ޣ 128*256 + public const int NET_DVR_PICTURE_SIZ_ERROR = 63;//ͼƬСޣ100K + public const int NET_DVR_LOADPLAYERSDKFAILED = 64;//뵱ǰĿ¼Player Sdk + public const int NET_DVR_LOADPLAYERSDKPROC_ERROR = 65;//ҲPlayer Sdkij + public const int NET_DVR_LOADDSSDKFAILED = 66;//뵱ǰĿ¼DSsdk + public const int NET_DVR_LOADDSSDKPROC_ERROR = 67;//ҲDsSdkij + public const int NET_DVR_DSSDK_ERROR = 68;//ӲDsSdkijʧ + public const int NET_DVR_VOICEMONOPOLIZE = 69;//ռ + public const int NET_DVR_JOINMULTICASTFAILED = 70;//ಥʧ + public const int NET_DVR_CREATEDIR_ERROR = 71;//־ļĿ¼ʧ + public const int NET_DVR_BINDSOCKET_ERROR = 72;//׽ʧ + public const int NET_DVR_SOCKETCLOSE_ERROR = 73;//socketжϣ˴ͨжϻĿĵزɴ + public const int NET_DVR_USERID_ISUSING = 74;//עʱûIDڽij + public const int NET_DVR_SOCKETLISTEN_ERROR = 75;//ʧ + public const int NET_DVR_PROGRAM_EXCEPTION = 76;//쳣 + public const int NET_DVR_WRITEFILE_FAILED = 77;//дļʧ + public const int NET_DVR_FORMAT_READONLY = 78;//ֹʽֻӲ + public const int NET_DVR_WITHSAMEUSERNAME = 79;//ûýṹдͬû + public const int NET_DVR_DEVICETYPE_ERROR = 80;//ʱ豸ͺŲƥ + public const int NET_DVR_LANGUAGE_ERROR = 81;//ʱԲƥ + public const int NET_DVR_PARAVERSION_ERROR = 82;//ʱ汾ƥ + public const int NET_DVR_IPCHAN_NOTALIVE = 83; //ԤʱIPͨ + public const int NET_DVR_RTSP_SDK_ERROR = 84;//ظIPCͨѶStreamTransClient.dllʧ + public const int NET_DVR_CONVERT_SDK_ERROR = 85;//תʧ + public const int NET_DVR_IPC_COUNT_OVERFLOW = 86;//ipͨ + public const int NET_DVR_USER_LOCKED = 153; + + public const int NET_PLAYM4_NOERROR = 500;//no error + public const int NET_PLAYM4_PARA_OVER = 501;//input parameter is invalid + public const int NET_PLAYM4_ORDER_ERROR = 502;//The order of the function to be called is error + public const int NET_PLAYM4_TIMER_ERROR = 503;//Create multimedia clock failed + public const int NET_PLAYM4_DEC_VIDEO_ERROR = 504;//Decode video data failed + public const int NET_PLAYM4_DEC_AUDIO_ERROR = 505;//Decode audio data failed + public const int NET_PLAYM4_ALLOC_MEMORY_ERROR = 506;//Allocate memory failed + public const int NET_PLAYM4_OPEN_FILE_ERROR = 507;//Open the file failed + public const int NET_PLAYM4_CREATE_OBJ_ERROR = 508;//Create thread or event failed + public const int NET_PLAYM4_CREATE_DDRAW_ERROR = 509;//Create DirectDraw object failed + public const int NET_PLAYM4_CREATE_OFFSCREEN_ERROR = 510;//failed when creating off-screen surface + public const int NET_PLAYM4_BUF_OVER = 511;//buffer is overflow + public const int NET_PLAYM4_CREATE_SOUND_ERROR = 512;//failed when creating audio device + public const int NET_PLAYM4_SET_VOLUME_ERROR = 513;//Set volume failed + public const int NET_PLAYM4_SUPPORT_FILE_ONLY = 514;//The function only support play file + public const int NET_PLAYM4_SUPPORT_STREAM_ONLY = 515;//The function only support play stream + public const int NET_PLAYM4_SYS_NOT_SUPPORT = 516;//System not support + public const int NET_PLAYM4_FILEHEADER_UNKNOWN = 517;//No file header + public const int NET_PLAYM4_VERSION_INCORRECT = 518;//The version of decoder and encoder is not adapted + public const int NET_PALYM4_INIT_DECODER_ERROR = 519;//Initialize decoder failed + public const int NET_PLAYM4_CHECK_FILE_ERROR = 520;//The file data is unknown + public const int NET_PLAYM4_INIT_TIMER_ERROR = 521;//Initialize multimedia clock failed + public const int NET_PLAYM4_BLT_ERROR = 522;//Blt failed + public const int NET_PLAYM4_UPDATE_ERROR = 523;//Update failed + public const int NET_PLAYM4_OPEN_FILE_ERROR_MULTI = 524;//openfile error, streamtype is multi + public const int NET_PLAYM4_OPEN_FILE_ERROR_VIDEO = 525;//openfile error, streamtype is video + public const int NET_PLAYM4_JPEG_COMPRESS_ERROR = 526;//JPEG compress error + public const int NET_PLAYM4_EXTRACT_NOT_SUPPORT = 527;//Don't support the version of this file + public const int NET_PLAYM4_EXTRACT_DATA_ERROR = 528;//extract video data failed + /*******************ȫִ end**********************/ + + /************************************************* + NET_DVR_IsSupport()ֵ + 19λֱʾϢλTRUE)ʾ֧֣ + **************************************************/ + public const int NET_DVR_SUPPORT_DDRAW = 1;//֧DIRECTDRAW֧֣򲥷ܹ + public const int NET_DVR_SUPPORT_BLT = 2;//Կ֧BLT֧֣򲥷ܹ + public const int NET_DVR_SUPPORT_BLTFOURCC = 4;//ԿBLT֧ɫת֧֣RGBת + public const int NET_DVR_SUPPORT_BLTSHRINKX = 8;//ԿBLT֧XС֧֣ϵͳת + public const int NET_DVR_SUPPORT_BLTSHRINKY = 16;//ԿBLT֧YС֧֣ϵͳת + public const int NET_DVR_SUPPORT_BLTSTRETCHX = 32;//ԿBLT֧XŴ֧֣ϵͳת + public const int NET_DVR_SUPPORT_BLTSTRETCHY = 64;//ԿBLT֧YŴ֧֣ϵͳת + public const int NET_DVR_SUPPORT_SSE = 128;//CPU֧SSEָIntel Pentium3֧SSEָ + public const int NET_DVR_SUPPORT_MMX = 256;//CPU֧MMXָIntel Pentium3֧SSEָ + + /**********************̨ begin*************************/ + public const int LIGHT_PWRON = 2;// ͨƹԴ + public const int WIPER_PWRON = 3;// ͨˢ + public const int FAN_PWRON = 4;// ͨȿ + public const int HEATER_PWRON = 5;// ͨ + public const int AUX_PWRON1 = 6;// ͨ豸 + public const int AUX_PWRON2 = 7;// ͨ豸 + public const int SET_PRESET = 8;// Ԥõ + public const int CLE_PRESET = 9;// Ԥõ + + public const int ZOOM_IN = 11;// ٶSS(ʱ) + public const int ZOOM_OUT = 12;// ٶSSС(ʱС) + public const int FOCUS_NEAR = 13;// ٶSSǰ + public const int FOCUS_FAR = 14;// ٶSS + public const int IRIS_OPEN = 15;// ȦٶSS + public const int IRIS_CLOSE = 16;// ȦٶSSС + + public const int TILT_UP = 21;/* ̨SSٶ */ + public const int TILT_DOWN = 22;/* ̨SSٶ¸ */ + public const int PAN_LEFT = 23;/* ̨SSٶת */ + public const int PAN_RIGHT = 24;/* ̨SSٶת */ + public const int UP_LEFT = 25;/* ̨SSٶת */ + public const int UP_RIGHT = 26;/* ̨SSٶת */ + public const int DOWN_LEFT = 27;/* ̨SSٶ¸ת */ + public const int DOWN_RIGHT = 28;/* ̨SSٶ¸ת */ + public const int PAN_AUTO = 29;/* ̨SSٶԶɨ */ + + public const int FILL_PRE_SEQ = 30;/* ԤõѲ */ + public const int SET_SEQ_DWELL = 31;/* Ѳͣʱ */ + public const int SET_SEQ_SPEED = 32;/* Ѳٶ */ + public const int CLE_PRE_SEQ = 33;/* ԤõѲɾ */ + public const int STA_MEM_CRUISE = 34;/* ʼ¼켣 */ + public const int STO_MEM_CRUISE = 35;/* ֹͣ¼켣 */ + public const int RUN_CRUISE = 36;/* ʼ켣 */ + public const int RUN_SEQ = 37;/* ʼѲ */ + public const int STOP_SEQ = 38;/* ֹͣѲ */ + public const int GOTO_PRESET = 39;/* תԤõ */ + /**********************̨ end*************************/ + + /************************************************* + طʱſ궨 + NET_DVR_PlayBackControl + NET_DVR_PlayControlLocDisplay + NET_DVR_DecPlayBackCtrlĺ궨 + ֲ֧鿴˵ʹ + **************************************************/ + public const int NET_DVR_PLAYSTART = 1;//ʼ + public const int NET_DVR_PLAYSTOP = 2;//ֹͣ + public const int NET_DVR_PLAYPAUSE = 3;//ͣ + public const int NET_DVR_PLAYRESTART = 4;//ָ + public const int NET_DVR_PLAYFAST = 5;// + public const int NET_DVR_PLAYSLOW = 6;// + public const int NET_DVR_PLAYNORMAL = 7;//ٶ + public const int NET_DVR_PLAYFRAME = 8;//֡ + public const int NET_DVR_PLAYSTARTAUDIO = 9;// + public const int NET_DVR_PLAYSTOPAUDIO = 10;//ر + public const int NET_DVR_PLAYAUDIOVOLUME = 11;// + public const int NET_DVR_PLAYSETPOS = 12;//ıļطŵĽ + public const int NET_DVR_PLAYGETPOS = 13;//ȡļطŵĽ + public const int NET_DVR_PLAYGETTIME = 14;//ȡǰѾŵʱ(ļطŵʱЧ) + public const int NET_DVR_PLAYGETFRAME = 15;//ȡǰѾŵ֡(ļطŵʱЧ) + public const int NET_DVR_GETTOTALFRAMES = 16;//ȡǰļܵ֡(ļطŵʱЧ) + public const int NET_DVR_GETTOTALTIME = 17;//ȡǰļܵʱ(ļطŵʱЧ) + public const int NET_DVR_THROWBFRAME = 20;//B֡ + public const int NET_DVR_SETSPEED = 24;//ٶ + public const int NET_DVR_KEEPALIVE = 25;//豸(ص2뷢һ) + public const int NET_DVR_PLAYSETTIME = 26;//ʱ䶨λ + public const int NET_DVR_PLAYGETTOTALLEN = 27;//ȡʱطŶӦʱڵļܳ + public const int NET_DVR_PLAY_FORWARD = 29;//лΪ + public const int NET_DVR_PLAY_REVERSE = 30;//лΪ + public const int NET_DVR_SET_TRANS_TYPE = 32;//תװ + public const int NET_DVR_PLAY_CONVERT = 33;//лΪ + + //Զ̰£ + /* 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; + + public const int KEY_PTZ_AP1_START = KEY_CODE_EDIT;/* Ȧ+ */ + public const int KEY_PTZ_AP1_STOP = 36; + + public const int KEY_PTZ_AP2_START = KEY_CODE_PAN;/* Ȧ- */ + public const int KEY_PTZ_AP2_STOP = 37; + + public const int KEY_PTZ_FOCUS1_START = KEY_CODE_A;/* ۽+ */ + public const int KEY_PTZ_FOCUS1_STOP = 38; + + public const int KEY_PTZ_FOCUS2_START = KEY_CODE_M;/* ۽- */ + public const int KEY_PTZ_FOCUS2_STOP = 39; + + public const int KEY_PTZ_B1_START = 40;/* 䱶+ */ + public const int KEY_PTZ_B1_STOP = 41; + + 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; + + /************************* begin*******************************/ + //NET_DVR_SetDVRConfigNET_DVR_GetDVRConfig,עӦýṹ + public const int NET_DVR_GET_DEVICECFG = 100;//ȡ豸 + public const int NET_DVR_SET_DEVICECFG = 101;//豸 + public const int NET_DVR_GET_NETCFG = 102;//ȡ + public const int NET_DVR_SET_NETCFG = 103;// + public const int NET_DVR_GET_PICCFG = 104;//ȡͼ + public const int NET_DVR_SET_PICCFG = 105;//ͼ + public const int NET_DVR_GET_COMPRESSCFG = 106;//ȡѹ + public const int NET_DVR_SET_COMPRESSCFG = 107;//ѹ + public const int NET_DVR_GET_RECORDCFG = 108;//ȡ¼ʱ + public const int NET_DVR_SET_RECORDCFG = 109;//¼ʱ + public const int NET_DVR_GET_DECODERCFG = 110;//ȡ + public const int NET_DVR_SET_DECODERCFG = 111;//ý + public const int NET_DVR_GET_RS232CFG = 112;//ȡ232ڲ + public const int NET_DVR_SET_RS232CFG = 113;//232ڲ + public const int NET_DVR_GET_ALARMINCFG = 114;//ȡ + public const int NET_DVR_SET_ALARMINCFG = 115;//ñ + public const int NET_DVR_GET_ALARMOUTCFG = 116;//ȡ + public const int NET_DVR_SET_ALARMOUTCFG = 117;//ñ + public const int NET_DVR_GET_TIMECFG = 118;//ȡDVRʱ + public const int NET_DVR_SET_TIMECFG = 119;//DVRʱ + public const int NET_DVR_GET_PREVIEWCFG = 120;//ȡԤ + public const int NET_DVR_SET_PREVIEWCFG = 121;//Ԥ + public const int NET_DVR_GET_VIDEOOUTCFG = 122;//ȡƵ + public const int NET_DVR_SET_VIDEOOUTCFG = 123;//Ƶ + public const int NET_DVR_GET_USERCFG = 124;//ȡû + public const int NET_DVR_SET_USERCFG = 125;//û + public const int NET_DVR_GET_EXCEPTIONCFG = 126;//ȡ쳣 + public const int NET_DVR_SET_EXCEPTIONCFG = 127;//쳣 + public const int NET_DVR_GET_ZONEANDDST = 128;//ȡʱʱƲ + public const int NET_DVR_SET_ZONEANDDST = 129;//ʱʱƲ + public const int NET_DVR_GET_SHOWSTRING = 130;//ȡַ + public const int NET_DVR_SET_SHOWSTRING = 131;//õַ + public const int NET_DVR_GET_EVENTCOMPCFG = 132;//ȡ¼¼ + public const int NET_DVR_SET_EVENTCOMPCFG = 133;//¼¼ + + public const int NET_DVR_GET_AUXOUTCFG = 140;//ȡ(HS豸2006-02-28) + public const int NET_DVR_SET_AUXOUTCFG = 141;//ñ(HS豸2006-02-28) + public const int NET_DVR_GET_PREVIEWCFG_AUX = 142;//ȡ-sϵ˫Ԥ(-sϵ˫2006-04-13) + public const int NET_DVR_SET_PREVIEWCFG_AUX = 143;//-sϵ˫Ԥ(-sϵ˫2006-04-13) + + public const int NET_DVR_GET_PICCFG_EX = 200;//ȡͼ(SDK_V14չ) + public const int NET_DVR_SET_PICCFG_EX = 201;//ͼ(SDK_V14չ) + public const int NET_DVR_GET_USERCFG_EX = 202;//ȡû(SDK_V15չ) + public const int NET_DVR_SET_USERCFG_EX = 203;//û(SDK_V15չ) + public const int NET_DVR_GET_COMPRESSCFG_EX = 204;//ȡѹ(SDK_V15չ2006-05-15) + public const int NET_DVR_SET_COMPRESSCFG_EX = 205;//ѹ(SDK_V15չ2006-05-15) + + public const int NET_DVR_GET_NETAPPCFG = 222;//ȡӦò NTP/DDNS/EMAIL + public const int NET_DVR_SET_NETAPPCFG = 223;//Ӧò NTP/DDNS/EMAIL + public const int NET_DVR_GET_NTPCFG = 224;//ȡӦò NTP + public const int NET_DVR_SET_NTPCFG = 225;//Ӧò NTP + public const int NET_DVR_GET_DDNSCFG = 226;//ȡӦò DDNS + public const int NET_DVR_SET_DDNSCFG = 227;//Ӧò DDNS + //ӦNET_DVR_EMAILPARA + public const int NET_DVR_GET_EMAILCFG = 228;//ȡӦò EMAIL + public const int NET_DVR_SET_EMAILCFG = 229;//Ӧò EMAIL + + public const int NET_DVR_GET_NFSCFG = 230;/* NFS disk config */ + public const int NET_DVR_SET_NFSCFG = 231;/* NFS disk config */ + + public const int NET_DVR_GET_SHOWSTRING_EX = 238;//ȡַչ(֧8ַ) + public const int NET_DVR_SET_SHOWSTRING_EX = 239;//õַչ(֧8ַ) + public const int NET_DVR_GET_NETCFG_OTHER = 244;//ȡ + public const int NET_DVR_SET_NETCFG_OTHER = 245;// + + //ӦNET_DVR_EMAILCFGṹ + public const int NET_DVR_GET_EMAILPARACFG = 250;//Get EMAIL parameters + public const int NET_DVR_SET_EMAILPARACFG = 251;//Setup EMAIL parameters + + public const int NET_DVR_GET_DDNSCFG_EX = 274;//ȡչDDNS + public const int NET_DVR_SET_DDNSCFG_EX = 275;//չDDNS + + public const int NET_DVR_SET_PTZPOS = 292;//̨PTZλ + public const int NET_DVR_GET_PTZPOS = 293;//̨ȡPTZλ + public const int NET_DVR_GET_PTZSCOPE = 294;//̨ȡPTZΧ + + public const int NET_DVR_GET_AP_INFO_LIST = 305;//ȡԴ + public const int NET_DVR_SET_WIFI_CFG = 306;//IP豸߲ + public const int NET_DVR_GET_WIFI_CFG = 307;//ȡIP豸߲ + public const int NET_DVR_SET_WIFI_WORKMODE = 308;//IP豸ڹģʽ + public const int NET_DVR_GET_WIFI_WORKMODE = 309;//ȡIP豸ڹģʽ + public const int NET_DVR_GET_WIFI_STATUS = 310; //ȡ豸ǰwifi״̬ + + /***************************ܷ begin *****************************/ + //豸 + public const int DS6001_HF_B = 60;//ΪDS6001-HF/B + public const int DS6001_HF_P = 61;//ʶDS6001-HF/P + public const int DS6002_HF_B = 62;//˫٣DS6002-HF/B + public const int DS6101_HF_B = 63;//ΪDS6101-HF/B + public const int IDS52XX = 64;//ܷIVMS + public const int DS9000_IVS = 65;//9000ϵDVR + public const int DS8004_AHL_A = 66;//ATM, DS8004AHL-S/A + public const int DS6101_HF_P = 67;//ʶDS6101-HF/P + + //ȡ + public const int VCA_DEV_ABILITY = 256;//豸ܷ + public const int VCA_CHAN_ABILITY = 272;//Ϊ + public const int MATRIXDECODER_ABILITY = 512;//·ʾ + //ȡ/ôӿڲ + //ʶNET_VCA_PLATE_CFG + public const int NET_DVR_SET_PLATECFG = 150;//óʶ + public const int NET_DVR_GET_PLATECFG = 151;//ȡʶ + //ΪӦNET_VCA_RULECFG + public const int NET_DVR_SET_RULECFG = 152;//Ϊ + public const int NET_DVR_GET_RULECFG = 153;//ȡΪ + + //˫궨NET_DVR_LF_CFG + public const int NET_DVR_SET_LF_CFG = 160;//˫ò + public const int NET_DVR_GET_LF_CFG = 161;//ȡ˫ò + + //ܷȡýṹ + public const int NET_DVR_SET_IVMS_STREAMCFG = 162;//ܷȡ + public const int NET_DVR_GET_IVMS_STREAMCFG = 163;//ȡܷȡ + + //ܿƲṹ + public const int NET_DVR_SET_VCA_CTRLCFG = 164;//ܿƲ + public const int NET_DVR_GET_VCA_CTRLCFG = 165;//ȡܿƲ + + //NET_VCA_MASK_REGION_LIST + public const int NET_DVR_SET_VCA_MASK_REGION = 166;// + public const int NET_DVR_GET_VCA_MASK_REGION = 167;//ȡ + + //ATM NET_VCA_ENTER_REGION + public const int NET_DVR_SET_VCA_ENTER_REGION = 168;//ý + public const int NET_DVR_GET_VCA_ENTER_REGION = 169;//ȡ + + //궨NET_VCA_LINE_SEGMENT_LIST + public const int NET_DVR_SET_VCA_LINE_SEGMENT = 170;//ñ궨 + public const int NET_DVR_GET_VCA_LINE_SEGMENT = 171;//ȡ궨 + + // ivmsNET_IVMS_MASK_REGION_LIST + public const int NET_DVR_SET_IVMS_MASK_REGION = 172;//IVMS + public const int NET_DVR_GET_IVMS_MASK_REGION = 173;//ȡIVMS + // ivmsNET_IVMS_ENTER_REGION + public const int NET_DVR_SET_IVMS_ENTER_REGION = 174;//IVMS + public const int NET_DVR_GET_IVMS_ENTER_REGION = 175;//ȡIVMS + + public const int NET_DVR_SET_IVMS_BEHAVIORCFG = 176;//ܷΪ + public const int NET_DVR_GET_IVMS_BEHAVIORCFG = 177;//ȡܷΪ + + // IVMS طż + public const int NET_DVR_IVMS_SET_SEARCHCFG = 178;//IVMSطż + public const int NET_DVR_IVMS_GET_SEARCHCFG = 179;//ȡIVMSطż + + /***************************DS9000(_V30) begin *****************************/ + //(NET_DVR_NETCFG_V30ṹ) + public const int NET_DVR_GET_NETCFG_V30 = 1000;//ȡ + public const int NET_DVR_SET_NETCFG_V30 = 1001;// + + //ͼ(NET_DVR_PICCFG_V30ṹ) + public const int NET_DVR_GET_PICCFG_V30 = 1002;//ȡͼ + public const int NET_DVR_SET_PICCFG_V30 = 1003;//ͼ + + //ͼ(NET_DVR_PICCFG_V40ṹ) + public const int NET_DVR_GET_PICCFG_V40 = 6179;//ȡͼV40չ + public const int NET_DVR_SET_PICCFG_V40 = 6180;//ͼV40չ + + //¼ʱ(NET_DVR_RECORD_V30ṹ) + public const int NET_DVR_GET_RECORDCFG_V30 = 1004;//ȡ¼ + public const int NET_DVR_SET_RECORDCFG_V30 = 1005;//¼ + + public const int NET_DVR_GET_RECORDCFG_V40 = 1008; //ȡ¼(չ) + public const int NET_DVR_SET_RECORDCFG_V40 = 1009; //¼(չ) + + //û(NET_DVR_USER_V30ṹ) + public const int NET_DVR_GET_USERCFG_V30 = 1006;//ȡû + public const int NET_DVR_SET_USERCFG_V30 = 1007;//û + + //9000DDNS(NET_DVR_DDNSPARA_V30ṹ) + public const int NET_DVR_GET_DDNSCFG_V30 = 1010;//ȡDDNS(9000չ) + public const int NET_DVR_SET_DDNSCFG_V30 = 1011;//DDNS(9000չ) + + //EMAIL(NET_DVR_EMAILCFG_V30ṹ) + public const int NET_DVR_GET_EMAILCFG_V30 = 1012;//ȡEMAIL + public const int NET_DVR_SET_EMAILCFG_V30 = 1013;//EMAIL + + //Ѳ (NET_DVR_CRUISE_PARAṹ) + public const int NET_DVR_GET_CRUISE = 1020; + public const int NET_DVR_SET_CRUISE = 1021; + + //ṹ (NET_DVR_ALARMINCFG_V30ṹ) + public const int NET_DVR_GET_ALARMINCFG_V30 = 1024; + public const int NET_DVR_SET_ALARMINCFG_V30 = 1025; + + //ṹ (NET_DVR_ALARMOUTCFG_V30ṹ) + public const int NET_DVR_GET_ALARMOUTCFG_V30 = 1026; + public const int NET_DVR_SET_ALARMOUTCFG_V30 = 1027; + + //Ƶṹ (NET_DVR_VIDEOOUT_V30ṹ) + public const int NET_DVR_GET_VIDEOOUTCFG_V30 = 1028; + public const int NET_DVR_SET_VIDEOOUTCFG_V30 = 1029; + + //ַṹ (NET_DVR_SHOWSTRING_V30ṹ) + public const int NET_DVR_GET_SHOWSTRING_V30 = 1030; + public const int NET_DVR_SET_SHOWSTRING_V30 = 1031; + + //쳣ṹ (NET_DVR_EXCEPTION_V30ṹ) + public const int NET_DVR_GET_EXCEPTIONCFG_V30 = 1034; + public const int NET_DVR_SET_EXCEPTIONCFG_V30 = 1035; + + //232ṹ (NET_DVR_RS232CFG_V30ṹ) + public const int NET_DVR_GET_RS232CFG_V30 = 1036; + public const int NET_DVR_SET_RS232CFG_V30 = 1037; + + //Ӳ̽ṹ (NET_DVR_NET_DISKCFGṹ) + public const int NET_DVR_GET_NET_DISKCFG = 1038;//Ӳ̽ȡ + public const int NET_DVR_SET_NET_DISKCFG = 1039;//Ӳ̽ + + //ѹ (NET_DVR_COMPRESSIONCFG_V30ṹ) + public const int NET_DVR_GET_COMPRESSCFG_V30 = 1040; + public const int NET_DVR_SET_COMPRESSCFG_V30 = 1041; + + //ȡ485 (NET_DVR_DECODERCFG_V30ṹ) + public const int NET_DVR_GET_DECODERCFG_V30 = 1042;//ȡ + public const int NET_DVR_SET_DECODERCFG_V30 = 1043;//ý + + //ȡԤ (NET_DVR_PREVIEWCFG_V30ṹ) + public const int NET_DVR_GET_PREVIEWCFG_V30 = 1044;//ȡԤ + public const int NET_DVR_SET_PREVIEWCFG_V30 = 1045;//Ԥ + + //Ԥ (NET_DVR_PREVIEWCFG_AUX_V30ṹ) + public const int NET_DVR_GET_PREVIEWCFG_AUX_V30 = 1046;//ȡԤ + public const int NET_DVR_SET_PREVIEWCFG_AUX_V30 = 1047;//øԤ + + //IPò NET_DVR_IPPARACFGṹ + public const int NET_DVR_GET_IPPARACFG = 1048; //ȡIPϢ + public const int NET_DVR_SET_IPPARACFG = 1049;//IPϢ + + //IPò NET_DVR_IPPARACFG_V40ṹ + public const int NET_DVR_GET_IPPARACFG_V40 = 1062; //ȡIPϢ + public const int NET_DVR_SET_IPPARACFG_V40 = 1063;//IPϢ + + //IPò NET_DVR_IPALARMINCFGṹ + public const int NET_DVR_GET_IPALARMINCFG = 1050; //ȡIPϢ + public const int NET_DVR_SET_IPALARMINCFG = 1051; //IPϢ + + //IPò NET_DVR_IPALARMOUTCFGṹ + public const int NET_DVR_GET_IPALARMOUTCFG = 1052;//ȡIPϢ + public const int NET_DVR_SET_IPALARMOUTCFG = 1053;//IPϢ + + //Ӳ̹IJȡ (NET_DVR_HDCFGṹ) + public const int NET_DVR_GET_HDCFG = 1054;//ȡӲ̹ò + public const int NET_DVR_SET_HDCFG = 1055;//Ӳ̹ò + + //IJȡ (NET_DVR_HDGROUP_CFGṹ) + public const int NET_DVR_GET_HDGROUP_CFG = 1056;//ȡò + public const int NET_DVR_SET_HDGROUP_CFG = 1057;//ò + + //豸(NET_DVR_COMPRESSION_AUDIOṹ) + public const int NET_DVR_GET_COMPRESSCFG_AUD = 1058;//ȡ豸Խ + public const int NET_DVR_SET_COMPRESSCFG_AUD = 1059;//豸Խ + + //IPò NET_DVR_IPPARACFG_V31ṹ + public const int NET_DVR_GET_IPPARACFG_V31 = 1060;//ȡIPϢ + public const int NET_DVR_SET_IPPARACFG_V31 = 1061; //IPϢ + + //豸 NET_DVR_DEVICECFG_V40ṹ + public const int NET_DVR_GET_DEVICECFG_V40 = 1100;//ȡ豸 + public const int NET_DVR_SET_DEVICECFG_V40 = 1101;//豸 + + //(NET_DVR_NETCFG_MULTIṹ) + public const int NET_DVR_GET_NETCFG_MULTI = 1161; + public const int NET_DVR_SET_NETCFG_MULTI = 1162; + + //BONDING(NET_DVR_NETWORK_BONDINGṹ) + public const int NET_DVR_GET_NETWORK_BONDING = 1254; + public const int NET_DVR_SET_NETWORK_BONDING = 1255; + + + //ȶԿ + public const int NET_DVR_GET_FACELIB_TRIGGER = 3962; //ȡȶԿ + public const int NET_DVR_SET_FACELIB_TRIGGER = 3963; //ȶԿ + public const int NET_DVR_GET_FACELIB_SCHEDULE = 3977; //ȡȶԿIJʱ + public const int NET_DVR_SET_FACELIB_SCHEDULE = 3978; //ȶԿIJʱ + + //NATӳò NET_DVR_NAT_CFGṹ + public const int NET_DVR_GET_NAT_CFG = 6111; //ȡNATӳ + public const int NET_DVR_SET_NAT_CFG = 6112; //NATӳ + + //ǽ + public const int NET_DVR_SET_WINCFG = 1202;//ڲ + public const int NET_DVR_MATRIX_BIGSCREENCFG_GET = 1140; //ȡƴӲ + public const int NET_DVR_MATRIX_BIGSCREENCFG_SET = 1141; //ôƴӲ + + public const int NET_DVR_MATRIX_WALL_GET = 9002; //ȡǽĻ + public const int NET_DVR_MATRIX_WALL_SET = 9001; //õǽĻ + + public const int NET_DVR_WALLWIN_GET = 9003; //ȡǽڲ + public const int NET_DVR_WALLWIN_SET = 9004; //õǽڲ + + public const int NET_DVR_WALLWINPARAM_SET = 9005; //ȡǽز + public const int NET_DVR_WALLWINPARAM_GET = 9006; //õǽز + + public const int NET_DVR_SWITCH_WIN_TOP = 9017; //ö + public const int NET_DVR_SWITCH_WIN_BOTTOM = 9018; //õ + + public const int NET_DVR_GET_VIDEOWALLDISPLAYPOSITION = 1734;//ȡʾλò + public const int NET_DVR_SET_VIDEOWALLDISPLAYPOSITION = 1733;//ʾλò + + public const int NET_DVR_GET_VIDEOWALLDISPLAYNO = 1732; //ȡ豸ʾ + + public const int NET_DVR_GET_VIDEOWALLWINDOWPOSITION = 1735; //ȡǽڲ + public const int NET_DVR_SET_VIDEOWALLWINDOWPOSITION = 1736; //õǽڲ + + public const int NET_DVR_GET_CHAN_RELATION = 9209; //ȡͨԴ + public const int NET_DVR_SET_CHAN_RELATION = 9210; //ñͨԴ + public const int NET_DVR_GET_ALL_CHAN_RELATION = 9211; //ȡбͨԴ + + public const int NET_DVR_GET_VW_SCENE_PARAM = 1746; //ȡǽģʽ + public const int NET_DVR_SET_VW_SCENE_PARAM = 1747; //õǽģʽ + + public const int NET_DVR_GET_OUTPUT_PIC_WIN_CFG = 9202; //ȡͼƬڲ + public const int NET_DVR_SET_OUTPUT_PIC_WIN_CFG = 9203; //ͼƬڲ + + public const int NET_DVR_GET_OUTPUT_OSD_CFG = 9206; //ȡOSD + public const int NET_DVR_SET_OUTPUT_OSD_CFG = 9207; //OSD + + public const int NET_DVR_SCENE_CONTROL = 1744; // + + + public const int NET_DVR_GET_CARD = 2560; + public const int NET_DVR_SET_CARD = 2561; + public const int NET_DVR_DEL_CARD = 2562; + public const int NET_DVR_GET_FINGERPRINT = 2563; + public const int NET_DVR_SET_FINGERPRINT = 2564; + public const int NET_DVR_DEL_FINGERPRINT = 2565; + public const int NET_DVR_GET_FACE = 2566; + public const int NET_DVR_SET_FACE = 2567; + + public const int NET_DVR_DEL_FACE_PARAM_CFG = 2509; //delete face param configure + public const int NET_DVR_CAPTURE_FACE_INFO = 2510; //capture face information + + //Ԥõƻȡ + public const int NET_DVR_GET_PRESET_NAME = 3383; + public const int NET_DVR_SET_PRESET_NAME = 3382; + + public const int NET_VCA_GET_RULECFG_V41 = 5011; //ȡΪ + public const int NET_VCA_SET_RULECFG_V41 = 5012; //Ϊ + + public const int NET_DVR_GET_TRAVERSE_PLANE_DETECTION = 3360; //ȡԽ + public const int NET_DVR_SET_TRAVERSE_PLANE_DETECTION = 3361; //Խ + + public const int NET_DVR_GET_THERMOMETRY_ALARMRULE = 3627; //ȡԤõ± + public const int NET_DVR_SET_THERMOMETRY_ALARMRULE = 3628; //Ԥõ± + public const int NET_DVR_GET_THERMOMETRY_TRIGGER = 3632; //ȡ + public const int NET_DVR_SET_THERMOMETRY_TRIGGER = 3633; //ò + + public const int NET_DVR_SET_MANUALTHERM_BASICPARAM = 6716; //ֶ» + public const int NET_DVR_GET_MANUALTHERM_BASICPARAM = 6717; //ȡֶ» + + public const int NET_DVR_SET_MANUALTHERM = 6708; //ֶ + + public const int NET_DVR_GET_MULTI_STREAM_COMPRESSIONCFG = 3216; //Զ̻ȡѹ + public const int NET_DVR_SET_MULTI_STREAM_COMPRESSIONCFG = 3217; //Զöѹ + + public const int NET_DVR_VIDEO_CALL_SIGNAL_PROCESS = 16032; //ӻԽ + + public const int NET_DVR_ARM_ALARMHOST_SUBSYSTEM = 2036;//Ͷϵͳ + + public const int NET_DVR_GET_MULTI_CARD_CFG_V50 = 2515; //ȡؿV50 + public const int NET_DVR_SET_MULTI_CARD_CFG_V50 = 2516; //öؿV50 + + public const int NET_DVR_BARRIERGATE_CTRL = 3128; //բ + + public const int NET_DVR_INQUEST_GET_CDW_STATUS = 6350; //ȡѶ¼״̬- + + public const int NET_DVR_GET_REALTIME_THERMOMETRY = 3629; //ʵʱ¶ȼ + + public const int NET_DVR_GET_ACS_EVENT = 2514;//豸¼ȡ + + public const int NET_SDK_GET_NEXT_STATUS_SUCCESS = 1000; + public const int NET_SDK_GET_NEXT_STATUS_NEED_WAIT = 1001; + public const int NET_SDK_GET_NEXT_STATUS_FINISH = 1002; + public const int NET_SDK_GET_NEXT_STATUS_FAILED = 1003; + /************************* end*******************************/ + + + /************************DVR־ begin***************************/ + /* */ + // + public const int MAJOR_ALARM = 1; + // + public const int MINOR_ALARM_IN = 1;/* */ + public const int MINOR_ALARM_OUT = 2;/* */ + public const int MINOR_MOTDET_START = 3; /* ƶⱨʼ */ + public const int MINOR_MOTDET_STOP = 4; /* ƶⱨ */ + public const int MINOR_HIDE_ALARM_START = 5;/* ڵʼ */ + public const int MINOR_HIDE_ALARM_STOP = 6;/* ڵ */ + public const int MINOR_VCA_ALARM_START = 7;/*ܱʼ*/ + public const int MINOR_VCA_ALARM_STOP = 8;/*ֹܱͣ*/ + + /* 쳣 */ + // + public const int MAJOR_EXCEPTION = 2; + // + public const int MINOR_VI_LOST = 33;/* ƵźŶʧ */ + public const int MINOR_ILLEGAL_ACCESS = 34;/* Ƿ */ + public const int MINOR_HD_FULL = 35;/* Ӳ */ + public const int MINOR_HD_ERROR = 36;/* Ӳ̴ */ + public const int MINOR_DCD_LOST = 37;/* MODEM (ʹ) */ + public const int MINOR_IP_CONFLICT = 38;/* IPַͻ */ + public const int MINOR_NET_BROKEN = 39;/* Ͽ*/ + public const int MINOR_REC_ERROR = 40;/* ¼ */ + public const int MINOR_IPC_NO_LINK = 41;/* IPC쳣 */ + public const int MINOR_VI_EXCEPTION = 42;/* Ƶ쳣(ֻģͨ) */ + public const int MINOR_IPC_IP_CONFLICT = 43;/*ipc ip ַ ͻ*/ + + //Ƶۺƽ̨ + public const int MINOR_FANABNORMAL = 49;/* Ƶۺƽ̨״̬쳣 */ + public const int MINOR_FANRESUME = 50;/* Ƶۺƽ̨״ָ̬ */ + public const int MINOR_SUBSYSTEM_ABNORMALREBOOT = 51;/* Ƶۺƽ̨6467쳣 */ + public const int MINOR_MATRIX_STARTBUZZER = 52;/* Ƶۺƽ̨dm6467쳣 */ + + /* */ + // + public const int MAJOR_OPERATION = 3; + // + public const int MINOR_START_DVR = 65;/* */ + public const int MINOR_STOP_DVR = 66;/* ػ */ + public const int MINOR_STOP_ABNORMAL = 67;/* 쳣ػ */ + public const int MINOR_REBOOT_DVR = 68;/*豸*/ + + public const int MINOR_LOCAL_LOGIN = 80;/* ص½ */ + public const int MINOR_LOCAL_LOGOUT = 81;/* ע½ */ + public const int MINOR_LOCAL_CFG_PARM = 82;/* ò */ + public const int MINOR_LOCAL_PLAYBYFILE = 83;/* ذļطŻ */ + public const int MINOR_LOCAL_PLAYBYTIME = 84;/* ذʱطŻ*/ + public const int MINOR_LOCAL_START_REC = 85;/* ؿʼ¼ */ + public const int MINOR_LOCAL_STOP_REC = 86;/* ֹͣ¼ */ + public const int MINOR_LOCAL_PTZCTRL = 87;/* ̨ */ + public const int MINOR_LOCAL_PREVIEW = 88;/* Ԥ (ʹ)*/ + public const int MINOR_LOCAL_MODIFY_TIME = 89;/* ޸ʱ(ʹ) */ + public const int MINOR_LOCAL_UPGRADE = 90;/* */ + public const int MINOR_LOCAL_RECFILE_OUTPUT = 91;/* ر¼ļ */ + public const int MINOR_LOCAL_FORMAT_HDD = 92;/* سʼӲ */ + public const int MINOR_LOCAL_CFGFILE_OUTPUT = 93;/* ļ */ + public const int MINOR_LOCAL_CFGFILE_INPUT = 94;/* 뱾ļ */ + public const int MINOR_LOCAL_COPYFILE = 95;/* رļ */ + public const int MINOR_LOCAL_LOCKFILE = 96;/* ¼ļ */ + public const int MINOR_LOCAL_UNLOCKFILE = 97;/* ؽ¼ļ */ + public const int MINOR_LOCAL_DVR_ALARM = 98;/* ֶʹ*/ + public const int MINOR_IPC_ADD = 99;/* IPC */ + public const int MINOR_IPC_DEL = 100;/* ɾIPC */ + public const int MINOR_IPC_SET = 101;/* IPC */ + public const int MINOR_LOCAL_START_BACKUP = 102;/* ؿʼ */ + public const int MINOR_LOCAL_STOP_BACKUP = 103;/* ֹͣ*/ + public const int MINOR_LOCAL_COPYFILE_START_TIME = 104;/* رݿʼʱ*/ + public const int MINOR_LOCAL_COPYFILE_END_TIME = 105;/* رݽʱ*/ + public const int MINOR_LOCAL_ADD_NAS = 106;/*Ӳ*/ + public const int MINOR_LOCAL_DEL_NAS = 107;/* ɾnas*/ + public const int MINOR_LOCAL_SET_NAS = 108;/* nas*/ + + public const int MINOR_REMOTE_LOGIN = 112;/* Զ̵¼ */ + public const int MINOR_REMOTE_LOGOUT = 113;/* Զע½ */ + public const int MINOR_REMOTE_START_REC = 114;/* Զ̿ʼ¼ */ + public const int MINOR_REMOTE_STOP_REC = 115;/* Զֹͣ¼ */ + public const int MINOR_START_TRANS_CHAN = 116;/* ʼ͸ */ + public const int MINOR_STOP_TRANS_CHAN = 117;/* ֹͣ͸ */ + public const int MINOR_REMOTE_GET_PARM = 118;/* Զ̻ȡ */ + public const int MINOR_REMOTE_CFG_PARM = 119;/* Զò */ + public const int MINOR_REMOTE_GET_STATUS = 120;/* Զ̻ȡ״̬ */ + public const int MINOR_REMOTE_ARM = 121;/* Զ̲ */ + public const int MINOR_REMOTE_DISARM = 122;/* Զ̳ */ + public const int MINOR_REMOTE_REBOOT = 123;/* Զ */ + public const int MINOR_START_VT = 124;/* ʼԽ */ + public const int MINOR_STOP_VT = 125;/* ֹͣԽ */ + public const int MINOR_REMOTE_UPGRADE = 126;/* Զ */ + public const int MINOR_REMOTE_PLAYBYFILE = 127;/* Զ̰ļط */ + public const int MINOR_REMOTE_PLAYBYTIME = 128;/* Զ̰ʱط */ + public const int MINOR_REMOTE_PTZCTRL = 129;/* Զ̨ */ + public const int MINOR_REMOTE_FORMAT_HDD = 130;/* Զ̸ʽӲ */ + public const int MINOR_REMOTE_STOP = 131;/* Զ̹ػ */ + public const int MINOR_REMOTE_LOCKFILE = 132;/* Զļ */ + public const int MINOR_REMOTE_UNLOCKFILE = 133;/* Զ̽ļ */ + public const int MINOR_REMOTE_CFGFILE_OUTPUT = 134;/* Զ̵ļ */ + public const int MINOR_REMOTE_CFGFILE_INTPUT = 135;/* Զ̵ļ */ + public const int MINOR_REMOTE_RECFILE_OUTPUT = 136;/* Զ̵¼ļ */ + public const int MINOR_REMOTE_DVR_ALARM = 137;/* Զֶʹ*/ + public const int MINOR_REMOTE_IPC_ADD = 138;/* ԶIPC */ + public const int MINOR_REMOTE_IPC_DEL = 139;/* ԶɾIPC */ + public const int MINOR_REMOTE_IPC_SET = 140;/* ԶIPC */ + public const int MINOR_REBOOT_VCA_LIB = 141;/*ܿ*/ + public const int MINOR_REMOTE_ADD_NAS = 142;/* Զnas*/ + public const int MINOR_REMOTE_DEL_NAS = 143;/* Զɾnas*/ + public const int MINOR_REMOTE_SET_NAS = 144;/* Զnas*/ + + //2009-12-16 Ƶۺƽ̨־ + public const int MINOR_SUBSYSTEMREBOOT = 160;/*Ƶۺƽ̨dm6467 */ + public const int MINOR_MATRIX_STARTTRANSFERVIDEO = 161; /*Ƶۺƽ̨лʼͼ*/ + public const int MINOR_MATRIX_STOPTRANSFERVIDEO = 162; /*Ƶۺƽ̨лֹͣͼ*/ + public const int MINOR_REMOTE_SET_ALLSUBSYSTEM = 163; /*Ƶۺƽ̨6467ϵͳϢ*/ + public const int MINOR_REMOTE_GET_ALLSUBSYSTEM = 164; /*Ƶۺƽ̨ȡ6467ϵͳϢ*/ + public const int MINOR_REMOTE_SET_PLANARRAY = 165; /*Ƶۺƽ̨üƻѯ*/ + public const int MINOR_REMOTE_GET_PLANARRAY = 166; /*Ƶۺƽ̨ȡƻѯ*/ + public const int MINOR_MATRIX_STARTTRANSFERAUDIO = 167; /*Ƶۺƽ̨лʼƵ*/ + public const int MINOR_MATRIX_STOPRANSFERAUDIO = 168; /*Ƶۺƽ̨лֹͣƵ*/ + public const int MINOR_LOGON_CODESPITTER = 169; /*Ƶۺƽ̨½*/ + public const int MINOR_LOGOFF_CODESPITTER = 170; /*Ƶۺƽ̨˳*/ + + //2010-12-16 ־ + public const int MINOR_REMOTE_BYPASS = 0xd0; /* Զ·*/ + public const int MINOR_REMOTE_UNBYPASS = 0xd1; /* Զ·ָ*/ + public const int MINOR_REMOTE_SET_ALARMIN_CFG = 0xd2; /* Զñ*/ + public const int MINOR_REMOTE_GET_ALARMIN_CFG = 0xd3; /* Զ̻ȡ*/ + public const int MINOR_REMOTE_SET_ALARMOUT_CFG = 0xd4; /* Զñ*/ + public const int MINOR_REMOTE_GET_ALARMOUT_CFG = 0xd5; /* Զ̻ȡ*/ + public const int MINOR_REMOTE_ALARMOUT_OPEN_MAN = 0xd6; /* Զֶ*/ + public const int MINOR_REMOTE_ALARMOUT_CLOSE_MAN = 0xd7; /* Զֶرձ*/ + public const int MINOR_REMOTE_ALARM_ENABLE_CFG = 0xd8; /* ԶñRS485ʹ״̬*/ + public const int MINOR_DBDATA_OUTPUT = 0xd9; /* ݿ¼ */ + public const int MINOR_DBDATA_INPUT = 0xda; /* ݿ¼ */ + public const int MINOR_MU_SWITCH = 0xdb; /* л */ + public const int MINOR_MU_PTZ = 0xdc; /* PTZ */ + public const int MINOR_DELETE_LOGO = 0xdd; /* ɾlogo */ + public const int MINOR_REMOTE_INQUEST_DEL_FILE = 0xde; /*Զɾļ*/ + + /*־Ϣ*/ + // + public const int MAJOR_INFORMATION = 4;/*Ϣ*/ + // + public const int MINOR_HDD_INFO = 161;/*ӲϢ*/ + public const int MINOR_SMART_INFO = 162;/*SMARTϢ*/ + public const int MINOR_REC_START = 163;/*ʼ¼*/ + public const int MINOR_REC_STOP = 164;/*ֹͣ¼*/ + public const int MINOR_REC_OVERDUE = 165;/*¼ɾ*/ + public const int MINOR_LINK_START = 166;//ǰ豸 + public const int MINOR_LINK_STOP = 167;//Ͽǰ豸 + public const int MINOR_NET_DISK_INFO = 168;//ӲϢ + + //־ΪMAJOR_OPERATION=03ΪMINOR_LOCAL_CFG_PARM=0x52MINOR_REMOTE_GET_PARM=0x76MINOR_REMOTE_CFG_PARM=0x77ʱdwParaType:Ч京£ + public const int PARA_VIDEOOUT = 1; + public const int PARA_IMAGE = 2; + public const int PARA_ENCODE = 4; + public const int PARA_NETWORK = 8; + public const int PARA_ALARM = 16; + public const int PARA_EXCEPTION = 32; + public const int PARA_DECODER = 64;/**/ + public const int PARA_RS232 = 128; + public const int PARA_PREVIEW = 256; + public const int PARA_SECURITY = 512; + public const int PARA_DATETIME = 1024; + public const int PARA_FRAMETYPE = 2048;/*֡ʽ*/ + //vca + public const int PARA_VCA_RULE = 4096;//Ϊ + /************************DVR־ End***************************/ + + + /*******************ļ־ֵ*************************/ + public const int NET_DVR_FILE_SUCCESS = 1000;//ļϢ + public const int NET_DVR_FILE_NOFIND = 1001;//ûļ + public const int NET_DVR_ISFINDING = 1002;//ڲļ + public const int NET_DVR_NOMOREFILE = 1003;//ļʱûиļ + public const int NET_DVR_FILE_EXCEPTION = 1004;//ļʱ쳣 + + /*********************ص begin************************/ + public const int COMM_ALARM = 0x1100;//8000ϢϴӦNET_DVR_ALARMINFO + public const int COMM_ALARM_RULE = 0x1102;//ΪϢӦNET_VCA_RULE_ALARM + public const int COMM_ALARM_PDC = 0x1103;//ͳƱϴӦNET_DVR_PDC_ALRAM_INFO + public const int COMM_ALARM_ALARMHOST = 0x1105;//籨ϴӦNET_DVR_ALARMHOST_ALARMINFO + public const int COMM_ALARM_FACE = 0x1106;//ʶ𱨾ϢӦNET_DVR_FACEDETECT_ALARM + public const int COMM_RULE_INFO_UPLOAD = 0x1107; // ¼Ϣϴ + public const int COMM_ALARM_AID = 0x1110; //ͨ¼Ϣ + public const int COMM_ALARM_TPS = 0x1111; //ͨͳƱϢ + public const int COMM_UPLOAD_FACESNAP_RESULT = 0x1112; //ʶϴ + public const int COMM_ALARM_FACE_DETECTION = 0x4010; //ⱨϢ + public const int COMM_ALARM_TFS = 0x1113; //ͨȡ֤Ϣ + public const int COMM_ALARM_TPS_V41 = 0x1114; //ͨͳƱϢչ + public const int COMM_ALARM_AID_V41 = 0x1115; //ͨ¼Ϣչ + public const int COMM_ALARM_VQD_EX = 0x1116; //Ƶϱ + public const int COMM_SENSOR_VALUE_UPLOAD = 0x1120; //ģʵʱϴ + public const int COMM_SENSOR_ALARM = 0x1121; //ģϴ + public const int COMM_SWITCH_ALARM = 0x1122; // + public const int COMM_ALARMHOST_EXCEPTION = 0x1123; //ϱ + public const int COMM_ALARMHOST_OPERATEEVENT_ALARM = 0x1124; //¼ϴ + public const int COMM_ALARMHOST_SAFETYCABINSTATE = 0x1125; //״̬ + public const int COMM_ALARMHOST_ALARMOUTSTATUS = 0x1126; ///״̬ + public const int COMM_ALARMHOST_CID_ALARM = 0x1127; //CID汨ϴ + public const int COMM_ALARMHOST_EXTERNAL_DEVICE_ALARM = 0x1128; //豸ϴ + public const int COMM_ALARMHOST_DATA_UPLOAD = 0x1129; //ϴ + public const int COMM_UPLOAD_VIDEO_INTERCOM_EVENT = 0x1132; //ӶԽ¼¼ϴ + public const int COMM_ALARM_AUDIOEXCEPTION = 0x1150; //Ϣ + public const int COMM_ALARM_DEFOCUS = 0x1151; //齹Ϣ + public const int COMM_ALARM_BUTTON_DOWN_EXCEPTION = 0x1152; //ť±Ϣ + public const int COMM_ALARM_ALARMGPS = 0x1202; //GPSϢϴ + public const int COMM_TRADEINFO = 0x1500; //ATMDVRϴϢ + public const int COMM_UPLOAD_PLATE_RESULT = 0x2800; //ϴϢ + public const int COMM_ITC_STATUS_DETECT_RESULT = 0x2810; //ʵʱ״̬ϴ(ܸIPC) + public const int COMM_IPC_AUXALARM_RESULT = 0x2820; //PIR߱ȱϴ + public const int COMM_UPLOAD_PICTUREINFO = 0x2900; //ϴͼƬϢ + public const int COMM_SNAP_MATCH_ALARM = 0x2902; //ֹȶԽϴ + public const int COMM_ITS_PLATE_RESULT = 0x3050; //նͼƬϴ + public const int COMM_ITS_TRAFFIC_COLLECT = 0x3051; //նͳϴ + public const int COMM_ITS_GATE_VEHICLE = 0x3052; //ڳץϴ + public const int COMM_ITS_GATE_FACE = 0x3053; //ץϴ + public const int COMM_ITS_GATE_COSTITEM = 0x3054; //ڹշϸ 2013-11-19 + public const int COMM_ITS_GATE_HANDOVER = 0x3055; //ڽӰ 2013-11-19 + public const int COMM_ITS_PARK_VEHICLE = 0x3056; //ͣϴ + public const int COMM_ITS_BLOCKLIST_ALARM = 0x3057; //ֹϴ + public const int COMM_ALARM_TPS_REAL_TIME = 0x3081; //TPSʵʱϴ + public const int COMM_ALARM_TPS_STATISTICS = 0x3082; //TPSͳƹϴ + public const int COMM_ALARM_V30 = 0x4000; //9000Ϣϴ + public const int COMM_IPCCFG = 0x4001; //9000豸IPCøı䱨Ϣϴ + public const int COMM_IPCCFG_V31 = 0x4002; //9000豸IPCøı䱨Ϣϴչ 9000_1.1 + public const int COMM_IPCCFG_V40 = 0x4003; // IVMS 2000 NVR IPCøıʱϢϴ + public const int COMM_ALARM_DEVICE = 0x4004; //豸ݣֵͨ256չ + public const int COMM_ALARM_CVR = 0x4005; //CVR 2.0.Xⲿ + public const int COMM_ALARM_HOT_SPARE = 0x4006; //ȱ쳣N+1ģʽ쳣 + public const int COMM_ALARM_V40 = 0x4007; //ƶ⣬ƵʧڵIOźȱϢϴΪɱ䳤 + public const int COMM_UPLOAD_HEATMAP_RESULT = 0x4008; //ȶͼϴ + + public const int COMM_ITS_ROAD_EXCEPTION = 0x4500; //·豸쳣 + public const int COMM_ITS_EXTERNAL_CONTROL_ALARM = 0x4520; //ر + public const int COMM_FIREDETECTION_ALARM = 0x4991; //ⱨ + public const int COMM_SCREEN_ALARM = 0x5000; // + public const int COMM_DVCS_STATE_ALARM = 0x5001; //ֲʽϴ + public const int COMM_ALARM_VQD = 0x6000; //VQDϴ + public const int COMM_PUSH_UPDATE_RECORD_INFO = 0x6001; //ģʽ¼Ϣϴ + public const int COMM_DIAGNOSIS_UPLOAD = 0x5100; //ϷVQDϴ + public const int COMM_ALARM_ACS = 0x5002; //Ž + public const int COMM_ID_INFO_ALARM = 0x5200; //֤Ϣϴ + public const int COMM_PASSNUM_INFO_ALARM = 0x5201; //ͨϱ + public const int COMM_ISAPI_ALARM = 0x6009; + + public const int COMM_THERMOMETRY_ALARM = 0x5212; //¶ȱϢ + + public const int COMM_UPLOAD_AIOP_VIDEO = 0x4021; //豸֧AIƽ̨룬ϴƵ + public const int COMM_UPLOAD_AIOP_PICTURE = 0x4022; //豸֧AIƽ̨룬ϴͼƬ + public const int COMM_UPLOAD_AIOP_POLLING_SNAP = 0x4023; //豸֧AIƽ̨룬ϴѲץͼͼƬ ӦĽṹ(NET_AIOP_POLLING_SNAP_HEAD) + public const int COMM_UPLOAD_AIOP_POLLING_VIDEO = 0x4024; //豸֧AIƽ̨룬ϴѲƵ ӦĽṹ(NET_AIOP_POLLING_VIDEO_HEAD) + + + + public const int NET_DVR_JSON_CONFIG = 2550; + public const int NET_DVR_FACE_DATA_RECORD = 2551; + public const int NET_DVR_FACE_DATA_SEARCH = 2552; + public const int NET_DVR_FACE_DATA_MODIFY = 2553; + + public const int NET_DVR_REMOTECONTROL_GATEWAY = 16009; //Զ̿ + + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern int NET_DVR_SendWithRecvRemoteConfig(int lHandle, IntPtr lpInBuff, uint dwInBuffSize, IntPtr lpOutBuff, uint dwOutBuffSize, ref uint dwOutDataLen); + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern int NET_DVR_SendWithRecvRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_FACE_RECORD lpInBuff, int dwInBuffSize, ref CHCNetSDK.NET_DVR_FACE_STATUS lpOutBuff, int dwOutBuffSize, IntPtr dwOutDataLen); + + [DllImport(@"..\..\..\HCNetSDK\HCNetSDK.dll")] + public static extern int NET_DVR_SendWithRecvRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_FINGERPRINT_RECORD lpInBuff, int dwInBuffSize, ref CHCNetSDK.NET_DVR_FINGERPRINT_STATUS lpOutBuff, int dwOutBuffSize, IntPtr dwOutDataLen); + + // ûSendwithRecvӿʱӿڷص״̬ + public enum NET_SDK_SENDWITHRECV_STATUS + { + NET_SDK_CONFIG_STATUS_SUCCESS = 1000, // ɹȡݣͻ˴걾ݺҪٴεNET_DVR_SendWithRecvRemoteConfigȡһ + NET_SDK_CONFIG_STATUS_NEEDWAIT, // õȴͻ˿NET_DVR_SendWithRecvRemoteConfig + NET_SDK_CONFIG_STATUS_FINISH, // ȫȡ꣬ʱͻ˿ɵNET_DVR_StopRemoteConfig + NET_SDK_CONFIG_STATUS_FAILED, // ʧܣͻ˿NET_DVR_SendWithRecvRemoteConfig + NET_SDK_CONFIG_STATUS_EXCEPTION, // 쳣ʱͻ˿ɵNET_DVR_StopRemoteConfig + } + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_STDXMLConfig(int lUserID, IntPtr lpInputParam, IntPtr lpOutputParam); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ControlGateway(int lUserID, int lGatewayIndex, uint dwStaic); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessageCallBack_V50(int iIndex, MSGCallBack fMessageCallBack, IntPtr pUser); + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_JSON_DATA_CFG + { + public uint dwSize; //size of NET_DVR_JSON_DATA_CFG + public IntPtr lpJsonData; //Json data + public uint dwJsonDataSize; //Json data size + public IntPtr lpPicData; //picture data + public uint dwPicDataSize; //picture data size + public uint dwInfraredFacePicSize; //infrared picture data size + public IntPtr lpInfraredFacePicBuffer; //infrared picture data + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 248)] + public byte[] byRes; //reserve + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAPTURE_FACE_COND + { + public int dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + byRes = new byte[128]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAPTURE_FACE_CFG + { + public int dwSize; + public int dwFaceTemplate1Size;//ģ1ݴС0ʱģ1 + public IntPtr pFaceTemplate1Buffer;//ģ1ݻ棨2.5k + public int dwFaceTemplate2Size;//ģ2ݴС0ʱģ2 + public IntPtr pFaceTemplate2Buffer; //ģ2ݻ棨2.5K + public int dwFacePicSize;//ͼƬݴС0ʱͼƬ; + public IntPtr pFacePicBuffer;//ͼƬݻ; + public byte byFaceQuality1;//Χ1-100 + public byte byFaceQuality2;//Χ1-100 + public byte byCaptureProgress; //ɼȣĿǰֵֻֽ0-δɼ100-ɼֻڽΪ100ʱŽϢ + public byte byRes1; + public int dwInfraredFacePicSize; //ͼƬݴС0ʱͼƬ + public IntPtr pInfraredFacePicBuffer; //ͼƬݻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 116, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + byRes = new byte[116]; + } + } + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_CAPTURE_FACE_CFG lpOutBuff, int dwOutBuffSize); + + public const int ERROR_MSG_LEN = 32; + public const int MAX_FINGER_PRINT_LEN = 768; + public const int NET_DVR_CAPTURE_FINGERPRINT_INFO = 2504; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINGERPRINT_STATUS + { + public int dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN)] + public byte[] byCardNo; + public byte byCardReaderRecvStatus;//ָƶ״ֽ̬ڱʾ0-ʧܣ1-ɹ2-ָģ鲻ߣ3-Իָ4-ڴ5-Ѵڸָƣ6-ѴڸָID7-ǷָID8-ָģ + public byte byFingerPrintID;//ָţЧֵΧΪ1-10 + public byte byFingerType;//ָ 0-ָͨƣ1-вָ + public byte byRecvStatus;//״̬0-ɹ1-ָŴ2-ָʹ3-Ŵ󣨿Ź񲻷豸Ҫ󣩣4-ָδŻ򿨺ţŻ򿨺ֶΪգ5-Ųڣ6-ָݳΪ07-Ŵ8-Ŵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ERROR_MSG_LEN)] + public byte[] byErrorMsg;//·ϢbyCardReaderRecvStatusΪ5ʱʾѴָƶӦĿ + public int dwCardReaderNo;//byCardReaderRecvStatusΪ5ʱʾѴָƶӦָƶţ·󷵻ء0ʱʾ޴Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20)] + public byte[] byRes; + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byErrorMsg = new byte[CHCNetSDK.ERROR_MSG_LEN]; + + byRes = new byte[20]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINGERPRINT_RECORD + { + public int dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN)] + public byte[] byCardNo; //ָƹĿ + public int dwFingerPrintLen; //ָݳ + public int dwEnableReaderNo;//Ҫ·ָƵĶ + public byte byFingerPrintID;//ָţЧֵΧΪ1-10 + public byte byFingerType;//ָ 0-ָͨƣ1-вָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 30)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.MAX_FINGER_PRINT_LEN)] + public byte[] byFingerData; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 96)] + public byte[] byRes; + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byRes1 = new byte[30]; + byFingerData = new byte[CHCNetSDK.MAX_FINGER_PRINT_LEN]; + byRes = new byte[96]; + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINGER_PRINT_INFO_CTRL_V50_ByCardNo + { + public int dwSize; + public byte byMode; //ɾʽ0-ţԱIDʽɾ1-ɾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] byRes1; + public CHCNetSDK.NET_DVR_FINGER_PRINT_BYCARD_V50 struProcessMode;//ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64)] + public byte[] byRes; + public void init() + { + byRes1 = new byte[3]; + byRes = new byte[64]; + struProcessMode.init(); + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINGER_PRINT_BYCARD_V50 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN)] + public byte[] byCardNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.MAX_CARD_READER_NUM_512)] + public byte[] byEnableCardReader; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.MAX_FINGER_PRINT_NUM)] + public byte[] byFingerPrintID; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.NET_SDK_EMPLOYEE_NO_LEN)] + public byte[] byEmployeeNo; + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byEnableCardReader = new byte[CHCNetSDK.MAX_CARD_READER_NUM_512]; + byFingerPrintID = new byte[CHCNetSDK.MAX_FINGER_PRINT_NUM]; + byRes1 = new byte[2]; + byEmployeeNo = new byte[CHCNetSDK.NET_SDK_EMPLOYEE_NO_LEN]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINGER_PRINT_INFO_STATUS_V50 + { + public int dwSize; + public int dwCardReaderNo; + public byte byStatus; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 63)] + public byte[] byRes; + public void init() + { + byRes = new byte[63]; + } + } + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_FINGER_PRINT_INFO_STATUS_V50 lpOutBuff, int dwOutBuffSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_ACS_EVENT_CFG lpOutBuff, int dwOutBuffSize); + + [DllImport(@"..\..\..\HCNetSDK\HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_FINGERPRINT_RECORD lpOutBuff, int dwOutBuffSize); + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAPTURE_FINGERPRINT_COND + { + public int dwSize; + public byte byFingerPrintPicType; //ͼƬͣ0- + public byte byFingerNo; //ָţΧ1-10 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 126)] + public byte[] byRes; + + public void init() + { + byRes = new byte[126]; + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAPTURE_FINGERPRINT_CFG + { + public int dwSize; + public int dwFingerPrintDataSize; //ָݴС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.MAX_FINGER_PRINT_LEN)] + public byte[] byFingerData; //ָ + public int dwFingerPrintPicSize; //ָͼƬС0ʱָͼƬ + public IntPtr pFingerPrintPicBuffer; //ָͼƬ + public byte byFingerNo; //ָţΧ1-10 + public byte byFingerPrintQuality; //ָΧ1-100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 62)] + public byte[] byRes; + + public void init() + { + byFingerData = new byte[CHCNetSDK.MAX_FINGER_PRINT_LEN]; + byRes = new byte[62]; + } + } + + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_CAPTURE_FINGERPRINT_CFG lpOutBuff, int dwOutBuffSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, ref CHCNetSDK.NET_DVR_FACE_RECORD lpOutBuff, int dwOutBuffSize); + + //Network Configure Structure(V50) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NETCFG_V50 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ETHERNET, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ETHERNET_V30[] struEtherNet; //Network Port + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPADDR[] struRes1; /*reserve*/ + public NET_DVR_IPADDR struAlarmHostIpAddr; /* IP address of remote management host */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; /* reserve */ + public ushort wAlarmHostIpPort; /* Port of remote management Host */ + public byte byUseDhcp; /* Whether to enable the DHCP 0xff- invalid 0- enabled 1- not enabled */ + public byte byIPv6Mode; //IPv6 allocation, 0- routing announcement, 1- manually, 2- enable DHCP allocation + public NET_DVR_IPADDR struDnsServer1IpAddr; /* IP address of the domain name server 1 */ + public NET_DVR_IPADDR struDnsServer2IpAddr; /* IP address of the domain name server 2 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byIpResolver; /* IP parse server domain name or IP address */ + public ushort wIpResolverPort; /* Parsing IP server port number */ + public ushort wHttpPortNo; /* HTTP port number */ + public NET_DVR_IPADDR struMulticastIpAddr; /* Multicast group address */ + public NET_DVR_IPADDR struGatewayIpAddr; /* Gateway address */ + public NET_DVR_PPPOECFG struPPPoE; + public byte byEnablePrivateMulticastDiscovery; //Private multicast search, 0- default, 1- enabled, 2 - disabled + public byte byEnableOnvifMulticastDiscovery; //Onvif multicast search, 0- default, 1- enabled, 2 - disabled + public ushort wAlarmHost2IpPort; /* Alarm host 2 port */ + public NET_DVR_IPADDR struAlarmHost2IpAddr; /* Alarm host 2 IP addresses */ + public byte byEnableDNS; //DNS Enabled, 0-close,1-open + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 599, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void Init() + { + struEtherNet = new NET_DVR_ETHERNET_V30[MAX_ETHERNET]; + struRes1 = new NET_DVR_IPADDR[2]; + struAlarmHostIpAddr = new NET_DVR_IPADDR(); + struAlarmHost2IpAddr = new NET_DVR_IPADDR(); + struDnsServer1IpAddr = new NET_DVR_IPADDR(); + struDnsServer2IpAddr = new NET_DVR_IPADDR(); + byIpResolver = new byte[MAX_DOMAIN_NAME]; + struMulticastIpAddr = new NET_DVR_IPADDR(); + struGatewayIpAddr = new NET_DVR_IPADDR(); + struPPPoE = new NET_DVR_PPPOECFG(); + byRes = new byte[599]; + } + } + + public const int MAX_CENTERNUM = 4; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_NETCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CENTERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ALARMHOST_NETPARAM[] struNetCenter; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_ABILITY + { + public uint dwSize; // ṹС + public ushort wTotalAlarmInNum; // (), + public ushort wLocalAlarmInNum; // ر + public ushort wExpandAlarmInNum; // չı + public ushort wTotalAlarmOutNum; // 豸ֵ֧ + public ushort wLocalAlarmOutNum; // رڸ + public ushort wExpandAlarmOutNum; // չı + public ushort wTotalRs485Num; // 豸ֵ֧ + public ushort wLocalRs485Num; // 485 + public ushort wExpandRs485Num; // չ485 + public ushort wFullDuplexRs485Num; // ȫ˫485 + public ushort wTotalSensorNum; // ģ (豸ֵ֧) + public ushort wLocalSensorNum; // ģ + public ushort wExpandSensorNum; // չģ + public ushort wAudioOutNum; // + public ushort wGatewayNum; //Ž + public ushort wElectroLockNum; // + public ushort wSirenNum; // Ŀ + public ushort wSubSystemNum; // ɻϵͳĿ + public ushort wNetUserNum; // û + public ushort wKeyboardNum; // + public ushort wOperatorUserNum; // û + public byte bySupportDetector;//Ƿֳ֧̽1-֧֣0-֧ + public byte bySupportSensitivity;//Ƿַ֧ȣ1-֧֣0-֧ + public byte bySupportArrayBypass;//Ƿ֧·1-֧֣0-֧ + public byte bySupportAlarmInDelay;//Ƿַ֧ӳ,1-֧֣0-֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] bySupportAlarmInType;//ֵ֧ķ,0:ʱ,1-24Сʱ,2-ʱ ,3-ڲ4-Կ׷ 5-𾯷 6-ܽ 7-24Сʱ 8-24Сʱ9-24Сʱ𶯷,10-Žŷ11-Žŷ15- + public byte byTelNum; //ֵ֧绰 + public byte byCenterGroupNum; // + public byte byGPRSNum; //GPRS4 + public byte byNetNum; //4 + public byte byAudioNum; //Ƶ + public byte by3GNum; //3Gģ + public byte byAnalogVideoChanNum; //ģƵͨ + public byte byDigitalVideoChanNum; //Ƶͨ + public byte bySubSystemArmType; //ϵͳͣ0-ʾ֧֣1-ʾ֧֡bit0-ͨעСֻ֧ͨмֶεʱСѾСиֶΪ00ʾ֧֣1ʾ֧֡ӿSDKڲݣbit1-ʱbit2-ز + public byte byPublicSubSystemNum; //ϵͳ + + public uint dwSupport1; //λʾ0ʾ֧֣0ʾ֧ + public uint dwSubSystemEvent; //ϵͳ¼λʾ0ʾ֧֣0ʾ֧,bit0-ʱbit1-˳ʱbit2-bit3-bit4-bit5- + public uint dwOverallEvent; //ȫ¼λʾ0ʾ֧֣0ʾ֧֣bit0-磬bit1-صѹͣbit2-绰ߵߣbit3-쳣bit4-쳣bit5-Ӳ̹,bit6-3G/4Gź쳣, bit7-ģӣ,bit8-WIFIͨŹϣbit9-RFźŸŹ + public uint dwFaultType; //豸ֵ֧Ĺͣbit0-ϵ磬bit1-Ƿѹbit2-𿪣bit3-绰ߵߣbit4-̵ߣbit5-ϣbit6-쳣bit7-չ쳣bit8-Ӳ쳣 + + public byte byPublicSubsystemAssociateSubsystemNum; //ϵͳɹϵͳ + public byte byOverallKeyboard; //ȫ̸ּ + public ushort wSafetyCabinSupport; //տλʾ0ʾ֧֣0ʾ֧ + + public byte by485SlotNum; //485λ + public byte bySubSystemAttributeAbility; // ֵΪ1ֹ1ϵͳرʹ + + public ushort wKeyboardAddrNum; // ̵ַ + public byte byAlarmLampNum; //Ŀ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 117, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + public void Init() + { + bySupportAlarmInType = new byte[16]; + byRes = new byte[117]; + } + } + + public const int ALARMHOST_ABILITY = 0x500; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_NETCFG_V50 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CENTERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ALARMHOST_NETPARAM_V50[] struNetCenter; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public void Init() + { + struNetCenter = new NET_DVR_ALARMHOST_NETPARAM_V50[MAX_CENTERNUM]; + byRes1 = new byte[128]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_NETPARAM_V50 + { + public uint dwSize; + public NET_DVR_IPADDR struIP; + public ushort wPort; + public byte byAddressType; //0 - , 1 - ipv4/ipv6ַ2 - + public byte byEnable; //ʹܣ0-ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byDomainName; //GPRSáʱֶξЧ + public byte byReportProtocol; //1-private 2-NAL2300, 3-Ehome + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACCOUNTNUM_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] byDevID; //ЭΪNAL2300ʱЧ + public byte byProtocolVersion; //EHomeЭ汾0-,1Cv2.02Cv4.03-v5.0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EHOME_KEY_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byEHomeKey; //EHome KeyEHome 5.0汾 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 28, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; //GPRSڹ̶ķϽеģԲҪϢԤһЩֶ + public void Init() + { + struIP = new NET_DVR_IPADDR(); + byDomainName = new byte[MAX_DOMAIN_NAME]; + byDevID = new byte[ACCOUNTNUM_LEN_32]; + byRes1 = new byte[3]; + byEHomeKey = new byte[NET_SDK_EHOME_KEY_LEN]; + byRes2 = new byte[28]; + } + } + + public const int NET_DVR_SET_ALARMHOST_NETCFG_V50 = 2225; //Set Net info V50 + public const int NET_DVR_GET_ALARMHOST_NETCFG_V50 = 2224; //Get Net infoV50 + + public const int MAX_AUDIO_V40 = 8; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SIMPLE_DAYTIME + { + public byte byHour; //hour + public byte byMinute; //minute + public byte bySecond; //second + public byte byRes; + } + + + public const int NET_DVR_GET_NETCFG_V50 = 1015; //Get network parameter configuration (V50) + public const int NET_DVR_SET_NETCFG_V50 = 1016; //Set network parameter configuration (V50) + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INDEX + { + public uint iIndex; + public void Init() + { + iIndex = 1; + } + } + + public struct NET_DVR_INBUFF + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)] + public uint[] StatusList; + public void Init() + { + StatusList = new uint[16]; + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_REPORT_CENTER_CFG_V40 + { + public uint dwSize; + public byte byValid; + public byte byDataType; //1-All alarm data 2-not alarm data 3-all data,4-zone report,5-not zone report + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.Struct)] + public byte[] byChanAlarmMode;//alarm channels, 1-T1,2-T2, 3-N1, 4-N2,5-G1, 6-G2 ,7-N3, 8-N4 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.Struct)] + public byte[] byDealFailCenter; //send to these centers while send fail 0-not choose,1-choose + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 512, ArraySubType = UnmanagedType.Struct)] + public byte[] byZoneReport; //zone report type,0-not upload,1-upload + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.Struct)] + public byte[] byNonZoneReport; //not zone report, 0-not upload,1-upload byNonZoneReport[0]-soft zone report byNonZoneReport[1]-system status report byNonZoneReport[2]-cancel report byNonZoneReport[3]-test report byNonZoneReport[4]-arm report byNonZoneReport[5]-disarm report byNonZoneReport[6]-duress report byNonZoneReport[7]-alarm recovery report byNonZoneReport[8]-bypass report byNonZoneReport[9]-bypass restore report,byNonZoneReport[10]-detector connect status report(online/offline),byNonZoneReport[11]-detector power status report(normal/low);bit12-video alarm report + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.Struct)] + public byte[] byAlarmNetCard; //network card center,0-primary card_1,1-primary card_2,2-extend card_1,3-extend card_2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 252, ArraySubType = UnmanagedType.Struct)] + public byte[] byRes2; + public void Init() + { + byRes = new byte[2]; + byChanAlarmMode = new byte[4]; + byDealFailCenter = new byte[16]; + byZoneReport = new byte[512]; + byNonZoneReport = new byte[32]; + byAlarmNetCard = new byte[4]; + byRes2 = new byte[252]; + } + } + + public const int DOOR_NAME_LEN = 32;//door name len + public const int STRESS_PASSWORD_LEN = 8;//stress password len + public const int SUPER_PASSWORD_LEN = 8;//super password len + public const int UNLOCK_PASSWORD_LEN = 8; + public const int MAX_DOOR_NUM = 32; + public const int MAX_GROUP_NUM = 32; + public const int LOCAL_CONTROLLER_NAME_LEN = 32; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DOOR_CFG + { + public uint dwSize; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = DOOR_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDoorName;//door name + public byte byMagneticType;//magnetic type, 0-always close 1-always open + public byte byOpenButtonType;//open button type, 0-always close 1-always open + public byte byOpenDuration;//open duration time, 1-255s(ladder control relay action time) + public byte byDisabledOpenDuration;//disable open duration , 1-255s + public byte byMagneticAlarmTimeout;//magnetic alarm time out , 0-255s,0 means not to alarm + public byte byEnableDoorLock;//whether to enable door lock, 0-disable, 1-enable + public byte byEnableLeaderCard;//whether to enable leader card , 0-disable, 1-enable + public byte byLeaderCardMode;//First card mode, 0 - first card function is not enabled, and 1 - the first card normally open mode, 2 - the first card authorization mode (using this field, the byEnableLeaderCard is invalid ) + public uint dwLeaderCardOpenDuration;//leader card open duration 1-1440min + [MarshalAs(UnmanagedType.ByValArray, SizeConst = STRESS_PASSWORD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byStressPassword;//stress ppassword + [MarshalAs(UnmanagedType.ByValArray, SizeConst = SUPER_PASSWORD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] bySuperPassword; //super password + [MarshalAs(UnmanagedType.ByValArray, SizeConst = UNLOCK_PASSWORD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUnlockPassword; + public byte byUseLocalController; //Read-only, whether the connection on the local controller, 0 - no, 1 - yes + public byte byRes1; + public ushort wLocalControllerID; //Read-only, on-site controller serial number, 1-64, 0 on behalf of unregistered + public ushort wLocalControllerDoorNumber; //Read-only, on-site controller door number, 1-4, 0 represents the unregistered + public ushort wLocalControllerStatus; //Read-only, on-site controller online status: 0 - offline, 1 - online, 2 - loop of RS485 serial port 1 on 1, 3 - loop of RS485 serial port 2 on 2, 4 - loop of RS485 serial port 1, 5 - loop of RS485 serial port 2, 6 - loop 3 of RS485 serial port 1, 7 - the loop on the RS485 serial port on the 3 4 2, 8 - loop on the RS485 serial port 1, 9 - loop 4 of RS485 serial port 2 (read-only) + public byte byLockInputCheck; //Whether to enable the door input detection (1 public byte, 0 is not enabled, 1 is enabled, is not enabled by default) + public byte byLockInputType; //Door lock input type + public byte byDoorTerminalMode; //Gate terminal working mode + public byte byOpenButton; //Whether to enable the open button + public byte byLadderControlDelayTime; //ladder control delay time,1-255min + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 43, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + + public void Init() + { + byDoorName = new byte[DOOR_NAME_LEN]; + byStressPassword = new byte[STRESS_PASSWORD_LEN]; + bySuperPassword = new byte[SUPER_PASSWORD_LEN]; + byUnlockPassword = new byte[UNLOCK_PASSWORD_LEN]; + byRes2 = new byte[43]; + } + } + + public const int NET_DVR_GET_DOOR_CFG = 2108; //get door parameter + public const int NET_DVR_SET_DOOR_CFG = 2109; //set door parameter + + + public const int NET_DVR_SET_ALARMHOST_REPORT_CENTER_V40 = 2065; // set data report mode v30 + + + + + + + + + + + + + /*************쳣(Ϣʽ, صʽ())****************/ + public const int EXCEPTION_EXCHANGE = 32768;//ûʱ쳣 + public const int EXCEPTION_AUDIOEXCHANGE = 32769;//Խ쳣 + public const int EXCEPTION_ALARM = 32770;//쳣 + public const int EXCEPTION_PREVIEW = 32771;//Ԥ쳣 + public const int EXCEPTION_SERIAL = 32772;//͸ͨ쳣 + public const int EXCEPTION_RECONNECT = 32773;//Ԥʱ + public const int EXCEPTION_ALARMRECONNECT = 32774;//ʱ + public const int EXCEPTION_SERIALRECONNECT = 32775;//͸ͨ + public const int EXCEPTION_PLAYBACK = 32784;//ط쳣 + public const int EXCEPTION_DISKFMT = 32785;//Ӳ̸ʽ + + /********************Ԥص*********************/ + public const int NET_DVR_SYSHEAD = 1;//ϵͳͷ + public const int NET_DVR_STREAMDATA = 2;//ƵݣƵֿƵݣ + public const int NET_DVR_AUDIOSTREAMDATA = 3;//Ƶ + public const int NET_DVR_STD_VIDEODATA = 4;//׼Ƶ + public const int NET_DVR_STD_AUDIODATA = 5;//׼Ƶ + + //صԤе״̬Ϣ + public const int NET_DVR_REALPLAYEXCEPTION = 111;//Ԥ쳣 + public const int NET_DVR_REALPLAYNETCLOSE = 112;//ԤʱӶϿ + public const int NET_DVR_REALPLAY5SNODATA = 113;//Ԥ5sûյ + public const int NET_DVR_REALPLAYRECONNECT = 114;//Ԥ + + /********************طŻص*********************/ + public const int NET_DVR_PLAYBACKOVER = 101;//طݲ + public const int NET_DVR_PLAYBACKEXCEPTION = 102;//ط쳣 + public const int NET_DVR_PLAYBACKNETCLOSE = 103;//طʱӶϿ + public const int NET_DVR_PLAYBACK5SNODATA = 104;//ط5sûյ + + /*********************ص end************************/ + //豸ͺ(DVR) + /* 豸 */ + public const int DVR = 1;/*δdvrͷNETRET_DVR*/ + public const int ATMDVR = 2;/*atm dvr*/ + public const int DVS = 3;/*DVS*/ + public const int DEC = 4;/* 6001D */ + public const int ENC_DEC = 5;/* 6001F */ + public const int DVR_HC = 6;/*8000HC*/ + public const int DVR_HT = 7;/*8000HT*/ + public const int DVR_HF = 8;/*8000HF*/ + public const int DVR_HS = 9;/* 8000HS DVR(no audio) */ + public const int DVR_HTS = 10; /* 8016HTS DVR(no audio) */ + public const int DVR_HB = 11; /* HB DVR(SATA HD) */ + public const int DVR_HCS = 12; /* 8000HCS DVR */ + public const int DVS_A = 13; /* ATAӲ̵DVS */ + public const int DVR_HC_S = 14; /* 8000HC-S */ + public const int DVR_HT_S = 15;/* 8000HT-S */ + public const int DVR_HF_S = 16;/* 8000HF-S */ + public const int DVR_HS_S = 17; /* 8000HS-S */ + public const int ATMDVR_S = 18;/* ATM-S */ + public const int LOWCOST_DVR = 19;/*7000Hϵ*/ + public const int DEC_MAT = 20; /*·*/ + public const int DVR_MOBILE = 21;/* mobile DVR */ + public const int DVR_HD_S = 22; /* 8000HD-S */ + public const int DVR_HD_SL = 23;/* 8000HD-SL */ + public const int DVR_HC_SL = 24;/* 8000HC-SL */ + public const int DVR_HS_ST = 25;/* 8000HS_ST */ + public const int DVS_HW = 26; /* 6000HW */ + public const int DS630X_D = 27; /* · */ + public const int IPCAM = 30;/*IP */ + public const int MEGA_IPCAM = 31;/*X52MFϵ,752MF,852MF*/ + public const int IPCAM_X62MF = 32;/*X62MFϵпɽ9000豸,762MF,862MF*/ + public const int IPDOME = 40; /*IP */ + public const int IPDOME_MEGA200 = 41;/*IP 200*/ + public const int IPDOME_MEGA130 = 42;/*IP 130*/ + public const int IPMOD = 50;/*IP ģ*/ + public const int DS71XX_H = 71;/* DS71XXH_S */ + public const int DS72XX_H_S = 72;/* DS72XXH_S */ + public const int DS73XX_H_S = 73;/* DS73XXH_S */ + public const int DS76XX_H_S = 76;/* DS76XX_H_S */ + public const int DS81XX_HS_S = 81;/* DS81XX_HS_S */ + public const int DS81XX_HL_S = 82;/* DS81XX_HL_S */ + public const int DS81XX_HC_S = 83;/* DS81XX_HC_S */ + public const int DS81XX_HD_S = 84;/* DS81XX_HD_S */ + public const int DS81XX_HE_S = 85;/* DS81XX_HE_S */ + public const int DS81XX_HF_S = 86;/* DS81XX_HF_S */ + public const int DS81XX_AH_S = 87;/* DS81XX_AH_S */ + public const int DS81XX_AHF_S = 88;/* DS81XX_AHF_S */ + public const int DS90XX_HF_S = 90; /*DS90XX_HF_S*/ + public const int DS91XX_HF_S = 91; /*DS91XX_HF_S*/ + public const int DS91XX_HD_S = 92; /*91XXHD-S(MD)*/ + /**********************豸 end***********************/ + + /********************** begin***********************/ + public const int DEVICE_SOFTHARDWARE_ABILITY = 0x001; + public const int DEVICE_NETWORK_ABILITY = 0x002; + public const int DEVICE_ENCODE_ALL_ABILITY_V20 = 0x008; + public const int IPC_FRONT_PARAMETER_V20 = 0x009; + public const int DEVICE_RAID_ABILITY = 0x007; + public const int DEVICE_ALARM_ABILITY = 0x00a; + public const int DEVICE_DYNCHAN_ABILITY = 0x00b; + public const int DEVICE_USER_ABILITY = 0x00c; + public const int DEVICE_NETAPP_ABILITY = 0x00d; + public const int DEVICE_VIDEOPIC_ABILITY = 0x00e; + public const int DEVICE_JPEG_CAP_ABILITY = 0x00f; + public const int DEVICE_SERIAL_ABILITY = 0x010; + public const int DEVICE_ABILITY_INFO = 0x011; + /********************** end***********************/ + + /************************************************* + Ž¼ + **************************************************/ + #region acs event upload + + /* Alarm */ + // Main Type + //public const int MAJOR_ALARM = 0x1; + // Hypo- Type + public const int MINOR_ALARMIN_SHORT_CIRCUIT = 0x400; // region short circuit + public const int MINOR_ALARMIN_BROKEN_CIRCUIT = 0x401; // region broken circuit + public const int MINOR_ALARMIN_EXCEPTION = 0x402; // region exception + public const int MINOR_ALARMIN_RESUME = 0x403; // region resume + public const int MINOR_HOST_DESMANTLE_ALARM = 0x404; // host desmantle alarm + public const int MINOR_HOST_DESMANTLE_RESUME = 0x405; // host desmantle resume + public const int MINOR_CARD_READER_DESMANTLE_ALARM = 0x406; // card reader desmantle alarm + public const int MINOR_CARD_READER_DESMANTLE_RESUME = 0x407; // card reader desmantle resume + public const int MINOR_CASE_SENSOR_ALARM = 0x408; // case sensor alarm + public const int MINOR_CASE_SENSOR_RESUME = 0x409; // case sensor resume + public const int MINOR_STRESS_ALARM = 0x40a; // stress alarm + public const int MINOR_OFFLINE_ECENT_NEARLY_FULL = 0x40b; // offline ecent nearly full + public const int MINOR_CARD_MAX_AUTHENTICATE_FAIL = 0x40c; // card max authenticate fall + public const int MINOR_SD_CARD_FULL = 0x40d; // SD card is full + public const int MINOR_LINKAGE_CAPTURE_PIC = 0x40e; // lingage capture picture + public const int MINOR_SECURITY_MODULE_DESMANTLE_ALARM = 0x40f; //Door control security module desmantle alarm + public const int MINOR_SECURITY_MODULE_DESMANTLE_RESUME = 0x410; //Door control security module desmantle resume + public const int MINOR_POS_START_ALARM = 0x411; // POS Start + public const int MINOR_POS_END_ALARM = 0x412; // POS end + public const int MINOR_FACE_IMAGE_QUALITY_LOW = 0x413; // face image quality low + public const int MINOR_FINGE_RPRINT_QUALITY_LOW = 0x414; // finger print quality low + public const int MINOR_FIRE_IMPORT_SHORT_CIRCUIT = 0x415; // Fire import short circuit + public const int MINOR_FIRE_IMPORT_BROKEN_CIRCUIT = 0x416; // Fire import broken circuit + public const int MINOR_FIRE_IMPORT_RESUME = 0x417; // Fire import resume + public const int MINOR_FIRE_BUTTON_TRIGGER = 0x418; // fire button trigger + public const int MINOR_FIRE_BUTTON_RESUME = 0x419; // fire button resume + public const int MINOR_MAINTENANCE_BUTTON_TRIGGER = 0x41a; // maintenance button trigger + public const int MINOR_MAINTENANCE_BUTTON_RESUME = 0x41b; // maintenance button resume + public const int MINOR_EMERGENCY_BUTTON_TRIGGER = 0x41c; // emergency button trigger + public const int MINOR_EMERGENCY_BUTTON_RESUME = 0x41d; // emergency button resume + public const int MINOR_DISTRACT_CONTROLLER_ALARM = 0x41e; // distract controller alarm + public const int MINOR_DISTRACT_CONTROLLER_RESUME = 0x41f; // distract controller resume + public const int MINOR_CHANNEL_CONTROLLER_DESMANTLE_ALARM = 0x422; //channel controller desmantle alarm + public const int MINOR_CHANNEL_CONTROLLER_DESMANTLE_RESUME = 0x423; //channel controller desmantle resume + public const int MINOR_CHANNEL_CONTROLLER_FIRE_IMPORT_ALARM = 0x424; //channel controller fire import alarm + public const int MINOR_CHANNEL_CONTROLLER_FIRE_IMPORT_RESUME = 0x425; //channel controller fire import resume + public const int MINOR_PRINTER_OUT_OF_PAPER = 0x440; //printer no paper + public const int MINOR_LEGAL_EVENT_NEARLY_FULL = 0x442; //Legal event nearly full + + /* Exception*/ + // Main Type + //public const int MAJOR_EXCEPTION = 0x2; + // Hypo- Type + + //public const int MINOR_NET_BROKEN = 0x27; // Network disconnected + public const int MINOR_RS485_DEVICE_ABNORMAL = 0x3a; // RS485 connect status exception + public const int MINOR_RS485_DEVICE_REVERT = 0x3b; // RS485 connect status exception recovery + + public const int MINOR_DEV_POWER_ON = 0x400; // device power on + public const int MINOR_DEV_POWER_OFF = 0x401; // device power off + public const int MINOR_WATCH_DOG_RESET = 0x402; // watch dog reset + public const int MINOR_LOW_BATTERY = 0x403; // low battery + public const int MINOR_BATTERY_RESUME = 0x404; // battery resume + public const int MINOR_AC_OFF = 0x405; // AC off + public const int MINOR_AC_RESUME = 0x406; // AC resume + public const int MINOR_NET_RESUME = 0x407; // Net resume + public const int MINOR_FLASH_ABNORMAL = 0x408; // FLASH abnormal + public const int MINOR_CARD_READER_OFFLINE = 0x409; // card reader offline + public const int MINOR_CARD_READER_RESUME = 0x40a; // card reader resume + public const int MINOR_INDICATOR_LIGHT_OFF = 0x40b; // Indicator Light Off + public const int MINOR_INDICATOR_LIGHT_RESUME = 0x40c; // Indicator Light Resume + public const int MINOR_CHANNEL_CONTROLLER_OFF = 0x40d; // channel controller off + public const int MINOR_CHANNEL_CONTROLLER_RESUME = 0x40e; // channel controller resume + public const int MINOR_SECURITY_MODULE_OFF = 0x40f; // Door control security module off + public const int MINOR_SECURITY_MODULE_RESUME = 0x410; // Door control security module resume + public const int MINOR_BATTERY_ELECTRIC_LOW = 0x411; // battery electric low + public const int MINOR_BATTERY_ELECTRIC_RESUME = 0x412; // battery electric resume + public const int MINOR_LOCAL_CONTROL_NET_BROKEN = 0x413; // Local control net broken + public const int MINOR_LOCAL_CONTROL_NET_RSUME = 0x414; // Local control net resume + public const int MINOR_MASTER_RS485_LOOPNODE_BROKEN = 0x415; // Master RS485 loop node broken + public const int MINOR_MASTER_RS485_LOOPNODE_RESUME = 0x416; // Master RS485 loop node resume + public const int MINOR_LOCAL_CONTROL_OFFLINE = 0x417; // Local control offline + public const int MINOR_LOCAL_CONTROL_RESUME = 0x418; // Local control resume + public const int MINOR_LOCAL_DOWNSIDE_RS485_LOOPNODE_BROKEN = 0x419; // Local downside RS485 loop node broken + public const int MINOR_LOCAL_DOWNSIDE_RS485_LOOPNODE_RESUME = 0x41a; // Local downside RS485 loop node resume + public const int MINOR_DISTRACT_CONTROLLER_ONLINE = 0x41b; // distract controller online + public const int MINOR_DISTRACT_CONTROLLER_OFFLINE = 0x41c; // distract controller offline + public const int MINOR_ID_CARD_READER_NOT_CONNECT = 0x41d; // Id card reader not connected(intelligent dedicated) + public const int MINOR_ID_CARD_READER_RESUME = 0x41e; //Id card reader connection restored(intelligent dedicated) + public const int MINOR_FINGER_PRINT_MODULE_NOT_CONNECT = 0x41f; // fingerprint module is not connected(intelligent dedicated) + public const int MINOR_FINGER_PRINT_MODULE_RESUME = 0x420; // The fingerprint module connection restored(intelligent dedicated) + public const int MINOR_CAMERA_NOT_CONNECT = 0x421; // Camera not connected + public const int MINOR_CAMERA_RESUME = 0x422; // Camera connection restored + public const int MINOR_COM_NOT_CONNECT = 0x423; // COM not connected + public const int MINOR_COM_RESUME = 0x424;// COM connection restored + public const int MINOR_DEVICE_NOT_AUTHORIZE = 0x425; // device are not authorized + public const int MINOR_PEOPLE_AND_ID_CARD_DEVICE_ONLINE = 0x426; // people and ID card device online + public const int MINOR_PEOPLE_AND_ID_CARD_DEVICE_OFFLINE = 0x427;// people and ID card device offline + public const int MINOR_LOCAL_LOGIN_LOCK = 0x428; // local login lock + public const int MINOR_LOCAL_LOGIN_UNLOCK = 0x429; //local login unlock + public const int MINOR_SUBMARINEBACK_COMM_BREAK = 0x42a; //submarineback communicate break + public const int MINOR_SUBMARINEBACK_COMM_RESUME = 0x42b; //submarineback communicate resume + public const int MINOR_MOTOR_SENSOR_EXCEPTION = 0x42c; //motor sensor exception + public const int MINOR_CAN_BUS_EXCEPTION = 0x42d; //can bus exception + public const int MINOR_CAN_BUS_RESUME = 0x42e; //can bus resume + public const int MINOR_GATE_TEMPERATURE_OVERRUN = 0x42f; //gate temperature over run + public const int MINOR_IR_EMITTER_EXCEPTION = 0x430; //IR emitter exception + public const int MINOR_IR_EMITTER_RESUME = 0x431; //IR emitter resume + public const int MINOR_LAMP_BOARD_COMM_EXCEPTION = 0x432; //lamp board communicate exception + public const int MINOR_LAMP_BOARD_COMM_RESUME = 0x433; //lamp board communicate resume + public const int MINOR_IR_ADAPTOR_COMM_EXCEPTION = 0x434; //IR adaptor communicate exception + public const int MINOR_IR_ADAPTOR_COMM_RESUME = 0x435; //IR adaptor communicate resume + public const int MINOR_PRINTER_ONLINE = 0x436; //printer online + public const int MINOR_PRINTER_OFFLINE = 0x437; //printer offline + public const int MINOR_4G_MOUDLE_ONLINE = 0x438; //4G module online + public const int MINOR_4G_MOUDLE_OFFLINE = 0x439; //4G module offline + + + /* Operation */ + // Main Type + //public const int MAJOR_OPERATION = 0x3; + + // Hypo- Type + //public const int MINOR_LOCAL_UPGRADE = 0x5a; // Upgrade (local) + //public const int MINOR_REMOTE_LOGIN = 0x70; // Login (remote) + //public const int MINOR_REMOTE_LOGOUT = 0x71; // Logout (remote) + //public const int MINOR_REMOTE_ARM = 0x79; // On guard (remote) + //public const int MINOR_REMOTE_DISARM = 0x7a; // Disarm (remote) + //public const int MINOR_REMOTE_REBOOT = 0x7b; // Reboot (remote) + //public const int MINOR_REMOTE_UPGRADE = 0x7e; // upgrade (remote) + //public const int MINOR_REMOTE_CFGFILE_OUTPUT = 0x86; // Export Configuration (remote) + //public const int MINOR_REMOTE_CFGFILE_INTPUT = 0x87; // Import Configuration (remote) + //public const int MINOR_REMOTE_ALARMOUT_OPEN_MAN = 0xd6; // remote mamual open alarmout + //public const int MINOR_REMOTE_ALARMOUT_CLOSE_MAN = 0xd7; // remote mamual close alarmout + + public const int MINOR_REMOTE_OPEN_DOOR = 0x400; // remote open door + public const int MINOR_REMOTE_CLOSE_DOOR = 0x401; // remote close door (controlled) + public const int MINOR_REMOTE_ALWAYS_OPEN = 0x402; // remote always open door (free) + public const int MINOR_REMOTE_ALWAYS_CLOSE = 0x403; // remote always close door (forbiden) + public const int MINOR_REMOTE_CHECK_TIME = 0x404; // remote check time + public const int MINOR_NTP_CHECK_TIME = 0x405; // ntp check time + public const int MINOR_REMOTE_CLEAR_CARD = 0x406; // remote clear card + public const int MINOR_REMOTE_RESTORE_CFG = 0x407; // remote restore configure + public const int MINOR_ALARMIN_ARM = 0x408; // alarm in arm + public const int MINOR_ALARMIN_DISARM = 0x409; // alarm in disarm + public const int MINOR_LOCAL_RESTORE_CFG = 0x40a; // local configure restore + public const int MINOR_REMOTE_CAPTURE_PIC = 0x40b; // remote capture picture + public const int MINOR_MOD_NET_REPORT_CFG = 0x40c; // modify net report cfg + public const int MINOR_MOD_GPRS_REPORT_PARAM = 0x40d; // modify GPRS report param + public const int MINOR_MOD_REPORT_GROUP_PARAM = 0x40e; // modify report group param + public const int MINOR_UNLOCK_PASSWORD_OPEN_DOOR = 0x40f; // unlock password open door + public const int MINOR_AUTO_RENUMBER = 0x410; // auto renumber + public const int MINOR_AUTO_COMPLEMENT_NUMBER = 0x411; // auto complement number + public const int MINOR_NORMAL_CFGFILE_INPUT = 0x412; // normal cfg file input + public const int MINOR_NORMAL_CFGFILE_OUTTPUT = 0x413; // normal cfg file output + public const int MINOR_CARD_RIGHT_INPUT = 0x414; // card right input + public const int MINOR_CARD_RIGHT_OUTTPUT = 0x415; // card right output + public const int MINOR_LOCAL_USB_UPGRADE = 0x416; // local USB upgrade + public const int MINOR_REMOTE_VISITOR_CALL_LADDER = 0x417; // visitor call ladder + public const int MINOR_REMOTE_HOUSEHOLD_CALL_LADDER = 0x418; // household call ladder + public const int MINOR_REMOTE_ACTUAL_GUARD = 0x419; //remote actual guard + public const int MINOR_REMOTE_ACTUAL_UNGUARD = 0x41a; //remote actual unguard + public const int MINOR_REMOTE_CONTROL_NOT_CODE_OPER_FAILED = 0x41b; //remote control not code operate failed + public const int MINOR_REMOTE_CONTROL_CLOSE_DOOR = 0x41c; //remote control close door + public const int MINOR_REMOTE_CONTROL_OPEN_DOOR = 0x41d; //remote control open door + public const int MINOR_REMOTE_CONTROL_ALWAYS_OPEN_DOOR = 0x41e; //remote control always open door + + /* Additional Log Info*/ + // Main Type + public const int MAJOR_EVENT = 0x5;/*event*/ + // Hypo- Type + public const int MINOR_LEGAL_CARD_PASS = 0x01; // legal card pass + public const int MINOR_CARD_AND_PSW_PASS = 0x02; // swipe and password pass + public const int MINOR_CARD_AND_PSW_FAIL = 0x03; // swipe and password fail + public const int MINOR_CARD_AND_PSW_TIMEOUT = 0x04; // swipe and password timeout + public const int MINOR_CARD_AND_PSW_OVER_TIME = 0x05; // swipe and password over time + public const int MINOR_CARD_NO_RIGHT = 0x06; // card no right + public const int MINOR_CARD_INVALID_PERIOD = 0x07; // invalid period + public const int MINOR_CARD_OUT_OF_DATE = 0x08; // card out of date + public const int MINOR_INVALID_CARD = 0x09; // invalid card + public const int MINOR_ANTI_SNEAK_FAIL = 0x0a; // anti sneak fail + public const int MINOR_INTERLOCK_DOOR_NOT_CLOSE = 0x0b; // interlock door doesn't close + public const int MINOR_NOT_BELONG_MULTI_GROUP = 0x0c; // card no belong multi group + public const int MINOR_INVALID_MULTI_VERIFY_PERIOD = 0x0d; // invalid multi verify period + public const int MINOR_MULTI_VERIFY_SUPER_RIGHT_FAIL = 0x0e; // have no super right in multi verify mode + public const int MINOR_MULTI_VERIFY_REMOTE_RIGHT_FAIL = 0x0f; // have no remote right in multi verify mode + public const int MINOR_MULTI_VERIFY_SUCCESS = 0x10; // success in multi verify mode + public const int MINOR_LEADER_CARD_OPEN_BEGIN = 0x11; // leader card begin to open + public const int MINOR_LEADER_CARD_OPEN_END = 0x12; // leader card end to open + public const int MINOR_ALWAYS_OPEN_BEGIN = 0x13; // always open begin + public const int MINOR_ALWAYS_OPEN_END = 0x14; // always open end + public const int MINOR_LOCK_OPEN = 0x15; // lock open + public const int MINOR_LOCK_CLOSE = 0x16; // lock close + public const int MINOR_DOOR_BUTTON_PRESS = 0x17; // press door open button + public const int MINOR_DOOR_BUTTON_RELEASE = 0x18; // release door open button + public const int MINOR_DOOR_OPEN_NORMAL = 0x19; // door open normal + public const int MINOR_DOOR_CLOSE_NORMAL = 0x1a; // door close normal + public const int MINOR_DOOR_OPEN_ABNORMAL = 0x1b; // open door abnormal + public const int MINOR_DOOR_OPEN_TIMEOUT = 0x1c; // open door timeout + public const int MINOR_ALARMOUT_ON = 0x1d; // alarm out turn on + public const int MINOR_ALARMOUT_OFF = 0x1e; // alarm out turn off + public const int MINOR_ALWAYS_CLOSE_BEGIN = 0x1f; // always close begin + public const int MINOR_ALWAYS_CLOSE_END = 0x20; // always close end + public const int MINOR_MULTI_VERIFY_NEED_REMOTE_OPEN = 0x21; // need remote open in multi verify mode + public const int MINOR_MULTI_VERIFY_SUPERPASSWD_VERIFY_SUCCESS = 0x22; // superpasswd verify success in multi verify mode + public const int MINOR_MULTI_VERIFY_REPEAT_VERIFY = 0x23; // repeat verify in multi verify mode + public const int MINOR_MULTI_VERIFY_TIMEOUT = 0x24; // timeout in multi verify mode + public const int MINOR_DOORBELL_RINGING = 0x25; // doorbell ringing + public const int MINOR_FINGERPRINT_COMPARE_PASS = 0x26; // fingerprint compare pass + public const int MINOR_FINGERPRINT_COMPARE_FAIL = 0x27; // fingerprint compare fail + public const int MINOR_CARD_FINGERPRINT_VERIFY_PASS = 0x28; // card and fingerprint verify pass + public const int MINOR_CARD_FINGERPRINT_VERIFY_FAIL = 0x29; // card and fingerprint verify fail + public const int MINOR_CARD_FINGERPRINT_VERIFY_TIMEOUT = 0x2a; // card and fingerprint verify timeout + public const int MINOR_CARD_FINGERPRINT_PASSWD_VERIFY_PASS = 0x2b; // card and fingerprint and passwd verify pass + public const int MINOR_CARD_FINGERPRINT_PASSWD_VERIFY_FAIL = 0x2c; // card and fingerprint and passwd verify fail + public const int MINOR_CARD_FINGERPRINT_PASSWD_VERIFY_TIMEOUT = 0x2d; // card and fingerprint and passwd verify timeout + public const int MINOR_FINGERPRINT_PASSWD_VERIFY_PASS = 0x2e; // fingerprint and passwd verify pass + public const int MINOR_FINGERPRINT_PASSWD_VERIFY_FAIL = 0x2f; // fingerprint and passwd verify fail + public const int MINOR_FINGERPRINT_PASSWD_VERIFY_TIMEOUT = 0x30; // fingerprint and passwd verify timeout + public const int MINOR_FINGERPRINT_INEXISTENCE = 0x31; // fingerprint inexistence + public const int MINOR_CARD_PLATFORM_VERIFY = 0x32; // card platform verify + public const int MINOR_CALL_CENTER = 0x33; // call center + public const int MINOR_FIRE_RELAY_TURN_ON_DOOR_ALWAYS_OPEN = 0x34; // fire relay turn on door always open + public const int MINOR_FIRE_RELAY_RECOVER_DOOR_RECOVER_NORMAL = 0x35; // fire relay recover door recover normal + public const int MINOR_FACE_AND_FP_VERIFY_PASS = 0x36; // face and finger print verify pass + public const int MINOR_FACE_AND_FP_VERIFY_FAIL = 0x37; // face and finger print verify fail + public const int MINOR_FACE_AND_FP_VERIFY_TIMEOUT = 0x38; // face and finger print verify timeout + public const int MINOR_FACE_AND_PW_VERIFY_PASS = 0x39; // face and password verify pass + public const int MINOR_FACE_AND_PW_VERIFY_FAIL = 0x3a; // face and password verify fail + public const int MINOR_FACE_AND_PW_VERIFY_TIMEOUT = 0x3b; // face and password verify timeout + public const int MINOR_FACE_AND_CARD_VERIFY_PASS = 0x3c; // face and card verify pass + public const int MINOR_FACE_AND_CARD_VERIFY_FAIL = 0x3d; // face and card verify fail + public const int MINOR_FACE_AND_CARD_VERIFY_TIMEOUT = 0x3e; // face and card verify timeout + public const int MINOR_FACE_AND_PW_AND_FP_VERIFY_PASS = 0x3f; // face and password and finger print verify pass + public const int MINOR_FACE_AND_PW_AND_FP_VERIFY_FAIL = 0x40; // face and password and finger print verify fail + public const int MINOR_FACE_AND_PW_AND_FP_VERIFY_TIMEOUT = 0x41; // face and password and finger print verify timeout + public const int MINOR_FACE_CARD_AND_FP_VERIFY_PASS = 0x42; // face and card and finger print verify pass + public const int MINOR_FACE_CARD_AND_FP_VERIFY_FAIL = 0x43; // face and card and finger print verify fail + public const int MINOR_FACE_CARD_AND_FP_VERIFY_TIMEOUT = 0x44; // face and card and finger print verify timeout + public const int MINOR_EMPLOYEENO_AND_FP_VERIFY_PASS = 0x45; // employee and finger print verify pass + public const int MINOR_EMPLOYEENO_AND_FP_VERIFY_FAIL = 0x46; // employee and finger print verify fail + public const int MINOR_EMPLOYEENO_AND_FP_VERIFY_TIMEOUT = 0x47; // employee and finger print verify timeout + public const int MINOR_EMPLOYEENO_AND_FP_AND_PW_VERIFY_PASS = 0x48; // employee and finger print and password verify pass + public const int MINOR_EMPLOYEENO_AND_FP_AND_PW_VERIFY_FAIL = 0x49; // employee and finger print and password verify fail + public const int MINOR_EMPLOYEENO_AND_FP_AND_PW_VERIFY_TIMEOUT = 0x4a; // employee and finger print and password verify timeout + public const int MINOR_FACE_VERIFY_PASS = 0x4b; // face verify pass + public const int MINOR_FACE_VERIFY_FAIL = 0x4c; // face verify fail + public const int MINOR_EMPLOYEENO_AND_FACE_VERIFY_PASS = 0x4d; // employee no and face verify pass + public const int MINOR_EMPLOYEENO_AND_FACE_VERIFY_FAIL = 0x4e; // employee no and face verify fail + public const int MINOR_EMPLOYEENO_AND_FACE_VERIFY_TIMEOUT = 0x4f; // employee no and face verify time out + public const int MINOR_FACE_RECOGNIZE_FAIL = 0x50; // face recognize fail + public const int MINOR_FIRSTCARD_AUTHORIZE_BEGIN = 0x51; // first card authorize begin + public const int MINOR_FIRSTCARD_AUTHORIZE_END = 0x52; // first card authorize end + public const int MINOR_DOORLOCK_INPUT_SHORT_CIRCUIT = 0x53; // door lock input short circuit + public const int MINOR_DOORLOCK_INPUT_BROKEN_CIRCUIT = 0x54; // door lock input broken circuit + public const int MINOR_DOORLOCK_INPUT_EXCEPTION = 0x55; // door lock input exception + public const int MINOR_DOORCONTACT_INPUT_SHORT_CIRCUIT = 0x56; // door contact input short circuit + public const int MINOR_DOORCONTACT_INPUT_BROKEN_CIRCUIT = 0x57; // door contact input broken circuit + public const int MINOR_DOORCONTACT_INPUT_EXCEPTION = 0x58; // door contact input exception + public const int MINOR_OPENBUTTON_INPUT_SHORT_CIRCUIT = 0x59; // open button input short circuit + public const int MINOR_OPENBUTTON_INPUT_BROKEN_CIRCUIT = 0x5a; // open button input broken circuit + public const int MINOR_OPENBUTTON_INPUT_EXCEPTION = 0x5b; // open button input exception + public const int MINOR_DOORLOCK_OPEN_EXCEPTION = 0x5c; // door lock open exception + public const int MINOR_DOORLOCK_OPEN_TIMEOUT = 0x5d; // door lock open timeout + public const int MINOR_FIRSTCARD_OPEN_WITHOUT_AUTHORIZE = 0x5e; // first card open without authorize + public const int MINOR_CALL_LADDER_RELAY_BREAK = 0x5f; // call ladder relay break + public const int MINOR_CALL_LADDER_RELAY_CLOSE = 0x60; // call ladder relay close + public const int MINOR_AUTO_KEY_RELAY_BREAK = 0x61; // auto key relay break + public const int MINOR_AUTO_KEY_RELAY_CLOSE = 0x62; // auto key relay close + public const int MINOR_KEY_CONTROL_RELAY_BREAK = 0x63; // key control relay break + public const int MINOR_KEY_CONTROL_RELAY_CLOSE = 0x64; // key control relay close + public const int MINOR_EMPLOYEENO_AND_PW_PASS = 0x65; // minor employee no and password pass + public const int MINOR_EMPLOYEENO_AND_PW_FAIL = 0x66; // minor employee no and password fail + public const int MINOR_EMPLOYEENO_AND_PW_TIMEOUT = 0x67; // minor employee no and password timeout + public const int MINOR_HUMAN_DETECT_FAIL = 0x68; // human detect fail + public const int MINOR_PEOPLE_AND_ID_CARD_COMPARE_PASS = 0x69; // the comparison with people and id card success + public const int MINOR_PEOPLE_AND_ID_CARD_COMPARE_FAIL = 0x70; // the comparison with people and id card failed + public const int MINOR_CERTIFICATE_BLOCKLIST = 0x71; // block list + public const int MINOR_LEGAL_MESSAGE = 0x72; // legal message + public const int MINOR_ILLEGAL_MESSAGE = 0x73; // illegal messag + public const int MINOR_MAC_DETECT = 0x74; // mac detect + public const int MINOR_DOOR_OPEN_OR_DORMANT_FAIL = 0x75; //door open or dormant fail + public const int MINOR_AUTH_PLAN_DORMANT_FAIL = 0x76; //auth plan dormant fail + public const int MINOR_CARD_ENCRYPT_VERIFY_FAIL = 0x77; //card encrypt verify fail + public const int MINOR_SUBMARINEBACK_REPLY_FAIL = 0x78; //submarineback reply fail + public const int MINOR_DOOR_OPEN_OR_DORMANT_OPEN_FAIL = 0x82; //door open or dormant open fail + public const int MINOR_DOOR_OPEN_OR_DORMANT_LINKAGE_OPEN_FAIL = 0x84; //door open or dormant linkage open fail + public const int MINOR_TRAILING = 0x85; //trailing + public const int MINOR_HEART_BEAT = 0x83; //heart beat event + public const int MINOR_REVERSE_ACCESS = 0x86; //reverse access + public const int MINOR_FORCE_ACCESS = 0x87; //force access + public const int MINOR_CLIMBING_OVER_GATE = 0x88; //climbing over gate + public const int MINOR_PASSING_TIMEOUT = 0x89; //passing timeout + public const int MINOR_INTRUSION_ALARM = 0x8a; //intrusion alarm + public const int MINOR_FREE_GATE_PASS_NOT_AUTH = 0x8b; //free gate pass not auth + public const int MINOR_DROP_ARM_BLOCK = 0x8c; //drop arm block + public const int MINOR_DROP_ARM_BLOCK_RESUME = 0x8d; //drop arm block resume + public const int MINOR_LOCAL_FACE_MODELING_FAIL = 0x8e; //device upgrade with module failed + public const int MINOR_STAY_EVENT = 0x8f; //stay event + public const int MINOR_PASSWORD_MISMATCH = 0x97; //password mismatch + public const int MINOR_EMPLOYEE_NO_NOT_EXIST = 0x98; //employee no not exist + public const int MINOR_COMBINED_VERIFY_PASS = 0x99; //combined verify pass + public const int MINOR_COMBINED_VERIFY_TIMEOUT = 0x9a; //combined verify timeout + public const int MINOR_VERIFY_MODE_MISMATCH = 0x9b; //verify mode mismatch + #endregion + + /************************************************* + ýṹ(_V30Ϊ9000) + **************************************************/ + //Уʱṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIME + { + public int dwYear; + public int dwMonth; + public int dwDay; + public int dwHour; + public int dwMinute; + public int dwSecond; + } + + //ʱ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIME_V30 + { + public ushort wYear; + public byte byMonth; + public byte byDay; + public byte byHour; + public byte byMinute; + public byte bySecond; + public byte byRes; + public ushort wMilliSec; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIME_EX + { + public ushort wYear; + public byte byMonth; + public byte byDay; + public byte byHour; + public byte byMinute; + public byte bySecond; + public byte byRes; + } + + //ʱ(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCHEDTIME + { + public byte byStartHour;//ʼʱ + public byte byStartMin;//ʼʱ + public byte byStopHour;//ʱ + public byte byStopMin;//ʱ + } + + /*豸쳣ʽ*/ + public const int NOACTION = 0x0;/*Ӧ*/ + public const int WARNONMONITOR = 0x1;/*Ͼ*/ + public const int WARNONAUDIOOUT = 0x2;/**/ + public const int UPTOCENTER = 0x4;/*ϴ*/ + public const int TRIGGERALARMOUT = 0x8;/**/ + public const int TRIGGERCATPIC = 0x10;/*ץͼϴE-mail*/ + public const int SEND_PIC_FTP = 0x200; /*ץͼϴftp*/ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STRUCTHEAD + { + public ushort wLength; //ṹ + public byte byVersion; /*ߵ4λֱߵͰ汾ݰ汾ͳȽչͬİ汾ijȽ*/ + public byte byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HANDLEEXCEPTION_V41 + { + public uint dwHandleType;/*ʽ,ʽ""*/ + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public uint dwMaxRelAlarmOutChanNum; //ıֻ֧ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelAlarmOut; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HANDLEEXCEPTION_V40 + { + public uint dwHandleType;/*ʽ,ʽ""*/ + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public uint dwMaxRelAlarmOutChanNum; //ıֻ֧ͨ + public uint dwRelAlarmOutChanNum; //ıͨ ʵ֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelAlarmOut; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //쳣ṹ(ӽṹ)(ദʹ)(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HANDLEEXCEPTION_V30 + { + public uint dwHandleType;/*ʽ,ʽ""*/ + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelAlarmOut;//ͨ,,Ϊ1ʾ + } + + //쳣ṹ(ӽṹ)(ദʹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HANDLEEXCEPTION + { + public uint dwHandleType;/*ʽ,ʽ""*/ + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JpegץͼϴEMail*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT, ArraySubType = UnmanagedType.I1)] + public byte[] byRelAlarmOut;//ͨ,,Ϊ1ʾ + } + + //DVR豸 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEVICECFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDVRName;//DVR + public uint dwDVRID;//DVR ID,ң //V1.4(0-99), V1.5(0-255) + public uint dwRecycleRecord;//Ƿѭ¼,0:; 1: + //²ɸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber;//к + public uint dwSoftwareVersion;//汾,16λ汾,16λǴΰ汾 + public uint dwSoftwareBuildDate;//,0xYYYYMMDD + public uint dwDSPSoftwareVersion;//DSP汾,16λ汾,16λǴΰ汾 + public uint dwDSPSoftwareBuildDate;// DSP,0xYYYYMMDD + public uint dwPanelVersion;// ǰ汾,16λ汾,16λǴΰ汾 + public uint dwHardwareVersion;// Ӳ汾,16λ汾,16λǴΰ汾 + public byte byAlarmInPortNum;//DVR + public byte byAlarmOutPortNum;//DVR + public byte byRS232Num;//DVR 232ڸ + public byte byRS485Num;//DVR 485ڸ + public byte byNetworkPortNum;//ڸ + public byte byDiskCtrlNum;//DVR Ӳ̿ + public byte byDiskNum;//DVR Ӳ̸ + public byte byDVRType;//DVR, 1:DVR 2:ATM DVR 3:DVS ...... + public byte byChanNum;//DVR ͨ + public byte byStartChan;//ʼͨ,DVS-1,DVR - 1 + public byte byDecordChans;//DVR · + public byte byVGANum;//VGAڵĸ + public byte byUSBNum;//USBڵĸ + public byte byAuxoutNum;//ڵĸ + public byte byAudioNum;//ڵĸ + public byte byIPChanNum;//ͨ + } + + /*IPַ*/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_IPADDR + { + + /// char[16] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sIpV4; + + /// BYTE[128] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byIPv6; + + public void Init() + { + sIpV4 = new byte[16]; + byIPv6 = new byte[128]; + } + } + + /*ݽṹ(ӽṹ)(9000չ)*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ETHERNET_V30 + { + public NET_DVR_IPADDR struDVRIP;//DVR IPַ + public NET_DVR_IPADDR struDVRIPMask;//DVR IPַ + public uint dwNetInterface;//ӿڣ1-10MBase-T2-10MBase-Tȫ˫3-100MBase-TX4-100Mȫ˫5-10M/100M/1000MӦ6-1000Mȫ˫ + public ushort wDVRPort;//˿ں + public ushort wMTU;//MTUãĬ1500 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr;// ַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_NETPARAM + { + public uint dwSize; + public NET_DVR_IPADDR struIP; + public ushort wPort; + public byte byAddressType; //0 - , 1 - ipv4/ipv6ַ2 - + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 1, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byDomainName; + public byte byReportProtocol; //1-private 2-NAL2300, 3-Ehome + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACCOUNTNUM_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] byDevID; //ЭΪNAL2300ʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; //GPRSڹ̶ķϽеģԲҪϢԤһЩֶ + } + + + + /*ݽṹ(ӽṹ)*/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_ETHERNET + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDVRIP;//DVR IPַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDVRIPMask;//DVR IPַ + public uint dwNetInterface;//ӿ 1-10MBase-T 2-10MBase-Tȫ˫ 3-100MBase-TX 4-100Mȫ˫ 5-10M/100MӦ + public ushort wDVRPort;//˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr;//ַ + } + + //pppoeṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PPPOECFG + { + public uint dwPPPOE;//0-,1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPPPoEUser;//PPPoEû + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string sPPPoEPassword;// PPPoE + public NET_DVR_IPADDR struPPPoEIP;//PPPoE IPַ + } + + //ýṹ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NETCFG_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ETHERNET, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ETHERNET_V30[] struEtherNet;//̫ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPADDR[] struRes1;/**/ + public NET_DVR_IPADDR struAlarmHostIpAddr;/* IPַ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public ushort wAlarmHostIpPort; + public byte byUseDhcp; + public byte byRes3; + public NET_DVR_IPADDR struDnsServer1IpAddr;/* 1IPַ */ + public NET_DVR_IPADDR struDnsServer2IpAddr;/* 2IPַ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byIpResolver; + public ushort wIpResolverPort; + public ushort wHttpPortNo; + public NET_DVR_IPADDR struMulticastIpAddr;/* ಥַ */ + public NET_DVR_IPADDR struGatewayIpAddr;/* صַ */ + public NET_DVR_PPPOECFG struPPPoE; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ϣṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ETHERNET_MULTI + { + public NET_DVR_IPADDR struDVRIP; + public NET_DVR_IPADDR struDVRIPMask; + public uint dwNetInterface; + public byte byCardType; //ͣ0-ͨ1-2- + public byte byRes1; + public ushort wMTU; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public byte byUseDhcp; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + public NET_DVR_IPADDR struGatewayIpAddr; + public NET_DVR_IPADDR struDnsServer1IpAddr; + public NET_DVR_IPADDR struDnsServer2IpAddr; + } + + //ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NETCFG_MULTI + { + public uint dwSize; + public byte byDefaultRoute; + public byte byNetworkCardNum; + public byte byWorkMode; //0-ͨģʽ1-ģʽ + public byte byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NETWORK_CARD, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ETHERNET_MULTI[] struEtherNet;//̫ + public NET_DVR_IPADDR struManageHost1IpAddr; + public NET_DVR_IPADDR struManageHost2IpAddr; + public NET_DVR_IPADDR struAlarmHostIpAddr; + public ushort wManageHost1Port; + public ushort wManageHost2Port; + public ushort wAlarmHostIpPort; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byIpResolver; + public ushort wIpResolverPort; + public ushort wDvrPort; + public ushort wHttpPortNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_IPADDR struMulticastIpAddr;/* ಥַ */ + public NET_DVR_PPPOECFG struPPPoE; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + //ýṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_NETCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ETHERNET, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ETHERNET[] struEtherNet;/* ̫ */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sManageHostIP;//Զַ̹ + public ushort wManageHostPort;//Զ̹˿ں + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sIPServerIP;//IPServerַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sMultiCastIP;//ಥַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sGatewayIP;//صַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sNFSIP;//NFSIPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PATHNAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNFSDirectory;//NFSĿ¼ + public uint dwPPPOE;//0-,1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPPPoEUser;//PPPoEû + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string sPPPoEPassword;// PPPoE + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sPPPoEIP;//PPPoE IPַ(ֻ) + public ushort wHttpPort;//HTTP˿ں + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_SIP_CFG + { + public uint dwSize; + public byte byEnableAutoLogin; //ʹԶעᣬ0-ʹܣ1-ʹ + public byte byLoginStatus; //ע״̬0-δעᣬ1-עᣬ˲ֻܻȡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_IPADDR stuServerIP; //SIPIP + public ushort wServerPort; //SIP˿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; //עû + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassWord; //ע + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NUMBER_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDispalyName; //豸ʾ + public ushort wLocalPort; //ض˿ + public byte byLoginCycle; //עڣ1-99 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 129, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //IPӶԽֻ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_IP_VIEW_DEVCFG + { + public uint dwSize; + public byte byDefaultRing; //ĬΧ1-6 + public byte byRingVolume; //Χ0-9 + public byte byInputVolume; //ֵΧ0-6 + public byte byOutputVolume; //ֵΧ0-9 + public ushort wRtpPort; //Rtp˿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwPreviewDelayTime; //Ԥʱã0-30 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //IpӶԽƵز + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_IP_VIEW_AUDIO_CFG + { + public uint dwSize; + public byte byAudioEncPri1; //Ƶȼ10-OggVorbis1-G711_U2-G711_A 5-MPEG2,6-G7267-AAC + public byte byAudioEncPri2; //Ƶȼ2sip֧Ƶ1ʱʹƵ20-OggVorbis1-G711_U2-G711_A 5-MPEG2,6-G7267-AAC + public ushort wAudioPacketLen1; //Ƶ1ݰ + public ushort wAudioPacketLen2; //Ƶ2ݰ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 30, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //IPֻжԽýṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_IP_VIEW_CALL_CFG + { + public uint dwSize ; + public byte byEnableAutoResponse; //ʹԶӦ,0-ʹܣ1-ʹ + public byte byAudoResponseTime; //ԶӦʱ䣬0-30 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byEnableAlarmNumber1; //10-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NUMBER_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmNumber1; //к1 + public byte byEnableAlarmNumber2; //20-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NUMBER_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmNumber2; //к2к1ʧ᳢ܻԺк2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 72, ArraySubType = UnmanagedType.I1)] + public byte[] byRes4; + } + + //ͨͼṹ + //ƶ(ӽṹ)(鷽ʽչ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_RECORDCHAN + { + public uint dwMaxRecordChanNum; //豸ֵ֧¼ͨ-ֻ + public uint dwCurRecordChanNum; //ǰʵõĹ¼ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint dwRelRecordChan; /* ʵʴ¼ֵͨʾ,ýУ±0 - MAX_CHANNUM_V30-1Чм0xffffffff,Ч*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ͨͼṹ + //ƶ(ӽṹ)(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MOTION_V30 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 96*64, ArraySubType = UnmanagedType.I1)] + public byte[] byMotionScope;/*,0-96λ,ʾ64,96*64С,Ϊ1ʾƶ,0-ʾ*/ + public byte byMotionSensitive;/*ƶ, 0 - 5,ԽԽ,oxffر*/ + public byte byEnableHandleMotion;/* Ƿƶ 0 1*/ + public byte byEnableDisplay;/* ƶʾ0- 1- */ + public byte reservedData; + public NET_DVR_HANDLEEXCEPTION_V30 struMotionHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;/*ʱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan;/* ¼ͨ*/ + } + + //ƶ(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MOTION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 396, ArraySubType = UnmanagedType.I1)] + public byte[] byMotionScope;/*,22*18С,Ϊ1ʾĺƶ,0-ʾ*/ + public byte byMotionSensitive;/*ƶ, 0 - 5,ԽԽ,0xffر*/ + public byte byEnableHandleMotion;/* Ƿƶ */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 2)] + public string reservedData; + public NET_DVR_HANDLEEXCEPTION strMotionHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan;//¼ͨ,Ϊ1ʾͨ + } + + //ڵ(ӽṹ)(9000չ) С704*576 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HIDEALARM_V30 + { + public uint dwEnableHideAlarm;/* Ƿڵ ,0-,1- 2- 3-*/ + public ushort wHideAlarmAreaTopLeftX;/* ڵx */ + public ushort wHideAlarmAreaTopLeftY;/* ڵy */ + public ushort wHideAlarmAreaWidth;/* ڵĿ */ + public ushort wHideAlarmAreaHeight;/*ڵĸ*/ + public NET_DVR_HANDLEEXCEPTION_V30 strHideAlarmHandleType; /* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + } + + //ڵ(ӽṹ) С704*576 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HIDEALARM + { + public uint dwEnableHideAlarm;/* Ƿڵ ,0-,1- 2- 3-*/ + public ushort wHideAlarmAreaTopLeftX;/* ڵx */ + public ushort wHideAlarmAreaTopLeftY;/* ڵy */ + public ushort wHideAlarmAreaWidth;/* ڵĿ */ + public ushort wHideAlarmAreaHeight;/*ڵĸ*/ + public NET_DVR_HANDLEEXCEPTION strHideAlarmHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + } + + //źŶʧ(ӽṹ)(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VILOST_V30 + { + public byte byEnableHandleVILost;/* ǷźŶʧ */ + public NET_DVR_HANDLEEXCEPTION_V30 strVILostHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 56, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + } + + //źŶʧ(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VILOST + { + public byte byEnableHandleVILost;/* ǷźŶʧ */ + public NET_DVR_HANDLEEXCEPTION strVILostHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + } + + //ڵ(ӽṹ) + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public struct NET_DVR_SHELTER + { + public ushort wHideAreaTopLeftX;/* ڵx */ + public ushort wHideAreaTopLeftY;/* ڵy */ + public ushort wHideAreaWidth;/* ڵĿ */ + public ushort wHideAreaHeight;/*ڵĸ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COLOR + { + public byte byBrightness;/*,0-255*/ + public byte byContrast;/*Աȶ,0-255*/ + public byte bySaturation;/*Ͷ,0-255*/ + public byte byHue;/*ɫ,0-255*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_RGB_COLOR + { + public byte byRed; //RGBɫеĺɫ + public byte byGreen; //RGBɫеɫ + public byte byBlue; //RGBɫеɫ + public byte byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DAYTIME + { + public byte byHour;//0~24 + public byte byMinute;//0~60 + public byte bySecond;//0~60 + public byte byRes; + public ushort wMilliSecond; //0~1000 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_SCHEDULE_DAYTIME + { + public NET_DVR_DAYTIME struStartTime; //ʼʱ + public NET_DVR_DAYTIME struStopTime; //ʱ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DNMODE + { + public byte byObjectSize;//ռȲ(0~100) + public byte byMotionSensitive; /*ƶ, 0 - 5,ԽԽ,0xffر*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MOTION_MULTI_AREAPARAM + { + public byte byAreaNo;//(IPC- 1~8) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_VCA_RECT struRect;//Ϣ() size = 16; + public NET_DVR_DNMODE struDayNightDisable;//رģʽ + public NET_DVR_DNMODE struDayModeParam;//ģʽ + public NET_DVR_DNMODE struNightModeParam;//ҹģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MOTION_MULTI_AREA + { + public byte byDayNightCtrl;//ҹ 0~ر,1~Զл,2~ʱл(ĬϹر) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_SCHEDULE_DAYTIME struScheduleTime;//лʱ 16 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_MULTI_AREA_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MOTION_MULTI_AREAPARAM[] struMotionMultiAreaParam;//֧24 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MOTION_SINGLE_AREA + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64*96, ArraySubType = UnmanagedType.I1)] + public byte[]byMotionScope; /*,0-96λ,ʾ64,96*64С,ĿǰЧ22*18,Ϊ1ʾƶ,0-ʾ*/ + public byte byMotionSensitive; /*ƶ, 0 - 5,ԽԽ,0xffر*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MOTION_MODE_PARAM + { + public NET_DVR_MOTION_SINGLE_AREA struMotionSingleArea; //ͨģʽµĵ + public NET_DVR_MOTION_MULTI_AREA struMotionMultiArea; //רģʽµĶ + } + + //ƶ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MOTION_V40 + { + public NET_DVR_MOTION_MODE_PARAM struMotionMode; //(5.1.0) + public byte byEnableHandleMotion; /* Ƿƶ 0 1*/ + public byte byEnableDisplay; /*ƶʾ0-1-*/ + public byte byConfigurationMode; //0~ͨ,1~ר(5.1.0) + public byte byRes1; //ֽ + /* 쳣ʽ */ + public uint dwHandleType; //쳣,쳣ʽ"" + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public uint dwMaxRelAlarmOutChanNum ; //ıֻ֧ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelAlarmOut; //ʵʴıţֵʾ,ýУ±0 - dwRelAlarmOut -1Чм0xffffffff,Ч + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS*MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime; /*ʱ*/ + /*¼ͨ*/ + public uint dwMaxRecordChanNum; //豸ֵ֧¼ͨ-ֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelRecordChan; /* ʵʴ¼ֵͨʾ,ýУ±0 - dwRelRecordChan -1Чм0xffffffff,Ч*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + //ڵ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_HIDEALARM_V40 + { + public uint dwEnableHideAlarm; /* Ƿڵ0-1-ȣ2-ȣ3-*/ + public ushort wHideAlarmAreaTopLeftX; /* ڵx */ + public ushort wHideAlarmAreaTopLeftY; /* ڵy */ + public ushort wHideAlarmAreaWidth; /* ڵĿ */ + public ushort wHideAlarmAreaHeight; /*ڵĸ*/ + /* źŶʧ */ + public uint dwHandleType; //쳣,쳣ʽ"" + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public uint dwMaxRelAlarmOutChanNum ; //ıֻ֧ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelAlarmOut; /*ţֵʾ,ýУ±0 - dwRelAlarmOut -1Чм0xffffffff,Ч*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS*MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime; /*ʱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //źŶʧ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_VILOST_V40 + { + public uint dwEnableVILostAlarm; /* ǷźŶʧ ,0-,1-*/ + /* źŶʧ */ + public uint dwHandleType; //쳣,쳣ʽ"" + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public uint dwMaxRelAlarmOutChanNum ; //ıֻ֧ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelAlarmOut; /*ţֵʾ,ýУ±0 - dwRelAlarmOut -1Чм0xffffffff,Ч*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS*MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime; /*ʱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_VICOLOR + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_COLOR[] struColor;/*ͼ(һЧ)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struHandleTime;/*ʱ()*/ + } + + //ͨͼṹ(V40չ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PICCFG_V40 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sChanName; + public uint dwVideoFormat; /* ֻ Ƶʽ 1-NTSC 2-PAL */ + public NET_DVR_VICOLOR struViColor;// ͼʱ + //ʾͨ + public uint dwShowChanName; // ԤͼǷʾͨ,0-ʾ,1-ʾ + public ushort wShowNameTopLeftX; /* ͨʾλõx */ + public ushort wShowNameTopLeftY; /* ͨʾλõy */ + //˽ڵ + public uint dwEnableHide; /* Ƿڵ ,0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SHELTERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SHELTER[] struShelter; + //OSD + public uint dwShowOsd;// ԤͼǷʾOSD,0-ʾ,1-ʾ + public ushort wOSDTopLeftX; /* OSDx */ + public ushort wOSDTopLeftY; /* OSDy */ + public byte byOSDType; /* OSD(Ҫոʽ) */ + /* 0: XXXX-XX-XX */ + /* 1: XX-XX-XXXX */ + /* 2: XXXXXXXX */ + /* 3: XXXXXXXX */ + /* 4: XX-XX-XXXX */ + /* 5: XXXXXXXX */ + /*6: xx/xx/xxxx(//) */ + /*7: xxxx/xx/xx(//) */ + /*8: xx/xx/xxxx(//)*/ + public byte byDispWeek; /* Ƿʾ */ + public byte byOSDAttrib; /* OSD:͸˸ */ + /* 0: ʾOSD */ + /* 1: ͸˸ */ + /* 2: ͸˸ */ + /* 3: ͸˸ */ + /* 4: ͸˸ */ + public byte byHourOSDType; /* OSDСʱ:0-24Сʱ,1-12Сʱ */ + public byte byFontSize; //16*16()/8*16(Ӣ)1-32*32()/16*32(Ӣ)2-64*64()/32*64(Ӣ) FOR 91ϵHD-SDIDVR + public byte byOSDColorType; //0-Ĭϣڰף1-Զ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_VILOST_V40 struVILost; //ƵźŶʧ֧飩 + public NET_DVR_VILOST_V40 struAULost; /*ƵźŶʧ֧飩*/ + public NET_DVR_MOTION_V40 struMotion; //ƶⱨ֧飩 + public NET_DVR_HIDEALARM_V40 struHideAlarm; //ڵ֧飩 + public NET_DVR_RGB_COLOR struOsdColor;//OSDɫ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͨͼṹ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PICCFG_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sChanName; + public uint dwVideoFormat;/* ֻ Ƶʽ 1-NTSC 2-PAL*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byReservedData;/**/ + //ʾͨ + public uint dwShowChanName;// ԤͼǷʾͨ,0-ʾ,1-ʾ С704*576 + public ushort wShowNameTopLeftX;/* ͨʾλõx */ + public ushort wShowNameTopLeftY;/* ͨʾλõy */ + //ƵźŶʧ + public NET_DVR_VILOST_V30 struVILost; + public NET_DVR_VILOST_V30 struRes;/**/ + //ƶ + public NET_DVR_MOTION_V30 struMotion; + //ڵ + public NET_DVR_HIDEALARM_V30 struHideAlarm; + //ڵ С704*576 + public uint dwEnableHide;/* Ƿڵ ,0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SHELTERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SHELTER[] struShelter; + //OSD + public uint dwShowOsd;// ԤͼǷʾOSD,0-ʾ,1-ʾ С704*576 + public ushort wOSDTopLeftX;/* OSDx */ + public ushort wOSDTopLeftY;/* OSDy */ + public byte byOSDType;/* OSD(Ҫոʽ) */ + /* 0: XXXX-XX-XX */ + /* 1: XX-XX-XXXX */ + /* 2: XXXXXXXX */ + /* 3: XXXXXXXX */ + /* 4: XX-XX-XXXX */ + /* 5: XXXXXXXX */ + public byte byDispWeek;/* Ƿʾ */ + public byte byOSDAttrib;/* OSD:͸˸ */ + /* 0: ʾOSD */ + /* 1: ͸,˸ */ + /* 2: ͸,˸ */ + /* 3: ˸,͸ */ + /* 4: ͸,˸ */ + public byte byHourOSDType;/* OSDСʱ:0-24Сʱ,1-12Сʱ */ + public byte byFontSize;//С16*16()/8*16(Ӣ)1-32*32()/16*32(Ӣ)2-64*64()/32*64(Ӣ) 3-48*48()/24*48(Ӣ) 0xff-Ӧ(adaptive) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 63, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͨͼṹSDK_V14չ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PICCFG_EX + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sChanName; + public uint dwVideoFormat;/* ֻ Ƶʽ 1-NTSC 2-PAL*/ + public byte byBrightness;/*,0-255*/ + public byte byContrast;/*Աȶ,0-255*/ + public byte bySaturation;/*Ͷ,0-255 */ + public byte byHue;/*ɫ,0-255*/ + //ʾͨ + public uint dwShowChanName;// ԤͼǷʾͨ,0-ʾ,1-ʾ С704*576 + public ushort wShowNameTopLeftX;/* ͨʾλõx */ + public ushort wShowNameTopLeftY;/* ͨʾλõy */ + //źŶʧ + public NET_DVR_VILOST struVILost; + //ƶ + public NET_DVR_MOTION struMotion; + //ڵ + public NET_DVR_HIDEALARM struHideAlarm; + //ڵ С704*576 + public uint dwEnableHide;/* Ƿڵ ,0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SHELTERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SHELTER[] struShelter; + //OSD + public uint dwShowOsd;// ԤͼǷʾOSD,0-ʾ,1-ʾ С704*576 + public ushort wOSDTopLeftX;/* OSDx */ + public ushort wOSDTopLeftY;/* OSDy */ + public byte byOSDType;/* OSD(Ҫոʽ) */ + /* 0: XXXX-XX-XX */ + /* 1: XX-XX-XXXX */ + /* 2: XXXXXXXX */ + /* 3: XXXXXXXX */ + /* 4: XX-XX-XXXX */ + /* 5: XXXXXXXX */ + public byte byDispWeek;/* Ƿʾ */ + public byte byOSDAttrib;/* OSD:͸˸ */ + /* 0: ʾOSD */ + /* 1: ͸,˸ */ + /* 2: ͸,˸ */ + /* 3: ˸,͸ */ + /* 4: ͸,˸ */ + public byte byHourOsdType;/* OSDСʱ:0-24Сʱ,1-12Сʱ */ + } + + //ͨͼṹ(SDK_V13֮ǰ汾) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PICCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sChanName; + public uint dwVideoFormat;/* ֻ Ƶʽ 1-NTSC 2-PAL*/ + public byte byBrightness;/*,0-255*/ + public byte byContrast;/*Աȶ,0-255*/ + public byte bySaturation;/*Ͷ,0-255 */ + public byte byHue;/*ɫ,0-255*/ + //ʾͨ + public uint dwShowChanName;// ԤͼǷʾͨ,0-ʾ,1-ʾ С704*576 + public ushort wShowNameTopLeftX;/* ͨʾλõx */ + public ushort wShowNameTopLeftY;/* ͨʾλõy */ + //źŶʧ + public NET_DVR_VILOST struVILost; + //ƶ + public NET_DVR_MOTION struMotion; + //ڵ + public NET_DVR_HIDEALARM struHideAlarm; + //ڵ С704*576 + public uint dwEnableHide;/* Ƿڵ ,0-,1-*/ + public ushort wHideAreaTopLeftX;/* ڵx */ + public ushort wHideAreaTopLeftY;/* ڵy */ + public ushort wHideAreaWidth;/* ڵĿ */ + public ushort wHideAreaHeight;/*ڵĸ*/ + //OSD + public uint dwShowOsd;// ԤͼǷʾOSD,0-ʾ,1-ʾ С704*576 + public ushort wOSDTopLeftX;/* OSDx */ + public ushort wOSDTopLeftY;/* OSDy */ + public byte byOSDType;/* OSD(Ҫոʽ) */ + /* 0: XXXX-XX-XX */ + /* 1: XX-XX-XXXX */ + /* 2: XXXXXXXX */ + /* 3: XXXXXXXX */ + /* 4: XX-XX-XXXX */ + /* 5: XXXXXXXX */ + public byte byDispWeek;/* Ƿʾ */ + public byte byOSDAttrib;/* OSD:͸˸ */ + /* 0: ʾOSD */ + /* 1: ͸,˸ */ + /* 2: ͸,˸ */ + /* 3: ˸,͸ */ + /* 4: ͸,˸ */ + public byte reservedData2; + } + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND + { + public uint dwSize; + public NET_DVR_STREAM_INFO struStreamInfo; + public uint dwStreamType; //ͣ0-1-2-¼ͣ3-3ԶͨGET /ISAPI/Streaming/channels//customStreamȡǰͨѾӵԶIDԶΪ6~10ֵ6~10 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MULTI_STREAM_COMPRESSIONCFG + { + public uint dwSize; + public uint dwStreamType; //ͣ0-1-2-¼ͣ3-3 + public NET_DVR_COMPRESSION_INFO_V30 struStreamPara; //ѹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 80, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ѹ(ӽṹ)(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSION_INFO_V30 + { + public byte byStreamType;// 0-Ƶ, 1-, ʾ¼ѹʱλʾǷѹ + public byte byResolution;//ֱ0-DCIF 1-CIF, 2-QCIF, 3-4CIF, 4-2CIF 516-VGA640*480 17-UXGA1600*1200 18-SVGA 800*60019-HD720p1280*72020-XVGA 21-HD900p + public byte byBitrateType;// 0:, 1: + public byte byPicQuality;//ͼ 0- 1-κ 2-Ϻ 3-һ 4-ϲ 5- + public uint dwVideoBitrate;//Ƶ 0- 1-16K 2-32K 3-48k 4-64K 5-80K 6-96K 7-128K 8-160k 9-192K 10-224K 11-256K 12-320K + // 13-384K 14-448K 15-512K 16-640K 17-768K 18-896K 19-1024K 20-1280K 21-1536K 22-1792K 23-2048K + //λ(31λ)ó1ʾԶ, 0-30λʾֵ + public uint dwVideoFrameRate;//֡ 0-ȫ; 1-1/16; 2-1/8; 3-1/4; 4-1/2; 5-1; 6-2; 7-4; 8-6; 9-8; 10-10; 11-12; 12-16; 13-20; V2.0汾¼14-15; 15-18; 16-22; + public ushort wIntervalFrameI;//I֡ + //2006-08-11 ӵP֡ýӿڣԸʵʱʱ + public byte byIntervalBPFrame;//0-BBP֡; 1-BP֡; 2-P֡ + public byte byres1; // + public byte byVideoEncType;//Ƶ 0 hik264;1׼h264; 2׼mpeg4; + public byte byAudioEncType; //Ƶ 0OggVorbis + public byte byVideoEncComplexity; //Ƶ븴Ӷȣ0-ͣ1-У2,0xfe:ԶԴһ + public byte byEnableSvc; //0 - SVCܣ1- SVC + public byte byFormatType; //װͣ1-2-RTPװ3-PSװ4-TSװ5-˽У6-FLV7-ASF8-3GP,9-RTP+PS꣺GB281810xff-Ч + public byte byAudioBitRate; //Ƶ0-Ĭϣ1-8Kbps, 2- 16Kbps, 3-32Kbps4-64Kbps5-128Kbps6-192Kbps(IPC5.1.0Ĭ4-64Kbps) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byres;//ﱣƵѹ + } + + //ͨѹ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSIONCFG_V30 + { + public uint dwSize; + public NET_DVR_COMPRESSION_INFO_V30 struNormHighRecordPara;//¼ Ӧ8000ͨ + public NET_DVR_COMPRESSION_INFO_V30 struRes;// char reserveData[28]; + public NET_DVR_COMPRESSION_INFO_V30 struEventRecordPara;//¼ѹ + public NET_DVR_COMPRESSION_INFO_V30 struNetPara;//() + } + + //ѹ(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSION_INFO + { + public byte byStreamType;//0-Ƶ,1-,ʾѹʱλʾǷѹ + public byte byResolution;//ֱ0-DCIF 1-CIF, 2-QCIF, 3-4CIF, 4-2CIF, 5-2QCIF(352X144)(ר) + public byte byBitrateType;//0:ʣ1: + public byte byPicQuality;//ͼ 0- 1-κ 2-Ϻ 3-һ 4-ϲ 5- + public uint dwVideoBitrate; //Ƶ 0- 1-16K() 2-32K 3-48k 4-64K 5-80K 6-96K 7-128K 8-160k 9-192K 10-224K 11-256K 12-320K + // 13-384K 14-448K 15-512K 16-640K 17-768K 18-896K 19-1024K 20-1280K 21-1536K 22-1792K 23-2048K + //λ(31λ)ó1ʾԶ, 0-30λʾֵ(MIN-32K MAX-8192K) + public uint dwVideoFrameRate;//֡ 0-ȫ; 1-1/16; 2-1/8; 3-1/4; 4-1/2; 5-1; 6-2; 7-4; 8-6; 9-8; 10-10; 11-12; 12-16; 13-20; + } + + //ͨѹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSIONCFG + { + public uint dwSize; + public NET_DVR_COMPRESSION_INFO struRecordPara;//¼/¼¼ + public NET_DVR_COMPRESSION_INFO struNetPara;/// + } + + //ѹ(ӽṹ)(չ) I֡ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSION_INFO_EX + { + public byte byStreamType;//0-Ƶ, 1- + public byte byResolution;//ֱ0-DCIF 1-CIF, 2-QCIF, 3-4CIF, 4-2CIF, 5-2QCIF(352X144)(ר) + public byte byBitrateType;//0:ʣ1: + public byte byPicQuality;//ͼ 0- 1-κ 2-Ϻ 3-һ 4-ϲ 5- + public uint dwVideoBitrate;//Ƶ 0- 1-16K() 2-32K 3-48k 4-64K 5-80K 6-96K 7-128K 8-160k 9-192K 10-224K 11-256K 12-320K + // 13-384K 14-448K 15-512K 16-640K 17-768K 18-896K 19-1024K 20-1280K 21-1536K 22-1792K 23-2048K + //λ(31λ)ó1ʾԶ, 0-30λʾֵ(MIN-32K MAX-8192K) + public uint dwVideoFrameRate;//֡ 0-ȫ; 1-1/16; 2-1/8; 3-1/4; 4-1/2; 5-1; 6-2; 7-4; 8-6; 9-8; 10-10; 11-12; 12-16; 13-20, //V2.014-15, 15-18, 16-22; + public ushort wIntervalFrameI;//I֡ + //2006-08-11 ӵP֡ýӿڣԸʵʱʱ + public byte byIntervalBPFrame;//0-BBP֡; 1-BP֡; 2-P֡ + public byte byRes; + } + + //ͨѹ(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSIONCFG_EX + { + public uint dwSize; + public NET_DVR_COMPRESSION_INFO_EX struRecordPara;//¼ + public NET_DVR_COMPRESSION_INFO_EX struNetPara;// + } + + //ʱ¼(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_RECORDSCHED + { + public NET_DVR_SCHEDTIME struRecordTime; + public byte byRecordType;//0:ʱ¼1:ƶ⣬2:¼3:|4:&, 5:, 6: ¼ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 3)] + public string reservedData; + } + + //ȫ¼(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORDDAY + { + public ushort wAllDayRecord;/* Ƿȫ¼ 0- 1-*/ + public byte byRecordType;/* ¼ 0:ʱ¼1:ƶ⣬2:¼3:|4:& 5:, 6: ¼*/ + public byte reservedData; + } + + //ʱ¼(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORDSCHED_V40 + { + public NET_DVR_SCHEDTIME struRecordTime; + /*¼ͣ0:ʱ¼1:ƶ⣬2:¼3:|4:& 5:, + 6-ܱ¼10-PIR11-߱12-ȱ13-ȫ¼,14-ܽͨ¼, + 15-Խ,16-,17-쳣,18-, + 19-(Խ|||쳣|),20,21-POS¼, + 22-, 23-뿪,24-ǻ,25-Աۼ,26-˶,27-ͣ, + 28-Ʒ,29-Ʒȡ,30-⣬31-ƻ,32-ܶŹ¼(˾),33-¼(˾), 34-˯¼(˾) + 35-ֻ, 36-Ԥ37-±38-²39-߲±,40-41-,42-ҵѯ,43-,44-ʸ,45-޳ʱ46-ץģ47-Ƿ̯,48-Ŀץ, + 49-˶50ڼ⣬51-52仯 */ + public byte byRecordType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ȫ¼(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORDDAY_V40 + { + public byte byAllDayRecord; /* Ƿȫ¼ 0- 1-*/ + /*¼ͣ0:ʱ¼1:ƶ⣬2:¼3:|4:& 5:, + 6-ܱ¼10-PIR11-߱12-ȱ13-ȫ¼,14-ܽͨ¼, + 15-Խ,16-,17-쳣,18-, + 19-(Խ|||쳣|),20,21-POS¼, + 22-, 23-뿪,24-ǻ,25-Աۼ,26-˶,27-ͣ, + 28-Ʒ,29-Ʒȡ,30-⣬31-ƻ,32-ܶŹ¼(˾),33-¼(˾), 34-˯¼(˾) + 35-ֻ, 36-Ԥ37-±38-²39-߲±,40-41-,42-ҵѯ,43-,44-ʸ,45-޳ʱ,46-ץ,47-Ƿ̯,48-Ŀץ, + 49-˶50ڼ⣬51-52仯*/ + public byte byRecordType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 62, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORD_V40 + { + public uint dwSize; + public uint dwRecord; /*Ƿ¼ 0- 1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDDAY_V40[] struRecAllDay; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDSCHED_V40[] struRecordSched; + public uint dwRecordTime; /* ¼ʱ 0-5룬 1-10룬 2-30룬 3-1ӣ 4-2ӣ 5-5ӣ 6-10*/ + public uint dwPreRecordTime; /* Ԥ¼ʱ 0-Ԥ¼ 1-5 2-10 3-15 4-20 5-25 6-30 7-0xffffffff(Ԥ¼) */ + public uint dwRecorderDuration; /* ¼񱣴ʱ */ + public byte byRedundancyRec; /*Ƿ¼,Ҫ˫ݣ0/1*/ + public byte byAudioRec; /*¼ʱʱǷ¼Ƶݣд˷*/ + public byte byStreamType; // 0-1-2-ͬʱ 3- + public byte byPassbackRecord; // 0:ش¼ 1ش¼ + public ushort wLockDuration; // ¼ʱλСʱ 0ʾ0xffffʾ¼εʱijʱ¼񣬽 + public byte byRecordBackup; // 0:¼񲻴浵 1¼浵 + public byte bySVCLevel; //SVC֡ͣ0-飬1-֮һ 2-ķ֮ + public byte byRecordManage; //¼ȣ0-ã 1-; ʱжʱ¼񣻲ʱжʱ¼񣬵¼ƻʹãƶ⣬شڰ¼ƻ + public byte byExtraSaveAudio;//Ƶ洢 + /*¼ܺ㷨Զ¼㷨书Ϊ¼Ŀ֣ήʡ֡ʣĿʱָֻȫʼ֡ʣӶﵽԴĵĿ*/ + public byte byIntelligentRecord;//Ƿ¼ 0- 1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 125, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͨ¼(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORD_V30 + { + public uint dwSize; + public uint dwRecord;/*Ƿ¼ 0- 1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDDAY[] struRecAllDay; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDSCHED[] struRecordSched; + public uint dwRecordTime;/* ¼ʱ 0-5룬 1-20룬 2-30룬 3-1ӣ 4-2ӣ 5-5ӣ 6-10*/ + public uint dwPreRecordTime;/* Ԥ¼ʱ 0-Ԥ¼ 1-5 2-10 3-15 4-20 5-25 6-30 7-0xffffffff(Ԥ¼) */ + public uint dwRecorderDuration;/* ¼񱣴ʱ */ + public byte byRedundancyRec;/*Ƿ¼,Ҫ˫ݣ0/1*/ + public byte byAudioRec;/*¼ʱʱǷ¼Ƶݣд˷*/ + public byte byStreamType; // 0: 1 + public byte byPassbackRecord; // 0:ش¼ 1ش¼ + public ushort wLockDuration; // ¼ʱλСʱ 0ʾ0xffffʾ¼εʱijʱ¼񣬽 + public byte byRecordBackup; // 0:¼񲻴浵 1¼浵 + public byte bySVCLevel; //SVC֡ͣ0-飬1-֮һ 2-ķ֮ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byReserve; + } + + //ͨ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORD + { + public uint dwSize; + public uint dwRecord;/*Ƿ¼ 0- 1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDDAY[] struRecAllDay; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDSCHED[] struRecordSched; + public uint dwRecordTime;/* ¼ʱ䳤 */ + public uint dwPreRecordTime;/* Ԥ¼ʱ 0-Ԥ¼ 1-5 2-10 3-15 4-20 5-25 6-30 7-0xffffffff(Ԥ¼) */ + } + + //̨Эṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZ_PROTOCOL + { + public uint dwType;/*ֵ1ʼ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDescribe;/*8000еһ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PTZ_PROTOCOL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PTZ_PROTOCOL[] struPtz;/*200PTZЭ*/ + public uint dwPtzNum;/*ЧptzЭĿ0ʼ(ʱ1)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + /***************************̨(end)******************************/ + + //ͨ(̨)(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODERCFG_V30 + { + public uint dwSize; + public uint dwBaudRate;//(bps)0501752110315043005600612007240084800996001019200 11384001257600137680014115.2k; + public byte byDataBit;// мλ 05λ16λ27λ38λ; + public byte byStopBit;// ֹͣλ 01λ12λ + public byte byParity;// У 0У飬1У飬2żУ; + public byte byFlowcontrol;// 0ޣ1,2-Ӳ + public ushort wDecoderType;//, 0ʼӦptzЭб + public ushort wDecoderAddress;/*ַ:0 - 255*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PRESET_V30, ArraySubType = UnmanagedType.I1)] + public byte[] bySetPreset;/* ԤõǷ,0-û,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CRUISE_V30, ArraySubType = UnmanagedType.I1)] + public byte[] bySetCruise;/* ѲǷ: 0-û,1- */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TRACK_V30, ArraySubType = UnmanagedType.I1)] + public byte[] bySetTrack;/* 켣Ƿ,0-û,1-*/ + } + + //ͨ(̨) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODERCFG + { + public uint dwSize; + public uint dwBaudRate; //(bps)0501752110315043005600612007240084800996001019200 11384001257600137680014115.2k; + public byte byDataBit; // мλ 05λ16λ27λ38λ; + public byte byStopBit;// ֹͣλ 01λ12λ; + public byte byParity; // У 0У飬1У飬2żУ; + public byte byFlowcontrol;// 0ޣ1,2-Ӳ + public ushort wDecoderType;//, 0YouLi1LiLin-10162LiLin-8203Pelco-p4DM DynaColor5HD6006JC-41167Pelco-d WX8Pelco-d PICO + public ushort wDecoderAddress;/*ַ:0 - 255*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PRESET, ArraySubType = UnmanagedType.I1)] + public byte[] bySetPreset;/* ԤõǷ,0-û,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CRUISE, ArraySubType = UnmanagedType.I1)] + public byte[] bySetCruise;/* ѲǷ: 0-û,1- */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TRACK, ArraySubType = UnmanagedType.I1)] + public byte[] bySetTrack;/* 켣Ƿ,0-û,1-*/ + } + + //ppp(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PPPCFG_V30 + { + public NET_DVR_IPADDR struRemoteIP;//ԶIPַ + public NET_DVR_IPADDR struLocalIP;//IPַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sLocalIPMask;//IPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUsername;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public byte byPPPMode;//PPPģʽ, 01 + public byte byRedial;//Ƿز 0-,1- + public byte byRedialMode;//زģʽ,0-ɲָ,1-Ԥûز + public byte byDataEncrypt;//ݼ,0-,1- + public uint dwMTU;//MTU + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PHONENUMBER_LEN)] + public string sTelephoneNumber;//绰 + } + + //ppp(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PPPCFG + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sRemoteIP;//ԶIPַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sLocalIP;//IPַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sLocalIPMask;//IPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUsername;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public byte byPPPMode;//PPPģʽ, 01 + public byte byRedial;//Ƿز 0-,1- + public byte byRedialMode;//زģʽ,0-ɲָ,1-Ԥûز + public byte byDataEncrypt;//ݼ,0-,1- + public uint dwMTU;//MTU + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PHONENUMBER_LEN)] + public string sTelephoneNumber;//绰 + } + + //RS232ڲ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLE_RS232 + { + public uint dwBaudRate;/*(bps)0501752110315043005600612007240084800996001019200 11384001257600137680014115.2k;*/ + public byte byDataBit;/* мλ 05λ16λ27λ38λ */ + public byte byStopBit;/* ֹͣλ 01λ12λ */ + public byte byParity;/* У 0У飬1У飬2żУ */ + public byte byFlowcontrol;/* 0ޣ1,2-Ӳ */ + public uint dwWorkMode; /* ģʽ0232PPPţ1232ڲƣ2͸ͨ */ + } + + //RS232ڲ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RS232CFG_V30 + { + public uint dwSize; + public NET_DVR_SINGLE_RS232 struRs232; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 84, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_PPPCFG_V30 struPPPConfig; + } + + //RS232ڲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RS232CFG + { + public uint dwSize; + public uint dwBaudRate;//(bps)0501752110315043005600612007240084800996001019200 11384001257600137680014115.2k; + public byte byDataBit;// мλ 05λ16λ27λ38λ; + public byte byStopBit;// ֹͣλ 01λ12λ; + public byte byParity;// У 0У飬1У飬2żУ; + public byte byFlowcontrol;// 0ޣ1,2-Ӳ + public uint dwWorkMode;// ģʽ0խ(232PPP)1̨(232ڲ)2͸ͨ + public NET_DVR_PPPCFG struPPPConfig; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PRESETCHAN_INFO + { + public uint dwEnablePresetChan; /*Ԥõͨ*/ + public uint dwPresetPointNo; /*ԤõͨӦԤõ, 0xfffffffʾԤõ㡣*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CRUISECHAN_INFO + { + public uint dwEnableCruiseChan; /*Ѳͨ*/ + public uint dwCruiseNo; /*ѲͨӦѲ, 0xfffffffʾЧ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZTRACKCHAN_INFO + { + public uint dwEnablePtzTrackChan; /*̨켣ͨ*/ + public uint dwPtzTrackNo; /*̨켣ͨӦı, 0xfffffffʾЧ*/ + } + + //(256·NVRչ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINCFG_V40 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAlarmInName; /* */ + public byte byAlarmType; //,0,1 + public byte byAlarmInHandle; /* Ƿ 0- 1-*/ + public byte byChannel; // 봥ʶͨ + public byte byRes1; // + public uint dwHandleType; //쳣,쳣ʽ"" + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: */ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public uint dwMaxRelAlarmOutChanNum ; //ıֻ֧ͨ + public uint dwRelAlarmOutChanNum; //ıͨ ʵ֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelAlarmOut; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + /*¼ͨ*/ + public uint dwMaxRecordChanNum; //豸ֵ֧¼ͨ-ֻ + public uint dwCurRecordChanNum; //ǰʵõĹ¼ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelRecordChan; /* ʵʴ¼ֵͨʾ,ýУ±0 - dwCurRecordChanNum -1Чм0xffffffff,Ч*/ + public uint dwMaxEnablePtzCtrlNun; //ǫ̃(ֻ) + public uint dwEnablePresetChanNum; //ǰԤõĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PRESETCHAN_INFO[] struPresetChanInfo; //õԤõϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 516, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; /**/ + public uint dwEnableCruiseChanNum; //ǰѲͨĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CRUISECHAN_INFO[] struCruiseChanInfo; //ѲͨϢ + public uint dwEnablePtzTrackChanNum; //ǰѲͨĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PTZTRACKCHAN_INFO[] struPtzTrackInfo; //̨켣ͨϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINCFG_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAlarmInName;/* */ + public byte byAlarmType; //,0,1 + public byte byAlarmInHandle; /* Ƿ 0- 1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_HANDLEEXCEPTION_V30 struAlarmHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan;//¼ͨ,Ϊ1ʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byEnablePreset;/* ǷԤõ 0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byPresetNo;/* ǫ̃Ԥõ,һԵǫ̈ͨԤõ, 0xffʾԤõ㡣*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 192, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;/**/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byEnableCruise;/* ǷѲ 0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byCruiseNo;/* Ѳ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byEnablePtzTrack;/* Ƿù켣 0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byPTZTrack;/* ǫ̃Ĺ켣 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct STRUCT_IO_ALARM + { + public uint dwAlarmInputNo; //ıͨţһֻһ + public uint dwTrigerAlarmOutNum; /*ıں䳤ݲдıͨţֽڱʾһ*/ + public uint dwTrigerRecordChanNum; /*¼ͨں䳤ݲд¼ͨţֽڱʾһ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 116, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct STRUCT_ALARM_CHANNEL + { + public uint dwAlarmChanNum; /*ͨݸں䳤ݲзıͨţֽڱʾһ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct STRUCT_ALARM_HD + { + public uint dwAlarmHardDiskNum; /*Ӳݳȣں䳤ݲзӲ̺ţĽڱʾһ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayout(LayoutKind.Explicit)] + public struct UNION_ALARMINFO_FIXED + { + [FieldOffset(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byUnionLen; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALRAM_FIXED_HEADER + { + public uint dwAlarmType; /*0-ź,1-Ӳ,2-źŶʧ3ƶ⣬4Ӳδʽ,5-дӲ̳,6-ڵ7-ʽƥ, 8-Ƿʣ9-Ƶź쳣10-¼쳣11-ܳ仯12-쳣13-ǰ/¼ֱʲƥ*/ + public NET_DVR_TIME_EX struAlarmTime; //ʱ + public UNION_ALARMINFO_FIXED uStruAlarm; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINFO_V40 + { + public NET_DVR_ALRAM_FIXED_HEADER struAlarmFixedHeader; //̶ + public IntPtr pAlarmData; //ɱ䲿 + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAlarmInName;/* */ + public byte byAlarmType;//,0,1 + public byte byAlarmInHandle;/* Ƿ 0- 1-*/ + public byte byChannel; // 봥ʶͨ + public byte byRes; + public NET_DVR_HANDLEEXCEPTION struAlarmHandleType;/* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan;//¼ͨ,Ϊ1ʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byEnablePreset;/* ǷԤõ 0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byPresetNo;/* ǫ̃Ԥõ,һԵǫ̈ͨԤõ, 0xffʾԤõ㡣*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byEnableCruise;/* ǷѲ 0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byCruiseNo;/* Ѳ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byEnablePtzTrack;/* Ƿù켣 0-,1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byPTZTrack;/* ǫ̃Ĺ켣 */ + } + + //ģⱨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ANALOG_ALARMINCFG + { + public uint dwSize; + public byte byEnableAlarmHandle; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmInName; //ģⱨ + public ushort wAlarmInUpper; //ģѹޣʵֵ10Χ0~360 + public ushort wAlarmInLower; //ģѹޣʵֵ10Χ0~360 + public NET_DVR_HANDLEEXCEPTION_V30 struAlarmHandleType; /* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ϴϢ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINFO_V30 + { + public uint dwAlarmType;/*0-ź,1-Ӳ,2-źŶʧ,3ƶ,4Ӳδʽ,5-дӲ̳,6-ڵ,7-ʽƥ, 8-Ƿ, 0xa-GPSλϢ(ض)*/ + public uint dwAlarmInputNumber;/*˿*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmOutputNumber;/*˿ڣΪ1ʾӦ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmRelateChannel;/*¼ͨΪ1ʾӦ¼, dwAlarmRelateChannel[0]Ӧ1ͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byChannel;/*dwAlarmTypeΪ23,6ʱʾĸͨdwChannel[0]Ӧ1ͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byDiskNumber;/*dwAlarmTypeΪ1,4,5ʱ,ʾĸӲ, dwDiskNumber[0]Ӧ1Ӳ*/ + public void Init() + { + dwAlarmType = 0; + dwAlarmInputNumber = 0; + byAlarmRelateChannel = new byte[MAX_CHANNUM_V30]; + byChannel = new byte[MAX_CHANNUM_V30]; + byAlarmOutputNumber = new byte[MAX_ALARMOUT_V30]; + byDiskNumber = new byte[MAX_DISKNUM_V30]; + for (int i = 0; i < MAX_CHANNUM_V30; i++) + { + byAlarmRelateChannel[i] = Convert.ToByte(0); + byChannel[i] = Convert.ToByte(0); + } + for (int i = 0; i < MAX_ALARMOUT_V30; i++) + { + byAlarmOutputNumber[i] = Convert.ToByte(0); + } + for (int i = 0; i < MAX_DISKNUM_V30; i++) + { + byDiskNumber[i] = Convert.ToByte(0); + } + } + public void Reset() + { + dwAlarmType = 0; + dwAlarmInputNumber = 0; + + for (int i = 0; i < MAX_CHANNUM_V30; i++) + { + byAlarmRelateChannel[i] = Convert.ToByte(0); + byChannel[i] = Convert.ToByte(0); + } + for (int i = 0; i < MAX_ALARMOUT_V30; i++) + { + byAlarmOutputNumber[i] = Convert.ToByte(0); + } + for (int i = 0; i < MAX_DISKNUM_V30; i++) + { + byDiskNumber[i] = Convert.ToByte(0); + } + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARM_HOT_SPARE + { + public uint dwSize; //ṹ + public uint dwExceptionCase; //ԭ 0-쳣 + public NET_DVR_IPADDR struDeviceIP; //쳣豸IPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINFO + { + public int dwAlarmType;/*0-ź,1-Ӳ,2-źŶʧ,3ƶ,4Ӳδʽ,5-дӲ̳,6-ڵ,7-ʽƥ, 8-Ƿ, 9-״̬, 0xa-GPSλϢ(ض)*/ + public int dwAlarmInputNumber;/*˿, Ϊ9ʱñʾ״̬0ʾ -1ʾ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT, ArraySubType = UnmanagedType.U4)] + public int[] dwAlarmOutputNumber;/*˿ڣһλΪ1ʾӦһ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.U4)] + public int[] dwAlarmRelateChannel;/*¼ͨһλΪ1ʾӦһ·¼, dwAlarmRelateChannel[0]Ӧ1ͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.U4)] + public int[] dwChannel;/*dwAlarmTypeΪ23,6ʱʾĸͨdwChannel[0]λӦ1ͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM, ArraySubType = UnmanagedType.U4)] + public int[] dwDiskNumber;/*dwAlarmTypeΪ1,4,5ʱ,ʾĸӲ, dwDiskNumber[0]λӦ1Ӳ*/ + public void Init() + { + dwAlarmType = 0; + dwAlarmInputNumber = 0; + dwAlarmOutputNumber = new int[MAX_ALARMOUT]; + dwAlarmRelateChannel = new int[MAX_CHANNUM]; + dwChannel = new int[MAX_CHANNUM]; + dwDiskNumber = new int[MAX_DISKNUM]; + for (int i = 0; i < MAX_ALARMOUT; i++) + { + dwAlarmOutputNumber[i] = 0; + } + for (int i = 0; i < MAX_CHANNUM; i++) + { + dwAlarmRelateChannel[i] = 0; + dwChannel[i] = 0; + } + for (int i = 0; i < MAX_DISKNUM; i++) + { + dwDiskNumber[i] = 0; + } + } + public void Reset() + { + dwAlarmType = 0; + dwAlarmInputNumber = 0; + + for (int i = 0; i < MAX_ALARMOUT; i++) + { + dwAlarmOutputNumber[i] = 0; + } + for (int i = 0; i < MAX_CHANNUM; i++) + { + dwAlarmRelateChannel[i] = 0; + dwChannel[i] = 0; + } + for (int i = 0; i < MAX_DISKNUM; i++) + { + dwDiskNumber[i] = 0; + } + } + } + + + ////////////////////////////////////////////////////////////////////////////////////// + //IPC + /* IP豸ṹ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPDEVINFO + { + public uint dwEnable;/* IP豸Ƿ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /* */ + public NET_DVR_IPADDR struIP;/* IPַ */ + public ushort wDVRPort;/* ˿ں */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 34, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;/* */ + + public void Init() + { + sUserName = new byte[NAME_LEN]; + sPassword = new byte[PASSWD_LEN]; + byRes = new byte[34]; + } + } + + //ipc豸Ϣչ֧ip豸 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPDEVINFO_V31 + { + public byte byEnable;//IP豸ǷЧ + public byte byProType; + public byte byEnableQuickAdd; + public byte byRes1;//ֶΣ0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;//û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byDomain;//豸 + public NET_DVR_IPADDR struIP;//IPַ + public ushort wDVRPort;// ˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 34, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;//ֶΣ0 + + public void Init() + { + sUserName = new byte[NAME_LEN]; + sPassword = new byte[PASSWD_LEN]; + byDomain = new byte[MAX_DOMAIN_NAME]; + byRes2 = new byte[34]; + } + } + + /* IPͨƥ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPCHANINFO + { + public byte byEnable;/* ͨǷ */ + public byte byIPID;/* IP豸ID ȡֵ1- MAX_IP_DEVICE */ + public byte byChannel;/* ͨ */ + public byte byIPIDHigh; // IP豸IDĸ8λ + public byte byTransProtocol;//Э0-TCP/auto(豸)1-UDP 2-ಥ 3-TCP 4-auto + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//,0 + public void Init() + { + byRes = new byte[31]; + } + } + + /* IPýṹ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPPARACFG + { + public uint dwSize;/* ṹС */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_DEVICE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPDEVINFO[] struIPDevInfo;/* IP豸 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byAnalogChanEnable; /* ģͨǷãӵ͵߱ʾ1-32ͨ0ʾЧ 1Ч */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_CHANNEL, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPCHANINFO[] struIPChanInfo;/* IPͨ */ + + public void Init() + { + int i = 0; + struIPDevInfo = new NET_DVR_IPDEVINFO[MAX_IP_DEVICE]; + + for (i = 0; i < MAX_IP_DEVICE; i++) + { + struIPDevInfo[i].Init(); + } + byAnalogChanEnable = new byte[MAX_ANALOG_CHANNUM]; + struIPChanInfo = new NET_DVR_IPCHANINFO[MAX_IP_CHANNEL]; + for (i = 0; i < MAX_IP_CHANNEL; i++) + { + struIPChanInfo[i].Init(); + } + } + } + + /* չIPýṹ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPPARACFG_V31 + { + public uint dwSize;/* ṹС */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_DEVICE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPDEVINFO_V31[] struIPDevInfo; /* IP豸 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byAnalogChanEnable; /* ģͨǷãӵ͵߱ʾ1-32ͨ0ʾЧ 1Ч */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_CHANNEL, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPCHANINFO[] struIPChanInfo;/* IPͨ */ + + public void Init() + { + int i = 0; + struIPDevInfo = new NET_DVR_IPDEVINFO_V31[MAX_IP_DEVICE]; + + for (i = 0; i < MAX_IP_DEVICE; i++) + { + struIPDevInfo[i].Init(); + } + byAnalogChanEnable = new byte[MAX_ANALOG_CHANNUM]; + struIPChanInfo = new NET_DVR_IPCHANINFO[MAX_IP_CHANNEL]; + for (i = 0; i < MAX_IP_CHANNEL; i++) + { + struIPChanInfo[i].Init(); + } + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPSERVER_STREAM + { + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_IPADDR struIPServer; + public ushort wPort; + public ushort wDvrNameLen; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDVRName; + public ushort wDVRSerialLen; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.U2)] + public ushort[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDVRSerialNumber; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassWord; + public byte byChannel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public void Init() + { + byRes = new byte[3]; + byDVRName = new byte[NAME_LEN]; + byRes1 = new ushort[2]; + byDVRSerialNumber = new byte[SERIALNO_LEN]; + byUserName = new byte[NAME_LEN]; + byPassWord = new byte[PASSWD_LEN]; + byRes2 = new byte[11]; + } + } + + /*ý*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STREAM_MEDIA_SERVER_CFG + { + public byte byValid;/*Ƿýȡ,0ʾЧ0ʾЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_IPADDR struDevIP; + public ushort wDevPort;/*ý˿*/ + public byte byTransmitType;/*Э 0-TCP1-UDP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 69, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + //豸ͨϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEV_CHAN_INFO + { + public NET_DVR_IPADDR struIP; //DVR IPַ + public ushort wDVRPort; //˿ں + public byte byChannel; //ͨ + public byte byTransProtocol; //Э0-TCP1-UDP + public byte byTransMode; //ģʽ 0 1 + public byte byFactoryType; /*ǰ豸,ͨӿڻȡ*/ + public byte byDeviceType; //豸(Ƶۺƽ̨ܰʹ)1-ʱƵۺƽ̨byVcaSupportChanModeֶʹýͨʾͨ2- + public byte byDispChan;//ʾͨ,ʹ + public byte bySubDispChan;//ʾͨͨţʱʹ + public byte byResolution; //; 1-CIF 2-4CIF 3-720P 4-1080P 5-500wʹãݸòԴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byDomain; //豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; //½ʺ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PU_STREAM_CFG + { + public uint dwSize; + public NET_DVR_STREAM_MEDIA_SERVER_CFG struStreamMediaSvrCfg; + public NET_DVR_DEV_CHAN_INFO struDevChanInfo; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DDNS_STREAM_CFG + { + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_IPADDR struStreamServer; + public ushort wStreamServerPort; + public byte byStreamServerTransmitType; + public byte byRes2; + public NET_DVR_IPADDR struIPServer; + public ushort wIPServerPort; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDVRName; + public ushort wDVRNameLen; + public ushort wDVRSerialLen; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDVRSerialNumber; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassWord; + public ushort wDVRPort; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes4; + public byte byChannel; + public byte byTransProtocol; + public byte byTransMode; + public byte byFactoryType; + public void Init() + { + byRes1 = new byte[3]; + byRes3 = new byte[2]; + sDVRName = new byte[NAME_LEN]; + sDVRSerialNumber = new byte[SERIALNO_LEN]; + sUserName = new byte[NAME_LEN]; + sPassWord = new byte[PASSWD_LEN]; + byRes4 = new byte[2]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PU_STREAM_URL + { + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 240, ArraySubType = UnmanagedType.I1)] + public byte[] strURL; + public byte byTransPortocol; + public ushort wIPID; + public byte byChannel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void Init() + { + strURL = new byte[240]; + byRes = new byte[7]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HKDDNS_STREAM + { + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byDDNSDomain; + public ushort wPort; + public ushort wAliasLen; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAlias; + public ushort wDVRSerialLen; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDVRSerialNumber; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassWord; + public byte byChannel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public void Init() + { + byRes = new byte[3]; + byDDNSDomain = new byte[64]; + byAlias = new byte[NAME_LEN]; + byRes1 = new byte[2]; + byDVRSerialNumber = new byte[SERIALNO_LEN]; + byUserName = new byte[NAME_LEN]; + byPassWord = new byte[PASSWD_LEN]; + byRes2 = new byte[11]; + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPCHANINFO_V40 + { + public byte byEnable; /* ͨǷ */ + public byte byRes1; + public ushort wIPID; //IP豸ID + public uint dwChannel; //ͨ + public byte byTransProtocol; //Э0-TCP1-UDP + public byte byTransMode; //ģʽ 0 1 + public byte byFactoryType; /*ǰ豸,ͨӿڻȡ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 241, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayout(LayoutKind.Explicit)] + public struct NET_DVR_GET_STREAM_UNION + { + [FieldOffset(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 492, ArraySubType = UnmanagedType.I1)] + public byte[] byUnion; + public void Init() + { + byUnion = new byte[492]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STREAM_MODE + { + public byte byGetStreamType;/*ȡʽ0- ֱӴ豸ȡ1- ýȡ2- ͨIPServerIPַȡ + * 3- ͨIPServerҵ豸ͨýȡ豸 4- ͨýURLȥȡ + * 5- ͨhiDDNS豸Ȼ豸ȡ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_GET_STREAM_UNION uGetStream; + public void Init() + { + byGetStreamType = 0; + byRes = new byte[3]; + //uGetStream.Init(); + } + } + + /* V40չIPýṹ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPPARACFG_V40 + { + public uint dwSize;/* ṹС */ + public uint dwGroupNum; + public uint dwAChanNum; + public uint dwDChanNum; + public uint dwStartDChan; + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAnalogChanEnable; /* ģͨǷãӵ͵߱ʾ1-32ͨ0ʾЧ 1Ч */ + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_DEVICE_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPDEVINFO_V31[] struIPDevInfo; /* IP豸 */ + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_STREAM_MODE[] struStreamMode;/* IPͨ */ + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; /* ģͨǷãӵ͵߱ʾ1-32ͨ0ʾЧ 1Ч */ + } + + //ΪCVRչı + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMINFO_DEV + { + public uint dwAlarmType; //0-(ͨ)ź1-˽о𻵣2- NVR˳ + //3-״̬쳣4-ϵͳʱ쳣5-¼ʣͣ + //6-(ͨ)ƶⱨ7-(ͨ)ڵ + public NET_DVR_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public uint dwNumber; //Ŀ + public IntPtr pNO; //dwNumberWORD; ÿWORDʾһͨţߴ̺, ЧʱΪ0 + } + + /* */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMOUTINFO + { + public byte byIPID;/* IP豸IDȡֵ1- MAX_IP_DEVICE */ + public byte byAlarmOut;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 18, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;/* */ + + public void Init() + { + byRes = new byte[18]; + } + } + + /* IPýṹ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMOUTCFG + { + public uint dwSize; /* ṹС */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMOUT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMOUTINFO[] struIPAlarmOutInfo;/* IP */ + + public void Init() + { + struIPAlarmOutInfo = new NET_DVR_IPALARMOUTINFO[MAX_IP_ALARMOUT]; + for (int i = 0; i < MAX_IP_ALARMOUT; i++) + { + struIPAlarmOutInfo[i].Init(); + } + } + } + /* IP */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMOUTINFO_V40 + { + public uint dwIPID; /* IP豸ID */ + public uint dwAlarmOut; /* IP豸IDӦı */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /* */ + } + + /*IP*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMOUTCFG_V40 + { + public uint dwSize; //ṹ峤 + public uint dwCurIPAlarmOutNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMOUT_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMOUTINFO_V40[] struIPAlarmOutInfo;/*IP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /* */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMININFO + { + public byte byIPID;/* IP豸IDȡֵ1- MAX_IP_DEVICE */ + public byte byAlarmIn;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 18, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;/* */ + } + + /* IPýṹ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMINCFG + { + public uint dwSize;/* ṹС */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMIN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMININFO[] struIPAlarmInInfo;/* IP */ + } + /* IP */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMININFO_V40 + { + public uint dwIPID; /* IP豸ID */ + public uint dwAlarmIn; /* IP豸IDӦı */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /* */ + } + /*IPԴ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMINCFG_V40 + { + public uint dwSize; //ṹ峤 + public uint dwCurIPAlarmInNum; //ǰ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMIN_V40, ArraySubType = UnmanagedType.I1)] + public NET_DVR_IPALARMININFO_V40[] struIPAlarmInInfo;/* IP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ipc alarm info + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMINFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_DEVICE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPDEVINFO[] struIPDevInfo; /* IP豸 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byAnalogChanEnable; /* ģͨǷã0-δ 1- */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_CHANNEL, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPCHANINFO[] struIPChanInfo;/* IPͨ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMIN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMININFO[] struIPAlarmInInfo;/* IP */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMOUT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMOUTINFO[] struIPAlarmOutInfo;/* IP */ + } + + //ipcøı䱨Ϣչ 9000_1.1 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMINFO_V31 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_DEVICE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPDEVINFO_V31[] struIPDevInfo; /* IP豸 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byAnalogChanEnable;/* ģͨǷã0-δ 1- */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_CHANNEL, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPCHANINFO[] struIPChanInfo;/* IPͨ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMIN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMININFO[] struIPAlarmInInfo; /* IP */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMOUT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMOUTINFO[] struIPAlarmOutInfo;/* IP */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPALARMINFO_V40 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_DEVICE_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPDEVINFO_V31[] struIPDevInfo; // IP豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAnalogChanEnable; /* ģͨǷã0-δ 1- */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPCHANINFO[] struIPChanInfo; /* IPͨ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMIN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMININFO[] struIPAlarmInInfo; /* IP */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IP_ALARMOUT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPALARMOUTINFO[] struIPAlarmOutInfo; /* IP */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + public enum HD_STAT + { + HD_STAT_OK = 0,/* */ + HD_STAT_UNFORMATTED = 1,/* δʽ */ + HD_STAT_ERROR = 2,/* */ + HD_STAT_SMART_FAILED = 3,/* SMART״̬ */ + HD_STAT_MISMATCH = 4,/* ƥ */ + HD_STAT_IDLE = 5, /* */ + NET_HD_STAT_OFFLINE = 6,/*̴δ״̬ */ + HD_RIADVD_EXPAND = 7, /* ̿ */ + HD_STAT_REPARING = 10, /* Ӳ޸(9000 2.0) */ + HD_STAT_FORMATING = 11, /* Ӳڸʽ(9000 2.0) */ + } + + //ӲϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLE_HD + { + public uint dwHDNo;/*Ӳ̺, ȡֵ0~MAX_DISKNUM_V30-1*/ + public uint dwCapacity;/*Ӳ()*/ + public uint dwFreeSpace;/*Ӳʣռ()*/ + public uint dwHdStatus;/*Ӳ״̬() HD_STAT*/ + public byte byHDAttr;/*0-Ĭ, 1-; 2-ֻ*/ + public byte byHDType;/*0-Ӳ,1-ESATAӲ,2-NASӲ*/ + public byte byDiskDriver; // ֵ ASCIIַ + public byte byRes1; + public uint dwHdGroup; /*ĸ 1-MAX_HD_GROUP*/ + public byte byRecycling; // Ƿѭ 0ѭã1ѭ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public uint dwStorageType; //λʾ 0-֧ 0-֧ + // dwStorageType & 0x1 ʾǷͨ¼רô洢 + // dwStorageType & 0x2 ʾǷdz֡¼רô洢 + // dwStorageType & 0x4 ʾǷͼƬ¼רô洢 + + public uint dwPictureCapacity; //ӲͼƬ()λ:MB + public uint dwFreePictureSpace; //ʣͼƬռ()λ:MB + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 104, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HDCFG + { + public uint dwSize; + public uint dwHDCount;/*Ӳ()*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_HD[] struHDInfo;//ӲزҪЧ + } + + //Ϣչ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLE_HDGROUP_V40 + { + public uint dwHDGroupNo; /*() 1-MAX_HD_GROUP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelRecordChan; //¼ֵͨʾ0xffffffffʱΪЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /* */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HDGROUP_CFG_V40 + { + public uint dwSize; //ṹС + public uint dwMaxHDGroupNum; //豸ֵ֧-ֻ + public uint dwCurHDGroupNum; /*ǰõ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HD_GROUP, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_HDGROUP_V40[] struHDGroupAttr; //ӲزҪЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLE_HDGROUP + { + public uint dwHDGroupNo;/*() 1-MAX_HD_GROUP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byHDGroupChans;/*Ӧ¼ͨ, 0-ʾͨ¼󵽸飬1-ʾ¼󵽸*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HDGROUP_CFG + { + public uint dwSize; + public uint dwHDGroupCount;/*()*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HD_GROUP, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_HDGROUP[] struHDGroupAttr;//ӲزҪЧ + } + + //ŲĽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCALECFG + { + public uint dwSize; + public uint dwMajorScale;/* ʾ 0-ţ1-*/ + public uint dwMinorScale;/* ʾ 0-ţ1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; + } + + //DVR(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMOUTCFG_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAlarmOutName;/* */ + public uint dwAlarmOutDelay;/* ʱ(-1Ϊޣֶر) */ + //0-5,1-10,2-30,3-1,4-2,5-5,6-10,7-ֶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmOutTime;/* ʱ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //DVR + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMOUTCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAlarmOutName;/* */ + public uint dwAlarmOutDelay;/* ʱ(-1Ϊޣֶر) */ + //0-5,1-10,2-30,3-1,4-2,5-5,6-10,7-ֶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmOutTime;/* ʱ */ + } + + //DVRԤ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PREVIEWCFG_V30 + { + public uint dwSize; + public byte byPreviewNumber;//ԤĿ,0-1,1-4,2-9,3-16,0xff: + public byte byEnableAudio;//ǷԤ,0-Ԥ,1-Ԥ + public ushort wSwitchTime;//лʱ,0-л,1-5s,2-10s,3-20s,4-30s,5-60s,6-120s,7-300s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PREVIEW_MODE * MAX_WINDOW_V30, ArraySubType = UnmanagedType.I1)] + public byte[] bySwitchSeq;//л˳,lSwitchSeq[i]Ϊ 0xffʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //DVRԤ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PREVIEWCFG + { + public uint dwSize; + public byte byPreviewNumber;//ԤĿ,0-1,1-4,2-9,3-16,0xff: + public byte byEnableAudio;//ǷԤ,0-Ԥ,1-Ԥ + public ushort wSwitchTime;//лʱ,0-л,1-5s,2-10s,3-20s,4-30s,5-60s,6-120s,7-300s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOW, ArraySubType = UnmanagedType.I1)] + public byte[] bySwitchSeq;//л˳,lSwitchSeq[i]Ϊ 0xffʾ + } + + //DVRƵ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VGAPARA + { + public ushort wResolution;/* ֱ */ + public ushort wFreq;/* ˢƵ */ + public uint dwBrightness;/* */ + } + + //MATRIXṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIXPARA_V30 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_CHANNUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wOrder;/* Ԥ˳, 0xffʾӦĴڲԤ */ + public ushort wSwitchTime;// Ԥлʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIXPARA + { + public ushort wDisplayLogo;/* ʾƵͨ */ + public ushort wDisplayOsd;/* ʾʱ */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VOOUT + { + public byte byVideoFormat;/* ʽ,0-PAL,1-NTSC */ + public byte byMenuAlphaValue;/* ˵뱳ͼԱȶ */ + public ushort wScreenSaveTime;/* Ļʱ 0-Ӳ,1-1,2-2,3-5,4-10,5-20,6-30 */ + public ushort wVOffset;/* Ƶƫ */ + public ushort wBrightness;/* Ƶ */ + public byte byStartMode;/* Ƶģʽ(0:˵,1:Ԥ)*/ + public byte byEnableScaler;/* Ƿ (0-, 1-)*/ + } + + //DVRƵ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOOUT_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VIDEOOUT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_VOOUT[] struVOOut; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VGA_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_VGAPARA[] struVGAPara;/* VGA */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_MATRIXOUT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIXPARA_V30[] struMatrixPara;/* MATRIX */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //DVRƵ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOOUT + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VIDEOOUT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_VOOUT[] struVOOut; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VGA, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_VGAPARA[] struVGAPara; /* VGA */ + public NET_DVR_MATRIXPARA struMatrixPara;/* MATRIX */ + } + + //û(ӽṹ)(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_INFO_V40 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /* ûֻ16ֽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalRight; /* Ȩ */ + /*0: ؿ̨*/ + /*1: ֶ¼*/ + /*2: ػط*/ + /*3: ò*/ + /*4: ز鿴״̬־*/ + /*5: ظ߼(ʽػ)*/ + /*6: ز鿴 */ + /*7: عģIP camera */ + /*8: ر */ + /*9: عػ/ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byRemoteRight;/* ԶȨ */ + /*0: Զ̨̿*/ + /*1: Զֶ¼*/ + /*2: Զ̻ط */ + /*3: Զò*/ + /*4: Զ̲鿴״̬־*/ + /*5: Զ̸߼(ʽػ)*/ + /*6: Զ̷Խ*/ + /*7: ԶԤ*/ + /*8: Զ󱨾ϴ*/ + /*9: Զ̿ƣ*/ + /*10: Զ̿ƴ*/ + /*11: Զ̲鿴 */ + /*12: Զ̹ģIP camera */ + /*13: Զ̹ػ/ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetPreviewRight; /* Զ̿Ԥͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalRecordRight; /* ؿ¼ͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetRecordRight; /* Զ̿¼ͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalPlaybackRight; /* ؿԻطŵͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetPlaybackRight; /* Զ̿Իطŵͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalPTZRight; /* ؿPTZͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetPTZRight; /* Զ̿PTZͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalBackupRight; /* رȨͨǰ˳У0xffffffffΪЧ*/ + public NET_DVR_IPADDR struUserIP; /* ûIPַ(Ϊ0ʱʾκεַ) */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr; /* ַ */ + public byte byPriority; /* ȼ0xff-ޣ0--ͣ1--У2-- */ + /* ޡʾ֧ȼ + ͡ĬȨ:غԶ̻ط,غԶ̲鿴־״̬,غԶ̹ػ/ + СغԶ̨̿,غԶֶ¼,غԶ̻ط,ԽԶԤر,/Զ̹ػ/ + ߡԱ */ + public byte byAlarmOnRight; // ڲȨ 1-Ȩޣ0-Ȩ + public byte byAlarmOffRight; // ڳȨ 1-Ȩޣ0-Ȩ + public byte byBypassRight; // ·Ȩ 1-Ȩޣ0-Ȩ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 118, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //û(ӽṹ)(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_INFO_V30 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalRight;/* Ȩ */ + /*0: ؿ̨*/ + /*1: ֶ¼*/ + /*2: ػط*/ + /*3: ò*/ + /*4: ز鿴״̬־*/ + /*5: ظ߼(ʽػ)*/ + /*6: ز鿴 */ + /*7: عģIP camera */ + /*8: ر */ + /*9: عػ/ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byRemoteRight;/* ԶȨ */ + /*0: Զ̨̿*/ + /*1: Զֶ¼*/ + /*2: Զ̻ط */ + /*3: Զò*/ + /*4: Զ̲鿴״̬־*/ + /*5: Զ̸߼(ʽػ)*/ + /*6: Զ̷Խ*/ + /*7: ԶԤ*/ + /*8: Զ󱨾ϴ*/ + /*9: Զ̿ƣ*/ + /*10: Զ̿ƴ*/ + /*11: Զ̲鿴 */ + /*12: Զ̹ģIP camera */ + /*13: Զ̹ػ/ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byNetPreviewRight;/* Զ̿Ԥͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalPlaybackRight;/* ؿԻطŵͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byNetPlaybackRight;/* Զ̿Իطŵͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalRecordRight;/* ؿ¼ͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byNetRecordRight;/* Զ̿¼ͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalPTZRight;/* ؿPTZͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byNetPTZRight;/* Զ̿PTZͨ 0-Ȩޣ1-Ȩ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalBackupRight;/* رȨͨ 0-Ȩޣ1-Ȩ*/ + public NET_DVR_IPADDR struUserIP;/* ûIPַ(Ϊ0ʱʾκεַ) */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr;/* ַ */ + public byte byPriority;/* ȼ0xff-ޣ0--ͣ1--У2-- */ + /* + ޡʾ֧ȼ + ͡ĬȨ:غԶ̻ط,غԶ̲鿴־״̬,غԶ̹ػ/ + СغԶ̨̿,غԶֶ¼,غԶ̻ط,ԽԶԤ + ر,/Զ̹ػ/ + ߡԱ + */ + public byte byAlarmOnRight; // ڲȨ + public byte byAlarmOffRight; // ڳȨ + public byte byBypassRight; // ·Ȩ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //û(SDK_V15չ)(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_USER_INFO_EX + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalRight;/* Ȩ */ + /*0: ؿ̨*/ + /*1: ֶ¼*/ + /*2: ػط*/ + /*3: ò*/ + /*4: ز鿴״̬־*/ + /*5: ظ߼(ʽػ)*/ + public uint dwLocalPlaybackRight;/* ؿԻطŵͨ bit0 -- channel 1*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.U4)] + public uint[] dwRemoteRight;/* Ȩ */ + /*0: Զ̨̿*/ + /*1: Զֶ¼*/ + /*2: Զ̻ط */ + /*3: Զò*/ + /*4: Զ̲鿴״̬־*/ + /*5: Զ̸߼(ʽػ)*/ + /*6: Զ̷Խ*/ + /*7: ԶԤ*/ + /*8: Զ󱨾ϴ*/ + /*9: Զ̿ƣ*/ + /*10: Զ̿ƴ*/ + public uint dwNetPreviewRight;/* Զ̿Ԥͨ bit0 -- channel 1*/ + public uint dwNetPlaybackRight;/* Զ̿Իطŵͨ bit0 -- channel 1*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sUserIP;/* ûIPַ(Ϊ0ʱʾκεַ) */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr;/* ַ */ + } + + //û(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_USER_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalRight;/* Ȩ */ + /*0: ؿ̨*/ + /*1: ֶ¼*/ + /*2: ػط*/ + /*3: ò*/ + /*4: ز鿴״̬־*/ + /*5: ظ߼(ʽػ)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.U4)] + public uint[] dwRemoteRight;/* Ȩ */ + /*0: Զ̨̿*/ + /*1: Զֶ¼*/ + /*2: Զ̻ط */ + /*3: Զò*/ + /*4: Զ̲鿴״̬־*/ + /*5: Զ̸߼(ʽػ)*/ + /*6: Զ̷Խ*/ + /*7: ԶԤ*/ + /*8: Զ󱨾ϴ*/ + /*9: Զ̿ƣ*/ + /*10: Զ̿ƴ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sUserIP;/* ûIPַ(Ϊ0ʱʾκεַ) */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr;/* ַ */ + } + + //û(ӽṹ)(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_INFO_V51 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /* ûֻ16ֽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalRight; /* Ȩ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byRemoteRight;/* ԶȨ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetPreviewRight; /* Զ̿Ԥͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalRecordRight; /* ؿ¼ͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetRecordRight; /* Զ̿¼ͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalPlaybackRight; /* ؿԻطŵͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetPlaybackRight; /* Զ̿Իطŵͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalPTZRight; /* ؿPTZͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwNetPTZRight; /* Զ̿PTZͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalBackupRight; /* رȨͨǰ˳У0xffffffffΪЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwLocalPreviewRight; /* ԤȨͨǰ˳У0xffffffffΪЧ*/ + public NET_DVR_IPADDR struUserIP; /* ûIPַ(Ϊ0ʱʾκεַ) */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr; /* ַ */ + public byte byPriority; /* ȼ0xff-ޣ0--ͣ1--У2-- */ + public byte byAlarmOnRight; // ڲȨ 1-Ȩޣ0-Ȩ + public byte byAlarmOffRight; // ڳȨ 1-Ȩޣ0-Ȩ + public byte byBypassRight; // ·Ȩ 1-Ȩޣ0-Ȩ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //ֽڶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RIGHT, ArraySubType = UnmanagedType.I1)] + public byte[] byPublishRight; //ϢרȨ + public uint dwPasswordValidity; //Ч,Աû޸,λ죬0ʾЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byKeypadPassword; // + public byte byUserOperateType; //ûͣ1-û2-û3-û+û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 1007, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_V51 + { + public uint dwSize; //ṹС + public uint dwMaxUserNum; //豸ֵ֧û-ֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_USERNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_USER_INFO_V51[] struUser; /* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sloginPassword; /* ½ȷ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 240, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //DVRû(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_V40 + { + public uint dwSize; //ṹС + public uint dwMaxUserNum; //豸ֵ֧û-ֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_USERNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_USER_INFO_V40[] struUser; /* û */ + } + + //DVRû(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_USERNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_USER_INFO_V30[] struUser; + } + + //DVRû(SDK_V15չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER_EX + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_USERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_USER_INFO_EX[] struUser; + } + + //DVRû + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_USER + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_USERNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_USER_INFO[] struUser; + } + + //쳣չṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EXCEPTION_V40 + { + public uint dwSize ; //ṹС + public uint dwMaxGroupNum ; //豸ֵ֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EXCEPTIONNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_HANDLEEXCEPTION_V41[] struExceptionHandle; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //DVR쳣(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EXCEPTION_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EXCEPTIONNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_HANDLEEXCEPTION_V30[] struExceptionHandleType; + /*0-,1- Ӳ̳,2-߶,3-IP ַͻ, 4-Ƿ, 5-/Ƶʽƥ, 6-Ƶź쳣, 7-¼쳣*/ + } + + //DVR쳣 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EXCEPTION + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EXCEPTIONNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_HANDLEEXCEPTION[] struExceptionHandleType; + /*0-,1- Ӳ̳,2-߶,3-IP ַͻ,4-Ƿ, 5-/Ƶʽƥ, 6-Ƶź쳣*/ + } + + //ͨ״̬(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHANNELSTATE_V30 + { + public byte byRecordStatic;//ͨǷ¼,0-¼,1-¼ + public byte bySignalStatic;//ӵź״̬,0-,1-źŶʧ + public byte byHardwareStatic;//ͨӲ״̬,0-,1-쳣,DSP + public byte byRes1;// + public uint dwBitRate;//ʵ + public uint dwLinkNum;//ͻӵĸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LINK, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPADDR[] struClientIP;//ͻ˵IPַ + public uint dwIPLinkNum;//ͨΪIP룬ôʾIP뵱ǰ + public byte byExceedMaxLink; // Ƿ񳬳˵·6· 0 - δ, 1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwChannelNo; //ǰͨţ0xffffffffʾЧ + + public void Init() + { + struClientIP = new NET_DVR_IPADDR[MAX_LINK]; + + for (int i = 0; i < MAX_LINK; i++) + { + struClientIP[i].Init(); + } + byRes = new byte[12]; + } + } + + //ͨ״̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHANNELSTATE + { + public byte byRecordStatic;//ͨǷ¼,0-¼,1-¼ + public byte bySignalStatic;//ӵź״̬,0-,1-źŶʧ + public byte byHardwareStatic;//ͨӲ״̬,0-,1-쳣,DSP + public byte reservedData;// + public uint dwBitRate;//ʵ + public uint dwLinkNum;//ͻӵĸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LINK, ArraySubType = UnmanagedType.U4)] + public uint[] dwClientIP;//ͻ˵IPַ + } + + //Ӳ״̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISKSTATE + { + public uint dwVolume;//Ӳ̵ + public uint dwFreeSpace;//Ӳ̵ʣռ + public uint dwHardDiskStatic;//Ӳ̵״̬,0-,1-,2- + } + + //豸״̬չṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WORKSTATE_V40 + { + public uint dwSize ; //ṹС + public uint dwDeviceStatic; //豸״̬,0-,1-CPUռ̫,85%,2-Ӳ,紮 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISKSTATE[] struHardDiskStatic; //Ӳ״̬,һֻܻȡ33ӲϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CHANNELSTATE_V30[] struChanStatic;//ͨ״̬ǰ˳ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwHasAlarmInStatic; //бıڣֵʾ±ֵ˳УֵΪ0xffffffffʱǰֵЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwHasAlarmOutStatic; //бıڣֵʾ±ֵ˳УֵΪ0xffffffffʱǰֵЧ + public uint dwLocalDisplay; //ʾ״̬,0-,1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AUDIO_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAudioInChanStatus; //λʾͨ״̬ 0-δʹã1-ʹУ0λʾ1ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 126, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GETWORKSTATE_COND + { + public uint dwSize ; //ṹ峤 + public byte byFindHardByCond; /*0-ȫ(һֻܲ33)ʱdwFindHardStatusNumЧ*/ + public byte byFindChanByCond ; /*0-ȫͨʱdwFindChanNumЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint[] dwFindHardStatus ; /*ҪҵӲ̺ţֵʾֵ˳У 0xffffffffΪЧ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwFindChanNo; /*Ҫҵͨţֵʾֵ˳У 0xffffffffΪЧ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //DVR״̬(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WORKSTATE_V30 + { + public uint dwDeviceStatic;//豸״̬,0-,1-CPUռ̫,85%,2-Ӳ,紮 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISKSTATE[] struHardDiskStatic; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CHANNELSTATE_V30[] struChanStatic;//ͨ״̬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmInStatic;//˿ڵ״̬,0-ûб,1-б + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmOutStatic;//˿ڵ״̬,0-û,1-б + public uint dwLocalDisplay;//ʾ״̬,0-,1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AUDIO_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAudioChanStatus;//ʾͨ״̬ 0-δʹã1-ʹ, 0xffЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + struHardDiskStatic = new NET_DVR_DISKSTATE[MAX_DISKNUM_V30]; + struChanStatic = new NET_DVR_CHANNELSTATE_V30[MAX_CHANNUM_V30]; + for (int i = 0; i < MAX_CHANNUM_V30; i++) + { + struChanStatic[i].Init(); + } + byAlarmInStatic = new byte[MAX_ALARMOUT_V30]; + byAlarmOutStatic = new byte[MAX_ALARMOUT_V30]; + byAudioChanStatus = new byte[MAX_AUDIO_V30]; + byRes = new byte[10]; + } + } + + //DVR״̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WORKSTATE + { + public uint dwDeviceStatic;//豸״̬,0-,1-CPUռ̫,85%,2-Ӳ,紮 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISKSTATE[] struHardDiskStatic; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CHANNELSTATE[] struChanStatic;//ͨ״̬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmInStatic;//˿ڵ״̬,0-ûб,1-б + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmOutStatic;//˿ڵ״̬,0-û,1-б + public uint dwLocalDisplay;//ʾ״̬,0-,1- + + public void Init() + { + struHardDiskStatic = new NET_DVR_DISKSTATE[MAX_DISKNUM]; + struChanStatic = new NET_DVR_CHANNELSTATE[MAX_CHANNUM]; + byAlarmInStatic = new byte[MAX_ALARMIN]; + byAlarmOutStatic = new byte[MAX_ALARMOUT]; + } + } + + //־Ϣ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_LOG_V30 + { + public NET_DVR_TIME strLogTime; + public uint dwMajorType;// 1-; 2-쳣; 3-; 0xff-ȫ + public uint dwMinorType;// 0-ȫ; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPanelUser;//û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNetUser;//û + public NET_DVR_IPADDR struRemoteHostAddr;//Զַ + public uint dwParaType;// + public uint dwChannel;//ͨ + public uint dwDiskNumber;//Ӳ̺ + public uint dwAlarmInPort;//˿ + public uint dwAlarmOutPort;//˿ + public uint dwInfoLen; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = LOG_INFO_LEN)] + public string sInfo; + } + + //־Ϣ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_LOG + { + public NET_DVR_TIME strLogTime; + public uint dwMajorType;// 1-; 2-쳣; 3-; 0xff-ȫ + public uint dwMinorType;// 0-ȫ; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPanelUser;//û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNetUser;//û + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sRemoteHostAddr;//Զַ + public uint dwParaType;// + public uint dwChannel;//ͨ + public uint dwDiskNumber;//Ӳ̺ + public uint dwAlarmInPort;//˿ + public uint dwAlarmOutPort;//˿ + } + + /************************־ begin************************************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_SEARCH_LOG_PARAM + { + public ushort wMajorType; // + public ushort wMinorType; // + public NET_DVR_TIME struStartTime; // ʼʱ + public NET_DVR_TIME struEndTime; // ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_LOG_RET + { + public NET_DVR_TIME struLogTime; // ־ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; // û + public NET_DVR_IPADDR struIPAddr; // IPַ + public ushort wMajorType; // + public ushort wMinorType; // + public ushort wParam; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwInfoLen; // Ϣ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = LOG_INFO_LEN)] + public string sInfo; // Ϣ + } + /*************************־ end***********************************************/ + + //״̬(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMOUTSTATUS_V30 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMOUT_V30, ArraySubType = UnmanagedType.I1)] + public byte[] Output; + + public void Init() + { + Output = new byte[MAX_ALARMOUT_V30]; + } + } + + //״̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMOUTSTATUS + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] Output; + } + + //ATMר + /****************************ATM(begin)***************************/ + public const int NCR = 0; + public const int DIEBOLD = 1; + public const int WINCOR_NIXDORF = 2; + public const int SIEMENS = 3; + public const int OLIVETTI = 4; + public const int FUJITSU = 5; + public const int HITACHI = 6; + public const int SMI = 7; + public const int IBM = 8; + public const int BULL = 9; + public const int YiHua = 10; + public const int LiDe = 11; + public const int GDYT = 12; + public const int Mini_Banl = 13; + public const int GuangLi = 14; + public const int DongXin = 15; + public const int ChenTong = 16; + public const int NanTian = 17; + public const int XiaoXing = 18; + public const int GZYY = 19; + public const int QHTLT = 20; + public const int DRS918 = 21; + public const int KALATEL = 22; + public const int NCR_2 = 23; + public const int NXS = 24; + + //Ϣ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_TRADEINFO + { + public ushort m_Year; + public ushort m_Month; + public ushort m_Day; + public ushort m_Hour; + public ushort m_Minute; + public ushort m_Second; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] DeviceName;//豸 + public uint dwChannelNumer;//ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] CardNumber;// + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 12)] + public string cTradeType;// + public uint dwCash;//׽ + } + + /*֡ʽ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FRAMETYPECODE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] code;/* */ + } + + //ATM + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_FRAMEFORMAT + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sATMIP;/* ATM IPַ */ + public uint dwATMType;/* ATM */ + public uint dwInputMode;/* 뷽ʽ 0- 1- 2-ֱ 3-ATM*/ + public uint dwFrameSignBeginPos;/* ı־λʼλ*/ + public uint dwFrameSignLength;/* ı־λij */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byFrameSignContent;/* ı־λ */ + public uint dwCardLengthInfoBeginPos;/* ųϢʼλ */ + public uint dwCardLengthInfoLength;/* ųϢij */ + public uint dwCardNumberInfoBeginPos;/* Ϣʼλ */ + public uint dwCardNumberInfoLength;/* Ϣij */ + public uint dwBusinessTypeBeginPos;/* ͵ʼλ */ + public uint dwBusinessTypeLength;/* ͵ij */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_FRAMETYPECODE[] frameTypeCode;/* */ + } + + //SDK_V31 ATM + /**/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FILTER + { + public byte byEnable;/*0,;1,*/ + public byte byMode;/*0,ASCII;1,HEX*/ + public byte byFrameBeginPos;// ı־λʼλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 1, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byFilterText;/*ַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*ʼʶ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IDENTIFICAT + { + public byte byStartMode;/*0,ASCII;1,HEX*/ + public byte byEndMode;/*0,ASCII;1,HEX*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_FRAMETYPECODE struStartCode;/*ʼַ*/ + public NET_DVR_FRAMETYPECODE struEndCode;/*ַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + /*Ϣλ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PACKAGE_LOCATION + { + public byte byOffsetMode;/*0,token;1,fix*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwOffsetPos;/*modeΪ1ʱʹ*/ + public NET_DVR_FRAMETYPECODE struTokenCode;/*־λ*/ + public byte byMultiplierValue;/*־λٴγ*/ + public byte byEternOffset;/*ӵƫ*/ + public byte byCodeMode;/*0,ASCII;1,HEX*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*Ϣ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PACKAGE_LENGTH + { + public byte byLengthMode;/*ͣ0,variable;1,fix;2,get from package(ÿųʹ)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwFixLength;/*modeΪ1ʱʹ*/ + public uint dwMaxLength; + public uint dwMinLength; + public byte byEndMode;/*ս0,ASCII;1,HEX*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_FRAMETYPECODE struEndCode;/*ս*/ + public uint dwLengthPos;/*lengthModeΪ2ʱʹãųڱеλ*/ + public uint dwLengthLen;/*lengthModeΪ2ʱʹãųȵij*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + /*OSD ӵλ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OSD_POSITION + { + public byte byPositionMode;/*ӷ񣬹2֣0ʾ1Custom*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwPos_x;/*x꣬positionmodeΪCustomʱʹ*/ + public uint dwPos_y;/*y꣬positionmodeΪCustomʱʹ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*ʾʽ*/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DATE_FORMAT + { + public byte byItem1;/*Month,0.mm;1.mmm;2.mmmm*/ + public byte byItem2;/*Day,0.dd;*/ + public byte byItem3;/*Year,0.yy;1.yyyy*/ + public byte byDateForm;/*0~53item*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 4)] + public string chSeprator;/*ָ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 4)] + public string chDisplaySeprator;/*ʾָ*/ + public byte byDisplayForm;/*0~53item*///lili mode by lili + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 27, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + /*ʱʾʽ*/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVRT_TIME_FORMAT + { + public byte byTimeForm;/*1. HH MM SS;0. HH MM*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byHourMode;/*0,12;1,24*/ //lili mode + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 4)] + public string chSeprator;/*ķָʱû*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 4)] + public string chDisplaySeprator;/*ʾָ*/ + public byte byDisplayForm;/*0~53item*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + public byte byDisplayHourMode;/*0,12;1,24*/ //lili mode + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 19, ArraySubType = UnmanagedType.I1)] + public byte[] byRes4; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OVERLAY_CHANNEL + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byChannel;/*ӵͨ*/ + public uint dwDelayTime;/*ʱʱ*/ + public byte byEnableDelayTime;/*Ƿõʱ˿ʱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_PACKAGE_ACTION + { + public NET_DVR_PACKAGE_LOCATION struPackageLocation; + public NET_DVR_OSD_POSITION struOsdPosition; + public NET_DVR_FRAMETYPECODE struActionCode;/*͵ȶӦ*/ + public NET_DVR_FRAMETYPECODE struPreCode;/*ַǰַ*/ + public byte byActionCodeMode;/*͵ȶӦ0,ASCII;1,HEX*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_PACKAGE_DATE + { + public NET_DVR_PACKAGE_LOCATION struPackageLocation; + public NET_DVR_DATE_FORMAT struDateForm; + public NET_DVR_OSD_POSITION struOsdPosition; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_PACKAGE_TIME + { + public NET_DVR_PACKAGE_LOCATION location; + public NET_DVRT_TIME_FORMAT struTimeForm; + public NET_DVR_OSD_POSITION struOsdPosition; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_PACKAGE_OTHERS + { + public NET_DVR_PACKAGE_LOCATION struPackageLocation; + public NET_DVR_PACKAGE_LENGTH struPackageLength; + public NET_DVR_OSD_POSITION struOsdPosition; + public NET_DVR_FRAMETYPECODE struPreCode;/*ַǰַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + //ûԶЭ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_USER_DEFINE_PROTOCOL + { + public NET_DVR_IDENTIFICAT struIdentification; //ı־ + public NET_DVR_FILTER struFilter; //ݰ + public NET_DVR_ATM_PACKAGE_OTHERS struCardNoPara; //ӿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ACTION_TYPE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ATM_PACKAGE_ACTION[] struTradeActionPara; //ӽΪ 0-9 ζӦInCard OutCard OverLay SetTime GetStatus Query WithDraw Deposit ChanPass Transfer + public NET_DVR_ATM_PACKAGE_OTHERS struAmountPara; //ӽ׽ + public NET_DVR_ATM_PACKAGE_OTHERS struSerialNoPara; //ӽ + public NET_DVR_OVERLAY_CHANNEL struOverlayChan; //ͨ + public NET_DVR_ATM_PACKAGE_DATE struRes1; //ڣ + public NET_DVR_ATM_PACKAGE_TIME struRes2; //ʱ䣬 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_FRAMEFORMAT_V30 + { + public uint dwSize; //ṹС + public byte byEnable; /*Ƿ0,;1,*/ + public byte byInputMode; /**뷽ʽ:0-1Э顢2-ڼ3-Э*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 34, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //ֽ + public NET_DVR_IPADDR struAtmIp; /*ATM IP ʱʹ */ + public ushort wAtmPort; /* Э鷽ʽʱʹ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + public uint dwAtmType; /*ATMЭͣNET_DVR_ATM_PROTOCOLṹлȡΪԶʱʹûԶЭ*/ + public NET_DVR_ATM_USER_DEFINE_PROTOCOL struAtmUserDefineProtocol; //ûԶЭ飬ATMΪԶʱҪʹøö + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + //ЭϢݽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_PROTO_TYPE + { + public uint dwAtmType; //ATMЭͣͬʱΪ ATM еdwAtmType ԶʱΪ1025 + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = ATM_DESC_LEN)] + public string chDesc; //ATMЭ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_ATM_PROTO_LIST + { + public uint dwAtmProtoNum;/*Эбĸ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ATM_PROTOCOL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ATM_PROTO_TYPE[] struAtmProtoType;/*ЭбϢ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATM_PROTOCOL + { + public uint dwSize; + public NET_DVR_ATM_PROTO_LIST struNetListenList; // Э + public NET_DVR_ATM_PROTO_LIST struSerialListenList; //ڼЭ + public NET_DVR_ATM_PROTO_LIST struNetProtoList; //Э + public NET_DVR_ATM_PROTO_LIST struSerialProtoList; //Э + public NET_DVR_ATM_PROTO_TYPE struCustomProto; //ԶЭ + } + + /*****************************DS-6001D/F(begin)***************************/ + //DS-6001D Decoder + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODERINFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byEncoderIP;//豸ӵķIP + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byEncoderUser;//豸ӵķû + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byEncoderPasswd;//豸ӵķ + public byte bySendMode;//豸ӷģʽ + public byte byEncoderChannel;//豸ӵķͨ + public ushort wEncoderPort;//豸ӵķĶ˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] reservedData;// + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODERSTATE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byEncoderIP;//豸ӵķIP + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byEncoderUser;//豸ӵķû + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byEncoderPasswd;//豸ӵķ + public byte byEncoderChannel;//豸ӵķͨ + public byte bySendMode;//豸ӵķģʽ + public ushort wEncoderPort;//豸ӵķĶ˿ں + public uint dwConnectState;//豸ӷ״̬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] reservedData;// + } + + /*豸붨*/ + 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; + + /*ӵͨ*/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DECCHANINFO + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDVRIP;/* DVR IPַ */ + public ushort wDVRPort;/* ˿ں */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public byte byChannel;/* ͨ */ + public byte byLinkMode;/* ģʽ */ + public byte byLinkType;/* 0 1 */ + } + + /*ÿͨ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECINFO + { + public byte byPoolChans;/*ÿ·ͨϵѭͨ, 4ͨ 0ʾûн*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DECPOOLNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DECCHANINFO[] struchanConInfo; + public byte byEnablePoll;/*ǷѲ 0- 1-*/ + public byte byPoolTime;/*Ѳʱ 0- 1-10 2-15 3-20 4-30 5-45 6-1 7-2 8-5 */ + } + + /*豸*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECCFG + { + public uint dwSize; + public uint dwDecChanNum;/*ͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DECNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DECINFO[] struDecInfo; + } + + //2005-08-01 + /* 豸͸ͨ */ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PORTINFO + { + public uint dwEnableTransPort;/* Ƿ͸ͨ 0 1*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDecoderIP;/* DVR IPַ */ + public ushort wDecoderPort;/* ˿ں */ + public ushort wDVRTransPort;/* ǰDVRǴ485/2321ʾ232,2ʾ485 */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 4)] + public string cReserve; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PORTCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TRANSPARENTNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PORTINFO[] struTransPortInfo;/* 0ʾ232 1ʾ485 */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct bytime + { + public uint dwChannel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/*Ƶû*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public NET_DVR_TIME struStartTime;/* ʱطŵĿʼʱ */ + public NET_DVR_TIME struStopTime;/* ʱطŵĽʱ */ + } + + /* ļط */ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_PLAYREMOTEFILE + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDecoderIP;/* DVR IPַ */ + public ushort wDecoderPort;/* ˿ں */ + public ushort wLoadMode;/* طģʽ 1 2ʱ */ + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct mode_size + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + /*[FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byFile;/* طŵļ */ + /*[FieldOffsetAttribute(0)] + public bytime bytime; + * */ + } + } + + + + /*ǰ豸״̬*/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DECCHANSTATUS + { + public uint dwWorkType;/*ʽ1Ѳ2̬ӽ롢3ļط 4ʱط*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDVRIP;/*ӵ豸ip*/ + public ushort wDVRPort;/*Ӷ˿ں*/ + public byte byChannel;/* ͨ */ + public byte byLinkMode;/* ģʽ */ + public uint dwLinkType;/* 0 1*/ + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct objectInfo + { + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct userInfo + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/*Ƶû*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 52)] + public string cReserve; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct fileInfo + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] fileName; + } + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct timeInfo + { + public uint dwChannel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/*Ƶû*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public NET_DVR_TIME struStartTime;/* ʱطŵĿʼʱ */ + public NET_DVR_TIME struStopTime;/* ʱطŵĽʱ */ + } + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECSTATUS + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DECNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DECCHANSTATUS[] struTransPortInfo; + } + /*****************************DS-6001D/F(end)***************************/ + + //ַ(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_SHOWSTRINGINFO + { + public ushort wShowString;// ԤͼǷʾַ,0-ʾ,1-ʾ С704*576,ַĴСΪ32*32 + public ushort wStringSize;/* ַijȣܴ44ַ */ + public ushort wShowStringTopLeftX;/* ַʾλõx */ + public ushort wShowStringTopLeftY;/* ַʾλõy */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 44)] + public string sString;/* Ҫʾַ */ + } + + //ַ(9000չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SHOWSTRING_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_STRINGNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SHOWSTRINGINFO[] struStringInfo;/* Ҫʾַ */ + } + + //ַչ(8ַ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SHOWSTRING_EX + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_STRINGNUM_EX, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SHOWSTRINGINFO[] struStringInfo;/* Ҫʾַ */ + } + + //ַ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SHOWSTRING + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_STRINGNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SHOWSTRINGINFO[] struStringInfo;/* Ҫʾַ */ + } + + /****************************DS9000ṹ(begin)******************************/ + /*EMAILṹ*/ + //ԭṹв + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struReceiver + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sName;/* ռ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EMAIL_ADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAddress;/* ռ˵ַ */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EMAILCFG_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAccount;/* ˺*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EMAIL_PWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struSender + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sName;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EMAIL_ADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sAddress;/* ˵ַ */ + } + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EMAIL_ADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSmtpServer;/* smtp */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EMAIL_ADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPop3Server;/* pop3 */ + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.Struct)] + public struReceiver[] struStringInfo;/* 3ռ */ + + public byte byAttachment;/* Ƿ */ + public byte bySmtpServerVerify;/* ͷҪ֤ */ + public byte byMailInterval;/* mail interval */ + public byte byEnableSSL;//sslǷ9000_1.1 + public ushort wSmtpPort;//gmail465ͨΪ25 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 74, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + /*DVRʵѲݽṹ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CRUISE_PARA + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CRUISE_MAX_PRESET_NUMS, ArraySubType = UnmanagedType.I1)] + public byte[] byPresetNo;/* Ԥõ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CRUISE_MAX_PRESET_NUMS, ArraySubType = UnmanagedType.I1)] + public byte[] byCruiseSpeed;/* Ѳٶ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CRUISE_MAX_PRESET_NUMS, ArraySubType = UnmanagedType.U2)] + public ushort[] wDwellTime;/* ͣʱ */ + public byte byEnableThisCruise;/* Ƿ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + /****************************DS9000ṹ(end)******************************/ + //ʱ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIMEPOINT + { + public uint dwMonth;// 0-11ʾ1-12 + public uint dwWeekNo;//ڼ 01 12 23 34 4һ + public uint dwWeekDate;//ڼ 0 1һ 2ڶ 3 4 5 6 + public uint dwHour;//Сʱ ʼʱ023 ʱ123 + public uint dwMin;// 059 + } + + //ʱ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ZONEANDDST + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + public uint dwEnableDST;//Ƿʱ 0 1 + public byte byDSTBias;//ʱƫֵ30min, 60min, 90min, 120min, ԷӼƣԭʼֵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_TIMEPOINT struBeginPoint;//ʱƿʼʱ + public NET_DVR_TIMEPOINT struEndPoint;//ʱֹͣʱ + } + + //ͼƬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_JPEGPARA + { + /*ע⣺ͼѹֱΪVGAʱ֧0=CIF, 1=QCIF, 2=D1ץͼ + ֱΪ3=UXGA(1600x1200), 4=SVGA(800x600), 5=HD720p(1280x720),6=VGA,7=XVGA, 8=HD900p + ֵ֧ǰֱʵץͼ*/ + public ushort wPicSize;/* 0=CIF, 1=QCIF, 2=D1 3=UXGA(1600x1200), 4=SVGA(800x600), 5=HD720p(1280x720),6=VGA*/ + public ushort wPicQuality;/* ͼƬϵ 0- 1-Ϻ 2-һ */ + } + + /* aux video out parameter */ + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUXOUTCFG + { + public uint dwSize; + public uint dwAlarmOutChan;/* ѡ񱨾󱨾ͨлʱ䣺1ͨ: 0:/1:1/2:2/3:3/4:4 */ + public uint dwAlarmChanSwitchTime;/* :1 - 10:10 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AUXOUT, ArraySubType = UnmanagedType.U4)] + public uint[] dwAuxSwitchTime;/* лʱ: 0-л,1-5s,2-10s,3-20s,4-30s,5-60s,6-120s,7-300s */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AUXOUT * MAX_WINDOW, ArraySubType = UnmanagedType.I1)] + public byte[] byAuxOrder;/* Ԥ˳, 0xffʾӦĴڲԤ */ + } + + //ntp + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NTPPARA + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sNTPServer;/* Domain Name or IP addr of NTP server */ + public ushort wInterval;/* adjust time interval(hours) */ + public byte byEnableNTP;/* enable NPT client 0-no1-yes*/ + public byte cTimeDifferenceH;/* ʱ׼ʱ Сʱƫ-12 ... +13 */ + public byte cTimeDifferenceM;/* ʱ׼ʱ ƫ0, 30, 45*/ + public byte res1; + public ushort wNtpPort; /* ntp server port 9000 豸ĬΪ123*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] res2; + } + + //ddns + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DDNSPARA + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUsername;/* DDNS˺û/ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sDomainName; /* */ + public byte byEnableDDNS;/*ǷӦ 0-1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DDNSPARA_EX + { + public byte byHostIndex;/* 0-Hikvision DNS 1Dyndns 2PeanutHull()*/ + public byte byEnableDDNS;/*ǷӦDDNS 0-1-*/ + public ushort wDDNSPort;/* DDNS˿ں */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUsername;/* DDNSû*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* DDNS */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] sDomainName;/* 豸䱸ַ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] sServerName;/* DDNS ӦķַIPַ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //9000չ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struDDNS + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUsername;/* DDNS˺û*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] sDomainName;/* 豸䱸ַ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] sServerName;/* DDNSЭӦķַIPַ */ + public ushort wDDNSPort;/* ˿ں */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DDNSPARA_V30 + { + public byte byEnableDDNS; + public byte byHostIndex;/* 0-Hikvision DNS() 1Dyndns 2PeanutHull()*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DDNS_NUMS, ArraySubType = UnmanagedType.Struct)] + public struDDNS[] struDDNS; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //email + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EMAILPARA + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sUsername;/* ʼ˺/ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sSmtpServer; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sPop3Server; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sMailAddr;/* email */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sEventMailAddr1;/* ϴ/쳣ȵemail */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sEventMailAddr2; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + // + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_NETAPPCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDNSIp; /* DNSַ */ + public NET_DVR_NTPPARA struNtpClientParam;/* NTP */ + public NET_DVR_DDNSPARA struDDNSClientParam;/* DDNS */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 464, ArraySubType = UnmanagedType.I1)] + public byte[] res;/* */ + } + + //nfsṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_SINGLE_NFS + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sNfsHostIPAddr; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PATHNAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNfsDirectory; + + public void Init() + { + this.sNfsDirectory = new byte[PATHNAME_LEN]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NFSCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NFS_DISK, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_NFS[] struNfsDiskParam; + + public void Init() + { + this.struNfsDiskParam = new NET_DVR_SINGLE_NFS[MAX_NFS_DISK]; + + for (int i = 0; i < MAX_NFS_DISK; i++) + { + struNfsDiskParam[i].Init(); + } + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ISCSI_CFG + { + public uint dwSize; // ṹС + public ushort wVrmPort; // VRM ˿ + public byte byEnable; // Ƿ ISCSI洢 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 69, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + public NET_DVR_IPADDR struVrmAddr; // VRM ipַ 16λ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 64)] + public string chNvtIndexCode; //nvt index Code + } + + //Ѳ(HIK IPר) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CRUISE_POINT + { + public byte PresetNum;//Ԥõ + public byte Dwell;//ͣʱ + public byte Speed;//ٶ + public byte Reserve;// + + public void Init() + { + PresetNum = 0; + Dwell = 0; + Speed = 0; + Reserve = 0; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CRUISE_RET + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CRUISE_POINT[] struCruisePoint;//֧32Ѳ + + public void Init() + { + struCruisePoint = new NET_DVR_CRUISE_POINT[32]; + for (int i = 0; i < 32; i++) + { + struCruisePoint[i].Init(); + } + } + } + + /************************************·(begin)***************************************/ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_NETCFG_OTHER + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sFirstDNSIP; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sSecondDNSIP; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_DECINFO + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDVRIP;/* DVR IPַ */ + public ushort wDVRPort;/* ˿ں */ + public byte byChannel;/* ͨ */ + public byte byTransProtocol;/* Э 0-TCP, 1-UDP */ + public byte byTransMode;/* ģʽ 0 1*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* ½ʺ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + } + + ///ֹ̬ͣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_DYNAMIC_DEC + { + public uint dwSize; + public NET_DVR_MATRIX_DECINFO struDecChanInfo;/* ̬ͨϢ */ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_DEC_CHAN_STATUS + { + public uint dwSize; + public uint dwIsLinked;/* ͨ״̬ 0 1 2 3-ڽ */ + public uint dwStreamCpRate;/* Stream copy rate, X kbits/second */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 64)] + public string cRes;/* */ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_DEC_CHAN_INFO + { + public uint dwSize; + public NET_DVR_MATRIX_DECINFO struDecChanInfo;/* ͨϢ */ + public uint dwDecState;/* 0-̬ 1ѭ 2ʱط 3ļط */ + public NET_DVR_TIME StartTime;/* ʱطſʼʱ */ + public NET_DVR_TIME StopTime;/* ʱطֹͣʱ */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string sFileName;/* ļطļ */ + } + + //ӵͨ 2007-11-05 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_DECCHANINFO + { + public uint dwEnable;/* Ƿ 0 1*/ + public NET_DVR_MATRIX_DECINFO struDecChanInfo;/* ѭͨϢ */ + } + + //2007-11-05 ÿͨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_LOOP_DECINFO + { + public uint dwSize; + public uint dwPoolTime;/*Ѳʱ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CYCLE_CHAN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_DECCHANINFO[] struchanConInfo; + } + + //2007-12-22 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct TTY_CONFIG + { + public byte baudrate;/* */ + public byte databits;/* λ */ + public byte stopbits;/* ֹͣλ */ + public byte parity;/* żУλ */ + public byte flowcontrol;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_TRAN_CHAN_INFO + { + public byte byTranChanEnable;/* ǰ͸ͨǷ 0ر 1 */ + /* + * ·1485ڣ1232ڶΪ͸ͨ,豸ŷ£ + * 0 RS485 + * 1 RS232 Console + */ + public byte byLocalSerialDevice;/* Local serial device */ + /* + * Զ̴,һRS232һRS485 + * 1ʾ232 + * 2ʾ485 + */ + public byte byRemoteSerialDevice;/* Remote output serial device */ + public byte res1;/* */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sRemoteDevIP;/* Remote Device IP */ + public ushort wRemoteDevPort;/* Remote Net Communication Port */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] res2;/* */ + public TTY_CONFIG RemoteSerialDevCfg; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_TRAN_CHAN_CONFIG + { + public uint dwSize; + public byte by232IsDualChan;/* ·232͸ͨȫ˫ ȡֵ1MAX_SERIAL_NUM */ + public byte by485IsDualChan;/* ·485͸ͨȫ˫ ȡֵ1MAX_SERIAL_NUM */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] res;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SERIAL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_TRAN_CHAN_INFO[] struTranInfo;/*ͬʱֽ֧MAX_SERIAL_NUM͸ͨ*/ + } + + //2007-12-24 Merry Christmas Eve... + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_DEC_REMOTE_PLAY + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sDVRIP;/* DVR IPַ */ + public ushort wDVRPort;/* ˿ں */ + public byte byChannel;/* ͨ */ + public byte byReserve; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public uint dwPlayMode;/* 0ļ 1ʱ*/ + public NET_DVR_TIME StartTime; + public NET_DVR_TIME StopTime; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string sFileName; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_DEC_REMOTE_PLAY_CONTROL + { + public uint dwSize; + public uint dwPlayCmd;/* ļ*/ + public uint dwCmdParam;/* */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_DEC_REMOTE_PLAY_STATUS + { + public uint dwSize; + public uint dwCurMediaFileLen;/* ǰŵýļ */ + public uint dwCurMediaFilePosition;/* ǰļIJλ */ + public uint dwCurMediaFileDuration;/* ǰļʱ */ + public uint dwCurPlayTime;/* ǰѾŵʱ */ + public uint dwCurMediaFIleFrames;/* ǰļ֡ */ + public uint dwCurDataType;/* ǰͣ19-ļͷ20-ݣ 21-Ž־ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 72, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + //2009-4-11 added by likui ·new + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_PASSIVEMODE + { + public ushort wTransProtol;//Э飬0-TCP, 1-UDP, 2-MCAST + public ushort wPassivePort;//UDP˿, TCPʱĬ + public NET_DVR_IPADDR struMcastIP; + public byte byStreamType;/* ݲģʽ:REAL_TIME_STREAM(1)ʵʱ,RECORD_STREAM(2)ļ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_TRAN_CHAN_INFO_V30 + { + public byte byTranChanEnable;/* ǰ͸ͨǷ 0ر 1 */ + /* + * ·1485ڣ1232ڶΪ͸ͨ,豸ŷ£ + * 0 RS485 + * 1 RS232 Console + */ + public byte byLocalSerialDevice;/* Local serial device */ + /* + * Զ̴,һRS232һRS485 + * 1ʾ232 + * 2ʾ485 + */ + public byte byRemoteSerialDevice;/* Remote output serial device */ + public byte byRes1;/* */ + public NET_DVR_IPADDR struRemoteDevIP;/* Remote Device IP */ + public ushort wRemoteDevPort;/* Remote Net Communication Port */ + public byte byIsEstablished;/* ͸ͨɹ־0-ûгɹ1-ɹ */ + public byte byRes2;/* */ + public TTY_CONFIG RemoteSerialDevCfg; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUsername;/* 32BYTES */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassword;/* 16BYTES */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_TRAN_CHAN_CONFIG_V30 + { + public uint dwSize; + public byte by232IsDualChan;/* ·232͸ͨȫ˫ ȡֵ1MAX_SERIAL_NUM */ + public byte by485IsDualChan;/* ·485͸ͨȫ˫ ȡֵ1MAX_SERIAL_NUM */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] vyRes;/* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SERIAL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_TRAN_CHAN_INFO[] struTranInfo;/*ͬʱֽ֧MAX_SERIAL_NUM͸ͨ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_CHAN_INFO_V30 + { + public uint dwEnable;/* Ƿ 0 1*/ + public NET_DVR_STREAM_MEDIA_SERVER_CFG streamMediaServerCfg; + public NET_DVR_DEV_CHAN_INFO struDevChanInfo;/* ѭͨϢ */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_LOOP_DECINFO_V30 + { + public uint dwSize; + public uint dwPoolTime; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CYCLE_CHAN_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_CHAN_INFO_V30[] struchanConInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_DEC_CHAN_INFO_V30 + { + public uint dwSize; + public NET_DVR_STREAM_MEDIA_SERVER_CFG streamMediaServerCfg;/*ý*/ + public NET_DVR_DEV_CHAN_INFO struDevChanInfo;/* ͨϢ */ + public uint dwDecState;/* 0-̬ 1ѭ 2ʱط 3ļط */ + public NET_DVR_TIME StartTime;/* ʱطſʼʱ */ + public NET_DVR_TIME StopTime;/* ʱطֹͣʱ */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string sFileName;/* ļطļ */ + public uint dwGetStreamMode;/*ȡģʽ:1-2-*/ + public NET_DVR_MATRIX_PASSIVEMODE struPassiveMode; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*ý*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STREAM_MEDIA_SERVER + { + public byte byValid;/*Ƿýȡ,0ʾЧ0ʾЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_DOMAIN_NAME)] + public string byAddress;/* 豸IPַ */ + public ushort wDevPort;/*ý˿*/ + public byte byTransmitType;/*Э 0-TCP1-UDP*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //豸ͨϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEV_CHAN_INFO_EX + { + public byte byChanType; //ͨͣ0-ͨͨ1-ͨ2-ID3-Դ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = STREAM_ID_LEN)] + public string byStreamId;/* IDͨ byChanType Ϊ 2 ʱЧ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwChannel;//ͨ byChanTypeΪ 013 ʱЧͨΪԴòֵʾԴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_DOMAIN_NAME)] + public string byAddress;/* 豸IPַ */ + public ushort wDVRPort; //˿ں + public byte byChannel; //òЧͨżdwChannel + public byte byTransProtocol; //Э0-TCP1-UDP + public byte byTransMode; //ģʽ 0 1 + public byte byFactoryType; /*ǰ豸,ͨӿڻȡ*/ + public byte byDeviceType; //豸(Ƶۺƽ̨ܰʹ)1-ʱƵۺƽ̨byVcaSupportChanModeֶʹýͨʾͨ2- + public byte byDispChan;//ʾͨ,ʹ + public byte bySubDispChan;//ʾͨͨţʱʹ + public byte byResolution; //; 1-CIF 2-4CIF 3-720P 4-1080P 5-500wʹãݸòԴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = NAME_LEN)] + public string sUserName; //½ʺ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string sPassword; // + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DEC_STREAM_DEV_EX + { + public NET_DVR_STREAM_MEDIA_SERVER struStreamMediaSvrCfg;/*ý*/ + public NET_DVR_DEV_CHAN_INFO_EX struDevChanInfo;/* ͨϢ */ + } + + //̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEV_DDNS_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_DOMAIN_NAME)] + public string byDevAddress; //豸(IPServerhiDDNSʱ豸кŻ߱) + public byte byTransProtocol; //Эͣ0- TCP1- UDP2- ಥ + public byte byTransMode; //ģʽ 0 1 + public byte byDdnsType; //ͣ0- IPServer1- Dyndns2- PeanutHull()3- NO-IP4- hiDDNS + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_DOMAIN_NAME)] + public string byDdnsAddress; //DDNSַ + public ushort wDdnsPort; //DDNS˿ں + public byte byChanType; //ͨͣ0-ͨͨ1-ͨ2-ID + public byte byFactoryType; //ǰ豸,ͨӿNET_DVR_GetIPCProtoListȡ + public uint dwChannel; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = STREAM_ID_LEN)] + public string byStreamId; // IDͨ byChanType Ϊ 2 ʱЧ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = NAME_LEN)] + public string sUserName; //½ʺ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string sPassword; // + public ushort wDevPort; //豸˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //̬ȡ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_DEC_DDNS_DEV + { + public NET_DVR_DEV_DDNS_INFO struDdnsInfo;/*ý*/ + public NET_DVR_STREAM_MEDIA_SERVER struMediaServer;/* ͨϢ */ + } + + //ȡģʽ + [StructLayout(LayoutKind.Explicit)] + public struct NET_DVR_DEC_STREAM_MODE + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 300, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //С + public void Init() + { + byRes = new byte[300]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MATRIX_DEC_CHAN_INFO_V41 + { + public uint dwSize; + public byte byStreamMode;/*ȡģʽ0- Ч1- ͨIPȡ2- ͨURLȡ3- ̬ͨ豸ȡ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_DEC_STREAM_MODE uDecStreamMode;/*ȡϢ*/ + public uint dwPlayMode;/*״̬0-̬룬1ѭ룬2ʱطţ3ļط*/ + public NET_DVR_TIME StartTime;/* ʱطſʼʱ */ + public NET_DVR_TIME StopTime;/* ʱطֹͣʱ */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string sFileName;/* ļطļ */ + public uint dwGetStreamMode;/*ȡģʽ:1-2-*/ + public NET_DVR_MATRIX_PASSIVEMODE struPassiveMode; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int MAX_RESOLUTIONNUM = 64; //ֱֵ֧Ŀ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_ABILITY + { + public uint dwSize; + public byte byDecNums; + public byte byStartChan; + public byte byVGANums; + public byte byBNCNums; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8*12, ArraySubType = UnmanagedType.I1)] + public byte[] byVGAWindowMode;/*VGAֵ֧Ĵģʽ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byBNCWindowMode;/*BNCֵ֧Ĵģʽ*/ + public byte byDspNums; + public byte byHDMINums;//HDMIʾͨ25ʼ + public byte byDVINums;//DVIʾͨ29ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 13, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RESOLUTIONNUM, ArraySubType = UnmanagedType.I1)] + public byte[] bySupportResolution;//öٶ,һֽڴһֱ//֧֣1֧֣0֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4*8, ArraySubType = UnmanagedType.I1)] + public byte[] byHDMIWindowMode;//HDMIֵ֧Ĵģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4*8, ArraySubType = UnmanagedType.I1)] + public byte[] byDVIWindowMode;//DVIֵ֧Ĵģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ϴlogoṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISP_LOGOCFG + { + public uint dwCorordinateX;//ͼƬʾX + public uint dwCorordinateY;//ͼƬʾY + public ushort wPicWidth; //ͼƬ + public ushort wPicHeight; //ͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byFlash;//Ƿ˸1-˸0-˸ + public byte byTranslucent;//Ƿ͸1-͸0-͸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;// + public uint dwLogoSize;//LOGOСBMPļͷ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PICTURECFG + { + public uint dwSize; //С + public byte byUseType; //1-ͼ2-GIFͼƬ3-CADͼƬ 4-ͼƬ + public byte bySequence;// + public byte byOverlayEnabled; //ͼƬʹܣǷϴͼƬͼƬӲ 1-Ӳ0- + public byte byRes; + public NET_DVR_BASEMAP_CFG struBasemapCfg; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPicName;//ͼƬ + public uint dwVideoWall; //ǽţ1ֽǽ+1ֽͨ+2ֽڴںţ + public byte byFlash; //ͼƬ˸ʹܣ1-˸0-˸ + public byte byTranslucent; //ͼƬ͸ʹܣ1-͸0-͸ + public byte byShowEnabled; //ͼƬʾʹܣ1-ʾ0- + public byte byPictureType; //ͼƬͣ1-bmp2-jpg3-png + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OUTPUT_PIC_CFG + { + public uint dwSize; + public uint dwOutputPicNo; //ͼƬ + public byte byEnable; //logoǷʾ1-ʾ0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_RECTCFG_EX struRect;//logoλãڷΧܴСΪ1920*1920 + public byte byFlash; //Ƿ˸1-˸0-˸ + public byte byTranslucent; //Ƿ͸1-͸0-͸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + public uint dwOutputPicWinNo; //ͼƬںţ1ֽ豸+1ֽں+2ֽͼƬںţ,ȡȫʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 28, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + public const int MAX_OSD_LEN = 64; //OSD + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OUTPUT_OSD_CFG + { + public uint dwSize; + public byte byEnable; //OSDǷʾ0-ʾ1-ʾ + public byte byFontSize; //С1-2-У3-С + public byte byOSDColor; //OSDɫã0-Ĭϣ 1-ڣ2-ף3-죬4-̣5- + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_OSD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byOsdContent; //OSD + public NET_DVR_RECTCFG_EX struRect;//OSDλãڷΧܴСΪ1920*1920 + public uint dwOsdWinNo; //OSDںţ1ֽ豸+1ֽں+2ֽOSDںţȡʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + /**/ + public const int NET_DVR_ENCODER_UNKOWN = 0;/*δ֪ʽ*/ + public const int NET_DVR_ENCODER_H264 = 1;/*HIK 264*/ + public const int NET_DVR_ENCODER_S264 = 2;/*Standard H264*/ + public const int NET_DVR_ENCODER_MPEG4 = 3;/*MPEG4*/ + public const int NET_DVR_ORIGINALSTREAM = 4;/*Original Stream*/ + public const int NET_DVR_PICTURE = 5;//*Picture*/ + public const int NET_DVR_ENCODER_MJPEG = 6; + public const int NET_DVR_ECONDER_MPEG2 = 7; + /* ʽ */ + public const int NET_DVR_STREAM_TYPE_UNKOWN = 0;/*δ֪ʽ*/ + public const int NET_DVR_STREAM_TYPE_HIKPRIVT = 1; /*Զʽ*/ + public const int NET_DVR_STREAM_TYPE_TS = 7;/* TS */ + public const int NET_DVR_STREAM_TYPE_PS = 8;/* PS */ + public const int NET_DVR_STREAM_TYPE_RTP = 9;/* RTP */ + + /*ͨ״̬*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_CHAN_STATUS + { + public byte byDecodeStatus;/*ǰ״̬:0:δ1*/ + public byte byStreamType;/**/ + public byte byPacketType;/*ʽ*/ + public byte byRecvBufUsage;/*ջʹ*/ + public byte byDecBufUsage;/*뻺ʹ*/ + public byte byFpsDecV;/*Ƶ֡*/ + public byte byFpsDecA;/*Ƶ֡*/ + public byte byCpuLoad;/*DSP CPUʹ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwDecodedV;/*Ƶ֡*/ + public uint dwDecodedA;/*Ƶ֡*/ + public ushort wImgW;/*ǰͼС,*/ + public ushort wImgH; // + public byte byVideoFormat;/*Ƶʽ:0-NON,NTSC--1,PAL--2*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public uint dwDecChan; /*ȡȫͨ״̬ʱЧʱ0*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + /*ʾͨ״̬*/ + public const int NET_DVR_MAX_DISPREGION = 16; /*ÿʾͨʾĴ*/ + //VGAֱʣĿǰõǣVGA_THS8200_MODE_XGA_60HZVGA_THS8200_MODE_SXGA_60HZ + // + public enum VGA_MODE + { + /*VGA*/ + VGA_NOT_AVALIABLE, + VGA_THS8200_MODE_SVGA_60HZ, //(800*600) + VGA_THS8200_MODE_SVGA_75HZ, //(800*600) + VGA_THS8200_MODE_XGA_60HZ, //(1024*768) + VGA_THS8200_MODE_XGA_75HZ, //(1024*768) + VGA_THS8200_MODE_SXGA_60HZ, //(1280*1024) + VGA_THS8200_MODE_720P_60HZ, //(1280*720) + VGA_THS8200_MODE_1080I_60HZ, //(1920*1080) + VGA_THS8200_MODE_1080P_30HZ, //(1920*1080) + VGA_THS8200_MODE_UXGA_30HZ, //(1600*1200) + /*HDMI*/ + HDMI_SII9134_MODE_XGA_60HZ, //(1024*768) + HDMI_SII9134_MODE_SXGA_60HZ, //(1280*1024) + HDMI_SII9134_MODE_SXGA2_60HZ, //(1280*960) + HDMI_SII9134_MODE_720P_60HZ, //(1280*720) + HDMI_SII9134_MODE_720P_50HZ, //(1280*720) + HDMI_SII9134_MODE_1080I_60HZ, //(1920*1080) + HDMI_SII9134_MODE_1080I_50HZ, //(1920*1080) + HDMI_SII9134_MODE_1080P_25HZ, //(1920*1080) + HDMI_SII9134_MODE_1080P_30HZ, //(1920*1080) + HDMI_SII9134_MODE_1080P_50HZ, //(1920*1080) + HDMI_SII9134_MODE_1080P_60HZ, //(1920*1080) + HDMI_SII9134_MODE_UXGA_60HZ, //(1600*1200) + /*DVI*/ + DVI_SII9134_MODE_XGA_60HZ, //(1024*768) + DVI_SII9134_MODE_SXGA_60HZ, //(1280*1024) + DVI_SII9134_MODE_SXGA2_60HZ, //(1280*960) + DVI_SII9134_MODE_720P_60HZ, //(1280*720) + DVI_SII9134_MODE_720P_50HZ, //(1280*720) + DVI_SII9134_MODE_1080I_60HZ, //(1920*1080) + DVI_SII9134_MODE_1080I_50HZ, //(1920*1080) + DVI_SII9134_MODE_1080P_25HZ, //(1920*1080) + DVI_SII9134_MODE_1080P_30HZ, //(1920*1080) + DVI_SII9134_MODE_1080P_50HZ, //(1920*1080) + DVI_SII9134_MODE_1080P_60HZ, //(1920*1080) + DVI_SII9134_MODE_UXGA_60HZ, //(1600*1200) + VGA_DECSVR_MODE_SXGA2_60HZ, + HDMI_DECSVR_MODE_1080P_24HZ, + DVI_DECSVR_MODE_1080P_24HZ, + YPbPr_DECSVR_MODE_720P_60HZ, + YPbPr_DECSVR_MODE_1080I_60HZ + } + + //֡ʶ + public const int LOW_DEC_FPS_1_2 = 51; + public const int LOW_DEC_FPS_1_4 = 52; + public const int LOW_DEC_FPS_1_8 = 53; + public const int LOW_DEC_FPS_1_16 = 54; + + /*Ƶʽ׼*/ + public enum VIDEO_STANDARD + { + VS_NON = 0, + VS_NTSC = 1, + VS_PAL = 2, + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_VIDEOPLATFORM + { + /*ӴڶӦͨӦĽϵͳIJλ(Ƶۺƽ̨нϵͳЧ)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecoderId; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_NOTVIDEOPLATFORM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VGA_DISP_CHAN_CFG + { + public uint dwSize; + public byte byAudio;/*ƵǷ,0-1-*/ + public byte byAudioWindowIdx;/*ƵӴ*/ + public byte byVgaResolution;/*VGAķֱ*/ + public byte byVedioFormat;/*Ƶʽ1:NTSC,2:PAL,0-NON*/ + public uint dwWindowMode;/*ģʽȡĿǰ֧1,2,4,9,16*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecChan;/*ӴڹĽͨ*/ + public byte byEnlargeStatus; /*ǷڷŴ״̬0Ŵ1Ŵ*/ + public byte byEnlargeSubWindowIndex;//ŴӴں + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct struDiff + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + public byte byUnionType;/*ֹ壬0-Ƶۺƽ̨ڲʾͨã1-ʾͨ*/ + public byte byScale; /*ʾģʽ0---ʵʾ1---ʾ( BNC )*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISP_CHAN_STATUS + { + public byte byDispStatus;/*ʾ״̬0δʾ1ʾ*/ + public byte byBVGA; /*VGA/BNC*/ + public byte byVideoFormat;/*Ƶʽ:1:NTSC,2:PAL,0-NON*/ + public byte byWindowMode;/*ǰģʽ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecChan;/*ӴڹĽͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_MAX_DISPREGION, ArraySubType = UnmanagedType.I1)] + public byte[] byFpsDisp;/*ÿӻʾ֡*/ + public byte byScreenMode; //Ļģʽ0-ͨ 1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int MAX_DECODECHANNUM = 32;//·ͨ + public const int MAX_DISPCHANNUM = 24;//·ʾͨ + + /*豸״̬*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODER_WORK_STATUS + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DECODECHANNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_CHAN_STATUS[] struDecChanStatus;/*ͨ״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISPCHANNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISP_CHAN_STATUS[] struDispChanStatus;/*ʾͨ״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_ALARMIN, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmInStatus;/*״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ANALOG_ALARMOUT, ArraySubType = UnmanagedType.I1)] + public byte[] byAalarmOutStatus;/*״̬*/ + public byte byAudioInChanStatus;/*Խ״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 127, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //2009-12-1 ӱ벥ſ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PASSIVEDECODE_CONTROL + { + public uint dwSize; + public uint dwPlayCmd; /* ļ*/ + public uint dwCmdParam; /* */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//Reverse + } + + public const int PASSIVE_DEC_PAUSE = 1; /*ͣ(ļЧ)*/ + public const int PASSIVE_DEC_RESUME = 2; /*ָ(ļЧ)*/ + public const int PASSIVE_DEC_FAST = 3; /*ٱ(ļЧ)*/ + public const int PASSIVE_DEC_SLOW = 4; /*ٱ(ļЧ)*/ + public const int PASSIVE_DEC_NORMAL = 5; /*(ļЧ)*/ + public const int PASSIVE_DEC_ONEBYONE = 6; /*뵥֡()*/ + public const int PASSIVE_DEC_AUDIO_ON = 7; /*Ƶ*/ + public const int PASSIVE_DEC_AUDIO_OFF = 8; /*Ƶر*/ + public const int PASSIVE_DEC_RESETBUFFER = 9; /*ջ*/ + + //2009-12-16 ӿƽͨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_DECCHAN_CONTROL + { + public uint dwSize; + public byte byDecChanScaleStatus;/*ͨʾſ,1ʾʾ0ʾʵʾ*/ + public byte byDecodeDelay;//ʱ0-Ĭϣ1-ʵʱԺã2-ʵʱԽϺã3-ʵʱУУ4-ԽϺã5-Ժã0xff-Զ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 66, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + /************************************·(end)***************************************/ + + /************************************Ƶۺƽ̨(begin)***************************************/ + public const int MAX_SUBSYSTEM_NUM = 80; //һϵͳϵͳ + public const int MAX_SUBSYSTEM_NUM_V40 = 120; //һϵͳϵͳ + public const int MAX_SERIALLEN = 36; //кų + public const int MAX_LOOPPLANNUM = 16; //ƻл + public const int DECODE_TIMESEGMENT = 4; //ƻÿʱ + + public const int MAX_DOMAIN_NAME = 64; /* */ + public const int MAX_DISKNUM_V30 = 33; //9000豸Ӳ/* 33Ӳ(16SATAӲ̡1eSATAӲ̺16NFS) */ + public const int MAX_DAYS = 7; //ÿ + public const int MAX_DISPNUM_V41 = 32; + public const int MAX_WINDOWS_NUM = 12; + public const int MAX_VOUTNUM = 32; + public const int MAX_SUPPORT_RES = 32; + public const int MAX_BIGSCREENNUM = 100; + + public const int VIDEOPLATFORM_ABILITY = 0x210; //Ƶۺƽ̨ + public const int MATRIXDECODER_ABILITY_V41 = 0x260; // + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SUBSYSTEMINFO + { + public byte bySubSystemType;//ϵͳͣ1-ϵͳ2-ϵͳ0-NULL˲ֻܻȡ + public byte byChan;//ϵͳͨ˲ֻܻȡ + public byte byLoginType;//עͣ1-ֱ2-DNS3- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_IPADDR struSubSystemIP;/*IPַ޸ģ*/ + public ushort wSubSystemPort;//ϵͳ˿ںţ޸ģ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_IPADDR struSubSystemIPMask;// + public NET_DVR_IPADDR struGatewayIpAddr; /* صַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û ˲ֻܻȡ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/*루˲ֻܻȡ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_DOMAIN_NAME)] + public string sDomainName;//(޸) + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_DOMAIN_NAME)] + public string sDnsAddress;/*DNSIPַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber;//кţ˲ֻܻȡ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALLSUBSYSTEMINFO + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SUBSYSTEM_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SUBSYSTEMINFO[] struSubSystemInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LOOPPLAN_SUBCFG + { + public uint dwSize; + public uint dwPoolTime; /*ѯλ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CYCLE_CHAN_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_CHAN_INFO_V30[] struChanConInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMMODECFG + { + public uint dwSize; + public byte byAlarmMode;//ͣ1-ѯ2- + public ushort wLoopTime;//ѯʱ, λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CODESPLITTERINFO + { + public uint dwSize; + public NET_DVR_IPADDR struIP;/*IPַ*/ + public ushort wPort;//˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName;/* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword;/* */ + public byte byChan;//485 + public byte by485Port;//485ڵַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ASSOCIATECFG + { + public byte byAssociateType;//ͣ1- + public ushort wAlarmDelay;//ʱ05룻110룻230룻31ӣ42ӣ55ӣ610ӣ + public byte byAlarmNum;//ţֵӦøͬıֵͬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DYNAMICDECODE + { + public uint dwSize; + public NET_DVR_ASSOCIATECFG struAssociateCfg;//̬ṹ + public NET_DVR_PU_STREAM_CFG struPuStreamCfg;//̬ṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODESCHED + { + public NET_DVR_SCHEDTIME struSchedTime; + public byte byDecodeType;/*0-ޣ1-ѯ룬2-̬*/ + public byte byLoopGroup;//ѯ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_PU_STREAM_CFG struDynamicDec;//̬ + } + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLANDECODE + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * DECODE_TIMESEGMENT, ArraySubType = UnmanagedType.I1)] + public NET_DVR_DECODESCHED[] struDecodeSched;//һΪʼ9000һ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byres; + } + /************************************Ƶۺƽ̨(end)***************************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOPLATFORM_ABILITY + { + public uint dwSize; + public byte byCodeSubSystemNums;//ϵͳ + public byte byDecodeSubSystemNums;//ϵͳ + [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)] + public byte[] byWindowMode; /*ʾֵ֧ͨĴģʽ*/ + [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)] + public byte[] byRes; + } + + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SUBSYSTEM_ABILITY + { + /*ϵͳͣ1-ϵͳ2-ϵͳ3-ϵͳ4-ϵͳ5-ϵͳ6-ϵͳ7-ϵͳ8-V6ϵͳ9-V6ϵͳ0-NULL˲ֻܻȡ*/ + public byte bySubSystemType; + public byte byChanNum;//ϵͳͨ + public byte byStartChan;//ϵͳʼͨ + public byte bySlotNum;//λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public struDecoderSystemAbility _struAbility; + } + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struDecoderSystemAbility + { + public byte byVGANums;//VGAʾͨ1ʼ + public byte byBNCNums;//BNCʾͨ9ʼ + public byte byHDMINums;//HDMIʾͨ25ʼ + public byte byDVINums;//DVIʾͨ29ʼ + + public byte byLayerNums;//ƴУʱ֧ͼ + public byte bySpartan;//Թܣ0-֧֣1-֧ + public byte byDecType; //ϵͳͣ0-ͨ,1-ǿ(ͨͷʱǰ4ʹԴǿ޴ƣǿɱϵͳ16·D1Դ + //ǿͱΪԴɱãܱͨ) + public byte byOutputSwitch;//Ƿ֧HDMI/DVIл0-֧֣1-֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 39, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byDecoderType; // 0-ͨ 1-ܽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 152, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struAbility + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 200, ArraySubType = UnmanagedType.I1)] + // [FieldOffsetAttribute(0)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOPLATFORM_ABILITY_V40 + { + public uint dwSize; + public byte byCodeSubSystemNums; + public byte byDecodeSubSystemNums;//ϵͳ + public byte bySupportNat;//Ƿ֧NAT0-֧֣1-֧ + public byte byInputSubSystemNums;//ϵͳ + public byte byOutputSubSystemNums;//ϵͳ + public byte byCodeSpitterSubSystemNums;//ϵͳ + public byte byAlarmHostSubSystemNums;//ϵͳ + public byte bySupportBigScreenNum;//֧ɴĸ + public byte byVCASubSystemNums;//ϵͳ + public byte byV6SubSystemNums;//V6ϵͳ + public byte byV6DecoderSubSystemNums;//V6ϵͳ + public byte bySupportBigScreenX;/*ƴӵģʽmn*/ + public byte bySupportBigScreenY; + public byte bySupportSceneNums;//ֳ֧ģʽĸ + public byte byVcaSupportChanMode;//ֵ֧ͨʹģʽ0-ʹýͨ1-ʹʾͨͨ + public byte bySupportScreenNums;//ֵ֧ĴĻ + public byte bySupportLayerNums;//ֵ֧ͼ0xff-Ч + public byte byNotSupportPreview;//Ƿ֧Ԥ,1-֧֣0-֧ + public byte byNotSupportStorage;//Ƿִ֧洢,1-֧֣0-֧ + public byte byUploadLogoMode;//ϴlogoģʽ0-ϴͨ1-ϴʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SUBSYSTEM_NUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SUBSYSTEM_ABILITY[] struSubSystemAbility; + public byte by485Nums;//485ڸ + public byte by232Nums;//232ڸ + public byte bySerieStartChan;//ʼͨ + public byte byScreenMode;//ģʽ0-ɿͻ˷䣬1-豸˷ + public byte byDevVersion;//豸汾0-B10/B11/B121-B20 + public byte bySupportBaseMapNums;//ֵ֧ĵͼͼŴ1ʼ + public ushort wBaseLengthX;//ÿСĻ׼ֵB20ʹ + public ushort wBaseLengthY; + public byte bySupportPictureTrans; //Ƿ֧ͼƬԣ0-֧֣1-֧ + public byte bySupportPreAllocDec; //Ƿ֧ܽԴԤ䣬0-֧֣1-֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 628, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLESCREENCFG + { + public byte byScreenSeq;//Ļţ0xffʾô,64-Tһʾ + public byte bySubSystemNum;//ϵͳλ,ֵû + public byte byDispNum;//ϵͳ϶Ӧʾͨţ64-Tиֵʾʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BIGSCREENCFG + { + public uint dwSize; + public byte byEnable;//ƴʹܣ0-ʹܣ1-ʹ + public byte byModeX;/*ƴģʽ*/ + public byte byModeY; + public byte byMainDecodeSystem;//ۺƽ̨Ľиֵʾλţ64-Tиֵʾͨ + public byte byMainDecoderDispChan;//ʾͨţ1.1netra汾netraʾܹͨΪ64-TиֵЧ + public byte byVideoStandard; //ÿʽͬ 1:NTSC,2:PAL + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwResolution; //ÿֱͬ + //ƴӴĻϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_BIGSCREENNUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLESCREENCFG[] struFollowSingleScreen; + //ʼΪ׼ + public ushort wBigScreenX; //ڵǽʼX + public ushort wBigScreenY; //ڵǽʼY + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + + public void Init() + { + byRes1 = new byte[2]; + struFollowSingleScreen = new NET_DVR_SINGLESCREENCFG[MAX_BIGSCREENNUM]; + byRes2 = new byte[12]; + } + } + + /************************************Ƶۺƽ̨(end)***************************************/ + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_EMAILCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sUserName; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sPassWord; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sFromName;/* Sender *///ַеĵһַһַ"@",ַҪ"@"ַ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 48)] + public string sFromAddr;/* Sender address */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sToName1;/* Receiver1 */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sToName2;/* Receiver2 */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 48)] + public string sToAddr1;/* Receiver address1 */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 48)] + public string sToAddr2;/* Receiver address2 */ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sEmailServer;/* Email server address */ + public byte byServerType;/* Email server type: 0-SMTP, 1-POP, 2-IMTP*/ + public byte byUseAuthen;/* Email server authentication method: 1-enable, 0-disable */ + public byte byAttachment;/* enable attachment */ + public byte byMailinterval;/* mail interval 0-2s, 1-3s, 2-4s. 3-5s*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSIONCFG_NEW + { + public uint dwSize; + public NET_DVR_COMPRESSION_INFO_EX struLowCompression;//ʱ¼ + public NET_DVR_COMPRESSION_INFO_EX struEventCompression;//¼¼ + } + + //̨ԤõϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PRESET_NAME + { + public uint dwSize; + public ushort wPresetNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byName; + public ushort wPanPos; + public ushort wTiltPos; + public ushort wZoomPos; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 58, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //λϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZPOS + { + public ushort wAction;//ȡʱֶЧ + public ushort wPanPos;//ˮƽ + public ushort wTiltPos;//ֱ + public ushort wZoomPos;//䱶 + } + + //ΧϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZSCOPE + { + public ushort wPanPosMin;//ˮƽmin + public ushort wPanPosMax;//ˮƽmax + public ushort wTiltPosMin;//ֱmin + public ushort wTiltPosMax;//ֱmax + public ushort wZoomPosMin;//䱶min + public ushort wZoomPosMax;//䱶max + } + + //rtsp ipcameraר + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RTSPCFG + { + public uint dwSize;// + public ushort wPort;//rtsp˿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 54, ArraySubType = UnmanagedType.I1)] + public byte[] byReserve;//Ԥ + } + + /********************************ӿڲṹ(begin)*********************************/ + + //NET_DVR_Login()ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEVICEINFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber;//к + public byte byAlarmInPortNum;//DVR + public byte byAlarmOutPortNum;//DVR + public byte byDiskNum;//DVRӲ̸ + public byte byDVRType;//DVR, 1:DVR 2:ATM DVR 3:DVS ...... + public byte byChanNum;//DVR ͨ + public byte byStartChan;//ʼͨ,DVS-1,DVR - 1 + } + + //NET_DVR_Login_V30()ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEVICEINFO_V30 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber; //к + public byte byAlarmInPortNum; // + public byte byAlarmOutPortNum; // + public byte byDiskNum; //Ӳ̸ + public byte byDVRType; //豸, 1:DVR 2:ATM DVR 3:DVS ...... + public byte byChanNum; //ģͨ + public byte byStartChan; //ʼͨ,DVS-1,DVR - 1 + public byte byAudioChanNum; //ͨ + public byte byIPChanNum; //ͨλ + public byte byZeroChanNum; //ͨ //2010-01-16 + public byte byMainProto; //Э 0-private, 1-rtsp,2-ͬʱ֧privatertsp + public byte bySubProto; //Э0-private, 1-rtsp,2-ͬʱ֧privatertsp + public byte bySupport; //λΪ0ʾ֧֣1ʾ֧֣ + //bySupport & 0x1, ʾǷ֧ + //bySupport & 0x2, ʾǷֱ֧ + //bySupport & 0x4, ʾǷ֧ѹȡ + //bySupport & 0x8, ʾǷֶ֧ + //bySupport & 0x10, ʾ֧ԶSADP + //bySupport & 0x20, ʾ֧Raid + //bySupport & 0x40, ʾ֧IPSAN Ŀ¼ + //bySupport & 0x80, ʾ֧rtp over rtsp + public byte bySupport1; // 䣬λΪ0ʾ֧֣1ʾ֧ + //bySupport1 & 0x1, ʾǷ֧snmp v30 + //bySupport1 & 0x2, ֻ֧طź + //bySupport1 & 0x4, Ƿֲ֧ȼ + //bySupport1 & 0x8, 豸Ƿֲ֧ʱչ + //bySupport1 & 0x10, ʾǷֶ֧33 + //bySupport1 & 0x20, ʾǷ֧rtsp over http + //bySupport1 & 0x80, ʾǷֳ֧±Ϣ2012-9-28, һʾǷ֧NET_DVR_IPPARACFG_V40ṹ + public byte bySupport2; /*λΪ0ʾ֧֣0ʾ֧ + bySupport2 & 0x1, ʾǷ֧ͨURLȡ + bySupport2 & 0x2, ʾ֧FTPV40 + bySupport2 & 0x4, ʾ֧ANR + bySupport2 & 0x8, ʾ֧CCDͨ + bySupport2 & 0x10, ʾֲ֧شϢ֧ץĻ ϱṹ + bySupport2 & 0x20, ʾǷֵ֧ȡ豸״̬ + bySupport2 & 0x40, ʾǷ豸*/ + public ushort wDevType; //豸ͺ + public byte bySupport3; //չλΪ0ʾ֧֣1ʾ֧ + //bySupport3 & 0x1, ʾǷ + // bySupport3 & 0x4 ʾְ֧ã ͨͼIP롢 + // û豸״̬JPEGץͼʱʱץͼӲ + //bySupport3 & 0x8Ϊ1 ʾ֧ʹTCPԤUDPԤಥԤе"ʱԤ"ֶʱԤʹַʽʱԤbySupport3 & 0x8Ϊ0ʱʹ "˽ʱԤ"Э顣 + //bySupport3 & 0x10 ʾ֧"ȡҪ״̬V40" + //bySupport3 & 0x20 ʾǷ֧ͨDDNSȡ + + public byte byMultiStreamProto;//Ƿֶ֧,λʾ,0-֧,1-֧,bit1-3,bit2-4,bit7-bit-8 + public byte byStartDChan; //ʼͨ,0ʾЧ + public byte byStartDTalkChan; //ʼֶԽͨţģԽͨţ0ʾЧ + public byte byHighDChanNum; //ͨλ + public byte bySupport4; + public byte byLanguageType;// ֧,λʾ,ÿһλ0-֧,1-֧ + // byLanguageType 0 ʾ 豸 + // byLanguageType & 0x1ʾ֧ + // byLanguageType & 0x2ʾ֧Ӣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayout(LayoutKind.Sequential)] + public struct NET_DVR_DEVICEINFO_V40 + { + public NET_DVR_DEVICEINFO_V30 struDeviceV30; + public byte bySupportLock; //豸֧ܣֶSDK豸ֵֵġbySupportLockΪ1ʱdwSurplusLockTimebyRetryLoginTimeЧ + public byte byRetryLoginTime; //ʣɳԵ½Ĵûʱ˲Ч + public byte byPasswordLevel; //admin밲ȫȼ0-Ч1-Ĭ룬2-Ч,3-սϸߵ롣ûΪĬ루12345߷սϸߵʱϲͻҪʾû롣 + public byte byProxyType;//ͣ0-ʹô, 1-ʹsocks5, 2-ʹEHome + public uint dwSurplusLockTime; //ʣʱ䣬λ룬ûʱ˲Ч + public byte byCharEncodeType; //ַͣSDKнӿڷصַͣ͸ӿڳ⣩0- ַϢ(豸)1- GB2312()2- GBK3- BIG5()4- Shift_JIS()5- EUC-KR()6- UTF-87- ISO8859-18- ISO8859-29- ISO8859-3ƣ21- ISO8859-15(ŷ) + public byte bySupportDev5;//֧v50汾豸ȡ豸ƺ豸ƳչΪ64ֽ + public byte bySupport; //չλ0- ֧֣1- ֧ + // bySupport & 0x1: + // bySupport & 0x2: 0-ֱ֧仯ϱ 1-ֱ֧仯ϱ + public byte byLoginMode; //¼ģʽ 0-Private¼ 1-ISAPI¼ + public int dwOEMCode; + public int iResidualValidity; //ûʣЧλ죬ظֵʾѾʹã硰-3ʾѾʹ3족 + public byte byResidualValidity; // iResidualValidityֶǷЧ0-Ч1-Ч + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 243, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int NET_DVR_DEV_ADDRESS_MAX_LEN = 129; + public const int NET_DVR_LOGIN_USERNAME_MAX_LEN = 64; + public const int NET_DVR_LOGIN_PASSWD_MAX_LEN = 64; + + public delegate void LOGINRESULTCALLBACK(int lUserID, int dwResult, IntPtr lpDeviceInfo, IntPtr pUser); + + [StructLayout(LayoutKind.Sequential)] + public struct NET_DVR_USER_LOGIN_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_DEV_ADDRESS_MAX_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDeviceAddress; + public byte byUseTransport; + public ushort wPort; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_LOGIN_USERNAME_MAX_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DVR_LOGIN_PASSWD_MAX_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; + public LOGINRESULTCALLBACK cbLoginResult; + public IntPtr pUser; + public bool bUseAsynLogin; + public byte byProxyType; //0:ʹô1ʹñ׼2ʹEHome + public byte byUseUTCTime; //0-תĬ,1-ӿȫʹUTCʱ,SDKUTCʱ豸ʱת,2-ӿȫʹƽ̨ʱ䣬SDKƽ̨ʱ豸ʱת + public byte byLoginMode; //0-Private, 1-ISAPI, 2-Ӧ + public byte byHttps; //0-tls1-ʹtls 2-Ӧ + public int iProxyID; //ţӴϢʱӦķ±ֵ + public byte byVerifyMode; //֤ʽ0-֤1-˫֤2-֤֤ʹTLSʱЧ; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 119, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + //sdk绷öٱԶ + public enum SDK_NETWORK_ENVIRONMENT + { + LOCAL_AREA_NETWORK = 0, + WIDE_AREA_NETWORK, + } + + //ʾģʽ + public enum DISPLAY_MODE + { + NORMALMODE = 0, + OVERLAYMODE + } + + //ģʽ + public enum SEND_MODE + { + PTOPTCPMODE = 0, + PTOPUDPMODE, + MULTIMODE, + RTPMODE, + RESERVEDMODE + } + + //ץͼģʽ + public enum CAPTURE_MODE + { + BMP_MODE = 0, //BMPģʽ + JPEG_MODE = 1 //JPEGģʽ + } + + //ʵʱģʽ + public enum REALSOUND_MODE + { + MONOPOLIZE_MODE = 1,//ռģʽ + SHARE_MODE = 2 //ģʽ + } + + public struct NET_DVR_CLIENTINFO + { + public Int32 lChannel;//ͨ + public Int32 lLinkMode;//λ(31)Ϊ0ʾΪ1ʾ030λʾӷʽ: 0TCPʽ,1UDPʽ,2ಥʽ,3 - RTPʽ4-Ƶֿ(TCP) + public IntPtr hPlayWnd;//Ŵڵľ,ΪNULLʾͼ + public string sMultiCastIP;//ಥַ + } + + //SDK״̬Ϣ(9000) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SDKSTATE + { + public uint dwTotalLoginNum;//ǰloginû + public uint dwTotalRealPlayNum;//ǰrealplay· + public uint dwTotalPlayBackNum;//ǰطŻ· + public uint dwTotalAlarmChanNum;//ǰͨ· + public uint dwTotalFormatNum;//ǰӲ̸ʽ· + public uint dwTotalFileSearchNum;//ǰ־ļ· + public uint dwTotalLogSearchNum;//ǰ־ļ· + public uint dwTotalSerialNum;//ǰ͸ͨ· + public uint dwTotalUpgradeNum;//ǰ· + public uint dwTotalVoiceComNum;//ǰת· + public uint dwTotalBroadCastNum;//ǰ㲥· + public uint dwTotalListenNum; //ǰ· + public uint dwEmailTestNum; //ǰʼ· + public uint dwBackupNum; // ǰļ· + public uint dwTotalInquestUploadNum; //ǰѶϴ· + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; + } + + //SDK֧Ϣ(9000) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SDKABL + { + public uint dwMaxLoginNum;//loginû MAX_LOGIN_USERS + public uint dwMaxRealPlayNum;//realplay· WATCH_NUM + public uint dwMaxPlayBackNum;//طŻ· WATCH_NUM + public uint dwMaxAlarmChanNum;//ͨ· ALARM_NUM + public uint dwMaxFormatNum;//Ӳ̸ʽ· SERVER_NUM + public uint dwMaxFileSearchNum;//ļ· SERVER_NUM + public uint dwMaxLogSearchNum;//־· SERVER_NUM + public uint dwMaxSerialNum;//͸ͨ· SERVER_NUM + public uint dwMaxUpgradeNum;//· SERVER_NUM + public uint dwMaxVoiceComNum;//ת· SERVER_NUM + public uint dwMaxBroadCastNum;//㲥· MAX_CASTNUM + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; + } + + //豸Ϣ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_ALARMER + { + public byte byUserIDValid;/* useridǷЧ 0-Ч1-Ч */ + public byte bySerialValid;/* кǷЧ 0-Ч1-Ч */ + public byte byVersionValid;/* 汾ǷЧ 0-Ч1-Ч */ + public byte byDeviceNameValid;/* 豸ǷЧ 0-Ч1-Ч */ + public byte byMacAddrValid; /* MACַǷЧ 0-Ч1-Ч */ + public byte byLinkPortValid;/* login˿ǷЧ 0-Ч1-Ч */ + public byte byDeviceIPValid;/* 豸IPǷЧ 0-Ч1-Ч */ + public byte bySocketIPValid;/* socket ipǷЧ 0-Ч1-Ч */ + public int lUserID; /* NET_DVR_Login()ֵ, ʱЧ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber;/* к */ + public uint dwDeviceVersion;/* 汾Ϣ 16λʾ汾16λʾΰ汾*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDeviceName;/* 豸 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMacAddr;/* MACַ */ + public ushort wLinkPort; /* link port */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] sDeviceIP;/* IPַ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] sSocketIP;/* ϴʱsocket IPַ */ + public byte byIpProtocol; /* IpЭ 0-IPV4, 1-IPV6 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //Ӳʾ(ӽṹ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPLAY_PARA + { + public int bToScreen; + public int bToVideoOut; + public int nLeft; + public int nTop; + public int nWidth; + public int nHeight; + public int nReserved; + } + + //ӲԤ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CARDINFO + { + public int lChannel;//ͨ + public int lLinkMode;//λ(31)Ϊ0ʾΪ1ʾӣ030λʾӷʽ:0TCPʽ,1UDPʽ,2ಥʽ,3 - RTPʽ4-绰ߣ5128k6256k7384k8512k + [MarshalAsAttribute(UnmanagedType.LPStr)] + public string sMultiCastIP; + public NET_DVR_DISPLAY_PARA struDisplayPara; + } + + //¼ļ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_FIND_DATA + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 100)] + public string sFileName;//ļ + public NET_DVR_TIME struStartTime;//ļĿʼʱ + public NET_DVR_TIME struStopTime;//ļĽʱ + public uint dwFileSize;//ļĴС + } + + //¼ļ(9000) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_FINDDATA_V30 + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 100)] + public string sFileName;//ļ + public NET_DVR_TIME struStartTime;//ļĿʼʱ + public NET_DVR_TIME struStopTime;//ļĽʱ + public uint dwFileSize;//ļĴС + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sCardNum; + public byte byLocked;//9000豸֧,1ʾļѾ,0ʾļ + public byte byFileType; //ļ:0ʱ¼,1-ƶ 2 + //3-|ƶ 4-&ƶ 5- 6-ֶ¼,7𶯱8-9-ܱ10-PIR11-߱12-ȱ,14-ܽͨ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //¼ļ(cvr) + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_FINDDATA_V40 + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 100)] + public string sFileName;//ļ + public NET_DVR_TIME struStartTime;//ļĿʼʱ + public NET_DVR_TIME struStopTime;//ļĽʱ + public uint dwFileSize;//ļĴС + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sCardNum; + public byte byLocked;//9000豸֧,1ʾļѾ,0ʾļ + public byte byFileType; //ļ:0ʱ¼,1-ƶ 2 + //3-|ƶ 4-&ƶ 5- 6-ֶ¼,7𶯱8-9-ܱ10-PIR11-߱12-ȱ,14-ܽͨ¼ + public byte byQuickSearch; //0:ͨѯ1٣ѯ + public byte byRes; + public uint dwFileIndex; //ļ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + //¼ļ() + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_FINDDATA_CARD + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 100)] + public string sFileName;//ļ + public NET_DVR_TIME struStartTime;//ļĿʼʱ + public NET_DVR_TIME struStopTime;//ļĽʱ + public uint dwFileSize;//ļĴС + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sCardNum; + } + + //¼ļṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FILECOND + { + public int lChannel;//ͨ + public uint dwFileType;//¼ļ0xffȫ0ʱ¼,1-ƶ 2 + //3-|ƶ 4-&ƶ 5- 6-ֶ¼ + public uint dwIsLocked;//Ƿ 0-ļ,1-ļ, 0xffʾļ + public uint dwUseCardNo;//Ƿʹÿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] sCardNumber;// + public NET_DVR_TIME struStartTime;//ʼʱ + public NET_DVR_TIME struStopTime;//ʱ + } + + //̨ѡŴС(HIK ר) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POINT_FRAME + { + public int xTop;//ʼx + public int yTop;//y + public int xBottom;//x + public int yBottom;//y + public int bCounter;// + } + + //Խ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSION_AUDIO + { + public byte byAudioEncType;//Ƶ 0-G722; 1-G711 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byres;//ﱣƵѹ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUDIOENC_INFO + { + public uint in_frame_size; /* һ֡ݴС(BYTES)GetInfoParam */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)] + public int[] reserved; /* */ + } + + // Ƶ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUDIOENC_PROCESS_PARAM + { + public IntPtr in_buf; /* buf */ + public IntPtr out_buf; /* buf */ + public uint out_frame_size; /* һ֡BYTE */ + public int g726enc_reset; /* ÿ */ + public int g711_type; /* g711,0 - U law, 1- A law */ + public int enc_mode; /* ƵģʽAMR */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.U4)] + public int[] reserved; /* */ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_AP_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = IW_ESSID_MAX_SIZE)] + public string sSsid; + public uint dwMode;/* 0 mange ģʽ;1 ad-hocģʽμNICMODE */ + public uint dwSecurity; /*0 ܣ1 wepܣ2 wpa-psk;3 wpa-EnterpriseμWIFISECURITY*/ + public uint dwChannel;/*1-11ʾ11ͨ*/ + public uint dwSignalStrength;/*0-100źΪǿ*/ + public uint dwSpeed;/*,λ0.01mbps*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AP_INFO_LIST + { + public uint dwSize; + public uint dwCount;/*AP20*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = WIFI_MAX_AP_COUNT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_AP_INFO[] struApInfo; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_WIFIETHERNET + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sIpAddress;/*IPַ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sIpMask;/**/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr;/*ַֻʾ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] bRes; + public uint dwEnableDhcp;/*Ƿdhcp 0 1*/ + public uint dwAutoDns;/*dhcpǷԶȡdns,0Զȡ 1ԶȡdhcpĿǰԶȡdns*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sFirstDns; /*һdns*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sSecondDns;/*ڶdns*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sGatewayIpAddr;/* صַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] bRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_EAP_TTLS + { + public byte byEapolVersion; //EAPOL汾0-汾11-汾2 + public byte byAuthType; //ڲ֤ʽ0-PAP1-MSCHAPV2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAnonyIdentity; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; //û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassword; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } //WPA-enterprise/WPA2-enterprisģʽ + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_EAP_PEAP + { + public byte byEapolVersion; //EAPOL汾0-汾11-汾2 + public byte byAuthType; //ڲ֤ʽ0-GTC1-MD52-MSCHAPV2 + public byte byPeapVersion; //PEAP汾0-汾01-汾1 + public byte byPeapLabel; //PEAPǩ0-ϱǩ1-±ǩ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAnonyIdentity; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; //û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassword; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } //WPA-enterprise/WPA2-enterprisģʽ + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_EAP_TLS + { + public byte byEapolVersion; //EAPOL汾0-汾11-汾2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byIdentity; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPrivateKeyPswd; //˽Կ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 76, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct WIFI_AUTH_PARAM + { + [FieldOffsetAttribute(0)] + public UNION_EAP_TTLS EAP_TTLS;//WPA-enterprise/WPA2-enterprisģʽ + + [FieldOffsetAttribute(0)] + public UNION_EAP_PEAP EAP_PEAP; //WPA-enterprise/WPA2-enterprisģʽ + + [FieldOffsetAttribute(0)] + public UNION_EAP_TLS EAP_TLS; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_WEP + { + public uint dwAuthentication;/*0 -ʽ 1-ʽ*/ + public uint dwKeyLength;/* 0 -64λ1- 128λ2-152λ*/ + public uint dwKeyType;/*0 16;1 ASCI */ + public uint dwActive;/*0 0---3ʾһԿ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = WIFI_WEP_MAX_KEY_COUNT * WIFI_WEP_MAX_KEY_LENGTH)] + public string sKeyInfo; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_WPA_PSK + { + public uint dwKeyLength;/*8-63ASCIIַ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = WIFI_WPA_PSK_MAX_KEY_LENGTH)] + public string sKeyInfo; + public byte byEncryptType;/*WPA/WPA2ģʽ¼,0-AES, 1-TKIP*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_WPA_WPA2 + { + public byte byEncryptType; /*,0-AES, 1-TKIP*/ + public byte byAuthType; //֤ͣ0-EAP_TTLS,1-EAP_PEAP,2-EAP_TLS + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public WIFI_AUTH_PARAM auth_param; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_WIFI_CFG_EX + { + public NET_DVR_WIFIETHERNET struEtherNet;/*wifi*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = IW_ESSID_MAX_SIZE)] + public string sEssid;/*SSID*/ + public uint dwMode;/* 0 mange ģʽ;1 ad-hocģʽμ*/ + public uint dwSecurity;/*0 ܣ1 wepܣ2 wpa-psk; */ + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct key + { + [FieldOffsetAttribute(0)] + public UNION_WEP wep; + + [FieldOffsetAttribute(0)] + public UNION_WPA_PSK wpa_psk; + + [FieldOffsetAttribute(0)] + public UNION_WPA_WPA2 wpa_wpa2;//WPA-enterprise/WPA2-enterprisģʽ + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WIFI_CFG + { + public uint dwSize; + public NET_DVR_WIFI_CFG_EX struWifiCfg; + } + + //wifi״̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WIFI_CONNECT_STATUS + { + public uint dwSize; + public byte byCurStatus; //1-ӣ2-δӣ3- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwErrorCode; // byCurStatus = 2ʱЧ,1-û,2-޴·,3-δ֪ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 244, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WIFI_WORKMODE + { + public uint dwSize; + public uint dwNetworkInterfaceMode;/*0 Զлģʽ1 ģʽ*/ + } + + //ܿϢ + public const int MAX_VCA_CHAN = 16;//ͨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_CTRLINFO + { + public byte byVCAEnable;//Ƿ + public byte byVCAType;//ͣVCA_CHAN_ABILITY_TYPE + public byte byStreamWithVCA;//ǷϢ + public byte byMode;//ģʽVCA_CHAN_MODE_TYPE ,atmʱҪ + public byte byControlType; //ͣλʾ0-1- + // byControlType &1 ǷץĹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//Ϊ0 + } + + //ܿϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_CTRLCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VCA_CHAN, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_CTRLINFO[] struCtrlInfo;//Ϣ,0Ӧ豸ʼͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //豸 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_DEV_ABILITY + { + public uint dwSize;//ṹ + public byte byVCAChanNum;//ͨ + public byte byPlateChanNum;//ͨ + public byte byBBaseChanNum;//Ϊ + public byte byBAdvanceChanNum;//Ϊ߼ + public byte byBFullChanNum;//Ϊ + public byte byATMChanNum;//ATM + public byte byPDCChanNum; //ͳͨ + public byte byITSChanNum; //ͨ¼ͨ + public byte byBPrisonChanNum; //Ϊ()ͨ + public byte byFSnapChanNum; //ץͨ + public byte byFSnapRecogChanNum; //ץĺʶͨ + public byte byFRetrievalChanNum; // + public byte bySupport; //λΪ0ʾ֧֣1ʾ֧ + //bySupport & 0x1ʾǷ֧ܸ 2012-3-22 + //bySupport & 0x2ʾǷ֧128·ȡչ2012-12-27 + public byte byFRecogChanNum; //ʶͨ + public byte byBPPerimeterChanNum; //Ϊ(ܽ)ͨ + public byte byTPSChanNum; //ͨյͨ + public byte byTFSChanNum; //·Υȡ֤ͨ + public byte byFSnapBFullChanNum; //ץĺΪͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 22, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ϊ + public enum VCA_ABILITY_TYPE:uint + { + TRAVERSE_PLANE_ABILITY = 0x01, //Խ + ENTER_AREA_ABILITY = 0x02, // + EXIT_AREA_ABILITY = 0x04, //뿪 + INTRUSION_ABILITY = 0x08, // + LOITER_ABILITY = 0x10, //ǻ + LEFT_TAKE_ABILITY = 0x20, //Ʒȡ + PARKING_ABILITY = 0x40, //ͣ + RUN_ABILITY = 0x80, //ƶ + HIGH_DENSITY_ABILITY = 0x100, //Աۼ + LF_TRACK_ABILITY = 0x200, // + VIOLENT_MOTION_ABILITY = 0x400, //˶ + REACH_HIGHT_ABILITY = 0x800, //ʸ߼ + GET_UP_ABILITY = 0x1000, // + LEFT_ABILITY = 0x2000, //Ʒ + TAKE_ABILITY = 0x4000, //Ʒȡ + LEAVE_POSITION = 0x8000, // + TRAIL_ABILITY = 0x10000, //β + KEY_PERSON_GET_UP_ABILITY = 0x20000, //صԱ + FALL_DOWN_ABILITY = 0x80000, // + AUDIO_ABNORMAL_ABILITY = 0x100000, //ǿͻ + ADV_REACH_HEIGHT_ABILITY = 0x200000, //ʸ + TOILET_TARRY_ABILITY = 0x400000, //޳ʱ + YARD_TARRY_ABILITY = 0x800000, //ŷ糡 + ADV_TRAVERSE_PLANE_ABILITY = 0x1000000, //߾ + HUMAN_ENTER_ABILITY = 0x10000000, //˿ATM ,ֻATM_PANELģʽ֧ + OVER_TIME_ABILITY = 0x20000000, //ʱ,ֻATM_PANELģʽ֧ + STICK_UP_ABILITY = 0x40000000, //ֽ + INSTALL_SCANNER_ABILITY = 0x80000000 //װ + } + + //ͨ + public enum VCA_CHAN_ABILITY_TYPE + { + VCA_BEHAVIOR_BASE = 1, //Ϊ + VCA_BEHAVIOR_ADVANCE = 2, //Ϊ߼ + VCA_BEHAVIOR_FULL = 3, //Ϊ + VCA_PLATE = 4, // + VCA_ATM = 5, //ATM + VCA_PDC = 6, //ͳ + VCA_ITS = 7, // ͨ¼ + VCA_BEHAVIOR_PRISON = 8, //Ϊ() + VCA_FACE_SNAP = 9, //ץ + VCA_FACE_SNAPRECOG = 10, //ץĺʶ + VCA_FACE_RETRIEVAL = 11, // + VCA_FACE_RECOG = 12, //ʶ + VCA_BEHAVIOR_PRISON_PERIMETER = 13, // Ϊ (ܽ) + VCA_TPS = 14, //ͨյ + VCA_TFS = 15, //·Υȡ֤ + VCA_BEHAVIOR_FACESNAP = 16 //ץĺΪ + } + + //ATMģʽ(ATM) + public enum VCA_CHAN_MODE_TYPE + { + VCA_ATM_PANEL = 0,//ATM + VCA_ATM_SURROUND = 1,//ATM + VCA_ATM_FACE = 2 //ATM + } + public enum TFS_CHAN_MODE_TYPE + { + TFS_CITYROAD = 0, //TFS е· + TFS_FREEWAY = 1 //TFS ٵ· + } + + //Ϊģʽ + public enum BEHAVIOR_SCENE_MODE_TYPE + { + BEHAVIOR_SCENE_DEFAULT = 0, //ϵͳĬ + BEHAVIOR_SCENE_WALL = 1, //Χǽ + BEHAVIOR_SCENE_INDOOR = 2 // + } + + //ͨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_CHAN_IN_PARAM + { + public byte byVCAType;//VCA_CHAN_ABILITY_TYPEöֵ + public byte byMode;//ģʽVCA_CHAN_MODE_TYPE ,atmʱҪ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//Ϊ0 + } + + //Ϊṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BEHAVIOR_ABILITY + { + public uint dwSize;//ṹ + public uint dwAbilityType;//ֵ֧ͣλʾVCA_ABILITY_TYPE + public byte byMaxRuleNum;// + public byte byMaxTargetNum;//Ŀ + public byte bySupport; // ֵ֧Ĺ λʾ + // bySupport & 0x01 ֱ֧궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //Ϊ0 + } + + // ͨṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ITS_ABILITY + { + public uint dwSize; // ṹС + public uint dwAbilityType; // ֵ֧б ITS_ABILITY_TYPE + public byte byMaxRuleNum; // + public byte byMaxTargetNum; //Ŀ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + /***********************************end*******************************************/ + + /************************************ܲṹ*********************************/ + //ܹýṹ + //ֵһ,ֵΪǰİٷֱȴС, ΪСλ + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_POINT + { + public float fX;// X, 0.001~1 + public float fY;//Y, 0.001~1 + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RECT + { + public float fX;//߽ϽǵX, 0.001~1 + public float fY;//߽ϽǵY, 0.001~1 + public float fWidth;//߽Ŀ, 0.001~1 + public float fHeight;//߽ĸ߶, 0.001~1 + } + + //Ϊ¼ + public enum VCA_EVENT_TYPE : uint + { + VCA_TRAVERSE_PLANE = 0x1, //Խ + VCA_ENTER_AREA = 0x2, //Ŀ,֧ + VCA_EXIT_AREA = 0x4, //Ŀ뿪,֧ + VCA_INTRUSION = 0x8, //ܽ,֧ + VCA_LOITER = 0x10, //ǻ,֧ + VCA_LEFT_TAKE = 0x20, //Ʒȡ,֧ + VCA_PARKING = 0x40, //ͣ,֧ + VCA_RUN = 0x80, //ƶ,֧ + VCA_HIGH_DENSITY = 0x100, //Աۼ,֧ + VCA_VIOLENT_MOTION = 0x200, //˶ + VCA_REACH_HIGHT = 0x400, //ʸ߼ + VCA_GET_UP = 0x800, // + VCA_LEFT = 0x1000, //Ʒ + VCA_TAKE = 0x2000, //Ʒȡ + VCA_LEAVE_POSITION = 0x4000, // + VCA_TRAIL = 0x8000, //β + VCA_KEY_PERSON_GET_UP = 0x10000, //صԱ + VCA_FALL_DOWN = 0x80000, //ؼ + VCA_AUDIO_ABNORMAL = 0x100000, //ǿͻ + VCA_ADV_REACH_HEIGHT = 0x200000, //ʸ + VCA_TOILET_TARRY = 0x400000, //޳ʱ + VCA_YARD_TARRY = 0x800000, //ŷ糡 + VCA_ADV_TRAVERSE_PLANE = 0x1000000, //߾ + VCA_HUMAN_ENTER = 0x10000000, //˿ATM ֻATM_PANELģʽ֧ + VCA_OVER_TIME = 0x20000000, //ʱ ֻATM_PANELģʽ֧ + VCA_STICK_UP = 0x40000000, //ֽ,֧ + VCA_INSTALL_SCANNER = 0x80000000 //װ,֧ + } + + //Ϊ¼չ + public enum VCA_RULE_EVENT_TYPE_EX : ushort + { + ENUM_VCA_EVENT_TRAVERSE_PLANE = 1, //Խ + ENUM_VCA_EVENT_ENTER_AREA = 2, //Ŀ,֧ + ENUM_VCA_EVENT_EXIT_AREA = 3, //Ŀ뿪,֧ + ENUM_VCA_EVENT_INTRUSION = 4, //ܽ,֧ + ENUM_VCA_EVENT_LOITER = 5, //ǻ,֧ + ENUM_VCA_EVENT_LEFT_TAKE = 6, //Ʒȡ,֧ + ENUM_VCA_EVENT_PARKING = 7, //ͣ,֧ + ENUM_VCA_EVENT_RUN = 8, //ƶ,֧ + ENUM_VCA_EVENT_HIGH_DENSITY = 9, //Աۼ,֧ + ENUM_VCA_EVENT_VIOLENT_MOTION = 10, //˶ + ENUM_VCA_EVENT_REACH_HIGHT = 11, //ʸ߼ + ENUM_VCA_EVENT_GET_UP = 12, // + ENUM_VCA_EVENT_LEFT = 13, //Ʒ + ENUM_VCA_EVENT_TAKE = 14, //Ʒȡ + ENUM_VCA_EVENT_LEAVE_POSITION = 15, // + ENUM_VCA_EVENT_TRAIL = 16, //β + ENUM_VCA_EVENT_KEY_PERSON_GET_UP = 17, //صԱ + ENUM_VCA_EVENT_FALL_DOWN = 20, //ؼ + ENUM_VCA_EVENT_AUDIO_ABNORMAL = 21, //ǿͻ + ENUM_VCA_EVENT_ADV_REACH_HEIGHT = 22, //ʸ + ENUM_VCA_EVENT_TOILET_TARRY = 23, //޳ʱ + ENUM_VCA_EVENT_YARD_TARRY = 24, //ŷ糡 + ENUM_VCA_EVENT_ADV_TRAVERSE_PLANE = 25, //߾ + ENUM_VCA_EVENT_HUMAN_ENTER = 29, //˿ATM,ֻATM_PANELģʽ֧ + ENUM_VCA_EVENT_OVER_TIME = 30, //ʱ,ֻATM_PANELģʽ֧ + ENUM_VCA_EVENT_STICK_UP = 31, //ֽ,֧ + ENUM_VCA_EVENT_INSTALL_SCANNER = 32 //װ,֧ + } + + //洩Խ + public enum VCA_CROSS_DIRECTION + { + VCA_BOTH_DIRECTION,// ˫ + VCA_LEFT_GO_RIGHT,// + VCA_RIGHT_GO_LEFT,// + } + + //߽ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_LINE + { + public NET_VCA_POINT struStart;// + public NET_VCA_POINT struEnd; //յ + + // public void init() + // { + // struStart = new NET_VCA_POINT(); + // struEnd = new NET_VCA_POINT(); + // } + } + + //ýṹᵼxamlʱûҵ + //ʱνṹ + //ͽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_POLYGON + { + /// DWORD->unsigned int + public uint dwPointNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = VCA_MAX_POLYGON_POINT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_POINT[] struPos; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TRAVERSE_PLANE + { + public NET_VCA_LINE struPlaneBottom;//ױ + public uint dwCrossDirection;//Խ: 0-˫1-ң2-ҵ + public byte bySensitivity;//ȣȡֵΧ[1,5] Smart IPCȡֵΧΪ[1,100] + public byte byPlaneHeight;//߶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 38, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + + // public void init() + // { + // struPlaneBottom = new NET_VCA_LINE(); + // struPlaneBottom.init(); + // byRes2 = new byte[38]; + // } + } + + ///뿪 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_AREA + { + public NET_VCA_POLYGON struRegion;//Χ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ݱӳʱʶдͼƬIOһ£1뷢һ + //ֲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_INTRUSION + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration;//ӳʱ: 1-120룬5룬жЧʱ + public byte bySensitivity; //ȲΧ[1-100] + public byte byRate; //ռȣδĿߴĿռıأһΪ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ǻ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_LOITER + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration;//ǻijʱ䣺1-120룬10 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /// + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TAKE_LEFT + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration;///ijʱ䣺1-120룬10 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_PARKING + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration;//ͣʱ䣺1-120룬10 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ܲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RUN + { + public NET_VCA_POLYGON struRegion;//Χ + public float fRunDistance;//˱, Χ: [0.1, 1.00] + public byte byRes1; // ֽ + public byte byMode; // 0 ģʽ 1 ʵģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Աۼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_HIGH_DENSITY + { + public NET_VCA_POLYGON struRegion;//Χ + public float fDensity;//ܶȱ, Χ: [0.1, 1.0] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public ushort wDuration; // Աۼֵ 20-360s + } + + //˶ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_VIOLENT_MOTION + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration; //˶ֵ1-50 + public byte bySensitivity; //ȲΧ[1,5] + public byte byMode; //0-Ƶģʽ1-Ƶģʽ2-Ƶģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ʸ߲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_REACH_HIGHT + { + public NET_VCA_LINE struVcaLine; //ʸ߾ + public ushort wDuration; //ʸֵ߱1-120 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //𴲲 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_GET_UP + { + public NET_VCA_POLYGON struRegion; //Χ + public ushort wDuration; //𴲱ֵ1-100 + public byte byMode; //ģʽ,0-ͨģʽ,1-ߵģʽ,2-ͨģʽ + public byte bySensitivity; //ȲΧ[1,10] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + //Ʒ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_LEFT + { + public NET_VCA_POLYGON struRegion; // Χ + public ushort wDuration; // Ʒֵ 10-100 + public byte bySensitivity; // ȲΧ[1,5] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + // Ʒȡ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TAKE + { + public NET_VCA_POLYGON struRegion; // Χ + public ushort wDuration; // Ʒȡֵ10-100 + public byte bySensitivity; // ȲΧ[1,5] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_OVER_TIME + { + public NET_VCA_POLYGON struRegion; // Χ + public ushort wDuration; // ʱֵ 4s-60000s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_HUMAN_ENTER + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; //ֽ + } + + //ֽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_STICK_UP + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration;//ʱ䣺10-60룬10 + public byte bySensitivity;//ȲΧ[1,5] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SCANNER + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration;//ʱ䣺10-60 + public byte bySensitivity;//ȲΧ[1,5] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_LEAVE_POSITION + { + public NET_VCA_POLYGON struRegion; //Χ + public ushort wLeaveDelay; //˱ʱ䣬λsȡֵ1-1800 + public ushort wStaticDelay; //˯ʱ䣬λsȡֵ1-1800 + public byte byMode; //ģʽ0-¼1-˯¼2-˯¼ + public byte byPersonType; //ֵͣ0-ֵڣ1-˫ֵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //β + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TRAIL + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wRes; /* */ + public byte bySensitivity; /* ȲΧ[1,5] */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ز + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FALL_DOWN + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDuration; /* ¼ֵ 1-60s*/ + public byte bySensitivity; /* ȲΧ[1,5] */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ǿͻ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_AUDIO_ABNORMAL + { + public ushort wDecibel; //ǿ + public byte bySensitivity; //ȲΧ[1,5] + public byte byAudioMode; //ģʽ0-ȼ⣬1-ֱֵ⣬2-ֱֵ + public byte byEnable; //ʹܣǷ + public byte byThreshold; //ֵ[0,100] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 54, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUDIO_EXCEPTION + { + public uint dwSize; + public byte byEnableAudioInException; //ʹܣǷ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_VCA_AUDIO_ABNORMAL struAudioAbnormal; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmSched; //ʱ + public NET_DVR_HANDLEEXCEPTION_V40 struHandleException; //쳣ʽ + public uint dwMaxRelRecordChanNum; //¼ͨ ֻ֧ + public uint dwRelRecordChanNum; //¼ͨ ʵֵ֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint[] byRelRecordChan; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TOILET_TARRY + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDelay; //޳ʱʱ[1,3600]λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_YARD_TARRY + { + public NET_VCA_POLYGON struRegion;//Χ + public ushort wDelay; //ŷ糡ʱ[1,120]λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_ADV_REACH_HEIGHT + { + public NET_VCA_POLYGON struRegion; //ʸ + public uint dwCrossDirection; //Խ(VCA_CROSS_DIRECTION): 0-˫1-2-ҵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_ADV_TRAVERSE_PLANE + { + public NET_VCA_POLYGON struRegion; // + public uint dwCrossDirection; //Խ(VCA_CROSS_DIRECTION): 0-˫1-2-ҵ + public byte bySensitivity; //ȲΧ[1,5] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + //¼ + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_VCA_EVENT_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.U4)] + public uint[] uLen;// + + //[FieldOffsetAttribute(0)] + //public NET_VCA_TRAVERSE_PLANE struTraversePlane;//Խ + //[FieldOffsetAttribute(0)] + //public NET_VCA_AREA struArea;///뿪 + //[FieldOffsetAttribute(0)] + //public NET_VCA_INTRUSION struIntrusion;//ֲ + //[FieldOffsetAttribute(0)] + //public NET_VCA_LOITER struLoiter;//ǻ + //[FieldOffsetAttribute(0)] + //public NET_VCA_TAKE_LEFT struTakeTeft;/// + //[FieldOffsetAttribute(0)] + //public NET_VCA_PARKING struParking;//ͣ + //[FieldOffsetAttribute(0)] + //public NET_VCA_RUN struRun;//ܲ + //[FieldOffsetAttribute(0)] + //public NET_VCA_HIGH_DENSITY struHighDensity;//Աۼ + //[FieldOffsetAttribute(0)] + //public NET_VCA_VIOLENT_MOTION struViolentMotion; //˶ + //[FieldOffsetAttribute(0)] + //public NET_VCA_REACH_HIGHT struReachHight; //ʸ + //[FieldOffsetAttribute(0)] + //public NET_VCA_GET_UP struGetUp; // + //[FieldOffsetAttribute(0)] + //public NET_VCA_LEFT struLeft; //Ʒ + //[FieldOffsetAttribute(0)] + //public NET_VCA_TAKE struTake; // Ʒȡ + //[FieldOffsetAttribute(0)] + //public NET_VCA_HUMAN_ENTER struHumanEnter; //Ա + //[FieldOffsetAttribute(0)] + //public NET_VCA_OVER_TIME struOvertime; //ʱ + //[FieldOffsetAttribute(0)] + //public NET_VCA_STICK_UP struStickUp;//ֽ + //[FieldOffsetAttribute(0)] + //public NET_VCA_SCANNER struScanner;// + //[FieldOffsetAttribute(0)] + //public NET_VCA_LEAVE_POSITION struLeavePos; //ڲ + //[FieldOffsetAttribute(0)] + //public NET_VCA_TRAIL struTrail; //β + //[FieldOffsetAttribute(0)] + //public NET_VCA_FALL_DOWN struFallDown; //ز + //[FieldOffsetAttribute(0)] + //public NET_VCA_AUDIO_ABNORMAL struAudioAbnormal; //ǿͻ + //[FieldOffsetAttribute(0)] + //public NET_VCA_ADV_REACH_HEIGHT struReachHeight; //ʸ߲ + //[FieldOffsetAttribute(0)] + //public NET_VCA_TOILET_TARRY struToiletTarry; //޳ʱ + //[FieldOffsetAttribute(0)] + //public NET_VCA_YARD_TARRY struYardTarry; //ŷ糡 + //[FieldOffsetAttribute(0)] + //public NET_VCA_ADV_TRAVERSE_PLANE struAdvTraversePlane;//߾ + } + + // ߴ + public enum SIZE_FILTER_MODE + { + IMAGE_PIX_MODE,//شС + REAL_WORLD_MODE,//ʵʴС + DEFAULT_MODE // Ĭģʽ + } + + //ߴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SIZE_FILTER + { + public byte byActive;//Ƿ񼤻ߴ 0- 0- + public byte byMode;//ģʽSIZE_FILTER_MODE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//0 + public NET_VCA_RECT struMiniRect;//СĿ,ȫ0ʾ + public NET_VCA_RECT struMaxRect;//Ŀ,ȫ0ʾ + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_ONE_RULE + { + public byte byActive;//Ƿ񼤻,0-,0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//Ϊ0ֶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName;// + public VCA_EVENT_TYPE dwEventType;//Ϊ¼ + public NET_VCA_EVENT_UNION uEventParam;//Ϊ¼ + public NET_VCA_SIZE_FILTER struSizeFilter;//ߴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType;//ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan;//¼ͨ,Ϊ1ʾͨ + } + + //Ϊýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RULECFG + { + public uint dwSize;//ṹ + public byte byPicProType;//ʱͼƬʽ 0- 0-ϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_JPEGPARA struPictureParam;//ͼƬṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RULE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_ONE_RULE[] struRule;// + } + + //ߴ˲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FILTER_STRATEGY + { + public byte byStrategy; //ߴ˲ 0 - 1-߶ȺͿȹ,2- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //򴥷 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RULE_TRIGGER_PARAM + { + public byte byTriggerMode; //Ĵʽ0- ã1- 켣 2- Ŀ + public byte byTriggerPoint; //㣬ʽΪ켣ʱЧ 0- ,1-,2- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public float fTriggerArea; //Ŀٷֱ [0,100]ʽΪĿʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_ONE_RULE_V41 + { + public byte byActive; //Ƿ񼤻,0-,0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //Ϊ0ֶ + public ushort wEventTypeEx; //Ϊ¼չڴֶdwEventTypeοVCA_RULE_EVENT_TYPE_EX + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public uint dwEventType; //Ϊ¼ͣΪ˼ݣʹwEventTypeExȡ¼ + public NET_VCA_EVENT_UNION uEventParam; //Ϊ¼ + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ,Ϊ1ʾͨ + public ushort wAlarmDelay; //ܱʱ0-5s,1-10,2-30s,3-60s,4-120s,5-300s,6-600s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + public NET_VCA_FILTER_STRATEGY struFilterStrategy; //ߴ˲ + public NET_VCA_RULE_TRIGGER_PARAM struTriggerParam; //򴥷 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ϊýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RULECFG_V41 + { + public uint dwSize; //ṹ + public byte byPicProType; //ʱͼƬʽ 0- 0-ϴ + public byte byUpLastAlarm; //2011-04-06 Ƿϴһεı + public byte byPicRecordEnable; /*2012-3-1ǷͼƬ洢, 0-, 1-*/ + public byte byRes1; + public NET_DVR_JPEGPARA struPictureParam; //ͼƬṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RULE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_ONE_RULE_V41[] struRule; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ŀṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TARGET_INFO + { + public uint dwID;//ĿID ,Աܶȹ߱ʱΪ0 + public NET_VCA_RECT struRect; //Ŀ߽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + //򻯵ĹϢ, ĻϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RULE_INFO + { + public byte byRuleID;//ID,0-7 + public byte byRes;// + public ushort wEventTypeEx; //Ϊ¼չڴֶdwEventTypeοVCA_RULE_EVENT_TYPE_EX + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName;// + public VCA_EVENT_TYPE dwEventType;//¼ + public NET_VCA_EVENT_UNION uEventParam;//¼ + } + + //ǰ豸ַϢܷDZʾǰ豸ĵַϢ豸ʾĵַ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_DEV_INFO + { + public NET_DVR_IPADDR struDevIP;//ǰ豸ַ + public ushort wPort;//ǰ豸˿ںţ + public byte byChannel;//ǰ豸ͨ + public byte byIvmsChannel;// ֽ + } + + //Ϊϱṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_RULE_ALARM + { + public uint dwSize;//ṹ + public uint dwRelativeTime;//ʱ + public uint dwAbsTime;//ʱ + public NET_VCA_RULE_INFO struRuleInfo;//¼Ϣ + public NET_VCA_TARGET_INFO struTargetInfo;//ĿϢ + public NET_VCA_DEV_INFO struDevInfo;//ǰ豸Ϣ + public uint dwPicDataLen;//ͼƬij Ϊ0ʾûͼƬ0ʾýṹͼƬ*/ + public byte byPicType; //0-ͨͼƬ 1-ԱͼƬ + public byte byRelAlarmPicNum; //ͨͼƬ + public byte bySmart;//IDS豸0(Ĭֵ)Smart Functiom Return 1 + public byte byPicTransType; //ͼƬݴ䷽ʽ: 0-ƣ1-url + public uint dwAlarmID; //IDԱʶͨϱ0ʾЧ + public ushort wDevInfoIvmsChannelEx; //NET_VCA_DEV_INFObyIvmsChannelܱͬʾֵϿͻbyIvmsChannelܼݣ255¿ͻ˰汾ʹwDevInfoIvmsChannelEx + public byte byRelativeTimeFlag; //dwRelativeTimeֶǷЧ 0-Ч 1-ЧdwRelativeTimeʾUTCʱ + public byte byAppendInfoUploadEnabled; //Ϣϴʹ 0-ϴ 1-ϴ + public IntPtr pAppendInfo; //ָ򸽼ϢNET_VCA_APPEND_INFOָ룬byAppendInfoUploadEnabledΪ1ʱbyTimeDiffFlagΪ1ʱЧ + public IntPtr pImage;//ָͼƬָ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SYSTEM_TIME + { + public ushort wYear; // + public ushort wMonth; // + public ushort wDay; // + public ushort wHour; //ʱ + public ushort wMinute; // + public ushort wSecond; // + public ushort wMilliSec; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //豸֧AIƽ̨룬ϴƵ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_AIOP_VIDEO_HEAD + { + public uint dwSize; //dwSize = sizeof(NET_AIOP_VIDEO_HEAD) + public uint dwChannel; //豸ͨͨţ + public NET_DVR_SYSTEM_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szTaskID; //ƵIDƵɷ + public uint dwAIOPDataSize; //ӦAIOPDdataݳ + public uint dwPictureSize; //ӦͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szMPID; //ģͰIDƥAIOPļݽͨURI(GET /ISAPI/Intelligent/AIOpenPlatform/algorithmModel/management?format=json)ȡǰ豸صģͰlabel descriptionϢ + public IntPtr pBufferAIOPData; //AIOPDdata + public IntPtr pBufferPicture;//ӦͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 184, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //豸֧AIƽ̨룬ϴͼƬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_AIOP_PICTURE_HEAD + { + public uint dwSize; //dwSize = sizeof(NET_AIOP_PICTURE_HEAD) + public NET_DVR_SYSTEM_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szPID; //͸·ͼƬIDͼƬɷ + public uint dwAIOPDataSize; //ӦAIOPDdataݳ + public byte byStatus; //״ֵ̬0-ɹ1-ͼƬС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szMPID; //ģͰIDƥAIOPļݽ + public IntPtr pBufferAIOPData;//AIOPDdata + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 184, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_AIOP_POLLING_VIDEO_HEAD + { + public uint dwSize; //dwSize = sizeof(NET_AIOP_POLLING_VIDEO_HEAD) + public uint dwChannel; //豸ͨͨ(SDKЭ) + public NET_DVR_SYSTEM_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szTaskID; //ѯץͼIDѯץͼɷ + public uint dwAIOPDataSize; //ӦAIOPDdataݳ + public uint dwPictureSize; //ӦͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szMPID; //ģͰIDƥAIOPļݽ + public IntPtr pBufferAIOPData;//AIOPDdata + public IntPtr pBufferPicture;//ӦͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 184, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_AIOP_POLLING_SNAP_HEAD + { + public uint dwSize; //dwSize = sizeof(NET_AIOP_POLLING_SNAP_HEAD) + public uint dwChannel; //豸ͨͨ(SDKЭ) + public NET_DVR_SYSTEM_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szTaskID; //ѯץͼIDѯץͼɷ + public uint dwAIOPDataSize; //ӦAIOPDdataݳ + public uint dwPictureSize; //ӦͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] szMPID; //ģͰIDƥAIOPļݽ + public IntPtr pBufferAIOPData;//AIOPDdata + public IntPtr pBufferPicture;//ͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 184, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ΪDSPϢӽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_DRAW_MODE + { + public uint dwSize; + public byte byDspAddTarget;//ǷĿ + public byte byDspAddRule;//Ƿӹ + public byte byDspPicAddTarget;//ץͼǷĿ + public byte byDspPicAddRule;//ץͼǷӹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + // + public enum OBJECT_TYPE_ENUM + { + ENUM_OBJECT_TYPE_COAT = 1 // + } + + //ɫṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OBJECT_COLOR_COND + { + public uint dwChannel; //ͨ + public uint dwObjType; //ͣμOBJECT_TYPE_ENUM + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ͼƬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PIC + { + public byte byPicType; //ͼƬͣ1-jpg + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwPicWidth; //ͼƬ + public uint dwPicHeight; //ͼƬ߶ + public uint dwPicDataLen; //ͼƬʵʴС + public uint dwPicDataBuffLen; //ͼƬݻС + public IntPtr byPicDataBuff; //ͼƬݻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ɫ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OBJECT_COLOR_UNION + { + public NET_DVR_COLOR struColor; //ɫֵ + public NET_DVR_PIC struPicture; //ͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ɫṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OBJECT_COLOR + { + public uint dwSize; //ṹС + public byte byEnable; //0-ã1- + public byte byColorMode; //ȡɫʽ1-ɫֵ2-ͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_OBJECT_COLOR_UNION uObjColor; //ɫ壬ȡֵȡɫʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + // + public enum AREA_TYPE_ENUM + { + ENUM_OVERLAP_REGION = 1,//ͬ + ENUM_BED_LOCATION = 2 //λ + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUXAREA + { + public uint dwAreaType; //ͣμAREA_TYPE_ENUM + public byte byEnable; //0-ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_VCA_POLYGON struPolygon; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //б + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUXAREA_LIST + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AUXAREA_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_AUXAREA[] struArea; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ͨģʽ + public enum CHAN_WORKMODE_ENUM + { + ENUM_CHAN_WORKMODE_INDEPENDENT = 1, //ģʽ + ENUM_CHAN_WORKMODE_MASTER = 2, //ģʽ + ENUM_CHAN_WORKMODE_SLAVE = 3 //ģʽ + } + + //ͨģʽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHANNEL_WORKMODE + { + public uint dwSize; //ṹС + public byte byWorkMode; //ģʽμCHAN_WORKMODE_ENUM + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 63, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //豸ͨṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHANNEL + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byAddress; //豸IP + public ushort wDVRPort; //˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; //û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; // + public uint dwChannel; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ͨϢ + [StructLayout(LayoutKind.Explicit)] + public struct NET_DVR_SLAVE_CHANNEL_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 152, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //С + } + + //ͨṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SLAVE_CHANNEL_PARAM + { + public byte byChanType; //ͨͣ1-ͨ2-Զͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_SLAVE_CHANNEL_UNION uSlaveChannel; //ͨ壬ȡֵbyChanType + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + + //ͨýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SLAVE_CHANNEL_CFG + { + public uint dwSize; //ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SLAVE_CHANNEL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SLAVE_CHANNEL_PARAM[] struChanParam;//ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Ƶϼ¼ + public enum VQD_EVENT_ENUM + { + ENUM_VQD_EVENT_BLUR = 1, //ͼģ + ENUM_VQD_EVENT_LUMA = 2, //쳣 + ENUM_VQD_EVENT_CHROMA = 3, //ͼƫɫ + ENUM_VQD_EVENT_SNOW = 4, //ѩ + ENUM_VQD_EVENT_STREAK = 5, //Ƹ + ENUM_VQD_EVENT_FREEZE = 6, //涳 + ENUM_VQD_EVENT_SIGNAL_LOSS = 7, //źŶʧ + ENUM_VQD_EVENT_PTZ = 8, //̨ʧ + ENUM_VQD_EVENT_SCNENE_CHANGE = 9, //ͻ + ENUM_VQD_EVENT_VIDEO_ABNORMAL = 10, //Ƶ쳣 + ENUM_VQD_EVENT_VIDEO_BLOCK = 11, //Ƶڵ + } + + //Ƶ¼ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VQD_EVENT_COND + { + public uint dwChannel; //ͨ + public uint dwEventType; //¼ͣμVQD_EVENT_ENUM + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Ƶ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VQD_EVENT_PARAM + { + public byte byThreshold; //ֵΧ[0,100] + public byte byTriggerMode; //1-2-δ + public byte byUploadPic; //0-ϴͼƬ1-ϴͼƬǷϴͼƬº󶼿Դ豸ȡ¼ӦµһűͼƬμӿNET_DVR_StartDownload + public byte byRes1; // + public uint dwTimeInterval; //ʱΧ[0,3600] λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //Ƶ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VQD_EVENT_RULE + { + public uint dwSize; //ṹС + public byte byEnable; //0-ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_VQD_EVENT_PARAM struEventParam; //Ƶ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IVMS_IP_CHANNEL, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ1ʾͨ0ʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //׼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BASELINE_SCENE + { + public uint dwSize; //ṹС + public byte byEnable; //0-ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 63, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //׼ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CONTROL_BASELINE_SCENE_PARAM + { + public uint dwSize; //ṹС + public uint dwChannel; //ͨ + public byte byCommand; //ͣ1-ֶαݲʹã2-»׼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 127, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Ƶϱṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VQD_ALARM + { + public uint dwSize; //ṹС + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public uint dwEventType; //¼ͣοVQD_EVENT_ENUM + public float fThreshold; //ֵ[0.000,1.000] + public uint dwPicDataLen; //ͼƬȣΪ0ʾûͼƬ + public IntPtr pImage; //ָͼƬָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //궨ӽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CB_POINT + { + public NET_VCA_POINT struPoint; //궨㣬ǹ + public NET_DVR_PTZPOS struPtzPos; //PTZ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //궨ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRACK_CALIBRATION_PARAM + { + public byte byPointNum; //Ч궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CALIB_PT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CB_POINT[] struCBPoint; //궨 + } + + //ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRACK_CFG + { + public uint dwSize; //ṹ + public byte byEnable; //궨ʹ + public byte byFollowChan; // ƵĴͨ + public byte byDomeCalibrate; //ܸ궨1 0 + public byte byRes; // ֽ + public NET_DVR_TRACK_CALIBRATION_PARAM struCalParam; //궨 + } + + //ģʽ + public enum TRACK_MODE + { + MANUAL_CTRL = 0, //ֶ + ALARM_TRACK // + } + + //ֶƽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MANUAL_CTRL_INFO + { + public NET_VCA_POINT struCtrlPoint; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ģʽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRACK_MODE + { + public uint dwSize; //ṹ + public byte byTrackMode; //ģʽ + public byte byRuleConfMode; //øģʽ0-ø٣1-Զø + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //0 + [StructLayout(LayoutKind.Explicit)] + public struct uModeParam + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] + public uint[] dwULen; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARM_JPEG + { + public byte byPicProType; /*ʱͼƬʽ 0- 1-ϴ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + public NET_DVR_JPEGPARA struPicParam; /*ͼƬṹ*/ + } + + //Ϊṹ + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_ONE_RULE + { + public byte byActive;/* Ƿ񼤻,0-, 0- */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;//Ϊ0ֶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName;// + public VCA_EVENT_TYPE dwEventType;//Ϊ¼ + public NET_VCA_EVENT_UNION uEventParam;//Ϊ¼ + public NET_VCA_SIZE_FILTER struSizeFilter;//ߴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 68, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;/*Ϊ0*/ + } + + // ǹṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_RULECFG + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RULE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_IVMS_ONE_RULE[] struRule; // + } + + // IVMSΪýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_BEHAVIORCFG + { + public uint dwSize; + public byte byPicProType;//ʱͼƬʽ 0- 0-ϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_JPEGPARA struPicParam;//ͼƬṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_IVMS_RULECFG[] struRuleCfg;//ÿʱζӦ + } + + //ܷȡƻӽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_DEVSCHED + { + public NET_DVR_SCHEDTIME struTime;//ʱ + public NET_DVR_PU_STREAM_CFG struPUStream;//ǰȡ + } + + //ܷDzýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_STREAMCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_IVMS_DEVSCHED[] struDevSched;//ʱǰȡԼϢ + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_MASK_REGION + { + public byte byEnable;//Ƿ񼤻, 0-񣬷0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//0 + public NET_VCA_POLYGON struPolygon;//ζ + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_MASK_REGION_LIST + { + public uint dwSize;//ṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_MASK_REGION_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_MASK_REGION[] struMask;// + } + + //ATM + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_ENTER_REGION + { + public uint dwSize; + public byte byEnable;//Ƿ񼤻0-񣬷0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_VCA_POLYGON struPolygon;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //IVMS + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_MASK_REGION_LIST + { + public uint dwSize;//ṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_MASK_REGION_LIST[] struList; + } + + //IVMSATM + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_ENTER_REGION + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_ENTER_REGION[] struEnter;// + } + + // ivms ͼƬϴṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_ALARM_JPEG + { + public byte byPicProType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_JPEGPARA struPicParam; + } + + // IVMS + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_IVMS_SEARCHCFG + { + public uint dwSize; + public NET_DVR_MATRIX_DEC_REMOTE_PLAY struRemotePlay;// Զ̻ط + public NET_IVMS_ALARM_JPEG struAlarmJpeg;// ϴͼƬ + public NET_IVMS_RULECFG struRuleCfg;//IVMS Ϊ + } + + /************************************end******************************************/ + //NAS֤ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IDENTIFICATION_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /* û 32*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /* 16*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_MOUNT_PARAM_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 52, ArraySubType = UnmanagedType.I1)] + public byte[] uLen; //ṹС + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NAS_MOUNT_PARAM + { + public byte byMountType; //0,1~NFS, 2~ SMB/CIFS + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_MOUNT_PARAM_UNION uMountParam; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_MOUNTMETHOD_PARAM_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 56, ArraySubType = UnmanagedType.I1)] + public byte[] uLen; //ṹС + } + + //Ӳ̽ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLE_NET_DISK_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + public NET_DVR_IPADDR struNetDiskAddr;//Ӳ̵ַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PATHNAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDirectory;// PATHNAME_LEN = 128 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 68, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;// + } + + public const int MAX_NET_DISK = 16; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NET_DISKCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NET_DISK, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_NET_DISK_INFO[] struNetDiskParam; + } + + //¼ + // + public enum MAIN_EVENT_TYPE + { + EVENT_MOT_DET = 0,//ƶ + EVENT_ALARM_IN = 1,// + EVENT_VCA_BEHAVIOR = 2,//Ϊ + EVENT_INQUEST = 3, //Ѷ¼ + EVENT_VCA_DETECTION = 4, // + EVENT_STREAM_INFO = 100 //IDϢ + } + + public const int INQUEST_START_INFO = 0x1001; /*ѶʿʼϢ*/ + public const int INQUEST_STOP_INFO = 0x1002; /*ѶֹͣϢ*/ + public const int INQUEST_TAG_INFO = 0x1003; /*صϢ*/ + public const int INQUEST_SEGMENT_INFO = 0x1004; /*ѶƬ״̬Ϣ*/ + + public enum VCA_DETECTION_MINOR_TYPE:uint + { + EVENT_VCA_TRAVERSE_PLANE = 1, //Խ + EVENT_FIELD_DETECTION, // + EVENT_AUDIO_INPUT_ALARM, //Ƶ쳣 + EVENT_SOUND_INTENSITY_ALARM, //ǿͻ + EVENT_FACE_DETECTION, // + EVENT_VIRTUAL_FOCUS_ALARM, /*齹*/ + EVENT_SCENE_CHANGE_ALARM, /**/ + EVENT_ALL = 0xffffffff //ʾȫ + } + + //ΪͶӦĴͣ 0xffffʾȫ + public enum BEHAVIOR_MINOR_TYPE + { + EVENT_TRAVERSE_PLANE = 0,// Խ, + EVENT_ENTER_AREA,//Ŀ,֧ + EVENT_EXIT_AREA,//Ŀ뿪,֧ + EVENT_INTRUSION,// ܽ,֧ + EVENT_LOITER,//ǻ,֧ + EVENT_LEFT_TAKE,//,֧ + EVENT_PARKING,//ͣ,֧ + EVENT_RUN,//,֧ + EVENT_HIGH_DENSITY,//Աܶ,֧ + EVENT_STICK_UP,//ֽ,֧ + EVENT_INSTALL_SCANNER,//װ,֧ + EVENT_OPERATE_OVER_TIME, // ʱ + EVENT_FACE_DETECT, // 쳣 + EVENT_LEFT, // Ʒ + EVENT_TAKE, // Ʒȡ + EVENT_LEAVE_POSITION, //¼ + EVENT_TRAIL_INFO = 16, //β + EVENT_FALL_DOWN_INFO = 19, // + EVENT_OBJECT_PASTE = 20, // ճ + EVENT_FACE_CAPTURE_INFO = 21, // + EVENT_MULTI_FACES_INFO = 22, // + EVENT_AUDIO_ABNORMAL_INFO = 23, //ǿͻ + EVENT_DETECT = 24 // + } + + // 100ӦС + public enum STREAM_INFO_MINOR_TYPE + { + EVENT_STREAM_ID = 0, // ID + EVENT_TIMING = 1, // ʱ¼ + EVENT_MOTION_DETECT = 2, // ƶ + EVENT_ALARM = 3, // ¼ + EVENT_ALARM_OR_MOTION_DETECT = 4, // ƶ + EVENT_ALARM_AND_MOTION_DETECT = 5, // ƶ + EVENT_COMMAND_TRIGGER = 6, //  + EVENT_MANNUAL = 7, // ֶ¼ + EVENT_BACKUP_VOLUME = 8 // 浵¼ + } + + //ŵCVR + public const int MAX_ID_COUNT = 256; + public const int MAX_STREAM_ID_COUNT = 1024; + public const int STREAM_ID_LEN = 32; + public const int PLAN_ID_LEN = 32; + + // Ϣ - 72ֽڳ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STREAM_INFO + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = STREAM_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byID; //ID + public uint dwChannel; //豸ͨ0xffffffffʱʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public void Init() + { + byID = new byte[STREAM_ID_LEN]; + byRes = new byte[32]; + } + } + + //¼ 200-04-07 9000_1.1 + public const int SEARCH_EVENT_INFO_LEN = 300; + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_ALARM_BYBIT + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmInNo;//ţbyAlarmInNo[0]1ʾɱ1¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SEARCH_EVENT_INFO_LEN - MAX_ALARMIN_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + byAlarmInNo = new byte[MAX_ALARMIN_V30]; + byRes = new byte[SEARCH_EVENT_INFO_LEN - MAX_CHANNUM_V30]; + } + } + + // ֵʾ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_ALARM_BYVALUE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.U2)] + public ushort[] wAlarmInNo;//ţbyAlarmInNo[0]1ʾɱ1¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + wAlarmInNo = new ushort[128]; + byRes = new byte[44]; + } + } + + //ƶ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_MOTION_BYBIT + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byMotDetChanNo;//ƶͨbyMotDetChanNo[0]1ʾͨ1ƶⴥ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SEARCH_EVENT_INFO_LEN - MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + byMotDetChanNo = new byte[MAX_CHANNUM_V30]; + byRes = new byte[SEARCH_EVENT_INFO_LEN - MAX_CHANNUM_V30]; + } + } + + //ƶ--ֵ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_MOTION_BYVALUE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.U2)] + public ushort[] wMotDetChanNo;//ţbyAlarmInNo[0]1ʾɱ1¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 172, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + wMotDetChanNo = new ushort[64]; + byRes = new byte[172]; + } + } + + //Ϊ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_VCA_BYBIT + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byChanNo;//¼ͨ + public byte byRuleID;//ID0xffʾȫ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 235, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + + public void init() + { + byChanNo = new byte[MAX_CHANNUM_V30]; + byRes1 = new byte[235]; + } + } + + //Ϊ--ֵʽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_VCA_BYVALUE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.U2)] + public ushort[] wChanNo; //¼ͨ + public byte byRuleID; //Ϊͣ0xffʾȫ0ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 171, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /**/ + public void init() + { + wChanNo = new ushort[64]; + byRes = new byte[171]; + } + } + + //Ѷ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_INQUEST_PARAM + { + public byte byRoomIndex; //Ѷұ,1ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 299, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public void init() + { + byRes = new byte[299]; + } + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_VCADETECT_BYBIT + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byChan;//ͨţ±ʾbyChan[0]1ʾͨ1ƶⴥ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public void init() + { + byChan = new byte[256]; + byRes = new byte[44]; + } + } + + // ͨŰֵʾ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_VCADETECT_BYVALUE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30-1, ArraySubType = UnmanagedType.U4)] + public uint[] dwChanNo;// ͨ,ֵʾ0xffffffffЧҺҲʾЧֵ + public byte byAll;//0-ʾȫ1-ʾȫ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 47, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + dwChanNo = new uint[MAX_CHANNUM_V30 - 1]; + byRes = new byte[47]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_STREAMID_PARAM + { + public NET_DVR_STREAM_INFO struIDInfo; // idϢ72ֽڳ + public uint dwCmdType; // ⲿͣNVRƴ洢ʹ + public byte byBackupVolumeNum; //浵ţCVRʹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 223, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + struIDInfo.Init(); + byRes = new byte[223]; + } + } + + [StructLayout(LayoutKind.Explicit)] + public struct SEARCH_EVENT_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SEARCH_EVENT_INFO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLen; + /* [FieldOffsetAttribute(0)] + public EVENT_ALARM_BYBIT struAlarmParam; + [FieldOffsetAttribute(0)] + public EVENT_ALARM_BYVALUE struAlarmParamByValue; + [FieldOffsetAttribute(0)] + public EVENT_MOTION_BYBIT struMotionParam; + [FieldOffsetAttribute(0)] + public EVENT_MOTION_BYVALUE struMotionParamByValue; + [FieldOffsetAttribute(0)] + public EVENT_VCA_BYBIT struVcaParam; + [FieldOffsetAttribute(0)] + public EVENT_VCA_BYVALUE struVcaParamByValue; + [FieldOffsetAttribute(0)] + public EVENT_INQUEST_PARAM struInquestParam; + [FieldOffsetAttribute(0)] + public EVENT_VCADETECT_BYBIT struVCADetectByBit; + [FieldOffsetAttribute(0)] + public EVENT_VCADETECT_BYVALUE struVCADetectByValue; + [FieldOffsetAttribute(0)] + public EVENT_STREAMID_PARAM struStreamIDParam; + * */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SEARCH_EVENT_PARAM + { + public ushort wMajorType;//0-ƶ⣬1-, 2-¼ + public ushort wMinorType;//- ͱ仯0xffffʾȫ + public NET_DVR_TIME struStartTime;//Ŀʼʱ䣬ֹͣʱ: ͬʱΪ(0, 0) ʾʱ俪ʼǰ4000¼ + public NET_DVR_TIME struEndTime; + public byte byLockType; // 0xff-ȫ0-δ1- + public byte byValue; //0-λʾ1-ֵʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 130, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + public SEARCH_EVENT_UNION uSeniorPara; + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_ALARM_RET + { + public uint dwAlarmInNo;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SEARCH_EVENT_INFO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + byRes = new byte[SEARCH_EVENT_INFO_LEN]; + } + } + //ƶ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_MOTION_RET + { + public uint dwMotDetNo;//ƶͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SEARCH_EVENT_INFO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + byRes = new byte[SEARCH_EVENT_INFO_LEN]; + } + } + //Ϊ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_VCA_RET + { + public uint dwChanNo;//¼ͨ + public byte byRuleID;//ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName;// + public NET_VCA_EVENT_UNION uEvent;//Ϊ¼wMinorType = VCA_EVENT_TYPE¼ + + public void init() + { + byRes1 = new byte[3]; + byRuleName = new byte[NAME_LEN]; + } + } + + //Ѷ¼ѯ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_INQUEST_RET + { + public byte byRoomIndex; //Ѷұ,1ʼ + public byte byDriveIndex; //¼,1ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwSegmentNo; //ƬڱѶе,1ʼ + public ushort wSegmetSize; //ƬϵĴС, λM + public ushort wSegmentState; //Ƭ״̬ 0 ¼1 ¼쳣2 ¼Ѷ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 288, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + + public void init() + { + byRes1 = new byte[6]; + byRes2 = new byte[288]; + } + } + + //id¼ѯ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct EVENT_STREAMID_RET + { + public uint dwRecordType; //¼ 0-ʱ¼ 1-ƶ 2-¼ 3-|ƶ 4-&ƶ 5- 6-ֶ¼ 7-𶯱 8- 9-ܱ 10-ش¼ + public uint dwRecordLength; //¼С + public byte byLockFlag; // ־ 0û 1 + public byte byDrawFrameType; // 0dz֡¼ 1֡¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byFileName; //ļ + public uint dwFileIndex; // 浵ϵļ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void init() + { + byRes1 = new byte[2]; + byFileName = new byte[NAME_LEN]; + byRes = new byte[256]; + } + } + + [StructLayout(LayoutKind.Explicit)] + public struct SEARCH_EVENT_RET + { + [FieldOffset(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 304, ArraySubType = UnmanagedType.I1)] + public byte[] byEventRetUnion; + /* + [FieldOffset(0)] + public EVENT_ALARM_RET struAlarmRet; + [FieldOffset(0)] + public EVENT_MOTION_RET struMotionRet; + [FieldOffset(0)] + public EVENT_VCA_RET struVcaRet; + [FieldOffset(0)] + public EVENT_INQUEST_RET struInquestRet; + [FieldOffset(0)] + public EVENT_STREAMID_RET struStreamIDRet; + * */ + } + //ҷؽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SEARCH_EVENT_RET + { + public ushort wMajorType;//MA + public ushort wMinorType;// + public NET_DVR_TIME struStartTime;//¼ʼʱ + public NET_DVR_TIME struEndTime;//¼ֹͣʱ䣬¼ʱͿʼʱһ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byChan; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 36, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public SEARCH_EVENT_RET uSeniorRet; + + public void init() + { + byChan = new byte[MAX_CHANNUM_V30]; + byRes = new byte[36]; + } + } + + //SDK_V35 2009-10-26 + + // 궨 + public enum tagCALIBRATE_TYPE + { + PDC_CALIBRATE = 0x01, // PDC 궨 + BEHAVIOR_OUT_CALIBRATE = 0x02, //Ϊⳡ궨 + BEHAVIOR_IN_CALIBRATE = 0x03, // Ϊڳ궨 + ITS_CALBIRETE = 0x04 // ͨ¼궨 + } + + public const int MAX_RECT_NUM = 6; + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECT_LIST + { + public byte byRectNum; // οĸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RECT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_RECT[] struVcaRect; // Ϊ6Rect + } + + // PDC 궨 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_CALIBRATION + { + public NET_DVR_RECT_LIST struRectList; // 궨οб + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 120, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + // 궨ߵʾǰ궨ʵʱʾǸ߶߻dzߡ + public enum LINE_MODE + { + HEIGHT_LINE, //߶ + LENGTH_LINE // + } + /*ñ궨ϢʱӦλʹܣزûʹܣ궨Իȡص*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAMERA_PARAM + { + public byte byEnableHeight; // Ƿʹ߶ + public byte byEnableAngle; // ǷʹǶ + public byte byEnableHorizon; // Ƿʹƽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + public float fCameraHeight; // ߶ + public float fCameraAngle; // Ƕ + public float fHorizon; // еĵƽ + } + + /*fValueʾĿ߶ȵʱstruStartPointstruEndPointֱʾĿͷͽŲ㡣 + * fValueʾ߶γȵʱstruStartPointstruEndPointֱʾ߶ʼյ㣬 + * modeʾǰ߱ʾ߶߻dzߡ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LINE_SEGMENT + { + public byte byLineMode; // LINE_MODE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + public NET_VCA_POINT struStartPoint; + public NET_VCA_POINT struEndPoint; + public float fValue; + } + + public const int MAX_LINE_SEG_NUM = 8; + + /*궨ĿǰҪ4-8ߣԻȡز*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BEHAVIOR_OUT_CALIBRATION + { + public uint dwLineSegNum; // ߸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LINE_SEG_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_LINE_SEGMENT[] struLineSegment; // + public NET_DVR_CAMERA_PARAM struCameraParam; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*ýṹʾIASܿ궨аһĿһӦĸ߶ȱ궨ߣ + * ĿΪվӾο򣻸߶ʶͷ㵽ŵı궨ߣùһʾ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IN_CAL_SAMPLE + { + public NET_VCA_RECT struVcaRect; // Ŀ + public NET_DVR_LINE_SEGMENT struLineSegment; // ߶ȱ궨 + } + + public const int MAX_SAMPLE_NUM = 5; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BEHAVIOR_IN_CALIBRATION + { + public uint dwCalSampleNum; // 궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SAMPLE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IN_CAL_SAMPLE[] struCalSample; // 궨 + public NET_DVR_CAMERA_PARAM struCameraParam; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int CALIB_PT_NUM = 4; + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ITS_CALIBRATION + { + public uint dwPointNum; //궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CALIB_PT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_POINT[] struPoint; //ͼ + public float fWidth; + public float fHeight; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + } + + // 궨 + // ر궨Էڸýṹ + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_CALIBRATION_PRARM_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 240, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ṹС + /*[FieldOffsetAttribute(0)] + public NET_DVR_PDC_CALIBRATION struPDCCalibration; //PDC 궨 + [FieldOffsetAttribute(0)] + public NET_DVR_BEHAVIOR_OUT_CALIBRATION struBehaviorOutCalibration; // Ϊⳡ궨 ҪӦIVS + [FieldOffsetAttribute(0)] + public NET_DVR_BEHAVIOR_IN_CALIBRATION struBehaviorInCalibration; // Ϊڳ궨ҪӦIAS + [FieldOffsetAttribute(0)] + public NET_DVR_ITS_CALIBRATION struITSCalibration; + * */ + } + + // 궨ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CALIBRATION_CFG + { + public uint dwSize; //궨ṹС + public byte byEnable; // Ƿñ궨 + public byte byCalibrationType; // 궨 ݲͬѡͬı궨 οCALIBRATE_TYPE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_CALIBRATION_PRARM_UNION uCalibrateParam; // 궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ͳƷṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_ENTER_DIRECTION + { + public NET_VCA_POINT struStartPoint; //ͳƷʼ + public NET_VCA_POINT struEndPoint; // ͳƷ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_RULE_CFG + { + public uint dwSize; //ṹС + public byte byEnable; // Ƿ񼤻; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_VCA_POLYGON struPolygon; // + public NET_DVR_PDC_ENTER_DIRECTION struEnterDirection; // 뷽 + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_RULE_CFG_V41 + { + public uint dwSize; //ṹС + public byte byEnable; // Ƿ񼤻; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_VCA_POLYGON struPolygon; // + public NET_DVR_PDC_ENTER_DIRECTION struEnterDirection; // 뷽 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME struAlarmTime;//ʱ + public NET_DVR_TIME_EX struDayStartTime; //쿪ʼʱ䣬ʱЧ + public NET_DVR_TIME_EX struNightStartTime; //ҹʼʱ䣬ʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ðϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRIAL_VERSION_CFG + { + public uint dwSize; + public ushort wReserveTime; //ʣʱ䣬0xffffʾЧλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 62, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SYN_CHANNEL_NAME_PARAM + { + public uint dwSize; + public uint dwChannel; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIME_SEGMENT + { + public NET_DVR_SIMPLE_DAYTIME struBeginTime; //begin time + public NET_DVR_SIMPLE_DAYTIME struEndTime; //end time + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLE_PLAN_SEGMENT + { + public byte byEnable; //whether to enable, 1-enable, 0-disable + public byte byDoorStatus; //door status(control ladder status),0-invaild, 1-always open(free), 2-always close(forbidden), 3-ordinary status(used by door plan) + public byte byVerifyMode; //verify method, 0-invaild, 1-swipe card, 2-swipe card +password(used by card verify ) 3-swipe card(used by card verify) 4-swipe card or password(used by card verify) + //5-fingerprint, 6-fingerprint and passwd, 7-fingerprint or swipe card, 8-fingerprint and swipe card, 9-fingerprint and passwd and swipe card, + //10-face or finger print or swipe card or password,11-face and finger print,12-face and password,13-face and swipe card,14-face,15-employee no and password, + //16-finger print or password,17-employee no and finger print,18-employee no and finger print and password, + //19-face and finger print and swipe card,20-face and password and finger print,21-employee no and face,22-face or face and swipe card + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_TIME_SEGMENT struTimeSegment; //time segment parameter + + public void Init() + { + byRes = new byte[5]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WEEK_PLAN_CFG + { + public uint dwSize; + public byte byEnable; //whether to enable, 1-enable, 0-disable + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_PLAN_SEGMENT[] struPlanCfg; //week plan parameter + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + + public void Init() + { + struPlanCfg = new NET_DVR_SINGLE_PLAN_SEGMENT[MAX_DAYS * MAX_TIMESEGMENT_V30]; + foreach (NET_DVR_SINGLE_PLAN_SEGMENT singlStruPlanCfg in struPlanCfg) + { + singlStruPlanCfg.Init(); + } + byRes1 = new byte[3]; + byRes2 = new byte[16]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_PLAN_CFG + { + public uint dwSize; + public byte byEnable; //whether to enable, 1-enable, 0-disable + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_DATE struBeginDate; //holiday begin date + public NET_DVR_DATE struEndDate; //holiday end date + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SINGLE_PLAN_SEGMENT[] struPlanCfg; //time segment parameter + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + public byte[] byRes2; + + public void Init() + { + struPlanCfg = new NET_DVR_SINGLE_PLAN_SEGMENT[MAX_TIMESEGMENT_V30]; + foreach (NET_DVR_SINGLE_PLAN_SEGMENT singlStruPlanCfg in struPlanCfg) + { + singlStruPlanCfg.Init(); + } + byRes1 = new byte[3]; + byRes2 = new byte[16]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_GROUP_CFG + { + public uint dwSize; + public byte byEnable; //whether to enable, 1-enable, 0-disable + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = HOLIDAY_GROUP_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byGroupName; //holiday group name + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_HOLIDAY_PLAN_NUM, ArraySubType = UnmanagedType.U4)] + public uint[] dwHolidayPlanNo; //holiday plan No. fill in from the front side, invalid when meet zero. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + + public void Init() + { + byGroupName = new byte[HOLIDAY_GROUP_NAME_LEN]; + dwHolidayPlanNo = new uint[MAX_HOLIDAY_PLAN_NUM]; + byRes1 = new byte[3]; + byRes2 = new byte[32]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLAN_TEMPLATE + { + public uint dwSize; + public byte byEnable; //whether to enable, 1-enable, 0-disable + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = TEMPLATE_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byTemplateName; //template name + public uint dwWeekPlanNo; //week plan no. 0 invalid + [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_HOLIDAY_GROUP_NUM, ArraySubType = UnmanagedType.U4)] + public uint[] dwHolidayGroupNo; //holiday group. fill in from the front side, invalid when meet zero. + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + + public void Init() + { + byTemplateName = new byte[TEMPLATE_NAME_LEN]; + dwHolidayGroupNo = new uint[MAX_HOLIDAY_GROUP_NUM]; + byRes1 = new byte[3]; + byRes2 = new byte[32]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_PLAN_COND + { + public uint dwSize; + public uint dwHolidayPlanNumber; //Holiday plan number + public ushort wLocalControllerID; //On the controller serial number [1, 64] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 106, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void Init() + { + byRes = new byte[106]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WEEK_PLAN_COND + { + public uint dwSize; + public uint dwWeekPlanNumber; //Week plan number + public ushort wLocalControllerID; //On the controller serial number [1, 64] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 106, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes = new byte[106]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_GROUP_COND + { + public uint dwSize; + public uint dwHolidayGroupNumber; //Holiday group number + public ushort wLocalControllerID; //On the controller serial number [1, 64] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 106, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes = new byte[106]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLAN_TEMPLATE_COND + { + public uint dwSize; + public uint dwPlanTemplateNumber; //Plan template number, starting from 1, the maximum value from the entrance guard capability sets + public ushort wLocalControllerID; //On the controller serial number[1,64], 0 is invalid + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 106, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes = new byte[106]; + } + } + + + public const int MAX_TIMESEGMENT_V30 = 8; //Maximum number of time segments in 9000 DVR's guard schedule + public const int HOLIDAY_GROUP_NAME_LEN = 32; //holiday group name len + public const int MAX_HOLIDAY_PLAN_NUM = 16; //holiday max plan number + public const int TEMPLATE_NAME_LEN = 32; //plan template name len + public const int MAX_HOLIDAY_GROUP_NUM = 16; //plan template max group number + + public const int NET_DVR_GET_WEEK_PLAN_CFG = 2100; //get door status week plan config + public const int NET_DVR_SET_WEEK_PLAN_CFG = 2101; //set door status week plan config + public const int NET_DVR_GET_DOOR_STATUS_HOLIDAY_PLAN = 2102; //get door status holiday week plan config + public const int NET_DVR_SET_DOOR_STATUS_HOLIDAY_PLAN = 2103; //set door status holiday week plan config + public const int NET_DVR_GET_DOOR_STATUS_HOLIDAY_GROUP = 2104; //get door holiday group parameter + public const int NET_DVR_SET_DOOR_STATUS_HOLIDAY_GROUP = 2105; //set door holiday group parameter + public const int NET_DVR_GET_DOOR_STATUS_PLAN_TEMPLATE = 2106; //get door status plan template parameter + public const int NET_DVR_SET_DOOR_STATUS_PLAN_TEMPLATE = 2107; //set door status plan template parameter + public const int NET_DVR_GET_VERIFY_WEEK_PLAN = 2124; //get reader card verfy week plan + public const int NET_DVR_SET_VERIFY_WEEK_PLAN = 2125; //set reader card verfy week plan + public const int NET_DVR_GET_CARD_RIGHT_WEEK_PLAN = 2126; //get card right week plan + public const int NET_DVR_SET_CARD_RIGHT_WEEK_PLAN = 2127; //set card right week plan + public const int NET_DVR_GET_VERIFY_HOLIDAY_PLAN = 2128; //get card reader verify holiday plan + public const int NET_DVR_SET_VERIFY_HOLIDAY_PLAN = 2129; //set card reader verify holiday plan + public const int NET_DVR_GET_CARD_RIGHT_HOLIDAY_PLAN = 2130; //get card right holiday plan + public const int NET_DVR_SET_CARD_RIGHT_HOLIDAY_PLAN = 2131; //set card right holiday plan + public const int NET_DVR_GET_VERIFY_HOLIDAY_GROUP = 2132; //get card reader verify holiday group + public const int NET_DVR_SET_VERIFY_HOLIDAY_GROUP = 2133; //set card reader verify holiday group + public const int NET_DVR_GET_CARD_RIGHT_HOLIDAY_GROUP = 2134; //get card right holiday group + public const int NET_DVR_SET_CARD_RIGHT_HOLIDAY_GROUP = 2135; //set card right holiday group + public const int NET_DVR_GET_VERIFY_PLAN_TEMPLATE = 2136; //get card reader verify plan template + public const int NET_DVR_SET_VERIFY_PLAN_TEMPLATE = 2137; //set card reader verify plan template + public const int NET_DVR_GET_CARD_RIGHT_PLAN_TEMPLATE = 2138; //get card right plan template + public const int NET_DVR_SET_CARD_RIGHT_PLAN_TEMPLATE = 2139; //set card right plan template + // V50 + public const int NET_DVR_GET_CARD_RIGHT_WEEK_PLAN_V50 = 2304; //Access card right V50 weeks plan parameters + public const int NET_DVR_SET_CARD_RIGHT_WEEK_PLAN_V50 = 2305; //Set card right V50 weeks plan parameters + public const int NET_DVR_GET_CARD_RIGHT_HOLIDAY_PLAN_V50 = 2310; //Access card right parameters V50 holiday plan + public const int NET_DVR_SET_CARD_RIGHT_HOLIDAY_PLAN_V50 = 2311; //Set card right parameters V50 holiday plan + public const int NET_DVR_GET_CARD_RIGHT_HOLIDAY_GROUP_V50 = 2316; //Access card right parameters V50 holiday group + public const int NET_DVR_SET_CARD_RIGHT_HOLIDAY_GROUP_V50 = 2317; //Set card right parameters V50 holiday group + public const int NET_DVR_GET_CARD_RIGHT_PLAN_TEMPLATE_V50 = 2322; //Access card right parameters V50 plan template + public const int NET_DVR_SET_CARD_RIGHT_PLAN_TEMPLATE_V50 = 2323; //Set card right parameters V50 plan template + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RESET_COUNTER_CFG + { + public uint dwSize; + public byte byEnable; //Ƿã0-ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_TIME_EX[] struTime;//ʱ䣬ʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VCA_CTRLINFO_COND + { + public uint dwSize; + public NET_DVR_STREAM_INFO struStreamInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VCA_CTRLINFO_CFG + { + public uint dwSize; + public byte byVCAEnable; //Ƿ + public byte byVCAType; //ͣVCA_CHAN_ABILITY_TYPE + public byte byStreamWithVCA; //ǷϢ + public byte byMode; //ģʽATM ʱVCA_CHAN_MODE_TYPE ,TFS ʱ TFS_CHAN_MODE_TYPEΪʱBEHAVIOR_SCENE_MODE_TYPE + public byte byControlType; //ͣλʾ0-1- + //byControlType &1 ǷץĹ + //byControlType &2 Ƿǰ豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 83, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //Ϊ0 + } + + /*ͳƲ Ϊڲؼֲ + * HUMAN_GENERATE_RATE + * ĿٶȲPDCĿٶȡٶԽ죬ĿԽɡ + * ƵϲԱȶȽϵʱõĹСʱӦӿĿٶȣ Ŀ©죻 + * ƵжԱȶȽϸʱ߹ϴʱӦýĿٶȣԼ졣 + * ĿٶȲ51ٶ5죬ĬϲΪ3 + * + * DETECT_SENSITIVE + * ĿȿƲPDCһ򱻼ΪĿȡ + * ԽߣԽױΪĿ꣬ԽԽѼΪĿꡣ + * ƵϲԱȶȽϵʱӦ߼ȣ Ŀ©죻 + * ƵжԱȶȽϸʱӦýͼȣԼ졣 + * Ӧ51ͣ5ߣĬϼΪ3 + * + * TRAJECTORY_LEN + * 켣ɳȿƲʾɹ켣ʱҪĿλء + * Ӧ51ɳ켣5ɳ̣켣죬ĬϼΪ3 + * + * TRAJECT_CNT_LEN + * 켣ȿƲʾ켣ʱҪĿλء + * Ӧ51Ҫ󳤶켣5Ҫ󳤶̣켣죬ĬϼΪ3 + * + * PREPROCESS + * ͼԤƲ0 - 1 - ĬΪ0 + * + * CAMERA_ANGLE + * Ƕ 0 - б 1 - ֱĬΪ0 + */ + + public enum PDC_PARAM_KEY + { + HUMAN_GENERATE_RATE = 50, // Ŀٶ 50ʼ + DETECT_SENSITIVE = 51, // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_TARGET_INFO + { + public uint dwTargetID; // Ŀid + public NET_VCA_RECT struTargetRect; // Ŀ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_TARGET_IN_FRAME + { + public byte byTargetNum; //Ŀ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] yRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TARGET_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PDC_TARGET_INFO[] struTargetInfo; //ĿϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //֡ͳƽʱʹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_STATFRAME + { + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 92, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_STATTIME + { + public NET_DVR_TIME tmStart; // ͳʼʱ + public NET_DVR_TIME tmEnd; // ͳƽʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 92, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_PDCPARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 140, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_ALRAM_INFO + { + public uint dwSize; // PDCϴṹС + public byte byMode; // 0 ֡ͳƽ 1Сʱͳƽ + public byte byChannel; // ϴͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public UNION_PDCPARAM uStatModeParam; + public uint dwLeaveNum; // 뿪 + public uint dwEnterNum; // + public byte byBrokenNetHttp; //־λ0-شݣ1-ش + public byte byRes3; + public ushort wDevInfoIvmsChannelEx; //NET_VCA_DEV_INFObyIvmsChannelܱͬʾֵϿͻbyIvmsChannelܼݣ255¿ͻ˰汾ʹwDevInfoIvmsChannelEx + public uint dwPassingNum; // ǻûд롢뿪 + public uint dwChildLeaveNum; // С뿪 + public uint dwChildEnterNum; // С + public uint dwDuplicatePeople; // ظ + public uint dwXmlLen;//XML͸ݳ, EventNotificationAlert XML Blockݳ + public IntPtr pXmlBuf; // XMLϢָ,XMLӦEventNotificationAlert XML Block + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //Ϣѯ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PDC_QUERY + { + public NET_DVR_TIME tmStart; + public NET_DVR_TIME tmEnd; + public uint dwLeaveNum; + public uint dwEnterNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZ_POSITION + { + // ǷóóΪʱֶЧóλϢʱΪʹλ + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPtzPositionName; //λ + public NET_DVR_PTZPOS struPtzPos; //ptz + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POSITION_RULE_CFG + { + public uint dwSize; // ṹС + public NET_DVR_PTZ_POSITION struPtzPosition; // λϢ + public NET_VCA_RULECFG struVcaRuleCfg; //Ϊ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 80, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POSITION_RULE_CFG_V41 + { + public uint dwSize; // ṹС + public NET_DVR_PTZ_POSITION struPtzPosition; // λϢ + public NET_VCA_RULECFG_V41 struVcaRuleCfg; //Ϊ + public byte byTrackEnable; //Ƿø + public byte byRes1; + public ushort wTrackDuration; //ٳʱ䣬λs + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 76, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LIMIT_ANGLE + { + public byte byEnable; // Ƿóλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_PTZPOS struUp; // λ + public NET_DVR_PTZPOS struDown; // λ + public NET_DVR_PTZPOS struLeft; // λ + public NET_DVR_PTZPOS struRight; // λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POSITION_INDEX + { + public byte byIndex; // + public byte byRes1; + public ushort wDwell; // ͣʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + public const int MAX_POSITION_NUM = 10; + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POSITION_TRACK_CFG + { + public uint dwSize; + public byte byNum; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_POSITION_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_POSITION_INDEX[] struPositionIndex; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //Ѳ·Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PATROL_SCENE_INFO + { + public ushort wDwell; // ͣʱ 30-300 + public byte byPositionID; // 1-10Ĭ0ʾѲ㲻ӳ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ѲϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PATROL_TRACKCFG + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PATROL_SCENE_INFO[] struPatrolSceneInfo; // Ѳ· + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ع˵ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRACK_PARAMCFG + { + public uint dwSize; // ṹС + public ushort wAlarmDelayTime; // ʱʱ䣬Ŀǰֻ֧ȫ Χ1-120 + public ushort wTrackHoldTime; // ٳʱ Χ0-300 + public byte byTrackMode; // IPDOME_TRACK_MODE + public byte byPreDirection; // ٷԤ 0- 1- + public byte byTrackSmooth; // 0- 1- + public byte byZoomAdjust; // ϵ μ± + public byte byMaxTrackZoom; //ٱϵ,0-ʾĬϱϵ,ȼ6-궨ֵ*1.0(Ĭ),1-5ΪС궨ֵֵԽССıԽ,7-15ΪŴֵԽ󣬷ŴıԽ + public byte byStopTrackWhenFindFace; //⵽Ƿֹͣ 0- 1- + public byte byStopTrackThreshold; //ֵֹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //о + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DOME_MOVEMENT_PARAM + { + public ushort wMaxZoom; // ϵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 42, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + /********************************ܽͨ¼ begin****************************************/ + public const int MAX_REGION_NUM = 8; // бĿ + public const int MAX_TPS_RULE = 8; // Ŀ + public const int MAX_AID_RULE = 8; // ¼Ŀ + public const int MAX_LANE_NUM = 8; // 󳵵Ŀ + + //ͨ¼ + public enum TRAFFIC_AID_TYPE + { + CONGESTION = 0x01, //ӵ + PARKING = 0x02, //ͣ + INVERSE = 0x04, // + PEDESTRIAN = 0x08, // + DEBRIS = 0x10, // Ƭ + SMOKE = 0x20, // + OVERLINE = 0x40, //ѹ + VEHICLE_CONTROL_LIST = 0x80, //ֹ + SPEED = 0x100 // + } + + public enum TRAFFIC_SCENE_MODE + { + FREEWAY = 0, // ٻⳡ + TUNNEL, // + BRIDGE // + } + + public enum ITS_ABILITY_TYPE + { + ITS_CONGESTION_ABILITY = 0x01, //ӵ + ITS_PARKING_ABILITY = 0x02, //ͣ + ITS_INVERSE_ABILITY = 0x04, // + ITS_PEDESTRIAN_ABILITY = 0x08, // + ITS_DEBRIS_ABILITY = 0x10, // Ƭ + ITS_SMOKE_ABILITY = 0x20, //- + ITS_OVERLINE_ABILITY = 0x40, //ѹ + ITS_VEHICLE_CONTROL_LIST_ABILITY = 0x80, //ֹ + ITS_SPEED_ABILITY = 0x100, // + ITS_LANE_VOLUME_ABILITY = 0x010000, // + ITS_LANE_VELOCITY_ABILITY = 0x020000, //ƽٶ + ITS_TIME_HEADWAY_ABILITY = 0x040000, //ͷʱ + ITS_SPACE_HEADWAY_ABILITY = 0x080000, //ͷ + ITS_TIME_OCCUPANCY_RATIO_ABILITY = 0x100000, //ռʣʱ) + ITS_SPACE_OCCUPANCY_RATIO_ABILITY = 0x200000, //ռʣٷֱȼ㣨ռ) + ITS_LANE_QUEUE_ABILITY = 0x400000, //Ŷӳ + ITS_VEHICLE_TYPE_ABILITY = 0x800000, // + ITS_TRAFFIC_STATE_ABILITY = 0x1000000 //ͨ״̬ + } + + // ͨͳƲ + public enum ITS_TPS_TYPE + { + LANE_VOLUME = 0x01, // + LANE_VELOCITY = 0x02, //ٶ + TIME_HEADWAY = 0x04, //ͷʱ + SPACE_HEADWAY = 0x08, //ͷ + TIME_OCCUPANCY_RATIO = 0x10, //ռ (ʱ) + SPACE_OCCUPANCY_RATIO = 0x20, //ռʣٷֱȼ(ռ) + QUEUE = 0x40, //Ŷӳ + VEHICLE_TYPE = 0x80, // + TRAFFIC_STATE = 0x100 //ͨ״̬ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_REGION_LIST + { + public uint dwSize; // ṹС + public byte byNum; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_REGION_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_POLYGON[] struPolygon; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DIRECTION + { + public NET_VCA_POINT struStartPoint; // ʼ + public NET_VCA_POINT struEndPoint; // + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_LANE + { + public byte byEnable; //Ƿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLaneName; // + public NET_DVR_DIRECTION struFlowDirection;// ڳ + public NET_VCA_POLYGON struPolygon; // + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LANE_CFG + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LANE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_LANE[] struLane; // ±ΪID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + } + + //ͨ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AID_PARAM + { + public ushort wParkingDuration; // Υͣ 10-120s + public ushort wPedestrianDuration; // ˳ʱ 1-120s + public ushort wDebrisDuration; // ʱ 10-120s + public ushort wCongestionLength; // ӵ³ֵ 5-200ף + public ushort wCongestionDuration; // ӵ³ 10-120s + public ushort wInverseDuration; // гʱ 1-10s + public ushort wInverseDistance; // оֵ λm Χ[2-100] Ĭ 10 + public ushort wInverseAngleTolerance; // Ƕƫ 90-180,ļн + public ushort wIllegalParkingTime; // Υͣʱ[4,60]λ ,TFS(ͨΥȡ֤) ģʽ + public ushort wIllegalParkingPicNum; // ΥͣͼƬ[1,6], TFS(ͨΥȡ֤) ģʽ + public byte byMergePic; // ͼƬƴ,TFS ģʽ 0- ƴ 1- ƴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + } + + //ͨ¼ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_AID_RULE + { + public byte byEnable; // Ƿ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public uint dwEventType; // ͨ¼ TRAFFIC_AID_TYPE + public NET_VCA_SIZE_FILTER struSizeFilter; // ߴ + public NET_VCA_POLYGON struPolygon; // + public NET_DVR_AID_PARAM struAIDParam; // ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ,Ϊ1ʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ͨ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AID_RULECFG + { + public uint dwSize; // ṹС + public byte byPicProType; //ʱͼƬʽ 0- 0-ϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_DVR_JPEGPARA struPictureParam; //ͼƬṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AID_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_AID_RULE[] struOneAIDRule; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ͨ¼ṹ(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_AID_RULE_V41 + { + public byte byEnable; // Ƿ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public uint dwEventType; // ͨ¼ TRAFFIC_AID_TYPE + public NET_VCA_SIZE_FILTER struSizeFilter; // ߴ + public NET_VCA_POLYGON struPolygon; // + public NET_DVR_AID_PARAM struAIDParam; // ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;// ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IVMS_IP_CHANNEL, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ1ʾͨ0ʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ͨ¼(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AID_RULECFG_V41 + { + public uint dwSize; // ṹС + public byte byPicProType; // ʱͼƬʽ 0- 0-ϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_DVR_JPEGPARA struPictureParam; // ͼƬṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_AID_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_AID_RULE_V41[] struAIDRule; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ͨͳƲṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_TPS_RULE + { + public byte byEnable; //Ƿʹܳͨ + public byte byLaneID; //ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwCalcType; //ͳƲITS_TPS_TYPE + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + public NET_VCA_POLYGON struVitrualLoop; //Ȧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ,һΪǷϴģܲҪ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; //ֽ + } + + //ͨͳƹýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_RULECFG + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TPS_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_TPS_RULE[] struOneTpsRule; // ±ӦͨID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //ͨͳƲṹ(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_TPS_RULE_V41 + { + public byte byEnable; //Ƿʹܳͨ + public byte byLaneID; //ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwCalcType; // ͳƲITS_TPS_TYPE + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + public NET_VCA_POLYGON struVitrualLoop; //Ȧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //ͨͳƹýṹ(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_RULECFG_V41 + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TPS_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_TPS_RULE_V41[] struOneTpsRule; // ±ӦͨID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ʵʱϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_PARAM + { + public byte byStart; // ʼ + public byte byCMD; // ţ01-ָ02-뿪ָ03-ӵ״ָ̬(Ϊ03ʱֻbyLaneStatebyQueueLenЧ)04-Ȧ״̬Ϊ04ʱwLoopStatewStateMaskЧʾbyLane϶ȦĹ״̬ + public ushort wSpaceHeadway; //ͷ࣬ + public ushort wDeviceID; // 豸ID + public ushort wDataLen; // ݳ + public byte byLane; // Ӧ + public byte bySpeed; // Ӧ٣KM/H + public byte byLaneState; // ״̬0-״̬1-ͨ2-ӵ3- + public byte byQueueLen; // ״̬Ŷӳȣ50ף + public ushort wLoopState; //Ȧ״̬ڼλʾȦ״̬ȦŴӾͷɽԶ״̬1-0-뿪 + public ushort wStateMask; //Ȧ״̬룬λΪ1ӦwLoopState״̬λЧΪ0ʾЧ + public uint dwDownwardFlow; //ǰ ϵ³ + public uint dwUpwardFlow; //ǰ µϳ + public byte byJamLevel; //ӵµȼbyLaneStateΪ3ʱЧ1-ȣ2-жȣ3-ض + public byte byVehicleDirection; //0-δ֪1-϶£2-¶ + public byte byJamFlow; //ӵÿһϱһۼƳϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public ushort wTimeHeadway; // ͷʱ࣬ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LLI_PARAM + { + public float fSec;//[0.000000,60.000000] + public byte byDegree;//:γ[0,90] [0,180] + public byte byMinute;//[0,59] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LLPOS_PARAM + { + public byte byLatitudeType;//γͣ0-γ1-γ + public byte byLongitudeType;//ͣ0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_LLI_PARAM struLatitude; /*γ*/ + public NET_DVR_LLI_PARAM struLongitude; /**/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //TPSϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_ADDINFO + { + public NET_DVR_LLPOS_PARAM struLLPos;//һľγλϢ(byLaneState=3byQueueLen>0ʱŷ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 1024, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //TPSʵʱϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_REAL_TIME_INFO + { + public uint dwSize; // ṹС + public uint dwChan;//ͨ + public NET_DVR_TIME_V30 struTime; //ʱ + public NET_DVR_TPS_PARAM struTPSRealTimeInfo;// ͨͳϢ + public IntPtr pAddInfoBuffer; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + /*ϢʶǷNET_DVR_TPS_ADDINFOṹ壩,0-޸Ϣ, 1-иϢ*/ + public byte byAddInfoFlag; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ͳϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_LANE_PARAM + { + public byte byLane; // Ӧ + public byte bySpeed; // ƽٶ + public ushort wArrivalFlow; // + public uint dwLightVehicle; // Сͳ + public uint dwMidVehicle; // ͳ + public uint dwHeavyVehicle; // ͳ + public uint dwTimeHeadway; // ͷʱ࣬ + public uint dwSpaceHeadway; // ͷ࣬ + public float fSpaceOccupyRation; // ռռʣٷֱȼ,*1000 + public float fTimeOccupyRation; // ʱռʣٷֱȼ,*1000 + public byte byStoppingTimes; //ƽͣ + public byte byQueueLen; // ״̬Ŷӳȣ50ף + public byte byFlag; //ϴʶ0-ʾT1ʱͳƽ,1-ʾT2ʱͳ + public byte byVehicelNum; // + public ushort wDelay; //ƽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwNonMotor; // ǻ + } + + // ͨͳϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_STATISTICS_PARAM + { + public byte byStart; // ʼ + public byte byCMD; // ţ 08-ʱָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // Ԥֽ + public ushort wDeviceID; // 豸ID + public ushort wDataLen; // ݳ + public byte byTotalLaneNum; // Ч + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_TIME_V30 struStartTime; //ͳƿʼʱ + public uint dwSamplePeriod; //ͳʱ,λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TPS_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_TPS_LANE_PARAM[] struLaneParam; + } + + //TPSͳƹϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_STATISTICS_INFO + { + public uint dwSize; // ṹС + public uint dwChan;//ͨ + public NET_DVR_TPS_STATISTICS_PARAM struTPSStatisticsInfo;// ͨͳϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ͨ¼Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AID_INFO + { + public byte byRuleID; // ţΪýṹ±꣬0-16 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public uint dwAIDType; // ¼ + public NET_DVR_DIRECTION struDirect; // ָ + public byte bySpeedLimit; //ֵλkm/h[0,255] + public byte byCurrentSpeed; //ǰٶֵλkm/h[0,255] + public byte byVehicleEnterState;//״̬ 0-Ч 1-ʻ 2-ʻ + public byte byState; //0-仯ϴ1-Ѳϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byParkingID; //ͣλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //ͨ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AID_ALARM + { + public uint dwSize; // ṹ + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + public NET_VCA_DEV_INFO struDevInfo; // ǰ豸Ϣ + public NET_DVR_AID_INFO struAIDInfo; // ͨ¼Ϣ + public uint dwPicDataLen; // ͼƬij Ϊ0ʾûͼƬ0ʾýṹͼƬ + public IntPtr pImage; // ָͼƬָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ͨȡ֤ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TFS_ALARM + { + public uint dwSize; //ṹС + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public uint dwIllegalType; //Υͣù궨壬dwIllegalTypeֵΪ0xffffffffʱʹbyIllegalCode + public uint dwIllegalDuration; //Υʱ䣨λ룩 = ץһͼƬʱ - ץĵһͼƬʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MONITORSITE_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitoringSiteID;//ţ·ڱšڲţ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DEVICE_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDeviceID; //豸 + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public NET_DVR_SCENE_INFO struSceneInfo; //Ϣ + public NET_DVR_TIME_EX struBeginRecTime; //¼ʼʱ + public NET_DVR_TIME_EX struEndRecTime; //¼ʱ + public NET_DVR_AID_INFO struAIDInfo; //ͨ¼Ϣ + public NET_DVR_PLATE_INFO struPlateInfo; //Ϣ + public NET_DVR_VEHICLE_INFO struVehicleInfo; //Ϣ + public uint dwPicNum; //ͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.Struct)] + public NET_ITS_PICTURE_INFO[] struPicInfo; //ͼƬϢ8 + public byte bySpecificVehicleType; //峵 οʶVTR_RESULT + public byte byLaneNo; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_TIME_V30 struTime;//ֶٶλǰʱ䡣 + public uint dwSerialNo;//ţ + public byte byVehicleAttribute;//ԣλʾ0- ޸(ͨ)bit1- Ʊ공(ı־)bit2- ΣƷֵ0- 1- + public byte byPilotSafebelt;//0-ʾδ֪,1-ϵȫ,2-ϵȫ + public byte byCopilotSafebelt;//0-ʾδ֪,1-ϵȫ,2-ϵȫ + public byte byPilotSunVisor;//0-ʾδ֪,1-,2- + public byte byCopilotSunVisor;//0-ʾδ֪, 1-,2- + public byte byPilotCall;// 0-ʾδ֪, 1-绰,2-绰 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ILLEGAL_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byIllegalCode;//ΥչdwIllegalTypeֵΪ0xffffffffʹֵ + public ushort wCountry; // ֵ,öCOUNTRY_INDEX + public byte byRegion; //ֵ,0-1-ŷ(Europe Region)2-(Russian Region)3-ŷ&˹(EU&CIS) , 4-жMiddle East0xff- + public byte byCrossLine;//Ƿѹͣ෽ͣ0-ʾδ֪1-ѹߣ2-ѹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIAL_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byParkingSerialNO;//λ + public byte byCrossSpaces;//Ƿ粴λͣ෽ͣ0-ʾδ֪1-δ粴λͣ2-粴λͣ + public byte byAngledParking;//Ƿбͣ෽ͣ, 0-ʾδ֪1-δбͣ2-бͣ + public byte byAlarmValidity;//ŶȣʻʻŶȣΧ0-100ŶԽߣ¼ʵԽ + public byte byDoorsStatus;//״̬ 0-Źر 1-ſ + public uint dwXmlLen;//XMLϢ + public IntPtr pXmlBuf; // XMLϢָ,XMLӦEventNotificationAlert XML Block + //[MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + //public byte[] byRes3; //32λSDKҪֽڶ + public byte byVehicleHeadTailStatus;//ͷβ״̬ 0- 1-ͷ 2-β + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //нṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LANE_QUEUE + { + public NET_VCA_POINT struHead; //ͷ + public NET_VCA_POINT struTail; //β + public uint dwLength; //ʵʶг λΪ [0-500] + } + + public enum TRAFFIC_DATA_VARY_TYPE + { + NO_VARY, //ޱ仯 + VEHICLE_ENTER, //Ȧ + VEHICLE_LEAVE, //뿪Ȧ + UEUE_VARY //б仯 + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LANE_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public byte byRuleID; //ţΪýṹ±꣬0-7 + public byte byVaryType; //ͨ仯 TRAFFIC_DATA_VARY_TYPE + public byte byLaneType; //л + public byte byRes1; + public uint dwLaneVolume; // ͳжٳͨ + public uint dwLaneVelocity; //ٶȣ + public uint dwTimeHeadway; //ͷʱ࣬ + public uint dwSpaceHeadway; //ͷ࣬ + public float fSpaceOccupyRation; //ռʣٷֱȼ㣨ռ) + public NET_DVR_LANE_QUEUE struLaneQueue; //г + public NET_VCA_POINT struRuleLocation; //Ȧĵλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_INFO + { + public uint dwLanNum; // ͨijĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TPS_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_LANE_PARAM[] struLaneParam; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_ALARM + { + public uint dwSize; //ṹС + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public NET_DVR_TPS_INFO struTPSInfo; //ͨ¼Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //ֽ + } + + public enum TRAFFIC_DATA_VARY_TYPE_EX_ENUM + { + ENUM_TRAFFIC_VARY_NO = 0x00, //ޱ仯 + ENUM_TRAFFIC_VARY_VEHICLE_ENTER = 0x01, //Ȧ + ENUM_TRAFFIC_VARY_VEHICLE_LEAVE = 0x02, //뿪Ȧ + ENUM_TRAFFIC_VARY_QUEUE = 0x04, //б仯 + ENUM_TRAFFIC_VARY_STATISTIC = 0x08, //ͳݱ仯ÿӱ仯һΰƽٶȣռ/ʱռʣͨ״̬ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LANE_PARAM_V41 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public byte byRuleID; // ţΪýṹ±꣬0-7 + public byte byLaneType; // л + public byte byTrafficState; // Ľͨ״̬0-Ч1-ͨ2-ӵ3- + public byte byRes1; // + public uint dwVaryType; // ͨ仯Ͳ TRAFFIC_DATA_VARY_TYPE_EX_ENUMλ + public uint dwTpsType; // ݱ仯ͱ־ʾǰϴͳƲУЩЧITS_TPS_TYPE,λ + public uint dwLaneVolume; // ͳжٳͨ + public uint dwLaneVelocity; // ٶȣ + public uint dwTimeHeadway ; // ͷʱ࣬ + public uint dwSpaceHeadway; // ͷ࣬ + public float fSpaceOccupyRation; // ռʣٷֱȼ㣨ռ) + public float fTimeOccupyRation; // ʱռʣٷֱȼ + public uint dwLightVehicle; // Сͳ + public uint dwMidVehicle; // ͳ + public uint dwHeavyVehicle; // ͳ + public NET_DVR_LANE_QUEUE struLaneQueue; // г + public NET_VCA_POINT struRuleLocation; // λȦ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_INFO_V41 + { + public uint dwLanNum; // ͨijĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TPS_RULE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_LANE_PARAM_V41[] struLaneParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACEDETECT_RULECFG + { + public uint dwSize; // ṹС + public byte byEnable; // Ƿ + public byte byEventType; //¼ͣ 0-쳣; 1-;2-쳣&; + public byte byUpLastAlarm; //2011-04-06 Ƿϴһεı + public byte byUpFacePic; //Ƿϴͼ0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; + public NET_VCA_POLYGON struVcaPolygon; // + public byte byPicProType; //ʱͼƬʽ 0- 0-ϴ + public byte bySensitivity; // + public ushort wDuration; // ʱֵ + public NET_DVR_JPEGPARA struPictureParam; //ͼƬṹ + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ,Ϊ1ʾͨ + public byte byPicRecordEnable; /*2012-3-1ǷͼƬ洢, 0-, 1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 39, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_PIPCFG + { + public byte byEnable; //Ƿл + public byte byBackChannel; //ͨţͨ + public byte byPosition; //λã0-,1-,2-,3- + public byte byPIPDiv; //ϵ(:廭)0-1:4,1-1:9,2-1:16 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACEDETECT_RULECFG_V41 + { + public uint dwSize; // ṹС + public byte byEnable; // Ƿ + public byte byEventType; //¼ͣ 0-쳣; 1-;2-쳣&; + public byte byUpLastAlarm; //2011-04-06 Ƿϴһεı + public byte byUpFacePic; //Ƿϴͼ0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; + public NET_VCA_POLYGON struVcaPolygon; // + public byte byPicProType; //ʱͼƬʽ 0- 0-ϴ + public byte bySensitivity; // + public ushort wDuration; // ʱֵ + public NET_DVR_JPEGPARA struPictureParam; //ͼƬṹ + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType; //ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ,Ϊ1ʾͨ + public byte byPicRecordEnable; /*2012-10-22ǷͼƬ洢, 0-, 1-*/ + public byte byRes1; + public ushort wAlarmDelay; //2012-10-22ܱʱ0-5s,1-10,2-30s,3-60s,4-120s,5-300s,6-600s + public NET_DVR_FACE_PIPCFG struFacePIP; //2012-11-7л + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 28, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACEDETECT_ALARM + { + public uint dwSize; // ṹС + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public NET_VCA_TARGET_INFO struTargetInfo; //ĿϢ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public uint dwPicDataLen; //ͼƬij Ϊ0ʾûͼƬ0ʾýṹͼƬ*/ + public byte byAlarmPicType; // 0-쳣ͼƬ 1- ͼƬ,2- + public byte byPanelChan; /*2012-3-1ͨͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwFacePicDataLen; //ͼƬij Ϊ0ʾûͼƬ0ʾýṹͼƬ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 48, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + public IntPtr pFaceImage; //ָͼָ + public IntPtr pImage; //ָͼƬָ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EVENT_PARAM_UNION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.U4)] + public uint[] uLen; // СΪ12ֽ + public uint dwHumanIn; //˽ӽ 0 - 1- + public float fCrowdDensity; // Աۼֵ + } + + //Ŀǰֻ¼Աۼ¼ʵʱϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EVENT_INFO + { + public byte byRuleID; // Rule ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRuleName; // + public uint dwEventType; // VCA_EVENT_TYPE + public NET_DVR_EVENT_PARAM_UNION uEventParam; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EVENT_INFO_LIST + { + public byte byNum; // ¼ʵʱϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RULE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_EVENT_INFO[] struEventInfo; // ¼ʵʱϢ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RULE_INFO_ALARM + { + public uint dwSize; // ṹС + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + public NET_VCA_DEV_INFO struDevInfo; // ǰ豸Ϣ + public NET_DVR_EVENT_INFO_LIST struEventInfoList; //¼Ϣб + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + //ʱ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_SCENE_TIME + { + public byte byActive; //0 -Ч,1CЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwSceneID; //ID + public NET_DVR_SCHEDTIME struEffectiveTime; //Чʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //Чʱ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCENE_TIME_CFG + { + public uint dwSize; //ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SCENE_TIMESEG_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_SCENE_TIME[] struSceneTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_SCENE_CFG + { + public byte byEnable; //Ƿøó,0- 1- + public byte byDirection; //ⷽ 1-У2-У3-˫4-ɶ5-򱱣6-򶫣7-ɱϣ8- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwSceneID; //ID(ֻ), 0 - ʾóЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] bySceneName; // + public NET_DVR_PTZPOS struPtzPos; //ptz + public uint dwTrackTime; //ʱ[5,300] 룬TFS(ͨȡ֤)ģʽЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCENE_CFG + { + public uint dwSize; //ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ITS_SCENE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_SCENE_CFG[] struSceneCfg; //Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ೡ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCENE_COND + { + public uint dwSize; //ṹС + public Int32 lChannel; //ͨ + public uint dwSceneID; //ID, 0-ʾóЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 48, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ȡ֤ʽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FORENSICS_MODE + { + public uint dwSize; //ṹС + public byte byMode; // 0-ֶȡ֤ ,1-Զȡ֤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCENE_INFO + { + public uint dwSceneID; //ID, 0 - ʾóЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] bySceneName; // + public byte byDirection; //ⷽ 1-У2-У3-˫4-ɶ5-򱱣6-򶫣7-ɱϣ8- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_PTZPOS struPtzPos; //Ptz + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2 ; // + } + + //ͨ¼(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AID_ALARM_V41 + { + public uint dwSize; //ṹ + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public NET_DVR_AID_INFO struAIDInfo; //ͨ¼Ϣ + public NET_DVR_SCENE_INFO struSceneInfo; //Ϣ + public uint dwPicDataLen; //ͼƬ + public IntPtr pImage; //ָͼƬָ + // 0-ֱϴ; 1-ƴ洢URL(3.7Ver)ԭȵͼƬݱURLݣͼƬȱURL + public byte byDataType; + public byte byLaneNo; // + public ushort wMilliSecond; //ʱ + //ţ·ڱšڲţ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MONITORSITE_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitoringSiteID; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DEVICE_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDeviceID;//豸 + public uint dwXmlLen;//XMLϢ + public IntPtr pXmlBuf;// XMLϢָ,XMLӦEventNotificationAlert XML Block + public byte byTargetType;// Ŀͣ0~δ֪1~ˡ2~ֳ3~ֳ(˼з) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 19, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ͨͳϢ(չ) + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TPS_ALARM_V41 + { + public uint dwSize; // ṹС + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + public NET_VCA_DEV_INFO struDevInfo; // ǰ豸Ϣ + public NET_DVR_TPS_INFO_V41 struTPSInfo; // ͨͳϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VCA_VERSION + { + public ushort wMajorVersion; // 汾 + public ushort wMinorVersion; // ΰ汾 + public ushort wRevisionNumber; // + public ushort wBuildNumber; // + public ushort wVersionYear; // 汾- + public byte byVersionMonth; // 汾- + public byte byVersionDay; // 汾- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + /*******************************ܽͨ¼ end*****************************************/ + + /******************************ʶ begin******************************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLATE_PARAM + { + public byte byPlateRecoMode; //ʶģʽ,ĬΪ1(Ƶģʽ) + public byte byBelive; /*Ŷֵ, ֻƵʶʽ, ݱӳ̶, 󴥷ʸ߾, ©ʸ߾, + * 80-90Χ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 22, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLATECFG + { + public uint dwSize; + public uint dwEnable; /* ǷƵʶ 0 1 */ + public byte byPicProType; //ʱͼƬʽ 0- 0-ϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_DVR_JPEGPARA struPictureParam; //ͼƬṹ + public NET_DVR_PLATE_PARAM struPlateParam; // ʶ + public NET_DVR_HANDLEEXCEPTION struHandleType; /* ʽ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan; //¼ͨ,Ϊ1ʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ʶӽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLATE_INFO + { + public byte byPlateType; // + public byte byColor; //ɫ + public byte byBright; // + public byte byLicenseLen; //ַ + public byte byEntireBelieve;//ƵŶȣ0-100 + public byte byRegion; // ֵ 0-1-ŷ(EU)2-(ER)3-ŷ&˹(EU&CIS) ,4-ж(ME),0xff- + public byte byCountry; // ֵöCOUNTRY_INDEX֧"COUNTRY_ALL = 0xff, //ALL ȫ" + public byte byArea; //ʡݣڲö٣ EMI_AREA + public byte byPlateSize; //Ƴߴ磬0~δ֪1~long, 2~short(жʹ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CATEGORY_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPlateCategory;//ƸϢ, жгƺԱߵСϢ(Ŀǰֻж֧) + public uint dwXmlLen; //XMLϢ + public IntPtr pXmlBuf; // XMLϢָ,Ϊ COMM_ITS_PLATE_RESULʱЧXMLӦEventNotificationAlert XML Block + public NET_VCA_RECT struPlateRect; //λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LICENSE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLicense; //ƺ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LICENSE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byBelieve; //ʶַŶȣ⵽"A12345", ŶΪ,20,30,40,50,60,70ʾ""ȷĿֻ%"A"ֵȷĿ% + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLATERECO_RESULE + { + public uint dwSize; + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public NET_VCA_DEV_INFO struDevInfo; // ǰ豸Ϣ + public NET_DVR_PLATE_INFO struPlateInfo; + public uint dwPicDataLen; //ͼƬij Ϊ0ʾûͼƬ0ʾýṹͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; //Ϊ0 + public IntPtr pImage; //ָͼƬָ + } + /******************************ʶ end******************************************/ + + /******************************ץĻ*******************************************/ + //IO + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IO_INCFG + { + public uint dwSize; + public byte byIoInStatus;//IO״̬0-½أ1-أ2-غ½أ3-ߵƽ4-͵ƽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//ֽ + } + + //IO + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IO_OUTCFG + { + public uint dwSize; + public byte byDefaultStatus;//IOĬ״̬0-͵ƽ1-ߵƽ + public byte byIoOutStatus;//IOЧʱ״̬0-͵ƽ1-ߵƽ2- + public ushort wAheadTime;//IOǰʱ䣬λus + public uint dwTimePluse;//ʱ䣬λus + public uint dwTimeDelay;//IOЧʱ䣬λus + public byte byFreqMulti; //ƵֵΧ[1,15] + public byte byDutyRate; //ռձȣ[0,40%] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FLASH_OUTCFG + { + public uint dwSize; + public byte byMode;//˸ģʽ0-1-2-3- + public byte byRelatedIoIn;//ƹIOţʱ˲Ч + public byte byRecognizedLane; /*IOţλʾbit0ʾIO1Ƿ0-1-*/ + public byte byDetectBrightness;/*Զʹ0-⣻1-*/ + public byte byBrightnessThreld;/*ʹֵΧ[0,100],ֵ*/ + public byte byStartHour; //ʼʱ-Сʱ,ȡֵΧ0-23 + public byte byStartMinute; //ʼʱ-,ȡֵΧ0-59 + public byte byEndHour; //ʱ-Сʱ,ȡֵΧ0-23 + public byte byEndMinute; //ʱ-,ȡֵΧ0-59 + public byte byFlashLightEnable; //ʱʹ:0-;1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //̵ƹܣ2IOһ飩 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LIGHTSNAPCFG + { + public uint dwSize; + public byte byLightIoIn;//̵ƵIO + public byte byTrigIoIn;//IO + public byte byRelatedDriveWay;//IOij + public byte byTrafficLight; //0-ߵƽƣ͵ƽ̵ƣ1-ߵƽ̵ƣ͵ƽ + public byte bySnapTimes1; //ץĴ10-ץģ0-Ĵ5 + public byte bySnapTimes2; //̵ץĴ20-ץģ0-Ĵ5 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTERVAL_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wIntervalTime1;//ļʱ䣬ms + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTERVAL_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wIntervalTime2;//̵ļʱ䣬ms + public byte byRecord;//¼־0-¼1-¼ + public byte bySessionTimeout;//¼ʱʱ䣨룩 + public byte byPreRecordTime;//¼ƬԤ¼ʱ() + public byte byVideoDelay;//¼Ƭʱʱ䣨룩 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;//ֽ + } + + //ٹ(2IOһ飩 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MEASURESPEEDCFG + { + public uint dwSize; + public byte byTrigIo1; //ٵ1Ȧ + public byte byTrigIo2; //ٵ2Ȧ + public byte byRelatedDriveWay;//IOij + public byte byTestSpeedTimeOut;//ģʽʱʱ䣬λs + public uint dwDistance;//Ȧ,cm + public byte byCapSpeed;//ģʽٶȣλkm/h + public byte bySpeedLimit;//ֵλkm/h + public byte bySnapTimes1; //Ȧ1ץĴ0-ץģ0-Ĵ5 + public byte bySnapTimes2; //Ȧ2ץĴ0-ץģ0-Ĵ5 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTERVAL_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wIntervalTime1;//Ȧ1ļʱ䣬ms + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTERVAL_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wIntervalTime2;//Ȧ2ļʱ䣬ms + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//ֽ + } + + //Ƶ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOEFFECT + { + public byte byBrightnessLevel; /*0-100*/ + public byte byContrastLevel; /*0-100*/ + public byte bySharpnessLevel; /*0-100*/ + public byte bySaturationLevel; /*0-100*/ + public byte byHueLevel; /*0-100,*/ + public byte byEnableFunc; //ʹܣλʾbit0-SMART IR()bit1-ն,bit2-ǿʹܣ0-1- + public byte byLightInhibitLevel; //ǿƵȼ[1-3]ʾȼ + public byte byGrayLevel; //Ҷֵ0-[0-255]1-[16-235] + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GAIN + { + public byte byGainLevel; /*棺0-100*/ + public byte byGainUserSet; /*ûԶ棻0-100ץĻCCDģʽµץ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwMaxGainValue;/*ֵλdB*/ + } + + //ƽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WHITEBALANCE + { + public byte byWhiteBalanceMode; /*0-ֶƽ⣨MWB,1-Զƽ1AWB1,2-Զƽ2 (AWB2),3-ԶƸΪƽ(Locked WB) + 4-(Indoor)5-(Outdoor)6-չ(Fluorescent Lamp)7-Ƶ(Sodium Lamp) + 8-Զ(Auto-Track)9-һΰƽ(One Push)10-Զ(Auto-Outdoor) + 11-ƵԶ (Auto-Sodiumlight)12-ˮ(Mercury Lamp)13-Զƽ(Auto) + 14-׳ (IncandescentLamp)15-ů(Warm Light Lamp)16-Ȼ(Natural Light) */ + public byte byWhiteBalanceModeRGain; /*ֶƽʱЧֶƽ R*/ + public byte byWhiteBalanceModeBGain; /*ֶƽʱЧֶƽ B*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ع + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EXPOSURE + { + public byte byExposureMode; /*0 ֶع 1Զع*/ + public byte byAutoApertureLevel; /* ԶȦ, 0-10 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwVideoExposureSet; /* ԶƵعʱ䣨λus*//*ע:ԶعʱֵΪعֵ 20-1s(1000000us)*/ + public uint dwExposureUserSet; /* Զعʱ,ץĻӦʱCCDģʽʱץĿٶ*/ + public uint dwRes; + } + + //̬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WDR + { + public byte byWDREnabled; /*̬0 dsibale 1 enable 2 auto*/ + public byte byWDRLevel1; /*0-F*/ + public byte byWDRLevel2; /*0-F*/ + public byte byWDRContrastLevel; /*0-100*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ҹת + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DAYNIGHT + { + public byte byDayNightFilterType; /*ҹл0-죬1-ҹ2-Զ3-ʱ4-봥*/ + public byte bySwitchScheduleEnabled; /*0 dsibale 1 enable,()*/ + //ʱģʽ + public byte byBeginTime; /*ʼʱ䣨Сʱ0-23*/ + public byte byEndTime; /*ʱ䣨Сʱ0-23*/ + //ģʽ2 + public byte byDayToNightFilterLevel; //0-7 + public byte byNightToDayFilterLevel; //0-7 + public byte byDayNightFilterTime;//(60) + //ʱģʽ + public byte byBeginTimeMin; //ʼʱ䣨֣0-59 + public byte byBeginTimeSec; //ʼʱ䣨룩0-59 + public byte byEndTimeMin; //ʱ䣨֣0-59 + public byte byEndTimeSec; //ʱ䣨룩0-59 + //봥ģʽ + public byte byAlarmTrigState; //봥״̬0-죬1-ҹ + } + + //GammaУ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GAMMACORRECT + { + public byte byGammaCorrectionEnabled; /*0 dsibale 1 enable*/ + public byte byGammaCorrectionLevel; /*0-100*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ⲹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BACKLIGHT + { + public byte byBacklightMode; /*ⲹ:0 off 1 UP2 DOWN3 LEFT4 RIGHT5MIDDLE6Զ*/ + public byte byBacklightLevel; /*0x0-0xF*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwPositionX1; //X1 + public uint dwPositionY1; //Y1 + public uint dwPositionX2; //X2 + public uint dwPositionY2; //Y2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ֽ빦 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NOISEREMOVE + { + public byte byDigitalNoiseRemoveEnable; /*0-ã1-ͨģʽֽ룬2-רģʽֽ*/ + public byte byDigitalNoiseRemoveLevel; /*ͨģʽֽ뼶0x0-0xF*/ + public byte bySpectralLevel; /*רģʽ¿ǿȣ0-100*/ + public byte byTemporalLevel; /*רģʽʱǿȣ0-100*/ + public byte byDigitalNoiseRemove2DEnable; /* ץ֡2D룬0-ã1- */ + public byte byDigitalNoiseRemove2DLevel; /* ץ֡2D뼶0-100 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //CMOSģʽǰ˾ͷ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CMOSMODECFG + { + public byte byCaptureMod; //ץģʽ0-ץģʽ11-ץģʽ2 + public byte byBrightnessGate;//ֵ + public byte byCaptureGain1; //ץ1,0-100 + public byte byCaptureGain2; //ץ2,0-100 + public uint dwCaptureShutterSpeed1;//ץĿٶ1 + public uint dwCaptureShutterSpeed2;//ץĿٶ2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ǰ˲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAMERAPARAMCFG + { + public uint dwSize; + public NET_DVR_VIDEOEFFECT struVideoEffect;/*ȡԱȶȡͶȡȡɫ*/ + public NET_DVR_GAIN struGain;/*Զ*/ + public NET_DVR_WHITEBALANCE struWhiteBalance;/*ƽ*/ + public NET_DVR_EXPOSURE struExposure; /*ع*/ + public NET_DVR_GAMMACORRECT struGammaCorrect;/*GammaУ*/ + public NET_DVR_WDR struWdr;/*̬*/ + public NET_DVR_DAYNIGHT struDayNight;/*ҹת*/ + public NET_DVR_BACKLIGHT struBackLight;/*ⲹ*/ + public NET_DVR_NOISEREMOVE struNoiseRemove;/*ֽ*/ + public byte byPowerLineFrequencyMode; /*0-50HZ; 1-60HZ*/ + public byte byIrisMode; /*0 ԶȦ 1ֶȦ*/ + public byte byMirror ; /* 0 off1- leftright2- updown3-center */ + public byte byDigitalZoom; /*:0 dsibale 1 enable*/ + public byte byDeadPixelDetect; /*,0 dsibale 1 enable*/ + public byte byBlackPwl;/*ڵƽ , 0-255*/ + public byte byEptzGate;// EPTZر:0-ǫ̃1-ǫ̃ + public byte byLocalOutputGate;//ر0-ر1-BNC 2-HDMIر + //20-HDMI_720P50 + //21-HDMI_720P60 + //22-HDMI_1080I60 + //23-HDMI_1080I50 + //24-HDMI_1080P24 + //25-HDMI_1080P25 + //26-HDMI_1080P30 + //27-HDMI_1080P50 + //28-HDMI_1080P60 + //40-SDI_720P50, + //41-SDI_720P60, + //42-SDI_1080I50, + //43-SDI_1080I60, + //44-SDI_1080P24, + //45-SDI_1080P25, + //46-SDI_1080P30, + //47-SDI_1080P50, + //48-SDI_1080P60 + public byte byCoderOutputMode;//fpgaģʽ0ֱͨ3ذ + public byte byLineCoding; //Ƿб룺0-1- + public byte byDimmerMode; //ģʽ0-Զ1-Զ + public byte byPaletteMode; //ɫ壺0-ȣ1-ȣ2-ɫ28-ɫ8 + public byte byEnhancedMode; //ǿʽܱ̽ߣ0-ǿ1-12-23-34-4 + public byte byDynamicContrastEN; //̬Աȶǿ 0-1 + public byte byDynamicContrast; //̬Աȶ 0-100 + public byte byJPEGQuality; //JPEGͼ 0-100 + public NET_DVR_CMOSMODECFG struCmosModeCfg;//CMOSģʽǰ˲ãͷģʽȡ + public byte byFilterSwitch; //˲أ0-ã1- + public byte byFocusSpeed; //ͷٶȣ0-10 + public byte byAutoCompensationInterval; //ʱԶŲ1-120λ + public byte bySceneMode; //ģʽ0-⣬1-ڣ2-Ĭϣ3- + } + + //͸ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEFOGCFG + { + public byte byMode; //ģʽ0-ã1-Զģʽ2-ģʽ + public byte byLevel; //ȼ0-100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ӷ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ELECTRONICSTABILIZATION + { + public byte byEnable;//ʹ 0- ã1- + public byte byLevel; //ȼ0-100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ģʽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CORRIDOR_MODE_CCD + { + public byte byEnableCorridorMode; //Ƿģʽ 0ã 1 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //SMART IR()ò + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SMARTIR_PARAM + { + public byte byMode;//0ֶ1Զ + public byte byIRDistance;//ȼ(ȼ)level:1~100 Ĭ:50ֶģʽӣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //byIrisMode ΪP-Iris1ʱЧúȦСȼģʽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PIRIS_PARAM + { + public byte byMode;//0-Զ1-ֶ + public byte byPIrisAperture;//ȦСȼ(ȼ,ȦС)level:1~100 Ĭ:50ֶģʽӣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ǰ˲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAMERAPARAMCFG_EX + { + public uint dwSize; + public NET_DVR_VIDEOEFFECT struVideoEffect;/*ȡԱȶȡͶȡȡɫ*/ + public NET_DVR_GAIN struGain;/*Զ*/ + public NET_DVR_WHITEBALANCE struWhiteBalance;/*ƽ*/ + public NET_DVR_EXPOSURE struExposure; /*ع*/ + public NET_DVR_GAMMACORRECT struGammaCorrect;/*GammaУ*/ + public NET_DVR_WDR struWdr;/*̬*/ + public NET_DVR_DAYNIGHT struDayNight;/*ҹת*/ + public NET_DVR_BACKLIGHT struBackLight;/*ⲹ*/ + public NET_DVR_NOISEREMOVE struNoiseRemove;/*ֽ*/ + public byte byPowerLineFrequencyMode; /*0-50HZ; 1-60HZ*/ + public byte byIrisMode; /*0-ԶȦ 1-ֶȦ, 2-P-Iris1*/ + public byte byMirror ; /* 0 off1- leftright2- updown3-center */ + public byte byDigitalZoom; /*:0 dsibale 1 enable*/ + public byte byDeadPixelDetect; /*,0 dsibale 1 enable*/ + public byte byBlackPwl;/*ڵƽ , 0-255*/ + public byte byEptzGate;// EPTZر:0-ǫ̃1-ǫ̃ + public byte byLocalOutputGate;//ر0-ر1-BNC 2-HDMIر + //20-HDMI_720P50 + //21-HDMI_720P60 + //22-HDMI_1080I60 + //23-HDMI_1080I50 + //24-HDMI_1080P24 + //25-HDMI_1080P25 + //26-HDMI_1080P30 + //27-HDMI_1080P50 + //28-HDMI_1080P60 + public byte byCoderOutputMode;//fpgaģʽ0ֱͨ3ذ + public byte byLineCoding; //Ƿб룺0-1- + public byte byDimmerMode; //ģʽ0-Զ1-Զ + public byte byPaletteMode; //ɫ壺0-ȣ1-ȣ2-ɫ28-ɫ8 + public byte byEnhancedMode; //ǿʽܱ̽ߣ0-ǿ1-12-23-34-4 + public byte byDynamicContrastEN; //̬Աȶǿ 0-1 + public byte byDynamicContrast; //̬Աȶ 0-100 + public byte byJPEGQuality; //JPEGͼ 0-100 + public NET_DVR_CMOSMODECFG struCmosModeCfg;//CMOSģʽǰ˲ãͷģʽȡ + public byte byFilterSwitch; //˲أ0-ã1- + public byte byFocusSpeed; //ͷٶȣ0-10 + public byte byAutoCompensationInterval; //ʱԶŲ1-120λ + public byte bySceneMode; //ģʽ0-⣬1-ڣ2-Ĭϣ3- + public NET_DVR_DEFOGCFG struDefogCfg;//͸ + public NET_DVR_ELECTRONICSTABILIZATION struElectronicStabilization;//ӷ + public NET_DVR_CORRIDOR_MODE_CCD struCorridorMode;//ģʽ + public byte byExposureSegmentEnable; //0~,1~ عʱʽ״عϵʱعʱ䵽мֵȻ浽мֵع⵽ֵ浽ֵ + public byte byBrightCompensate;//ǿ [0~100] + + /*0-رա1-640*480@25fps2-640*480@30ps3-704*576@25fps4-704*480@30fps5-1280*720@25fps6-1280*720@30fps + * 7-1280*720@50fps8-1280*720@60fps9-1280*960@15fps10-1280*960@25fps11-1280*960@30fps + * 12-1280*1024@25fps13--1280*1024@30fps14-1600*900@15fps15-1600*1200@15fps16-1920*1080@15fps + * 17-1920*1080@25fps18-1920*1080@30fps19-1920*1080@50fps20-1920*1080@60fps21-2048*1536@15fps22-2048*1536@20fps + * 23-2048*1536@24fps24-2048*1536@25fps25-2048*1536@30fps26-2560*2048@25fps27-2560*2048@30fps + * 28-2560*1920@7.5fps29-3072*2048@25fps30-3072*2048@30fps31-2048*1536@12.532-2560*1920@6.25 + * 33-1600*1200@2534-1600*1200@3035-1600*1200@12.536-1600*900@12.537-1600@900@1538-800*600@2539-800*600@30*/ + public byte byCaptureModeN; //ƵģʽNƣ + public byte byCaptureModeP; //ƵģʽPƣ + public NET_DVR_SMARTIR_PARAM struSmartIRParam; //ŹϢ + public NET_DVR_PIRIS_PARAM struPIrisParam;//PIrisϢӦbyIrisModeֶδ2-PIris1ʼЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 296, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + //ɫ + public enum VCA_PLATE_COLOR + { + VCA_BLUE_PLATE = 0,//ɫ + VCA_YELLOW_PLATE,//ɫ + VCA_WHITE_PLATE,//ɫ + VCA_BLACK_PLATE,//ɫ + VCA_GREEN_PLATE //ɫ + } + + // + public enum VCA_PLATE_TYPE + { + VCA_STANDARD92_PLATE = 0,//׼ó + VCA_STANDARD02_PLATE,//02ʽó + VCA_WJPOLICE_PLATE,//侯 + VCA_JINGCHE_PLATE,// + STANDARD92_BACK_PLATE,//ó˫β + VCA_SHIGUAN_PLATE, //ʹݳ + VCA_NONGYONG_PLATE, //ũó + VCA_MOTO_PLATE //Ħг + } + + public enum VLR_VEHICLE_CLASS + { + VLR_OTHER = 0, // + VLR_VOLKSWAGEN = 1, // + VLR_BUICK = 2, // + VLR_BMW = 3, // + VLR_HONDA = 4, // + VLR_PEUGEOT = 5, // + VLR_TOYOTA = 6, // + VLR_FORD = 7, // + VLR_NISSAN = 8, //ղ + VLR_AUDI = 9, //µ + VLR_MAZDA = 10, //Դ + VLR_CHEVROLET = 11, //ѩ + VLR_CITROEN = 12, //ѩ + VLR_HYUNDAI = 13, //ִ + VLR_CHERY = 14 // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VEHICLE_INFO + { + public uint dwIndex; + public byte byVehicleType; + public byte byColorDepth; + public byte byColor; + public byte byRadarState; + public ushort wSpeed; + public ushort wLength; + public byte byIllegalType; + public byte byVehicleLogoRecog; //οö VLR_VEHICLE_CLASS + public byte byVehicleSubLogoRecog; //Ʒʶ𣻲οVSB_VOLKSWAGEN_CLASSö١ + public byte byVehicleModel; //Ʒ0-δ֪ο"Ʒ.xlsx" + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byCustomInfo; //ԶϢ + public ushort wVehicleLogoRecog; //Ʒƣο"Ʒ.xlsx" (ֶμbyVehicleLogoRecog); + public byte byIsParking;//Ƿͣ 0-Ч1-ͣ2-δͣ + public byte byRes;//ֽ + public uint dwParkingTime; //ͣʱ䣬λs + public byte byBelieve; //byIllegalTypeŶȣ1-100 + public byte byCurrentWorkerNumber;//ǰҵ + public byte byCurrentGoodsLoadingRate;//ǰװ 0- 1- 2- 3- 4- + public byte byDoorsStatus;//״̬ 0-Źر 1-ſ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + + public void Init() + { + byCustomInfo = new byte[16]; + byRes3 = new byte[4]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLATE_RESULT + { + public uint dwSize; + public byte byResultType; + public byte byChanIndex; + public ushort wAlarmRecordID; //¼ID(ڲѯ¼񣬽byResultTypeΪ2ʱЧ) + public uint dwRelativeTime; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byAbsTime; + public uint dwPicLen; + public uint dwPicPlateLen; + public uint dwVideoLen; + public byte byTrafficLight; + public byte byPicNum; + public byte byDriveChan; + public byte byVehicleType; //0- δ֪1- ͳ2- 3- γ4- 5- С + public uint dwBinPicLen; + public uint dwCarPicLen; + public uint dwFarCarPicLen; + public IntPtr pBuffer3; + public IntPtr pBuffer4; + public IntPtr pBuffer5; + public byte byRelaLaneDirectionType; + public byte byCarDirectionType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + public NET_DVR_PLATE_INFO struPlateInfo; + public NET_DVR_VEHICLE_INFO struVehicleInfo; + public IntPtr pBuffer1; + public IntPtr pBuffer2; + + public void Init() + { + byAbsTime = new byte[32]; + byRes3 = new byte[6]; + } + } + + //ͼϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IMAGEOVERLAYCFG + { + public uint dwSize; + public byte byOverlayInfo;//ʹܿأ0-ӣ1- + public byte byOverlayMonitorInfo;//ǷӼϢ0-ӣ1- + public byte byOverlayTime;//Ƿʱ䣬0-ӣ1- + public byte byOverlaySpeed;//Ƿٶȣ0-ӣ1- + public byte byOverlaySpeeding;//Ƿӳٱ0-ӣ1- + public byte byOverlayLimitFlag;//Ƿٱ־0-ӣ1- + public byte byOverlayPlate;//Ƿӳƺţ0-ӣ1- + public byte byOverlayColor;//Ƿӳɫ0-ӣ1- + public byte byOverlayLength;//Ƿӳ0-ӣ1- + public byte byOverlayType;//Ƿӳͣ0-ӣ1- + public byte byOverlayColorDepth;//Ƿӳɫdz0-ӣ1- + public byte byOverlayDriveChan;//Ƿӳ0-ӣ1- + public byte byOverlayMilliSec; //ӺϢ 0-ӣ1- + public byte byOverlayIllegalInfo; //ΥϢ 0-ӣ1- + public byte byOverlayRedOnTime; //Ӻʱ 0-ӣ1- + public byte byFarAddPlateJpeg; //ԶͼǷӳƽͼ,0-,1- + public byte byNearAddPlateJpeg; //ͼǷӳƽͼ,0-,1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitorInfo1; //Ϣ1 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitorInfo2; //Ϣ2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 52, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + + + public struct NET_DVR_FACELIB_GUARD_COND + { + public uint dwSize; + public uint dwChannel; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 68, ArraySubType = UnmanagedType.I1)] + public byte[] szFDID;//ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + public struct NET_DVR_EVENT_SCHEDULE + { + public uint dwSize;//ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime; /*ʱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struHolidayAlarmTime; /*ղʱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.I1)] + public byte[] bySceneID;//,Ŀǰ֧1~40ΪЧó벼ʱÿʱһһӦ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 72, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SNAPCFG + { + public uint dwSize; + public byte byRelatedDriveWay; + public byte bySnapTimes; + public ushort wSnapWaitTime; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTERVAL_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wIntervalTime; + public uint dwSnapVehicleNum; //ץijš + public NET_DVR_JPEGPARA struJpegPara;//ץͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public enum ITC_MAINMODE_ABILITY + { + ITC_MODE_UNKNOW = 0x0, // + ITC_POST_MODE = 0x1, //ģʽ + ITC_EPOLICE_MODE = 0x2, //羯ģʽ + ITC_POSTEPOLICE_MODE = 0x4 //ʽ羯ģʽ + } + + public enum ITC_RECOG_REGION_TYPE + { + ITC_REGION_RECT = 0x0, // + ITC_REGION_POLYGON = 0x1, // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SNAP_ABILITY + { + public uint dwSize; + public byte byIoInNum;//IO + public byte byIoOutNum;//IO + public byte bySingleSnapNum;//IO + public byte byLightModeArrayNum;//̵ģʽ + public byte byMeasureModeArrayNum;//ģʽ + public byte byPlateEnable; //ʶ + public byte byLensMode;//ͷģʽ0-CCD,1-CMOS + public byte byPreTriggerSupport; //Ƿ֧ԭģʽ0-֧֣1-֧ + public uint dwAbilityType; //ֵ֧ĴģʽλʾITC_MAINMODE_ABILITY + public byte byIoSpeedGroup; //ֵ֧IO + public byte byIoLightGroup; //ֵ֧IO̵ + public byte byRecogRegionType; //ʶֵ֧ͣITC_RECOG_REGION_TYPE + public byte bySupport; //豸λʾ0-֧֣1-֧ + // bySupport&0x1ʾǷ֧չַ + // bySupport&0x2ʾǷ֧չУʱýṹ + // bySupport&0x4, ʾǷֶ֧() + // bySupport&0x8, ʾǷ֧bonding(ݴ) + // bySupport&0x10, ʾǷ֧Խ + //2013-07-09 + public ushort wSupportMultiRadar;// 豸λʾ0-֧֣1-֧ + // wSupportMultiRadar&0x1ʾ RS485״ ֳ֧״ﴦ + // wSupportMultiRadar&0x2ʾ Ȧ ֳ֧״ﴦ + // wSupportMultiRadar&0x4ʾ п ֳ֧״ﴦ + // wSupportMultiRadar&0x8ʾ Ƶ ֳ֧״ﴦ + public byte byICRPresetNum; + // ʾֵ֧ICRԤõ㣨˹ƬƫƵ㣩 + public byte byICRTimeSlot;//ʾֵ֧ICRʱ18 + public byte bySupportRS485Num;//ʾֵ֧RS485ڵ + public byte byExpandRs485SupportSensor;// 豸λʾ0-֧֣1-֧ + // byExpandRs485SupportSensor &0x1ʾ羯ֳ֧ + // byExpandRs485SupportSensor &0x2ʾʽ羯ֳ֧ + public byte byExpandRs485SupportSignalLampDet;// 豸λʾ0-֧֣1-֧ + // byExpandRs485SupportSignalLampDet &0x1ʾ羯֧źŵƼ + // byExpandRs485SupportSignalLampDet &0x2ʾʽ羯֧źŵƼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 13, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_ICRTIMECFG + { + public NET_DVR_SCHEDTIME struTime; + public byte byAssociateRresetNo;//Ԥõ18 , 0 + public byte bySubSwitchMode;//1~죬2~ (Ԥõ0 ʱЧ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_ICR_TIMESWITCH_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_ICRTIMECFG[] struAutoCtrlTime;//Զлʱ (Զл ʱЧ ֧4飬Ԥ4) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ICR_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byICRPreset; //ʵЧ̬ʾ [0~100] ±ʾԤõ18 07 Ӧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_ICR_MANUALSWITCH_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ICR_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byICRPreset; //ʵЧ̬ʾ [0~100] + public byte bySubSwitchMode;//1~죬2~ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 147, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_ICR_AOTOSWITCH_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ICR_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byICRPreset; //ʵЧ̬ʾ [0~100] ±ʾԤõ18 07 Ӧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 148, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_ICR_PARAM_UNION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 156, ArraySubType = UnmanagedType.I1)] + public byte[] uLen; + public NET_ITC_ICR_AOTOSWITCH_PARAM struICRAutoSwitch; + public NET_ITC_ICR_MANUALSWITCH_PARAM struICRManualSwitch; + public NET_ITC_ICR_TIMESWITCH_PARAM struICRTimeSwitch; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_ICRCFG + { + public uint dwSize; + public byte bySwitchType;//1~Զл2~ֶл ,3~ʱл + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_ITC_ICR_PARAM_UNION uICRParam; + } + + //2013-07-09 쳣 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_HANDLEEXCEPTION + { + public uint dwHandleType; //쳣,쳣ʽ"" + /*0x00: Ӧ*/ + /*0x01: Ͼ*/ + /*0x02: */ + /*0x04: ϴ*/ + /*0x08: ̵*/ + /*0x10: JPRGץͼϴEmail*/ + /*0x20: ⱨ*/ + /*0x40: ӵͼ(ĿǰֻPCNVR֧)*/ + /*0x200: ץͼϴFTP*/ + public byte byEnable; //0ã1 + public byte byRes; + public ushort wDuration;//ʱ(λ/s) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ITC_EXCEPTIONOUT, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmOutTriggered;//ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITC_EXCEPTION + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_EXCEPTIONNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_HANDLEEXCEPTION[] struSnapExceptionType; + //ÿԪضʾһ쳣0- Ӳ̳,1-߶,2-IP ַͻ, 3-쳣, 4-źŵƼ쳣 + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRIGCOORDINATE + { + public ushort wTopLeftX; /*ȦϽǺ꣨2ֽڣ*/ + public ushort wTopLeftY; /*ȦϽ꣨2ֽڣ*/ + public ushort wWdith; /*Ȧȣ2ֽڣ*/ + public ushort wHeight; /*Ȧ߶ȣ2ֽڣ*/ + } + + public enum PROVINCE_CITY_IDX + { + ANHUI_PROVINCE = 0, // + AOMEN_PROVINCE = 1, // + BEIJING_PROVINCE = 2, // + CHONGQING_PROVINCE = 3, // + FUJIAN_PROVINCE = 4, // + GANSU_PROVINCE = 5, // + GUANGDONG_PROVINCE = 6, //㶫 + GUANGXI_PROVINCE = 7, // + GUIZHOU_PROVINCE = 8, // + HAINAN_PROVINCE = 9, // + HEBEI_PROVINCE = 10, //ӱ + HENAN_PROVINCE = 11, // + HEILONGJIANG_PROVINCE = 12, // + HUBEI_PROVINCE = 13, // + HUNAN_PROVINCE = 14, // + JILIN_PROVINCE = 15, // + JIANGSU_PROVINCE = 16, // + JIANGXI_PROVINCE = 17, // + LIAONING_PROVINCE = 18, // + NEIMENGGU_PROVINCE = 19, //ɹ + NINGXIA_PROVINCE = 20, // + QINGHAI_PROVINCE = 21, //ຣ + SHANDONG_PROVINCE = 22, //ɽ + SHANXI_JIN_PROVINCE = 23, //ɽ + SHANXI_SHAN_PROVINCE = 24, // + SHANGHAI_PROVINCE = 25, //Ϻ + SICHUAN_PROVINCE = 26, //Ĵ + TAIWAN_PROVINCE = 27, //̨ + TIANJIN_PROVINCE = 28, // + XIZANG_PROVINCE = 29, // + XIANGGANG_PROVINCE = 30, // + XINJIANG_PROVINCE = 31, //½ + YUNNAN_PROVINCE = 32, // + ZHEJIANG_PROVINCE = 33 //㽭 + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GEOGLOCATION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.U4)] + public int[] iRes; /**/ + public uint dwCity; /*УPROVINCE_CITY_IDX */ + } + + //ģʽ + public enum SCENE_MODE + { + UNKOWN_SCENE_MODE = 0, //δ֪ģʽ + HIGHWAY_SCENE_MODE = 1, //ٳģʽ + SUBURBAN_SCENE_MODE = 2, //ģʽ() + URBAN_SCENE_MODE = 3, //ģʽ + TUNNEL_SCENE_MODE = 4 //ģʽ() + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VTPARAM + { + public uint dwSize; + public byte byEnable; /* ǷʹȦ0-ʹã1-ʹ*/ + public byte byIsDisplay; /* ǷʾȦ0-ʾ1-ʾ*/ + public byte byLoopPos; //䴥Ȧƫ0-ϣ1- + public byte bySnapGain; /*ץ*/ + public uint dwSnapShutter; /*ץĿٶ*/ + public NET_DVR_TRIGCOORDINATE struTrigCoordinate; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_TRIGCOORDINATE[] struRes; + public byte byTotalLaneNum;/*Ƶij1*/ + public byte byPolarLenType; /*ƫͣ0ƫ񾵣1ʩ͵ƫ񾵡*/ + public byte byDayAuxLightMode; /*츨ģʽ0޸1LED2*/ + public byte byLoopToCalRoadBright; /*Լ·ȵij(Ȧ)*/ + public byte byRoadGrayLowTh; /*·ȵֵʼֵ1*/ + public byte byRoadGrayHighTh; /*·ȸֵʼֵ140*/ + public ushort wLoopPosBias; /*䴥Ȧλ30*/ + public uint dwHfrShtterInitValue; /*ͼعʱijʼֵ2000*/ + public uint dwSnapShtterInitValue; /*ץͼعʱijʼֵ500*/ + public uint dwHfrShtterMaxValue; /*ͼعʱֵ20000*/ + public uint dwSnapShtterMaxValue; /*ץͼعʱֵ1500*/ + public uint dwHfrShtterNightValue; /*ͼعʱֵ3000*/ + public uint dwSnapShtterNightMinValue; /*ץͼعʱСֵ3000*/ + public uint dwSnapShtterNightMaxValue; /*ץͼعʱֵ5000*/ + public uint dwInitAfe; /*ijʼֵ200*/ + public uint dwMaxAfe; /*ֵ400*/ + public ushort wResolutionX;/* 豸ǰֱʿ*/ + public ushort wResolutionY;/* 豸ǰֱʸ*/ + public uint dwGainNightValue; /*棬Ĭֵ70*/ + public uint dwSceneMode; /*ģʽ SCENE_MODE */ + public uint dwRecordMode; /*¼־0-¼1-¼*/ + public NET_DVR_GEOGLOCATION struGeogLocation; /*ַλ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VL_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byTrigFlag; /*־0-ͷ1-β2-ͷ/β*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VL_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byTrigSensitive; /*ȣ1-100*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 62, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SNAPENABLECFG + { + public uint dwSize; + public byte byPlateEnable;//Ƿֳ֧ʶ0-֧֣1-֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public byte byFrameFlip; //ͼǷת 0-ת1-ת + public ushort wFlipAngle; //ͼתǶ 0,90,180,270 + public ushort wLightPhase; //λȡֵΧ[0, 360] + public byte byLightSyncPower; //ǷźŵƵԴͬ0-ͬ1-ͬ + public byte byFrequency; //źƵ + public byte byUploadSDEnable; //ǷԶϴSDͼƬ0-1- + public byte byPlateMode; //ʶģʽ:0-Ƶ,1-ⲿ + public byte byUploadInfoFTP; //ǷϴץĸϢFTP0-1- + public byte byAutoFormatSD; //ǷԶʽSD0-1- + public ushort wJpegPicSize; //JpegͼƬС[64-8196] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 56, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + + + /*ftpϴ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FTPCFG + { + public uint dwSize; + public uint dwEnableFTP; /*Ƿftpϴ*/ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string sFTPIP; /*ftp */ + public uint dwFTPPort; /*ftp˿*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /*û*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /**/ + public uint dwDirLevel; /*0 = ʹĿ¼ṹֱӱڸĿ¼,1 = ʹ1Ŀ¼,2=ʹ2Ŀ¼*/ + public ushort wTopDirMode; /* һĿ¼0x1 = ʹ豸,0x2 = ʹ豸,0x3 = ʹ豸ipַ0x4=ʹü,0x5=ʹʱ(),0x=6Զ,0x7=Υ,0x8=,0x9=ص*/ + public ushort wSubDirMode; /* Ŀ¼0x1 = ʹͨ,0x2 = ʹͨţ,0x3=ʹʱ(),0x4=ʹó,0x=5Զ,0x6=Υ,0x7=,0x8=ص*/ + public byte byEnableAnony; //0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*ͼƬԪ */ + public const int PICNAME_ITEM_DEV_NAME = 1; /*豸*/ + public const int PICNAME_ITEM_DEV_NO = 2; /*豸*/ + public const int PICNAME_ITEM_DEV_IP = 3; /*豸IP*/ + public const int PICNAME_ITEM_CHAN_NAME = 4; /*ͨ*/ + public const int PICNAME_ITEM_CHAN_NO = 5; /*ͨ*/ + public const int PICNAME_ITEM_TIME = 6; /*ʱ*/ + public const int PICNAME_ITEM_CARDNO = 7; /**/ + public const int PICNAME_ITEM_PLATE_NO = 8; /*ƺ*/ + public const int PICNAME_ITEM_PLATE_COLOR = 9; /*ɫ*/ + public const int PICNAME_ITEM_CAR_CHAN = 10; /**/ + public const int PICNAME_ITEM_CAR_SPEED = 11; /*ٶ*/ + public const int PICNAME_ITEM_CARCHAN = 12; /**/ + public const int PICNAME_ITEM_PIC_NUMBER = 13; //ͼƬ + public const int PICNAME_ITEM_CAR_NUMBER = 14; // + + public const int PICNAME_ITEM_SPEED_LIMIT_VALUES = 15; //ֵ + public const int PICNAME_ITEM_ILLEGAL_CODE = 16; //Υ + public const int PICNAME_ITEM_CROSS_NUMBER = 17; //·ڱ + public const int PICNAME_ITEM_DIRECTION_NUMBER = 18; // + + public const int PICNAME_MAXITEM = 15; + //ͼƬ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PICTURE_NAME + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PICNAME_MAXITEM, ArraySubType = UnmanagedType.I1)] + public byte[] byItemOrder; /* 鶨ļĹ */ + public byte byDelimiter; /*ָһΪ'_'*/ + } + + + //2013-09-27 + public const int PICNAME_ITEM_PARK_DEV_IP = 1; /*豸IP*/ + public const int PICNAME_ITEM_PARK_PLATE_NO = 2;/*ƺ*/ + public const int PICNAME_ITEM_PARK_TIME = 3; /*ʱ*/ + public const int PICNAME_ITEM_PARK_INDEX = 4; /*λ*/ + public const int PICNAME_ITEM_PARK_STATUS = 5; /*λ״̬*/ + + //ͼƬչ 2013-09-27 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PICTURE_NAME_EX + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PICNAME_MAXITEM, ArraySubType = UnmanagedType.I1)] + public byte[] byItemOrder; /* 鶨ļĹ */ + public byte byDelimiter; /*ָһΪ'_'*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /**/ + } + + /* ץͼ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SERIAL_CATCHPIC_PARA + { + public byte byStrFlag; /*ݿʼ*/ + public byte byEndFlag; /**/ + public ushort wCardIdx; /*ʼλ*/ + public uint dwCardLen; /*ų*/ + public uint dwTriggerPicChans; /*ͨţλӵ1λʼƣ0x2ʾһͨ*/ + } + + //DVRץͼãߣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_JPEGCFG_V30 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_JPEGPARA[] struJpegPara; /*ÿͨͼ*/ + public ushort wBurstMode; /*ץͼʽ,λ.0x1=봥0x2=ƶⴥ 0x4=2320x8=4850x10=紥*/ + public ushort wUploadInterval; /*ͼƬϴ()[0,65535]*/ + public NET_DVR_PICTURE_NAME struPicNameRule; /* ͼƬ */ + public byte bySaveToHD; /*Ƿ񱣴浽Ӳ*/ + public byte byRes1; + public ushort wCatchInterval; /*ץͼ()[0,65535]*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_SERIAL_CATCHPIC_PARA struRs232Cfg; + public NET_DVR_SERIAL_CATCHPIC_PARA struRs485Cfg; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint[] dwTriggerPicTimes; /* ÿͨһδմ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN_V30, ArraySubType = UnmanagedType.U4)] + public uint[] dwAlarmInPicChanTriggered; /*ץͨ,λãӵ1λʼ*/ + } + + //ֶ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_MANUALSNAP + { + public byte byOSDEnable; + public byte byLaneNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 22, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int NET_ITC_GET_TRIGGERCFG = 3003; //ȡ + public const int NET_ITC_SET_TRIGGERCFG = 3004; //ô + public const int NET_DVR_GET_CURTRIGGERMODE = 3130; //ȡ豸ǰģʽ + public const int NET_ITC_GET_VIDEO_TRIGGERCFG = 3017; //ȡƵ羯 + public const int NET_ITC_SET_VIDEO_TRIGGERCFG = 3018; //Ƶ羯 + + public const int MAX_ITC_LANE_NUM = 6; + public const int MAX_IOOUT_NUM = 4; + public const int MAX_LANEAREA_NUM = 2; + public const int MAX_IOIN_NUMEX = 10; + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_SERIAL_INFO + { + public byte bySerialProtocol; + public byte byIntervalType; + public ushort wInterval; + public byte byNormalPassProtocol; + public byte byInverseProtocol; + public byte bySpeedProtocol; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_EPOLICE_LANE_PARAM + { + public byte byEnable; + public byte byRelatedDriveWay; + public ushort wDistance; + public byte byRecordEnable; + public byte byRecordType; + public byte byPreRecordTime; + public byte byRecordDelayTime; + public byte byRecordTimeOut; + public byte bySignSpeed; + public byte bySpeedLimit; + public byte byOverlayDriveWay; + public NET_ITC_SERIAL_INFO struSerialInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IOOUT_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byRelatedIOOut; + public byte byFlashMode; + public byte bySerialType; + public byte byRelatedIOOutEx; + public byte bySnapPicPreRecord; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LANEAREA_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_PLATE_RECOG_REGION_PARAM[] struPlateRecog; + public byte byBigCarSignSpeed; + public byte byBigCarSpeedLimit; + public byte byRedTrafficLightChan; + public byte byYellowTrafficLightChan; + public byte byRelaLaneDirectionType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_EPOLICE_RS485_PARAM + { + public byte byRelatedLaneNum; + public byte byTrafficLightSignalSrc; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_ITC_PLATE_RECOG_PARAM struPlateRecog; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ITC_LANE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_EPOLICE_LANE_PARAM[] struLane; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_SINGLEIO_PARAM + { + public byte byDefaultStatus; + public byte byRelatedDriveWay; + public byte bySnapTimes; + public byte byRelatedIOOutEx; + public NET_ITC_INTERVAL_PARAM struInterval; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IOOUT_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byRelatedIOOut; + public byte byFlashMode; + public byte byEnable; + public byte byUseageType; + public byte byRes2; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LANEAREA_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_PLATE_RECOG_REGION_PARAM[] struPlateRecog; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_POST_SINGLEIO_PARAM + { + public NET_ITC_PLATE_RECOG_PARAM struPlateRecog; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IOIN_NUMEX, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_SINGLEIO_PARAM[] struSingleIO; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_CURTRIGGERMODE + { + public uint dwSize; + public uint dwTriggerType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_PLATE_RECOG_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 3)] + public string byDefaultCHN; + public byte byEnable; + public uint dwRecogMode; + public byte byVehicleLogoRecog; + public byte byProvince; + public byte byRegion; + public byte byRes1; + public ushort wPlatePixelWidthMin; + public ushort wPlatePixelWidthMax; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_INTERVAL_PARAM + { + public byte byIntervalType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTERVAL_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wInterval; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct UNION_REGION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 164, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_PLATE_RECOG_REGION_PARAM + { + public byte byMode; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public UNION_REGION uRegion; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_LANE_PARAM + { + public byte byEnable; + public byte byRelatedDriveWay; + public ushort wDistance; + public ushort wTrigDelayTime; + public byte byTrigDelayDistance; + public byte bySpeedCapEn; + public byte bySignSpeed; + public byte bySpeedLimit; + public byte bySnapTimes; + public byte byOverlayDriveWay; + public NET_ITC_INTERVAL_PARAM struInterval; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IOOUT_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byRelatedIOOut; + public byte byFlashMode; + public byte byCartSignSpeed; + public byte byCartSpeedLimit; + public byte byRelatedIOOutEx; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LANEAREA_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_PLATE_RECOG_REGION_PARAM[] struPlateRecog; + public byte byLaneType; + public byte byUseageType; + public byte byRelaLaneDirectionType; + public byte byLowSpeedLimit; + public byte byBigCarLowSpeedLimit; + public byte byLowSpeedCapEn; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_RADAR_PARAM + { + public byte byRadarType; + public byte byLevelAngle; + public ushort wRadarSensitivity; + public ushort wRadarSpeedValidTime; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public float fLineCorrectParam; + public int iConstCorrectParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_POST_RS485_RADAR_PARAM + { + public byte byRelatedLaneNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_ITC_PLATE_RECOG_PARAM struPlateRecog; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ITC_LANE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_LANE_PARAM[] struLane; + public NET_ITC_RADAR_PARAM struRadar; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_TRIGGER_PARAM_UNION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4280, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_SINGLE_TRIGGERCFG + { + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwTriggerType; + public NET_ITC_TRIGGER_PARAM_UNION uTriggerParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_TRIGGERCFG + { + public uint dwSize; + public NET_ITC_SINGLE_TRIGGERCFG struTriggerParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_VIDEO_TRIGGER_COND + { + public uint dwSize; + public uint dwChannel; + public uint dwTriggerMode; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_VIDEO_TRIGGER_PARAM_UNION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 1150, ArraySubType = UnmanagedType.U4)] + public uint[] uLen; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_LIGHT_ACCESSPARAM_UNION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 122, ArraySubType = UnmanagedType.U4)] + public uint[] uLen; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_TRAFFIC_LIGHT_PARAM + { + public byte bySource; //ͨźŵƽԴ0-IO룬1-RS485 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_ITC_LIGHT_ACCESSPARAM_UNION struLightAccess;//źŵƽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Բṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_LANE_LOGIC_PARAM + { + public byte byUseageType; //;ͣITC_LANE_USEAGE_TYPE + public byte byDirectionType; //ͣITC_LANE_DIRECTION_TYPE + public byte byCarDriveDirect; //ʻITC_LANE_CAR_DRIVE_DIRECT + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 33, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //Υṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_VIOLATION_DETECT_PARAM + { + public uint dwVioDetectType; //Υ, λʾ, ITC_VIOLATION_DETECT_TYPE ,0-,1- + public byte byDriveLineSnapTimes; //ѹץ,2-3 + public byte byReverseSnapTimes; //ץ,2-3 + public ushort wStayTime; //ռͣʱ䣨ʱץģλs + public byte byNonDriveSnapTimes;//ռץ2-3 + public byte byChangeLaneTimes;//Υץ 2-3 + public byte bybanTimes;//Υץ2-3 + public byte byDriveLineSnapSen;// ѹ(0~100)(3.7Ver) + public ushort wSnapPosFixPixel; //2,3ץλСƫ(ΥźŵʱЧ)λأ Ľ + public byte bySpeedTimes;//Υץ2-3(3.8Ver) + public byte byTurnAroundEnable;//Υµͷʹ 0~ر 1~ + public byte byThirdPlateRecogTime;//ʶʱ 0~180s + public byte byPostSnapTimes;//ץ,1-2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 18, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public ushort wStopLineDis; //羯2ΥͼƬֹͣߵ̾룬[0,300]λ() + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_VIDEO_TRIGGER_PARAM + { + public uint dwSize; + public uint dwMode; + public NET_ITC_VIDEO_TRIGGER_PARAM_UNION uVideoTrigger; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_LAMP_EXTERNAL_CFG + { + public uint dwSize; + public byte byEnable; //ʹ 0 1 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_LAMP_STATE struLampStateCtrl;//ָʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ָʾ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_LAMP_STATE + { + public byte byFlicker;//0~˸ 1 ˸ + public byte byParkingIndex;//λ13 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwIONo;//1~IO1;2~IO2;4~IO3; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int MAX_LED_INFO_LEN = 512; + public const int MAX_VOICE_INFO_LEN = 128; + + public const int NET_DVR_GET_LEDDISPLAY_CFG = 3673; + public const int NET_DVR_SET_LEDDISPLAY_CFG = 3672; + public const int NET_DVR_SET_VOICEBROADCAST_CFG = 3675; + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LEDDISPLAY_CFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LED_INFO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDisplayInfo; + public byte byDisplayMode; + public byte bySpeedType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwShowTime; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VOICEBROADCAST_CFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VOICE_INFO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sInfo; // + public byte byBroadcastNum;// 1~10 + public byte byIntervalTime;// ʱ,1~5s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 126, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_VIDEO_EPOLICE_PARAM + { + public byte byEnable; //Ƿã0-ã1- + public byte byLaneNum; //ʶij + public byte byLogicJudge;//Υж߼ֵΪ0-1- + public byte byRes1; + public NET_ITC_PLATE_RECOG_PARAM struPlateRecog; //ʶ + public NET_ITC_TRAFFIC_LIGHT_PARAM struTrafficLight; //ͨźŵƲ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ITC_LANE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_LANE_VIDEO_EPOLICE_PARAM[] struLaneParam; // + public NET_ITC_LINE struLaneBoundaryLine; //߽ߣұ߳ı߽ߣ + public NET_ITC_LINE struLeftLine; //תֽ + public NET_ITC_LINE struRightLine; //תֽ + public NET_ITC_LINE struTopZebraLine; //ϲ + public NET_ITC_LINE struBotZebraLine; //² + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ƶ羯߽ṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_LINE + { + public NET_VCA_LINE struLine; //߲ + public byte byLineType; //ͣITC_LINE_TYPE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͽṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_POLYGON + { + public uint dwPointNum; //Ч ڵ33һΪЧ߽ΪЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_POINT[] struPos; //α߽,20 + } + + //Υ߲ṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_VIOLATION_DETECT_LINE + { + public NET_ITC_LINE struLaneLine; //߲ + public NET_ITC_LINE struStopLine; //ֹ߲ͣ + public NET_ITC_LINE struRedLightLine; //ƴ߲ + public NET_ITC_LINE struCancelLine; //ֱдλȡ + public NET_ITC_LINE struWaitLine; //ֹ߲ͣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.Struct)] + public NET_ITC_LINE[] struRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_ITC_LANE_VIDEO_EPOLICE_PARAM + { + public byte byLaneNO; //ij + public byte bySensitivity; //Ȧȣ[1,100] + public byte byEnableRadar;//״0-ã1- + //ͣοITC_RELA_LANE_DIRECTION_TYPE + //òΪŶӦȷΨһԡ + public byte byRelaLaneDirectionType; + public NET_ITC_LANE_LOGIC_PARAM struLane; // + public NET_ITC_VIOLATION_DETECT_PARAM struVioDetect; //Υ + public NET_ITC_VIOLATION_DETECT_LINE struLine; //Υ + public NET_ITC_POLYGON struPlateRecog; //ʶ + public byte byRecordEnable;//¼־0-¼1-¼ + public byte byRecordType;//¼ͣ0-Ԥ¼1-ʱ¼ + public byte byPreRecordTime;//¼ƬԤ¼ʱ䣨Ĭ0λ + public byte byRecordDelayTime;//¼Ƭʱʱ䣨Ĭ0λ + public byte byRecordTimeOut;//¼ʱʱ䣨룩 + public byte byCarSpeedLimit; //ֵλkm/h + public byte byCarSignSpeed;//־٣λkm/h + public byte bySnapPicPreRecord; //ץͼƬԤ¼ʱ㣻0-ĬֵڶͼƬ1-һͼƬ2-ڶͼƬ3-ͼƬ + public NET_ITC_INTERVAL_PARAM struInterval;//ץļ20byte + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 36, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SPRCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHJC_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byDefaultCHN; /*豸ʡݵĺּд*/ + public byte byPlateOSD; /*0:ͳƲɫͼ,1:ͳƲɫͼ*/ + public byte bySendJPEG1; /*0-ͽJPEGͼ,1-ͽJPEGͼ*/ + public byte bySendJPEG2; /*0-ԶJPEGͼ,1-ԶJPEGͼ*/ + public ushort wDesignedPlateWidth; /*ƿ*/ + public byte byTotalLaneNum; /*ʶij*/ + public byte byRes1; /**/ + public ushort wRecognizedLane; /*ʶijţλʾbit0ʾ1Ƿʶ0-ʶ1-ʶ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LANERECT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_RECT[] struLaneRect; /*ʶ*/ + public uint dwRecogMode; /*ʶͣ + bit0-ʶ0-ʶ1-ʶ(βʶ) + bit1-ʶСʶ0-Сʶ1-ʶ + bit2-ɫʶ0-óɫʶڱʶСʶʱֹã1-ɫʶ + bit3-ũóʶ0-ũóʶ1-ũóʶ + bit4-ģʶ0-ģʶ1-ģʶ + bit5-֡λ򳡶λ0-֡λ1-λ + bit6-֡ʶʶ0-֡ʶ1-ʶ + bit7-ϻ죺0-죬1- */ + public byte bySendPRRaw; //Ƿԭͼ0-ͣ1- + public byte bySendBinImage; //Ƿͳƶֵͼ0-ͣ1- + public byte byDelayCapture; //ʱץĿ,λ֡ + public byte byUseLED; //ʹLEDƣ0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 68, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLCCFG + { + public uint dwSize; + public byte byPlcEnable; //ǷóȲĬã0-رգ1- + public byte byPlateExpectedBright; //ƵԤȣĬֵ50, Χ[0, 100] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public byte byTradeoffFlash; //ǷƵӰ: 0 - ; 1 - (Ĭ); + //ʹƲʱ, ǼƵǿЧӦ, ҪΪ1;Ϊ0 + public byte byCorrectFactor; //ϵ, Χ[0, 100], Ĭֵ50 (tradeoff_flashлʱ,ָĬֵ + public ushort wLoopStatsEn; //ǷȦȣλʾ0-ͳƣ1-ͳ + public byte byPlcBrightOffset;// Ȳ(ȦģʽЧ)ȡֵΧ1~100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 19, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEVICESTATECFG + { + public uint dwSize; + public ushort wPreviewNum; //ԤӸ + public ushort wFortifyLinkNum; //Ӹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LINK, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPADDR[] struPreviewIP; //ԤûIPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_FORTIFY_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_IPADDR[] struFortifyIP; //ӵûIPַ + public uint dwVideoFrameRate; //֡ʣ0-ȫ; 1-1/16; 2-1/8; 3-1/4; 4-1/2; 5-1; 6-2; 7-4; 8-6; 9-8; 10-10; 11-12; 12-16; 13-20; 14-15; 15-18; 16-22; + public byte byResolution; //ֱ0-DCIF 1-CIF, 2-QCIF, 3-4CIF, 4-2CIF 5,16-VGA640*480, 17-UXGA1600*1200, 18-SVGA 800*600,19-HD720p1280*720,20-XVGA, 21-HD900p, 27-HD1080i, 28-2560*1920, 29-1600*304, 30-2048*1536, 31-2448*2048 + public byte bySnapResolution; //ץķֱ0-DCIF 1-CIF, 2-QCIF, 3-4CIF, 4-2CIF 5,16-VGA640*480, 17-UXGA1600*1200, 18-SVGA 800*600,19-HD720p1280*720,20-XVGA, 21-HD900p, 27-HD1080i, 28-2560*1920, 29-1600*304, 30-2048*1536, 31-2448*2048 + public byte byStreamType; //ͣ0-1- + public byte byTriggerType; //ģʽ0-Ƶ1-ͨ + public uint dwSDVolume; //SD + public uint dwSDFreeSpace; //SDʣռ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DRIVECHAN_NUM * MAX_COIL_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byDetectorState; //״̬0-δʹã1-2-쳣 + public byte byDetectorLinkState; //״̬0-δӣ1- + public byte bySDStatus; //SD״̬ 01ߣ2쳣3-sd + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_FORTIFY_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byFortifyLevel; //ȼ0-ޣ1-һȼߣ2-ȼУ3-ȼͣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 116, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POSTEPOLICECFG + { + public uint dwSize; + public uint dwDistance;//Ȧ,λcmȡֵΧ[0,20000] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SIGNALLIGHT_NUM, ArraySubType = UnmanagedType.U4)] + public uint[] dwLightChan; //źŵͨ + public byte byCapSpeed;//־٣λkm/hȡֵΧ[0,255] + public byte bySpeedLimit;//ֵλkm/hȡֵΧ[0,255] + public byte byTrafficDirection;//0-ɶ1-򶫣2-򱱣3-ɱ + public byte byRes1; // + public ushort wLoopPreDist; /*ӳپ λ*/ + public ushort wTrigDelay; /*Ӳʱʱ λ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//ֽ + } + /***************************** end *********************************************/ + public const int IPC_PROTOCOL_NUM = 50; //ipc Э + + //Э + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PROTO_TYPE + { + public uint dwType; /*ipcЭֵ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDescribe; /*Эֶ*/ + } + + //Эб + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPC_PROTO_LIST + { + public uint dwSize; + public uint dwProtoNum; /*ЧipcЭĿ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = IPC_PROTOCOL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PROTO_TYPE[] struProto; /*ЧipcЭ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ЭбV41 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPC_PROTO_LIST_V41 + { + public uint dwSize; + public uint dwProtoNum; //ЧipcЭĿ + public IntPtr pBuffer; //Эб, dwProtoNum NET_DVR_PROTO_TYPEṹ + public uint dwBufferLen; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + public const int MAX_ALERTLINE_NUM = 8; //󾯽 + + //Խѯ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TRAVERSE_PLANE_SEARCHCOND + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALERTLINE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_TRAVERSE_PLANE[] struVcaTraversePlane; //Խ + public uint dwPreTime; /*ܱǰʱ λ:*/ + public uint dwDelayTime; /*ܱӳʱ λ:*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5656, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + public const int MAX_INTRUSIONREGION_NUM = 8; // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INTRUSION_SEARCHCOND + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INTRUSIONREGION_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_INTRUSION[] struVcaIntrusion; // + public uint dwPreTime; /*ܱǰʱ λ:*/ + public uint dwDelayTime; /*ܱӳʱ λ:*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5400, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_AREA_SMARTSEARCH_COND_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6144, ArraySubType = UnmanagedType.I1)] + public byte[] byLen; //ṹ峤 + /*[FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64 * 96, ArraySubType = UnmanagedType.I1)] + public byte[] byMotionScope; // 0-96λʾ64У96*64С飬1-ƶ0-ƶ + [FieldOffsetAttribute(0)] + public NET_DVR_TRAVERSE_PLANE_SEARCHCOND struTraversPlaneCond; //Խ + [FieldOffsetAttribute(0)] + public NET_DVR_INTRUSION_SEARCHCOND struIntrusionCond; // + * */ + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SMART_SEARCH_PARAM + { + public byte byChan; //ͨ + public byte bySearchCondType; //ܲNET_DVR_AREA_SMARTSEARCH_COND_UNION + /*0-ƶ 1-Խ⣬ 2-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_TIME struStartTime; //¼ʼʱ + public NET_DVR_TIME struEndTime; //¼ֹͣʱ + public NET_DVR_AREA_SMARTSEARCH_COND_UNION uSmartSearchCond; //ܲ + public byte bySensitivity; //ƶ,1 >80% 2 40%~80% 3 1%~40% + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SMART_SEARCH_RET + { + public NET_DVR_TIME struStartTime; //ƶⱨʼʱ + public NET_DVR_TIME struEndTime; //¼ֹͣʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //IPSAN ļĿ¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPSAN_SERACH_PARAM + { + public NET_DVR_IPADDR struIP; // IPSAN IPַ + public ushort wPort; // IPSAN ˿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPSAN_SERACH_RET + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byDirectory; // صļĿ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //DVR豸 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEVICECFG_V40 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDVRName; //DVR + public uint dwDVRID; //DVR ID,ң //V1.4(0-99), V1.5(0-255) + public uint dwRecycleRecord; //Ƿѭ¼,0:; 1: + //²ɸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber; //к + public uint dwSoftwareVersion; //汾,16λ汾,16λǴΰ汾 + public uint dwSoftwareBuildDate; //,0xYYYYMMDD + public uint dwDSPSoftwareVersion; //DSP汾,16λ汾,16λǴΰ汾 + public uint dwDSPSoftwareBuildDate; // DSP,0xYYYYMMDD + public uint dwPanelVersion; // ǰ汾,16λ汾,16λǴΰ汾 + public uint dwHardwareVersion; // Ӳ汾,16λ汾,16λǴΰ汾 + public byte byAlarmInPortNum; //DVR + public byte byAlarmOutPortNum; //DVR + public byte byRS232Num; //DVR 232ڸ + public byte byRS485Num; //DVR 485ڸ + public byte byNetworkPortNum; //ڸ + public byte byDiskCtrlNum; //DVR Ӳ̿ + public byte byDiskNum; //DVR Ӳ̸ + public byte byDVRType; //DVR, 1:DVR 2:ATM DVR 3:DVS ...... + public byte byChanNum; //DVR ͨ + public byte byStartChan; //ʼͨ,DVS-1,DVR - 1 + public byte byDecordChans; //DVR · + public byte byVGANum; //VGAڵĸ + public byte byUSBNum; //USBڵĸ + public byte byAuxoutNum; //ڵĸ + public byte byAudioNum; //ڵĸ + public byte byIPChanNum; //ͨ 8λ8λbyHighIPChanNum + public byte byZeroChanNum; //ͨ + public byte bySupport; //λΪ0ʾ֧֣1ʾ֧֣ + //bySupport & 0x1, ʾǷ֧ + //bySupport & 0x2, ʾǷֱ֧ + //bySupport & 0x4, ʾǷ֧ѹȡ + //bySupport & 0x8, ʾǷֶ֧ + //bySupport & 0x10, ʾ֧ԶSADP + //bySupport & 0x20, ʾ֧Raid + //bySupport & 0x40, ʾ֧IPSAN + //bySupport & 0x80, ʾ֧rtp over rtsp + public byte byEsataUseage; //EsataĬ;0-Ĭϱݣ1-Ĭ¼ + public byte byIPCPlug; //0-رռ弴ã1-򿪼弴 + public byte byStorageMode; //0-ģʽ,1-, 2֡ģʽ + public byte bySupport1; //λΪ0ʾ֧֣1ʾ֧ + //bySupport1 & 0x1, ʾǷ֧snmp v30 + //bySupport1 & 0x2, ֻ֧طź + //bySupport1 & 0x4, Ƿֲ֧ȼ + //bySupport1 & 0x8, 豸Ƿֲ֧ʱչ + //bySupport1 & 0x10, ʾǷֶ֧33 + //bySupport1 & 0x20, ʾǷ֧rtsp over http + public ushort wDevType;//豸ͺ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DEV_TYPE_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDevTypeName;//豸ͺ + public byte bySupport2; //չλΪ0ʾ֧֣1ʾ֧ + //bySupport2 & 0x1, ʾǷ֧չOSDַ(ն˺ץĻչ) + public byte byAnalogAlarmInPortNum; //ģⱨ + public byte byStartAlarmInNo; //ģⱨʼ + public byte byStartAlarmOutNo; //ģⱨʼ + public byte byStartIPAlarmInNo; //IPʼ 0-Ч + public byte byStartIPAlarmOutNo; //IPʼ 0-Ч + public byte byHighIPChanNum; //ͨ8λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + public const int MAX_ZEROCHAN_NUM = 16; + //ͨѹò + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ZEROCHANCFG + { + public uint dwSize; //ṹ + public byte byEnable; //0-ֹͣͨ룬1-ʾͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwVideoBitrate; /*Ƶ 0- 1-16K() 2-32K 3-48k 4-64K 5-80K 6-96K 7-128K 8-160k 9-192K 10-224K 11-256K + * 12-320K 13-384K 14-448K 15-512K 16-640K 17-768K 18-896K 19-1024K 20-1280K 21-1536K 22-1792K + * 23-2048K + * λ(31λ)ó1ʾԶ, 0-30λʾֵ(MIN-32K MAX-8192K) */ + public uint dwVideoFrameRate; //֡ 0-ȫ; 1-1/16; 2-1/8; 3-1/4; 4-1/2; 5-1; 6-2; 7-4; 8-6; 9-8; 10-10; 11-12; 12-16; 13-20, + //V2.014-15, 15-18, 16-22; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ͨŲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ZERO_ZOOMCFG + { + public uint dwSize; //ṹ + public NET_VCA_POINT struPoint; //е + public byte byState; //ڵ״̬0-С1-Ŵ + public byte byPreviewNumber; //ԤĿ,0-1,1-4,2-9,3-16 òֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOW_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byPreviewSeq;//ͨϢ òֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 30, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + public const int DESC_LEN_64 = 64; + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SNMPCFG + { + public uint dwSize; //ṹ + public byte byEnable; //0-SNMP1-ʾSNMP + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public ushort wVersion; //snmp 汾 v1 = 1, v2 =2, v3 =3豸Ŀǰ֧ v3 + public ushort wServerPort; //snmpϢն˿ڣĬ 161 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byReadCommunity; //ͬ壬31,Ĭ"public" + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byWriteCommunity;//дͬ,31 ֽ,Ĭ "private" + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN_64, ArraySubType = UnmanagedType.I1)] + public byte[] byTrapHostIP; //ipַ֧IPV4 IPV6 + public ushort wTrapHostPort; //trap˿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byTrapName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 70, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SNMPv3_USER + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; // û + public byte bySecLevel; //ȫ 1-У 2-ȨУ 3-ȨУ + public byte byAuthtype; //֤ 0-MD5֤ 1-SHA֤ 2: none + public byte byPrivtype; //0: DES; 1: AES; 2: none; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAuthpass; //֤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPrivpass; // + } + + //snmpv30 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SNMPCFG_V30 + { + public uint dwSize; //ṹ + public byte byEnableV1; //0-SNMP V11-ʾSNMP V1 + public byte byEnableV2; //0-SNMP V21-ʾSNMP V2 + public byte byEnableV3; //0-SNMP V31-ʾSNMP V3 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public ushort wServerPort; //snmpϢն˿ڣĬ 161 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byReadCommunity; //ͬ壬31,Ĭ"public" + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byWriteCommunity; //дͬ,31 ֽ,Ĭ "private" + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN_64, ArraySubType = UnmanagedType.I1)] + public byte[] byTrapHostIP; //ipַ֧IPV4 IPV6 + public ushort wTrapHostPort; // trap˿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_SNMPv3_USER struRWUser; // дû + public NET_DVR_SNMPv3_USER struROUser; // ֻû + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byTrapName; + } + + public const int PROCESSING = 0; //ڴ + public const int PROCESS_SUCCESS = 100; // + public const int PROCESS_EXCEPTION = 400; //쳣 + public const int PROCESS_FAILED = 500; //ʧ + public const int PROCESS_QUICK_SETUP_PD_COUNT = 501; //һ3Ӳ + + public const int SOFTWARE_VERSION_LEN = 48; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SADPINFO + { + public NET_DVR_IPADDR struIP; // 豸IPַ + public ushort wPort; // 豸˿ں + public ushort wFactoryType; // 豸 + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = SOFTWARE_VERSION_LEN)] + public string chSoftwareVersion; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string chSerialNo; // к + public ushort wEncCnt; // ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr; // MAC ַ + public NET_DVR_IPADDR struSubDVRIPMask; // DVR IPַ + public NET_DVR_IPADDR struGatewayIpAddr; // + public NET_DVR_IPADDR struDnsServer1IpAddr; /* 1IPַ */ + public NET_DVR_IPADDR struDnsServer2IpAddr; /* 2IPַ */ + public byte byDns; + public byte byDhcp; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 158, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + public const int MAX_SADP_NUM = 256; //豸Ŀ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SADPINFO_LIST + { + public uint dwSize; // ṹС + public ushort wSadpNum; // 豸Ŀ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SADP_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SADPINFO[] struSadpInfo; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SADP_VERIFY + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string chPassword; + public NET_DVR_IPADDR struOldIP; + public ushort wOldPort; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 62, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEO_CALL_COND + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEO_CALL_PARAM + { + public uint dwSize; + public uint dwCmdType; // 0-У1-ȡκУ2-κ 3-ܾ 4-峬ʱ 5-ͨ6-豸ͨУ7-ͻͨУ8ڻ + public ushort wPeriod; //ں, Χ[0,9] + public ushort wBuildingNumber; //¥ + public ushort wUnitNumber; //Ԫ + public ushort wFloorNumber; // + public ushort wRoomNumber; // + public ushort wDevIndex; //豸 + public byte byUnitType; //豸ͣ1-ſڻ2-3-ڻ4-Χǽ5-ſڻ6-ȷϻ7-8700ͻˣ8-4200ͻˣ9-APP + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 115, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_UNLOCK_RECORD_INFO + { + public byte byUnlockType; //ʽοUNLOCK_TYPE_ENUM + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byControlSrc; //ԴϢˢʱΪţʱΪөʯAPP˺ţά뿪ʱΪÿ͵ֻţΪ豸 + public uint dwPicDataLen; //ͼƬݳ + public IntPtr pImage; //ͼƬָ + public uint dwCardUserID; //ֿID + public ushort nFloorNumber;//ˢʱЧΪ¥ + public ushort wRoomNumber; //ԴϢˢʱЧΪţ + public ushort wLockID; //ſڻ0-ʾϽӵ1-ʾӿϽӵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = LOCK_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLockName; //ˢʱЧƣӦŲ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EMPLOYEE_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byEmployeeNo; //ţԱID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 136, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ϢĶִ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NOTICEDATA_RECEIPT_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NOTICE_NUMBER_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byNoticeNumber; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 224, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //֤¼豸δʵ֣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUTH_INFO + { + public byte byAuthResult; //֤0-Ч1-֤ɹ2-֤ʧ + public byte byAuthType; //֤ʽ0-Ч1-ָƣ2- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; // + public uint dwPicDataLen; //ͼƬݳȣ֤ʽbyAuthTypeΪʱЧ + public IntPtr pImage; //ͼƬָ루֤ʽbyAuthTypeΪʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 212, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_VIDEO_INTERCOM_EVENT_INFO_UINON + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byLen; + } + + //ӶԽ¼¼ + public struct NET_DVR_VIDEO_INTERCOM_EVENT + { + public uint dwSize; //ṹС + public NET_DVR_TIME_EX struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DEV_NUMBER_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDevNumber; //豸 + public byte byEventType; //¼Ϣͣ1-¼2-ϢĶִ3-֤¼4-Ϣϴ5Ƿˢ¼6-ſڻ¼(ҪſڻܣˢʱŻϴ¼) + public byte byPicTransType; //ͼƬݴ䷽ʽ: 0-ƣ1-url + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_VIDEO_INTERCOM_EVENT_INFO_UINON uEventInfo; //¼ϢݲοbyEventTypeȡֵ + public uint dwIOTChannelNo; //IOTͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 252, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + public struct NET_DVR_CONTROL_GATEWAY + { + public uint dwSize; //ṹС + public uint dwGatewayIndex; //Žţ1ʼ + public byte byCommand; //0-رգ1-򿪣2-ͨ״̬3-ָͨ״̬ + public byte byLockType; //ͣ0-ͨǰĬ϶Ϊ0,1- + public ushort wLockID; //ID1ʼԶ̿ſڻʱ0ʾſڻϽӵ1ʾӿϽӵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byControlSrc; //ԴϢ + public byte byControlType; //ͣ1-ӣ2-ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassword; //룬byLockTypeΪʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 108, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //XML͸ӿ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_XML_CONFIG_INPUT + { + public uint dwSize;//ṹС + public IntPtr lpRequestUrl;//ַʽ + public uint dwRequestUrlLen; + public IntPtr lpInBuffer;//XMLʽ + public uint dwInBufferSize; + public uint dwRecvTimeOut;//ճʱʱ䣬λms0ʹĬϳʱ5s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_XML_CONFIG_OUTPUT + { + public uint dwSize;//ṹС + public IntPtr lpOutBuffer;//XMLʽ + public uint dwOutBufferSize; + public uint dwReturnedXMLSize;//ʵXMLݴС + public IntPtr lpStatusBuffer;//ص״̬(XMLʽResponseStatus)ȡɹʱḳֵҪNULL + public uint dwStatusSize;//״̬С(ڴС) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHANNEL_GROUP + { + public uint dwSize;//ṹС + public uint dwChannel;//ͨ + public uint dwGroup; //ţ0ʼ0ʾ1飬1ʾ2飬 + public byte byID;//豸ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwPositionNo;//λţIPCΪ0IPD1ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 56, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_TRAVERSE_PLANE_DETECTION + { + public uint dwSize;//ṹС + public byte byEnable;//ʹԽ⹦ܣ0- 1- + public byte byEnableDualVca; //֧ܺ0- ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALERTLINE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_TRAVERSE_PLANE[] struAlertParam;//߲ + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmSched;//ʱ䣬ÿ7죬ÿ8ʱ + + public NET_DVR_HANDLEEXCEPTION_V40 struHandleException;//쳣ʽ + + public uint dwMaxRelRecordChanNum; + public uint dwRelRecordChanNum; + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint[] byRelRecordChan; + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struHolidayTime; //ղʱ䣬8ʱ + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STD_CONFIG + { + public IntPtr lpCondBuffer; + public uint dwCondSize; + public IntPtr lpInBuffer; + public uint dwInSize; + public IntPtr lpOutBuffer; + public uint dwOutSize; + public IntPtr lpStatusBuffer; + public uint dwStatusSize; + public IntPtr lpXmlBuffer; + public uint dwXmlSize; + public byte byDataType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_THERMOMETRY_COND + { + public uint dwSize; + public uint dwChannel; + public ushort wPresetNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 62, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_THERMOMETRY_TRIGGER_COND + { + public uint dwSize; + public uint dwChan; + public uint dwPreset; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EVENT_TRIGGER + { + public uint dwSize; + public NET_DVR_HANDLEEXCEPTION_V41 struHandleException; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRelRecordChan; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PRESETCHAN_INFO[] struPresetChanInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CRUISECHAN_INFO[] struCruiseChanInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PTZTRACKCHAN_INFO[] struPtzTrackInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_THERMOMETRY_ALARMRULE + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = THERMOMETRY_ALARMRULE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_THERMOMETRY_ALARMRULE_PARAM[] struThermometryAlarmRuleParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_THERMOMETRY_ALARMRULE_PARAM + { + public byte byEnabled; + public byte byRuleID; + public byte byRule; + public byte byRes; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = NAME_LEN)] + public string szRuleName; + public float fAlert; + public float fAlarm; + public float fThreshold; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_THERMOMETRY_ALARM + { + public uint dwSize; + public uint dwChannel;//ͨ + public byte byRuleID;//ID + public byte byThermometryUnit;//µλ: 0-϶ȣ棩1-϶ȣH2-(K) + public ushort wPresetNo; //Ԥõ + public NET_PTZ_INFO struPtzInfo;//ptzϢ + public byte byAlarmLevel;//0-Ԥ 1- + public byte byAlarmType;/* 0-¶ 1-¶ 2-ƽ¶ 3-² 4-¶ͻ 5-¶ͻ*/ + public byte byAlarmRule;//0-ڣ1-С + public byte byRuleCalibType;//궨 0-㣬1-2 + public NET_VCA_POINT struPoint;//꣨궨ΪʱЧ + public NET_VCA_POLYGON struRegion;//򣨵궨ΪʱЧ + public float fRuleTemperature;/*ù¶,ȷСһλ(-40-1000),+100 */ + public float fCurrTemperature;/*ǰ¶,ȷСһλ(-40-1000),+100 */ + public uint dwPicLen;//ɼͼƬ + public uint dwThermalPicLen;//ȳͼƬ + public uint dwThermalInfoLen;//ȳ񸽼Ϣ + public IntPtr pPicBuff; ///ɼͼƬָ + public IntPtr pThermalPicBuff;// ȳͼƬָ + public IntPtr pThermalInfoBuff; //ȳ񸽼Ϣָ + public NET_VCA_POINT struHighestPoint;//ߡ¶λ꣨궨ΪߡʱЧ + public float fToleranceTemperature;/* ݲ¶,ȷСһλ(-40-1000),+100 */ + public uint dwAlertFilteringTime;//¶Ԥȴʱ λ ΧΪ0-200룬ĬΪ0 + public uint dwAlarmFilteringTime;//¶ȱȴʱ λ ΧΪ0-200룬ĬΪ0 + public uint dwTemperatureSuddenChangeCycle;//¶ͻ¼ڣλ + public float fTemperatureSuddenChangeValue;//¶ͻֵ,ȷСһλ(0) + public byte byPicTransType; //ͼƬݴ䷽ʽ: 0-ƣ1-url + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwVisibleChannel; //ɼͨͨ + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + public float fAlarmRuleTemperature;/* TMAù¶,ȷСһλ(-40-1000),+100 */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_SDK_MANUALTHERM_BASICPARAM + { + public uint dwSize; + public ushort wDistance;//(m)[0, 10000] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public float fEmissivity;//( ȷСλ)[0.01, 1.00](ı) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_SDK_POINT_THERMOMETRY + { + public float fPointTemperature;/*µǰ¶, 궨Ϊ0-ʱЧȷСһλ(-40-1000),+100*10 */ + public NET_VCA_POINT struPoint;//꣨궨Ϊ㡱ʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_SDK_REGION_THERMOMETRY + { + public float fMaxTemperature;//¶,ȷСһλ(-40-1000),+100*10 */ + public float fMinTemperature;//¶,ȷСһλ(-40-1000),+100*10 */ + public float fAverageTemperature;//ƽ¶,ȷСһλ(-40-1000),+100*10 */ + public float fTemperatureDiff;//²,ȷСһλ(-40-1000),+100*10 */ + public NET_VCA_POLYGON struRegion;//ߣ궨Ϊ򡱻ߡߡʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_SDK_MANUALTHERM_RULE + { + public byte byRuleID;//ID 0-ʾЧ1ʼ listڲжЧԣ + public byte byEnable;//Ƿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] szRuleName;// + public byte byRuleCalibType;//궨 0-㣬1-2- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_SDK_POINT_THERMOMETRY struPointTherm;//£궨Ϊ0-ʱЧ + public NET_SDK_REGION_THERMOMETRY struRegionTherm; //£궨Ϊ1-2-ʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 512, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_SDK_MANUAL_THERMOMETRY + { + public uint dwSize;//ṹС + public uint dwChannel;//ͨ + public uint dwRelativeTime; // ʱֻ꣨ + public uint dwAbsTime; // ʱֻ꣨ + public byte byThermometryUnit;//µλ: 0-϶ȣ棩1-϶ȣH2-(K) + public byte byDataType;//״̬:0-У1-ʼ2-ֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_SDK_MANUALTHERM_RULE struRuleInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 512, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ʵʱ¶ȼṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_REALTIME_THERMOMETRY_COND + { + public uint dwSize; + public uint dwChan;//ͨţ1ʼ0xffffffffȡȫͨ + public byte byRuleID; //ID 0-ȡȫ򣬾ID1ʼ + /* + * 1-ʱģʽ豸ÿһϴݵ¡ºƽ¶ֵ² + * 2-²ģʽһһ»»ƽ»²ֵ²ڵ2϶ȣϴ¡ºƽ¶ֵڵһСʱ²ֵС2϶ȣϴ¡¡ƽº²ֵ + */ + public byte byMode; //ģʽ 0-Ϊ豸1-ʱģʽ2-²ģʽ + public ushort wInterval; //ϴ²ģʽ֧֣1~3600S0Ĭ3600Sϴһ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POINT_THERM_CFG + { + public float fTemperature;//ǰ¶ + public NET_VCA_POINT struPoint;//꣨궨ΪʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 120, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LINEPOLYGON_THERM_CFG + { + public float fMaxTemperature;// + public float fMinTemperature;// + public float fAverageTemperature;//ƽ + public float fTemperatureDiff;//² + public NET_VCA_POLYGON struRegion;//򣨵궨Ϊ/ߵʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_THERMOMETRY_UPLOAD + { + public uint dwSize; + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] szRuleName;// + public byte byRuleID;//ID + public byte byRuleCalibType;//궨 0-㣬1-2- + public ushort wPresetNo; //Ԥõ + public NET_DVR_POINT_THERM_CFG struPointThermCfg; + public NET_DVR_LINEPOLYGON_THERM_CFG struLinePolygonThermCfg; + public byte byThermometryUnit;//µλ: 0-϶ȣ棩1-϶ȣH2-(K) + public byte byDataType;//״̬:0-У1-ʼ2- + public byte byRes1; + /* + bit0-ĵ£0-֧֣1-֧֣ + bit1-ߵ£0-֧֣1-֧֣ + bit2-͵£0-֧֣1-֧֣ + */ + public byte bySpecialPointThermType;// Ƿ֧ + public float fCenterPointTemperature;//ĵ¶,ȷСһλ(-40-1500),+100*10 bySpecialPointThermTypeжǷ֧ĵ㣩 + public float fHighestPointTemperature;//ߵ¶,ȷСһλ(-40-1500),+100*10bySpecialPointThermTypeжǷ֧ߵ㣩 + public float fLowestPointTemperature;//͵¶,ȷСһλ(-40-1500),+100*10bySpecialPointThermTypeжǷ֧͵㣩 + public NET_VCA_POINT struHighestPoint;//ߡ¶λ꣨궨ΪߡʱЧ + public NET_VCA_POINT struLowestPoint;//ߡ¶λ꣨궨ΪߡʱЧ + public byte yIsFreezedata;//Ƿݶ 0- 1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public uint dwChan; //ͨţѯͨΪ0xffffffffʱֶЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 88, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + /***************************** end *********************************************/ + + /*******************************ݽṹ begin********************************/ + //ȡ豸Ϣӿڶ + public const int DESC_LEN_32 = 32; //ֳ + public const int MAX_NODE_NUM = 256; //ڵ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DESC_NODE + { + public int iValue; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] byDescribe; //ֶ + public uint dwFreeSpace; //ȡбר,λΪM + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISKABILITY_LIST + { + public uint dwSize; //ṹ + public uint dwNodeNum; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NODE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DESC_NODE[] struDescNode; // + } + + //ݽб + public const int BACKUP_SUCCESS = 100; // + public const int BACKUP_CHANGE_DEVICE = 101; //豸豸 + + public const int BACKUP_SEARCH_DEVICE = 300; //豸 + public const int BACKUP_SEARCH_FILE = 301; //¼ļ + public const int BACKUP_SEARCH_LOG_FILE = 302; //־ļ + + public const int BACKUP_EXCEPTION = 400; //쳣 + public const int BACKUP_FAIL = 500; //ʧ + + public const int BACKUP_TIME_SEG_NO_FILE = 501; //ʱ¼ļ + public const int BACKUP_NO_RESOURCE = 502; //벻Դ + public const int BACKUP_DEVICE_LOW_SPACE = 503; //豸 + public const int BACKUP_DISK_FINALIZED = 504; //¼̷ + public const int BACKUP_DISK_EXCEPTION = 505; //¼쳣 + public const int BACKUP_DEVICE_NOT_EXIST = 506; //豸 + public const int BACKUP_OTHER_BACKUP_WORK = 507; //ݲڽ + public const int BACKUP_USER_NO_RIGHT = 508; //ûûвȨ + public const int BACKUP_OPERATE_FAIL = 509; //ʧ + public const int BACKUP_NO_LOG_FILE = 510; //Ӳ־ + + //ݹ̽ӿڶ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BACKUP_NAME_PARAM + { + public uint dwFileNum; //ļ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RECORD_FILE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_FINDDATA_V30[] struFileList; //ļб + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] byDiskDes; //ݴ + public byte byWithPlayer; //Ƿ񱸷ݲ + public byte byContinue; /*Ƿ 0 1*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 34, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BACKUP_TIME_PARAM + { + public int lChannel; //ʱ䱸ݵͨ + public NET_DVR_TIME struStartTime; //ݵʼʱ + public NET_DVR_TIME struStopTime; //ݵֹʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] byDiskDes; //ݴ + public byte byWithPlayer; //Ƿ񱸷ݲ + public byte byContinue; //Ƿ 0 1 + public byte byDrawFrame; //0 ֡ 1 ֡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 33, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + /********************************* end *******************************************/ + public enum COMPRESSION_ABILITY_TYPE + { + COMPRESSION_STREAM_ABILITY = 0, //ѹ + MAIN_RESOLUTION_ABILITY = 1, //ѹֱ + SUB_RESOLUTION_ABILITY = 2, //ѹֱ + EVENT_RESOLUTION_ABILITY = 3, //¼ѹֱ + FRAME_ABILITY = 4, //֡ + BITRATE_TYPE_ABILITY = 5, //λ + BITRATE_ABILITY = 6, //λ + THIRD_RESOLUTION_ABILITY = 7, //ѹֱ + STREAM_TYPE_ABILITY = 8, // + PIC_QUALITY_ABILITY = 9, //ͼ + INTERVAL_BPFRAME_ABILITY = 10, //BP֡ + VIDEO_ENC_ABILITY = 11, //Ƶ + AUDIO_ENC_ABILITY = 12, //Ƶ + VIDEO_ENC_COMPLEXITY_ABILITY = 13, //Ƶ븴Ӷ + FORMAT_ABILITY = 14, //װʽ + } + + //б + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ABILITY_LIST + { + public uint dwAbilityType; // COMPRESSION_ABILITY_TYPE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + public uint dwNodeNum; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NODE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DESC_NODE[] struDescNode; // + } + + public const int MAX_ABILITYTYPE_NUM = 12; // + + // ѹб + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSIONCFG_ABILITY + { + public uint dwSize; //ṹ + public uint dwAbilityNum; //͸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ABILITYTYPE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ABILITY_LIST[] struAbilityNode; // + } + + //ģʽA + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDATE_MODEA + { + public byte byStartMonth; // ʼ 1ʼ + public byte byStartDay; // ʼ 1ʼ + public byte byEndMonth; // + public byte byEndDay; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDATE_MODEB + { + public byte byStartMonth; // 1ʼ + public byte byStartWeekNum; // ڼ 1ʼ + public byte byStartWeekday; // ڼ + public byte byEndMonth; // 1ʼ + public byte byEndWeekNum; // ڼ 1ʼ + public byte byEndWeekday; // ڼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDATE_MODEC + { + public ushort wStartYear; // + public byte byStartMon; // + public byte byStartDay; // + public ushort wEndYear; // + public byte byEndMon; // + public byte byEndDay; // + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_HOLIDATE_UNION + { + //С 12ֽ + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.U4)] + public uint[] dwSize; + /*[FieldOffsetAttribute(0)] + public NET_DVR_HOLIDATE_MODEA struModeA; // ģʽA + [FieldOffsetAttribute(0)] + public NET_DVR_HOLIDATE_MODEB struModeB; // ģʽB + [FieldOffsetAttribute(0)] + public NET_DVR_HOLIDATE_MODEC struModeC; // ģʽC + * */ + } + + public enum HOLI_DATE_MODE + { + HOLIDATE_MODEA = 0, + HOLIDATE_MODEB, + HOLIDATE_MODEC + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_PARAM + { + public byte byEnable; // Ƿ + public byte byDateMode; // ģʽ 0-ģʽA 1-ģʽB 2-ģʽC + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_DVR_HOLIDATE_UNION uHolidate; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + public const int MAX_HOLIDAY_NUM = 32; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_PARAM_CFG + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HOLIDAY_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_HOLIDAY_PARAM[] struHolidayParam; // ղ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ձʽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_HANDLE + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime; // ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 240, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HOLIDAY_RECORD + { + public uint dwSize; + public NET_DVR_RECORDDAY struRecDay; // ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RECORDSCHED[] struRecordSched; // ¼ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + public const int MAX_LINK_V30 = 128; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ONE_LINK + { + public NET_DVR_IPADDR struIP; // ͻIP + public int lChannel; // ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LINK_STATUS + { + public uint dwSize; // ṹС + public ushort wLinkNum; // ӵĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LINK_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_LINK[] struOneLink; // ӵĿͻϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + public const int MAX_BOND_NUM = 2; + + //BONDINGýṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_ONE_BONDING + { + public byte byMode; + public byte byUseDhcp; + public byte byMasterCard; + public byte byStatus; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NETWORK_CARD, ArraySubType = UnmanagedType.I1)] + public byte[] byBond; + public NET_DVR_ETHERNET_V30 struEtherNet; + public NET_DVR_IPADDR struGatewayIpAddr; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //BONDINGýṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_NETWORK_BONDING + { + public uint dwSize; + public byte byEnable; + public byte byNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_BOND_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_ONE_BONDING[] struOneBond; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISK_QUOTA + { + public byte byQuotaType; // ,1 - + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public uint dwHCapacity; // Ĵ32λ λMB + public uint dwLCapacity; // Ĵ32λ λMB + public uint dwHUsedSpace; // ʹõĴ̴С32λ λMB + public uint dwLUsedSpace; // ʹõĴ̴С32λ λMB + public byte byQuotaRatio; // Ĵ̱,λ:% + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 21, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISK_QUOTA_CFG + { + public uint dwSize; // ṹС + public NET_DVR_DISK_QUOTA struPicQuota; // ͼƬ + public NET_DVR_DISK_QUOTA struRecordQuota; // ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIMING_CAPTURE + { + public NET_DVR_JPEGPARA struJpegPara; // ʱץͼͼƬ + public uint dwPicInterval; //ʱץͼʱ,λs 1-1s 2-2s 3-3s 4-4s 5-5s + //6-10m 7-30m 8-1h 9-12h 10-24h + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_REL_CAPTURE_CHAN + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byChan; // λʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + public const int MAX_PIC_EVENT_NUM = 32; + public const int MAX_ALARMIN_CAPTURE = 16; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_REL_CAPTURE_CHAN_V40 + { + public uint dwMaxRelCaptureChanNum; //ɴĹͨ-ֻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U4)] + public uint[] dwChanNo; //Ĺץͼͨţֵʾý,0xffffffffʾЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EVENT_CAPTURE_V40 + { + public NET_DVR_JPEGPARA struJpegPara; // ¼ץͼͼƬ + public uint dwPicInterval; // ¼ץͼʱ λΪ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PIC_EVENT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_REL_CAPTURE_CHAN_V40[] struRelCaptureChan; // ± 0 ƶⴥץͼ 1 Ƶڵץͼ 2 Ƶʧץͼ,3ʾPIRץͼ4ʾ߱ץͼ5ʾȱץͼ,6ʾץͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN_CAPTURE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_REL_CAPTURE_CHAN_V40[] struAlarmInCapture; // 봥ץͼ±0 1 + public uint dwMaxGroupNum; //豸ֵ֧󱨾ÿ16 + public byte byCapTimes; //ץͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 59, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EVENT_CAPTURE + { + public NET_DVR_JPEGPARA struJpegPara; // ¼ץͼͼƬ + public uint dwPicInterval; /*¼ץͼʱ λΪ 1-1s 2-2s 3-3s 4-4s 5-5s + * 6-10m 7-30m 8-1h 9-12h 10-24h*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PIC_EVENT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_REL_CAPTURE_CHAN[] struRelCaptureChan; /* ± 0 ƶⴥץͼ 1 Ƶڵץͼ, + * 2 Ƶʧץͼ,3ʾPIRץͼ4ʾ߱ץͼ + * 5ʾȱץͼ,6ʾץͼ 7ʾ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ALARMIN_CAPTURE, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_REL_CAPTURE_CHAN[] struAlarmInCapture; //봥ץͼ±0 1 + public byte byCapTimes; //ץͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 59, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_JPEG_CAPTURE_CFG_V40 + { + public uint dwSize; //ṹ峤 + public NET_DVR_TIMING_CAPTURE struTimingCapture; + public NET_DVR_EVENT_CAPTURE_V40 struEventCapture; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_JPEG_CAPTURE_CFG + { + public uint dwSize; // ṹС + public NET_DVR_TIMING_CAPTURE struTimingCapture; + public NET_DVR_EVENT_CAPTURE struEventCapture; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAPTURE_DAY + { + public byte byAllDayCapture; // Ƿȫץͼ + public byte byCaptureType; // ץͼͣ0-ʱץͼ1-ƶץͼ2-ץͼ3-ƶ򱨾ץͼ4-ƶͱץͼ6-ܱץͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAPTURE_SCHED + { + public NET_DVR_SCHEDTIME struCaptureTime; // ץͼʱ + public byte byCaptureType; // ץͼͣ0-ʱץͼ1-ƶץͼ2-ץͼ3-ƶ򱨾ץͼ4-ƶͱץͼ6-ܱץͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ͨץͼƻ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCHED_CAPTURECFG + { + public uint dwSize; //ṹ + public byte byEnable; //Ƿץͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CAPTURE_DAY[] struCaptureDay;//ȫץͼƻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CAPTURE_SCHED[] struCaptureSched;//ʱץͼƻ + public NET_DVR_CAPTURE_DAY struCaptureHoliday; //ץͼƻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TIMESEGMENT_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CAPTURE_SCHED[] struHolidaySched; //ʱμץͼƻ + public uint dwRecorderDuration; //ץͼʱ 0xffffffffʾֵЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FLOW_TEST_PARAM + { + public uint dwSize; //ṹС + public int lCardIndex; // + public uint dwInterval; //豸ϴʱ, λ:100ms + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FLOW_INFO + { + public uint dwSize; //ṹС + public uint dwSendFlowSize; //С,λkbps + public uint dwRecvFlowSize; //С,λkbps + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //¼ǩ + public const int LABEL_NAME_LEN = 40; + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORD_LABEL + { + public uint dwSize; // ṹС + public NET_DVR_TIME struTimeLabel; // ǩʱ + public byte byQuickAdd; // Ƿ ʱǩЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = LABEL_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLabelName; // ǩ Ϊ40ֽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + public const int LABEL_IDENTIFY_LEN = 64; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LABEL_IDENTIFY + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = LABEL_IDENTIFY_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLabelIdentify; // 64ֽڱʶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + public const int MAX_DEL_LABEL_IDENTIFY = 20;// ɾǩʶ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEL_LABEL_PARAM + { + public uint dwSize; // ṹС + public byte byMode; // λʾ,0x01ʾʶɾ + public byte byRes1; + public ushort wLabelNum; // ǩĿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DEL_LABEL_IDENTIFY, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_LABEL_IDENTIFY[] struIndentify; // ǩʶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 160, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MOD_LABEL_PARAM + { + public NET_DVR_LABEL_IDENTIFY struIndentify; //Ҫ޸ĵıǩʶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = LABEL_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLabelName; //޸ĺıǩ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ǩṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FIND_LABEL + { + public uint dwSize; // ṹС + public int lChannel; // ҵͨ + public NET_DVR_TIME struStartTime; // ʼʱ + public NET_DVR_TIME struStopTime; // ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = LABEL_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLabelName; // ¼ǩ ǩΪգֹʱбǩ + public byte byDrawFrame; //0:֡1֡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 39, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + //ǩϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINDLABEL_DATA + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = LABEL_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLabelName; // ǩ + public NET_DVR_TIME struTimeLabel; // ǩʱ + public NET_DVR_LABEL_IDENTIFY struLabelIdentify; // ǩʶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + } + + public const int CARDNUM_LEN_V30 = 40; + public const int PICTURE_NAME_LEN = 64; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FIND_PICTURE + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PICTURE_NAME_LEN)] + public string sFileName;//ͼƬ + public NET_DVR_TIME struTime;//ͼƬʱ + public uint dwFileSize;//ͼƬĴС + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = CARDNUM_LEN_V30)] + public string sCardNum; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FIND_PICTURE_PARAM + { + public uint dwSize; // ṹС + public int lChannel; // ͨ + public byte byFileType; + public byte byNeedCard; // ǷҪ + public byte byProvince; //ʡֵ + public byte byEventType; // ¼ͣ01-ͨ¼2-Υȡ֤3-¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CARDNUM_LEN_V30, ArraySubType = UnmanagedType.I1)] + public byte[] sCardNum; // + public NET_DVR_TIME struStartTime;//ͼƬĿʼʱ + public NET_DVR_TIME struStopTime;// ͼƬĽʱ + //ITC3.7 + public uint dwTrafficType; //ͼƬЧ ο VCA_OPERATE _TYPE + public uint dwVehicleType; // ο VCA_VEHICLE_TYPE + //ΥͲο VCA_ILLEGAL_TYPE ǰָ֧ѡ + public uint dwIllegalType; + public byte byLaneNo; //(1~99) + public byte bySubHvtType ;//0-,1-(ֳ֧Ƽʡݼ),2-ǻ,3- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LICENSE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLicense; //ƺ + public byte byRegion; // ֵ 0-1-ŷ(Europe Region)2-(Russian Region)3-ŷ&˹(EU&CIS), 4-ж(Middle East),0xff- + public byte byCountry; // ֵգCOUNTRY_INDEX + public byte byArea; // + public byte byISO8601; //Ƿ8601ʱʽʱֶǷЧ0-ʱЧʱΪ豸ʱ 1-ʱЧ + public byte cStartTimeDifferenceH; //ʼʱUTCʱСʱ-12 ... +14 ʾʱ + public byte cStartTimeDifferenceM; //ʼʱUTCʱӣ-30, 0, 30, 45ʾʱ + public byte cStopTimeDifferenceH; //ʱUTCʱСʱ-12 ... +14ʾʱ + public byte cStopTimeDifferenceM; //ʱUTCʱӣ-30, 0, 30, 45ʾʱ + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ADDRESS + { + public NET_DVR_IPADDR struIP; //IPַ + public ushort wPort; //˿ں + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_PIC_EXTRA_INFO_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 544, ArraySubType = UnmanagedType.I1)] + public byte[] byUnionLen; //峤ȣʵ + } + + public const int MAX_FACE_PIC_NUM = 30; /*ͼ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_EXTRA_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_FACE_PIC_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_RECT[] struVcaRect; //ͼϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FIND_PICTURE_V50 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PICTURE_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sFileName;//ͼƬ + public NET_DVR_TIME struTime;//ͼƬʱ + public uint dwFileSize;//ͼƬĴС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CARDNUM_LEN_V30, ArraySubType = UnmanagedType.I1)] + public byte[] sCardNum; // + public byte byPlateColor;//οṹ VCA_PLATE_COLOR + public byte byVehicleLogo;//οṹ VLR_VEHICLE_CLASS + public byte byFileType; //ļͣ :0ʱץͼ1 ƶץͼ 2 ץͼ3 | ƶץͼ 4 & ƶץͼ 6 ֶץͼ ,9-ͼƬ,10- PIR11- ߱12- ȱ, 0xa Ԥʱͼ0xd , 0xe Խ⣬0xf ⣬0x10 , 0x11-豸ػطʱͼ, 0x12- + public byte byRecogResult;//ʶοṹVTR_RESULT + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LICENSE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLicense; //ƺ + public byte byEventSearchStatus; //ͼƬʾͬһҽʱ0-ʾûͼƬϢ1-ʾ滹ͼƬϢܹͼƬϢһ״̬Ϊ0ͼƬ + public NET_DVR_ADDRESS struAddr; //ͼƬڵĵַϢͼƬʱõ + public byte byISO8601; //Ƿ8601ʱʽʱֶǷЧ0-ʱЧʱΪ豸ʱ 1-ʱЧ + public byte cTimeDifferenceH; //UTCʱСʱ-12 ... +14 + public byte cTimeDifferenceM; //UTCʱӣ-30,0, 30, 45 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 253, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + public NET_DVR_PIC_EXTRA_INFO_UNION uPicExtraInfo; //ͼƬϢ + } + + public const int MAX_RECORD_PICTURE_NUM = 50; //󱸷ͼƬ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BACKUP_PICTURE_PARAM + { + public uint dwSize; // ṹС + public uint dwPicNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RECORD_PICTURE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_FIND_PICTURE[] struPicture; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] byDiskDes; + public byte byWithPlayer; + public byte byContinue; /*Ƿ 0 1*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 34, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_COMPRESSION_LIMIT + { + public uint dwSize; //ṹС + public uint dwChannel; //ͨ + public byte byCompressType; //ȡѹ1,2,3,¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public NET_DVR_COMPRESSIONCFG_V30 struCurrentCfg; //ǰѹ + } + + public const int STEP_READY = 0; //׼ + public const int STEP_RECV_DATA = 1; // + public const int STEP_UPGRADE = 2; //ϵͳ + public const int STEP_BACKUP = 3; //ϵͳ + public const int STEP_SEARCH = 255; //ļ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEO_EFFECT + { + public uint dwBrightValue; //[0,255] + public uint dwContrastValue; //Աȶ[0,255] + public uint dwSaturationValue; //Ͷ[0,255] + public uint dwHueValue; //ɫ[0,255] + public uint dwSharpness; //[0,255] + public uint dwDenoising; //ȥ[0,255] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEO_INPUT_EFFECT + { + public uint dwSize; //ṹС + public ushort wEffectMode; //ģʽ 0-׼ 1- 2- 3- 255-Զ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 146, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_DVR_VIDEO_EFFECT struVideoEffect; //ƵЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOPARA_V40 + { + public uint dwChannel; // ͨ + public uint dwVideoParamType; // Ƶ 0- 1-Աȶ 2-Ͷ 3-ɫ 4- 5-ȥ + public uint dwVideoParamValue; //ӦƵֵΧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEFAULT_VIDEO_COND + { + public uint dwSize; // ṹС + public uint dwChannel; // ͨ + public uint dwVideoMode; // ģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ENCODE_JOINT_PARAM + { + public uint dwSize; // ṹС + public byte byJointed; // 0 ûй 1 Ѿ + public byte byDevType; // 豸 1 豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // ֽ + public NET_DVR_IPADDR struIP; // ıȡ豸IPַ + public ushort wPort; // ıȡ豸˿ں + public ushort wChannel; // ıȡ豸ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VCA_CHAN_WORKSTATUS + { + public byte byJointed; // 0-ûй 1-Ѿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_IPADDR struIP; // ȡ豸IPַ + public ushort wPort; // ȡ豸˿ں + public ushort wChannel; // ȡ豸ͨ + public byte byVcaChanStatus; // 0 - δ 1 - + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 19, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VCA_DEV_WORKSTATUS + { + public uint dwSize; // ṹС + public byte byDeviceStatus; // 豸״̬0 - 1- + public byte byCpuLoad; // CPUʹ0-100 ֱʹðٷ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VCA_CHAN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_VCA_CHAN_WORKSTATUS[] struVcaChanStatus; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_VIDEOPLATFORM_V40 + { + /*ӴڶӦͨӦĽϵͳIJλ(Ƶۺƽ̨нϵͳЧ)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecoderId; + //ʾƵֱʣ1-D1,2-720P,3-1080P豸Ҫݴ//ֱʽнͨķ䣬1ó1080P豸4ͨ + //˽ͨ + public byte byDecResolution; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 143, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_NOTVIDEOPLATFORM_V40 + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 160, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VGA_DISP_CHAN_CFG_V40 + { + public uint dwSize; + public byte byAudio; /*ƵǷ*/ + public byte byAudioWindowIdx; /*ƵӴ*/ + public byte byVgaResolution; /*ֱʣȡ*/ + public byte byVedioFormat; /*1:NTSC,2:PAL0-NULL*/ + public uint dwWindowMode; /*ģʽȡ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecChan;/*ӴڹĽͨ*/ + public byte byEnlargeStatus; /*ǷڷŴ״̬0Ŵ1Ŵ*/ + public byte byEnlargeSubWindowIndex;//ŴӴں + public byte byScale; /*ʾģʽ0---ʵʾ1---ʾ( BNC )*/ + /*ֹ壬0-Ƶۺƽ̨ڲʾͨã1-ʾͨ*/ + public byte byUnionType; + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct struDiff + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 160, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + /*[FieldOffsetAttribute(0)] + public UNION_VIDEOPLATFORM_V40 struVideoPlatform; + + [FieldOffsetAttribute(0)] + public UNION_NOTVIDEOPLATFORM_V40 struNotVideoPlatform; + * */ + } + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 120, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_V6SUBSYSTEMPARAM + { + public byte bySerialTrans;//Ƿ͸0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 35, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int NET_DVR_V6PSUBSYSTEMARAM_GET = 1501;//ȡV6ϵͳ + public const int NET_DVR_V6PSUBSYSTEMARAM_SET = 1502;//V6ϵͳ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CORRECT_DEADPIXEL_PARAM + { + public uint dwSize; + public uint dwCommand; //0-뻵ģʽ1-ӻ㣬2-滵㣬3-˳ + public uint dwDeadPixelX; //X + public uint dwDeadPixelY; //Y + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + public const int MAX_REDAREA_NUM = 6; //̵ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_REDAREACFG + { + public uint dwSize; + public uint dwCorrectEnable; //ǷУܣ0-رգ1- + public uint dwCorrectLevel; //У1(У)-10(У),ĬΪ5 + public uint dwAreaNum; //У + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_REDAREA_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_RECT[] struLaneRect; //У + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HISTORICDATACFG + { + public uint dwSize; + public uint dwTotalNum; //ʷݸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int INQUEST_MESSAGE_LEN = 44; //ѶصϢ + public const int INQUEST_MAX_ROOM_NUM = 2; //ѶҸ + public const int MAX_RESUME_SEGMENT = 2; //֧ͬʱָƬĿ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_ROOM + { + public byte byRoomIndex; //Ѷұ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + public const int MAX_INQUEST_CDRW_NUM = 4; //¼Ŀ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_CDRW_STATUS + { + /*״̬0-Ѷʼ + * 1-Ѷп¼2-Ѷֹͣ + * 3-¼Ѷļ, + * 4-(º󱸷ݺͱر) + * 5- + * 6-ʼӲ + * 7-ָѶ*/ + public uint dwType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_INQUEST_CDRW_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_INQUEST_CDRW[] strCDRWNum; //0ʾ¼1 + public NET_DVR_TIME_EX struInquestStartTime; //Ѷʼʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_CDRW + { + public uint dwEnable; //¼״̬ǷЧ,0-Ч,1-Ч + public uint dwStatus; /* dwType=0ʱ + 0-1-޹̻쳣, + dwType=12ʱ + 0-¼1-޹̻쳣 + 2-ѷ(81֧)3-̿ռ䲻㣬 + 4-쳣Ѷֹ(81֧) + dwType=3ʱ + 0-¼1-޹̻쳣 + 2-ѷ(81֧)3-̿ռ䲻 + dwType=4ʱ + 0-¼1-޹̻쳣 + 2-ѷ(81֧)3-̿ռ䲻 + dwType=5ʱ, + 0- 1-޹̻쳣, + 2-ѷ(81֧) + dwType=67ʱ, + 0-¼, 1-޹̻쳣, + 2-ѷ(81֧), 3-̿ռ䲻*/ + public uint dwVolumn; //,λM + public uint dwFreeSpace; //ʣ,λM + public uint dwTimeLeft; // ʣʱ䣬λ + public byte byCDType; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_CDRW_CFG + { + public uint dwSize; + public uint dwNum; //¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U4)] + public uint[]dwRwSelectPara;// Ƿѡиù + public uint dwModeSelect; //0ʾѭ¼ģʽ 1ʾп¼ģʽ(Ĭģʽ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public uint dwStartCDRW; //DVR Ѿʼ¼ + public uint dwHdExcp; //Ӳ + public uint dwInterval; //ʱ10(0)20(1)30(2) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] sLable; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_MESSAGE + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = INQUEST_MESSAGE_LEN)] + public string sMessage; //صϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 46, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_SENSOR_DEVICE + { + public ushort wDeviceType; //ݲɼ豸ͺ:0- 1- 2-ز 3- 4- 5-ء6-ϡ7-ά˹ + public ushort wDeviceAddr; //ݲɼ豸ַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 28, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_SENSOR_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = INQUEST_MAX_ROOM_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_INQUEST_SENSOR_DEVICE[] struSensorDevice; + public uint dwSupportPro; //֧Э,λʾ, °汾չֶ + //0x1: 0x2:ز 0x4: + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 120, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_ROOM_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = NAME_LEN)] + public string szCDName; //ƣ˫̹һ + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct uCalcMode + { + [FieldOffsetAttribute(0)] + public byte byBitRate; // byCalcTypeΪ0ʱЧ(0-321-482-643-804-965-128 + //6-1607-1928-2249-25610-32011-38412-448 + //13-51214-64015-76816-896ǰ16ֵ)17-102418-128019-1536 + //20-179221-204822-307223-409624-8192 + [FieldOffsetAttribute(0)] + public byte byInquestTime; // byCalcTypeΪ1ʱЧ0-1Сʱ, 1-2Сʱ,2-3Сʱ,3-4Сʱ, 4-6Сʱ,5-8Сʱ + //8-16Сʱ, 9-20Сʱ,10-22Сʱ,11-24Сʱ + } + public byte byCalcType; //¼0- 1-ʱ + public byte byAutoDelRecord; // ǷԶɾ¼0-ɾʱ¼ 1-ɾ + public byte byAlarmThreshold; // ֵ + public byte byInquestChannelResolution; //Ѷֱͨʣ0:720P 1:1080P + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_SYSTEM_INFO + { + public uint dwRecordMode; //¼ģʽ:1 ˫ģʽ 2 ֿģʽ 3 ˫˫ģʽ޸Ҫ豸 + public uint dwWorkMode; //ģʽ:0 ׼ģʽ 1 ͨģʽ(Ŀǰֻб׼ģʽ) + public uint dwResolutionMode; //豸ֱʣ0: 1:D1 2:720P 3:1080PѶôֶΣ + public NET_DVR_INQUEST_SENSOR_INFO struSensorInfo; //ʪȴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = INQUEST_MAX_ROOM_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_INQUEST_ROOM_INFO[] struInquestRoomInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_RESUME_SEGMENT + { + public NET_DVR_TIME struStartTime; //¼ʼʱ + public NET_DVR_TIME struStopTime; //¼ֹʱ + public byte byRoomIndex; //Ѷұ,1ʼ + public byte byDriveIndex; //¼,1ʼ + public ushort wSegmetSize; //ƬϵĴС, λM + public uint dwSegmentNo; //ƬڱѶе,1ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_RESUME_EVENT + { + public uint dwResumeNum; //ָ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RESUME_SEGMENT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_INQUEST_RESUME_SEGMENT[] struResumeSegment; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 200, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INQUEST_DEVICE_VERSION + { + public byte byMainVersion; /*汾. + 0 : δ֪ + 1 : 8000ѶDVR + ΰ汾: 1 : 8000HD-S + 2 : 8100ѶDVR + ΰ汾: 1 : Ѷ81SNL + 2 : Ѷ81SH + 3 : Ѷ81SFH + 3 : 8608ѶNVR + ΰ汾: 1 : DS-8608SN-SP + 2 : DS-8608SN-ST + */ + public byte bySubVersion; //ߴΰ汾 + public byte byUpgradeVersion; //汾,δΪ0 + public byte byCustomizeVersion; //ư汾,ǶΪ0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISK_RAID_INFO + { + public uint dwSize; //ṹС + public byte byEnable; //RaidǷ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 35, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SYNCHRONOUS_IPC + { + public uint dwSize; //ṹС + public byte byEnable; //ǷãΪǰIPCͬ豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPC_PASSWD + { + public uint dwSize; //ṹС + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string sOldPasswd; //IPCľ룬DVRDVR֤ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = PASSWD_LEN)] + public string sNewPasswd; //IPC + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͨȡDVR״̬λbps + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DEVICE_NET_USING_INFO + { + public uint dwSize; //ṹС + public uint dwPreview; //Ԥ + public uint dwPlayback; //ط + public uint dwIPCModule; //IPC + public uint dwNetDiskRW; //̶д + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] res; + } + + //ͨDVRǰIPCIPַ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IPC_NETCFG + { + public uint dwSize; //ṹС + public NET_DVR_IPADDR struIP; //IPCIPַ + public ushort wPort; //IPCĶ˿ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 126)] + public string res; + } + + //ʱ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_TIME_LOCK + { + public uint dwSize; //ṹС + public NET_DVR_TIME strBeginTime; + public NET_DVR_TIME strEndTime; + public uint dwChannel; //ͨ, 0xffʾͨ + public uint dwRecordType; //¼: 0xffffffffȫ0ʱ¼1-ƶ⣬23-ƶ⣬4-ƶ⣬5-6-ֶ¼7-¼(ͬļ) + public uint dwLockDuration; //ʱ,λ,0xffffffffʾ + public NET_DVR_TIME_EX strUnlockTimePoint; //ʱЧdwLockDurationΪʱʱ䵽ʱԶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LOCK_RETURN + { + public uint dwSize; //ṹС + public NET_DVR_TIME strBeginTime; + public NET_DVR_TIME strEndTime; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //67DVS + //֤ + public enum NET_SDK_UPLOAD_TYPE + { + UPGRADE_CERT_FILE = 0, + UPLOAD_CERT_FILE = 1, + TRIAL_CERT_FILE = 2, + CONFIGURATION_FILE = 3 + } + + public enum NET_SDK_DOWNLOAD_TYPE + { + NET_SDK_DOWNLOAD_CERT = 0, //֤ + NET_SDK_DOWNLOAD_IPC_CFG_FILE = 1,//IPCļ + NET_SDK_DOWNLOAD_BASELINE_SCENE_PIC = 2, //ػ׼ͼƬ + NET_SDK_DOWNLOAD_VQD_ALARM_PIC = 3, //VQDͼƬ + NET_SDK_DOWNLOAD_CONFIGURATION_FILE=4 //ļ + } + + //״̬ + public enum NET_SDK_DOWNLOAD_STATUS + { + NET_SDK_DOWNLOAD_STATUS_SUCCESS = 1, //سɹ + NET_SDK_DOWNLOAD_STATUS_PROCESSING, // + NET_SDK_DOWNLOAD_STATUS_FAILED, //ʧ + NET_SDK_DOWNLOAD_STATUS_UNKOWN_ERROR //δ֪ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BONJOUR_CFG + { + public uint dwSize; // ṹС + public byte byEnableBonjour; // Bonjourʹ 0 1ر + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byFriendlyName; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SOCKS_CFG + { + public uint dwSize; // ṹС + public byte byEnableSocks; // ʹ 0ر 1 + public byte byVersion; // SOCKS汾 4SOCKS4 5SOCKS5 + public ushort wProxyPort; // ˿ڣĬ1080 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byProxyaddr; // IPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byUserName; // û SOCKS + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPassword; // SOCKS5 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LOCAL_ADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLocalAddr; //ʹsocksΣʽΪ"ip/netmask;ip/netmask;" + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_QOS_CFG + { + public uint dwSize; + public byte byManageDscp; // ݵDSCPֵ [0-63] + public byte byAlarmDscp; // ݵDSCPֵ [0-63] + public byte byVideoDscp; // ƵݵDSCPֵ [0-63]byFlagΪ0ʱʾƵ + public byte byAudioDscp; // ƵݵDSCPֵ [0-63]byFlagΪ1ʱЧ + public byte byFlag; // 0Ƶһ1Ƶֿ + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 126, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HTTPS_CFG + { + public uint dwSize; + public ushort wHttpsPort; // HTTPS˿ + public byte byEnable; // ʹ 0ر 1 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 125, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //֤ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CERT_NAME + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_COUNTRY_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCountry; //Ҵ CN + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byState; //޻ʡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byLocality; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byOrganization; //֯ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byUnit; //λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byCommonName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOMAIN_NAME, ArraySubType = UnmanagedType.I1)] + public byte[] byEmail; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CERT_PARAM + { + public uint dwSize; + public ushort wCertFunc; //֤࣬0-802.1x,1-HTTPS + public ushort wCertType; //֤ͣ0-CA1-Certificate,2-˽Կļ + public byte byFileType; //֤ļͣ0-PEM,1-PFX + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 35, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int UPLOAD_CERTIFICATE = 1; //ϴ֤ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CERT_INFO + { + public uint dwSize; + public NET_DVR_CERT_PARAM struCertParam; //֤ + public uint dwValidDays; //ЧΪǩʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPasswd; //˽Կ + public NET_DVR_CERT_NAME struCertName; // ֤ + public NET_DVR_CERT_NAME struIssuerName; // ֤鷢ƣǩ֤ϢȡʱЧ + public NET_DVR_TIME_EX struBeginTime; //֤鴴ʱ䣨ǩ֤ϢȡʱЧ + public NET_DVR_TIME_EX struEndTime; //ֹ֤ʱ䣨ǩ֤ϢȡʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] serialNumber; //֤ʶ루ǩ֤ϢȡʱЧ + public byte byVersion; + public byte byKeyAlgorithm; // 0-RSA 1-DSA + public byte byKeyLen; //ܳ 0-512 1-1024 2-2048 + public byte bySignatureAlgorithm; //ǩ㷨ͣǩ֤ϢȡʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //channel record status + //***ͨ¼״̬*****// + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHANS_RECORD_STATUS + { + public byte byValid; //ǷЧ + public byte byRecord; /*(ֻ)¼, λʾ:0: ¼1¼ 2- + 3- 4-Ƶ 5-δ 6-浵 + 7-ش 8-û 9-δ֤ + 10-浵к¼ 11-¼شк¼*/ + public ushort wChannelNO; //ͨ + public uint dwRelatedHD; // + public byte byOffLineRecord; //¼ 0-ر 1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IP_ALARM_GROUP_NUM + { + public uint dwSize; + public uint dwIPAlarmInGroup; //IPͨ + public uint dwIPAlarmInNum; //IPͨ + public uint dwIPAlarmOutGroup; //IPͨ + public uint dwIPAlarmOutNum; //IPͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //****NVR end***// + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHAN_GROUP_RECORD_STATUS + { + public uint dwSize; //ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CHANS_RECORD_STATUS[] struChanStatus; //һ64 + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECTCFG + { + public ushort wXCoordinate; /*ϽʼX*/ + public ushort wYCoordinate; /*ϽY*/ + public ushort wWidth; /*ο*/ + public ushort wHeight; /*θ߶*/ + } + + /*Ϣ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WINCFG + { + public uint dwSize; + public byte byVaild; + public byte byInputIdx; /*Դ*/ + public byte byLayerIdx; /*ͼ㣬0Ϊײ*/ + public byte byTransparency; //͸ȣ0100 + public NET_DVR_RECTCFG struWin;//ĿĴ(ʾǽ) + public ushort wScreenHeight;// + public ushort wScreenWidth;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALLWINCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LAYERNUMS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_WINCFG[] struWinCfg; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREENZOOM + { + public uint dwSize; + public uint dwScreenNum;// + public NET_DVR_POINT_FRAME struPointFrame; + public byte byLayer;//ͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //2011-04-18 + /*Ϣ,99991ʼ */ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_CAMERAINFO + { + public uint dwGlobalCamId; /* camȫֱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sCamName; /*cam*/ + public uint dwMatrixId; /*camӦı*/ + public uint dwLocCamId; /*camӦڲ*/ + public byte byValid; /*ǷЧ0-1-*/ + public byte byPtzCtrl; /* Ƿɿأ0-1-*/ + public byte byUseType; //*ʹͣ0-Ϊʹã1-BNC2-SP3,3-V6ˣ4-*/ + public byte byUsedByTrunk;//ǰʹ״̬0-ûбʹã1-ʹ + public byte byTrunkReq; /*ֱ,D1Ϊλ1 - 1D12- 2D1ΪʹʱָǸߵĴ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_TIME struInstallTime;//װʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPurpose;/*;*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*Ϣ2048*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_MONITORINFO + { + public uint dwGloalMonId; /*mon ͳһ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sMonName; + public uint dwMatrixId; /*monھı*/ + public uint dwLocalMonId; /*monڲ*/ + public byte byValid; /*ǷЧ0-1-*/ + public byte byTrunkType; /*ʹͣ0-Ϊʹã1-BNC2-SP3,3-V6ˣ4-*/ + public byte byUsedByTrunk;//ǰʹ״̬0-ûбʹã1-ʹ + public byte byTrunkReq; /*ֱ, D1Ϊλ1- 1D12- 2D1ΪʹʱָǸߵĴ*/ + public NET_DVR_TIME struInstallTime;//װʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPurpose;/*;*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_DIGITALMATRIX + { + public NET_DVR_IPADDR struAddress; /*豸Ϊ豸ʱIPϢ*/ + public ushort wPort; + public byte byNicNum; /*0 - eth0, 1 - eth1, ˫ͨż󶨵*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 69, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_ANALOGMATRIX + { + public byte bySerPortNum; /*ӵĴں*/ + public byte byMatrixSerPortType;/* صĴģļ̿(Э)ӻͨſڣЭ飩 0 --- ЭͨѶ 1 --- ͨѶ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_SINGLE_RS232 struRS232; //232ڲ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 200, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIXLIST + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwMatrixNum;//豸صľ + public IntPtr pBuffer;//Ϣ + public uint dwBufLen;//ָ볤ȣ + } + + + /*Ϣ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_UARTPARAM + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPortName; + public ushort wUserId; /*ûţ豸ΪʱһûȨ޹*/ + public byte byPortType; /*ͣ0-RS232/1-RS485/2-RS422*/ + public byte byFuncType; /*ӵ豸0-У1-̣2-͸ͨ(485ڲó͸ͨ),3-ģ*/ + public byte byProtocolType; /*ֵ֧Э, Ӽ豸ʱҪϢ,ȡ֧Эıż*/ + public byte byBaudRate; + public byte byDataBits; + public byte byStopBits; /*ֹͣλ*/ + public byte byParity; /*У*/ + public byte byFlowCtrl; /*أأ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 22, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /*Ԥ*/ + } + + //256û1256 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_USERPARAM + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; + public byte byRole;/*ûɫ:0-Ա,1-ԱֻһϵͳԱ255Ա*/ + public byte byLevel; /*ͳһڲ,1- 255*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 18, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //255Դ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_RESOURSEGROUPPARAM + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byGroupName; + public byte byGroupType;/*0-CAM飬1-MON*/ + public byte byRes1; + public ushort wMemNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 512, ArraySubType = UnmanagedType.U4)] + public uint[] dwGlobalId; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //255û + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_USERGROUPPARAM + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sGroupName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 255, ArraySubType = UnmanagedType.U2)] + public ushort[] wUserMember; /*ûԱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 255, ArraySubType = UnmanagedType.U2)] + public ushort[] wResorceGroupMember; /*ԴԱ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byPermission;//Ȩޣ0-ptzȨޡлȨޡѯȨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_MATRIX_TRUNKPARAM + { + public uint dwSize; + public uint dwTrunkId; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sTrunkName; + public uint dwSrcMonId; + public uint dwDstCamId; + public byte byTrunkType; /*ʹ 1-BNC2-SP3˸壬3-SP3D1 4-V6ˣ5-*/ + public byte byAbility; /*ʾ˵ĴԴ伸·*/ + public byte bySubChan; /*Թ˸߶ԣʾͨ*/ + public byte byLevel; /* ߼ 1-255*/ + public ushort wReserveUserID; //ԤûID 1~256 0ʾͷԤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 18, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_TRUNKLIST + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwTrunkNum;//豸صĸ + public IntPtr pBuffer;//Ϣ + public uint dwBufLen;//ָ볤ȣ + } + + public const int MATRIX_PROTOCOL_NUM = 20; //ֵ֧Э + public const int KEYBOARD_PROTOCOL_NUM = 20; //ֵ֧Э + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PROTO_TYPE_EX + { + public ushort wType; /*ipcЭֵ*/ + public ushort wCommunitionType; /*0ģ 1 2ģ⡢*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DESC_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDescribe; /*Эֶ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIXMANAGE_ABIILITY + { + public uint dwSize; + public uint dwMaxCameraNum;//Camera + public uint dwMaxMonitorNum;// + public ushort wMaxMatrixNum;// + public ushort wMaxSerialNum;// + public ushort wMaxUser;//û + public ushort wMaxResourceArrayNum;//Դ + public ushort wMaxUserArrayNum;//û + public ushort wMaxTrunkNum;// + public byte nStartUserNum;//ʼû + public byte nStartUserGroupNum;//ʼû + public byte nStartResourceGroupNum;//ʼԴ + public byte nStartSerialNum;//ʼں + public uint dwMatrixProtoNum; /*ЧľЭĿ0ʼ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MATRIX_PROTOCOL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PROTO_TYPE_EX[] struMatrixProto;/*Эб*/ + public uint dwKeyBoardProtoNum; /*ЧļЭĿ0ʼ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MATRIX_PROTOCOL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PROTO_TYPE_EX[] struKeyBoardProto;/*Эб*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SINGLEWALLPARAM + { + public uint dwSize; + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwWallNum;//ǽ + //Ϊ׼128128Ⱥ͸߶ֵãΪ׼ֵ + public NET_DVR_RECTCFG struRectCfg; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 36, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*Ϣ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WALLWINCFG + { + public uint dwSize; + public byte byEnable; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 7, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwWinNum;//ں + public uint dwLayerIndex;//Ӧͼ + public NET_DVR_RECTCFG struWinPosition;//ĿĴ(ʾǽ) + public uint dwDeviceIndex;//ֲʽ豸 + public ushort wInputIndex;//źԴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ز + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WALLWINPARAM + { + public uint dwSize; + public byte byTransparency; //ʹ͸ȣ0-أ0- + public byte byWinMode;//ڷģʽȡ + public byte byEnableSpartan;//ʹܣ0-أ1- + public byte byDecResource; //ΪڷĽԴ1-D1,2-720P,3-1080P + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECTCFG_EX + { + public uint dwXCoordinate; + public uint dwYCoordinate; + public uint dwWidth; + public uint dwHeight; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ǽλ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOWALLDISPLAYPOSITION + { + public uint dwSize; + public byte byEnable; //ʹܣ0- ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwVideoWallNo;//ǽ() + public uint dwDisplayNo; //ʾ()ȡȫʱЧ + public NET_DVR_RECTCFG_EX struRectCfg;//λ꣬Ϊ׼꣨ͨȡȺ͸߶ֵãΪ׼ֵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ʾ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPLAYPARAM + { + public uint dwDisplayNo;//ʾ + public byte byDispChanType;/*ģʽ,1-BNC2-VGA3-HDMI4-DVI5-SDI, 6-FIBER, \ + 7-RGB, 8-YPrPb, 9-VGA/HDMI/DVIӦ10-3GSDI,11-VGA/DVIӦ12-HDBaseT, 0xff-Ч*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ʾ + public const int MAX_DISPLAY_NUM = 512; //ʾ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPLAYCFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISPLAY_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISPLAYPARAM[] struDisplayParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VIDEOWALLWINDOWPOSITION + { + public uint dwSize; + public byte byEnable; //ʹ,0-ʹܣ1-ʹ + public byte byWndOperateMode; //ڲģʽ0-ͳһ꣬1-ֱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwWindowNo;//ں + public uint dwLayerIndex;//Ӧͼţͼŵöö + public NET_DVR_RECTCFG_EX struRect; //ĿĴͳһ(ʾǽ)ȡͳһʱЧ + public NET_DVR_RECTCFG_EX struResolution; //ĿĴڷֱ꣬ȡ򰴷ֱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHAN_RELATION_RESOURCE + { + public uint dwSize; + public uint dwDisplayChan; //ʾͨţ1ֽ豸+1ֽڱ+2ֽʾͨţ + public byte byRelateAudio; //ǷӴƵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwSubWinNo; //ƵӴںţ1ֽڵǽ+1ֽӴں+2ֽڴںţ + public uint dwChannel; //ͨţȡȫʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PU_STREAM_CFG_V41 + { + public uint dwSize; + public byte byStreamMode;//ȡģʽ0- Ч1- ͨIPȡ2- ͨURLȡ3- ̬ͨ豸ȡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_DEC_STREAM_MODE uDecStreamMode; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_VIDEO_WALL_INFO + { + public uint dwSize; + public uint dwWindowNo; + public uint dwSceneNo; + public uint dwDestWallNo; //Ŀǽ + public uint dwDestSceneNo;//Ŀij + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_SCENE_CONTROL_INFO + { + public uint dwSize; + public NET_DVR_VIDEO_WALL_INFO struVideoWallInfo; + public uint dwCmd; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WALLSCENECFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSceneName; // + public byte byEnable; //ǷЧ0-Ч1-Ч + public byte bySceneIndex; //ţֻܻȡȡгʱʹøò + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 78, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BUF_INFO + { + public IntPtr pBuf; + public uint nLen; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_IN_PARAM + { + public NET_DVR_BUF_INFO struCondBuf; + public NET_DVR_BUF_INFO struInParamBuf; + public uint dwRecvTimeOut; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OUT_PARAM + { + public NET_DVR_BUF_INFO struOutBuf; + public IntPtr lpStatusList; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INPUTSTREAMCFG_V40 + { + public uint dwSize; + public byte byValid; // + public byte byCamMode;//NET_DVR_CAM_MODE + public ushort wInputNo; //źԴ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = NAME_LEN)] + public string sCamName; + public NET_DVR_VIDEOEFFECT struVideoEffect;//Ƶ + public NET_DVR_PU_STREAM_CFG struPuStream; //ipʱʹ + public ushort wBoardNum; //źԴڵİ忨ţֻܻȡ + public ushort wInputIdxOnBoard; //źԴڰ忨ϵλãֻܻȡ + public uint dwResolution;//ֱ + public byte byVideoFormat;//ƵʽVIDEO_STANDARD + public byte byStatus; //źԴ״̬0-ֶЧ 1-ź 2-ź 3-쳣 + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = NAME_LEN)] + public string sGroupName; //źԴ + public byte byJointMatrix; //0- 1-źԴΪNET_DVR_CAM_BNCNET_DVR_CAM_VGANET_DVR_CAM_DVINET_DVR_CAM_HDMI,еһʱòЧ + public byte byJointNo; //ƴźԴƴӱ(ֻܻȡ) + public byte byColorMode; //ɫģʽ 0-Զ 1- 2-ͨ 3-ͣΪԶʱʹstruVideoEffect + public byte byScreenServer; //Ļ0-1- + public byte byDevNo; //豸 + public byte byRes1; + public uint dwInputSignalNo; //źԴţ£ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 120, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ץĹ() + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SINGLE_FACESNAPCFG + { + public byte byActive; //Ƿ񼤻0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + public NET_VCA_POLYGON struVcaPolygon; //ʶ + } + + //ץĹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAPCFG + { + public uint dwSize; + public byte bySnapTime; //ĿץĴ0-10 + public byte bySnapInterval; //ץļλ֡ + public byte bySnapThreshold; //ץֵ0-100 + public byte byGenerateRate; //Ŀٶ,Χ[1, 5] + public byte bySensitive; //ĿȣΧ[1, 5] + public byte byReferenceBright; //2012-3-27ο[0,100] + public byte byMatchType; //2012-5-3ȶԱģʽ0-Ŀʧ󱨾1-ʵʱ + public byte byMatchThreshold; //2012-5-3ʵʱȶֵ0~100 + public NET_DVR_JPEGPARA struPictureParam; //ͼƬṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RULE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_SINGLE_FACESNAPCFG[] struRule; //ץĹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ʶṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_HUMAN_FEATURE + { + public byte byAgeGroup; //,μ HUMAN_AGE_GROUP_ENUM + public byte bySex; //Ա, 0-ʾδ֪㷨֧֣,1 C , 2 C Ů, 0xff-㷨֧֣ûʶ + public byte byEyeGlass; //Ƿ۾ 0-ʾδ֪㷨֧֣,1 C , 2 C ,0xff-㷨֧֣ûʶ + //ץͼƬʹ÷ʽbyAgeΪ15,byAgeDeviationΪ1,ʾʵͼƬΪ14-16֮ + public byte byAge;// 0-ʾδ֪㷨֧֣,0xff-㷨֧֣ûʶ + public byte byAgeDeviation;//ֵ + public byte byEthnic; //ֶԤ,ݲ + public byte byMask; //Ƿ 0-ʾδ֪㷨֧֣,1 C , 2 Cͨ۾, 3 Cī,0xff-㷨֧֣ûʶ + public byte bySmile; //Ƿ΢Ц 0-ʾδ֪㷨֧֣,1 C ΢Ц, 2 C ΢Ц, 0xff-㷨֧֣ûʶ + public byte byFaceExpression; /*,μFACE_EXPRESSION_GROUP_ENUM*/ + public byte byBeard; //, 0-֧֣1-ûкӣ2-кӣ0xff-unknowʾδ֪,㷨֧δ + public byte byRes2; + public byte byHat; //ñ, 0-֧,1-ñ,2-ñ,0xff-unknowʾδ֪,㷨֧δ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ץĸϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAP_ADDINFO + { + //ο,ΪСͼ(ͷ) + public NET_VCA_RECT struFacePicRect; + public int iSwingAngle;//ת, -90~90 + public int iTiltAngle;//, -90~90 + public uint dwPupilDistance;//ͫ,ΧΪСֵΪ10,ֵΪǰֱʿ/1.6 + public byte byBlockingState;//Ŀڵ״̬ 0-ʾδ֪㷨֧֣,1~ڵ,2~˲ʱڵ3~ڵ4~ڵ + public byte byFaceSnapThermometryEnabled;//ץIJʹ 1- 0-ر + public byte byIsAbnomalTemperature;//ץIJǷ¶쳣 1- 0- + public byte byThermometryUnit;//µλ: 0-϶ȣ棩1-϶ȣH2-(K) + public NET_DVR_TIME_EX struEnterTime; // ץ½ʱ + public NET_DVR_TIME_EX struExitTime; // ץ뿪ʱ + public float fFaceTemperature; // ¶ȣ - 20.0~150.0棬ȷС1λ + public float fAlarmTemperature;// ±ֵȷС1λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 472, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// ֽ + } + + //ץĽϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAP_RESULT + { + public uint dwSize; + public uint dwRelativeTime; + public uint dwAbsTime; + public uint dwFacePicID; + public uint dwFaceScore; + public NET_VCA_TARGET_INFO struTargetInfo; + public NET_VCA_RECT struRect; + public NET_VCA_DEV_INFO struDevInfo; + public uint dwFacePicLen; + public uint dwBackgroundPicLen; + public byte bySmart; //IDS豸0(Ĭֵ)Smart Functiom Return 1 + public byte byAlarmEndMark;//0-1-ǣֶνIDֶʹãʾIDӦ±ҪṩNVRʹãжϱȡʶͼƬУߵͼƬ + public byte byRepeatTimes; //ظ0- + public byte byUploadEventDataType;//ͼƬݳʽ0-ݣ1-URL + public NET_VCA_HUMAN_FEATURE struFeature; // + public float fStayDuration; //ͣʱ(λ: ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sStorageIP; //洢IPַ + public ushort wStoragePort; //洢˿ں + public ushort wDevInfoIvmsChannelEx; //NET_VCA_DEV_INFObyIvmsChannelܱͬʾֵϿͻbyIvmsChannelܼݣ255¿ͻ˰汾ʹwDevInfoIvmsChannelEx + public byte byFacePicQuality; + public byte byUIDLen; // ϴıʶ + public byte byLivenessDetectionStatus;// ״̬0-1-δ֪(ʧ)2-3-4-δ + /*ϢʶλǷNET_VCA_FACESNAP_ADDINFOṹ壩,0-޸Ϣ, 1-иϢ*/ + public byte byAddInfo; + public IntPtr pUIDBuffer; //ʶָ + public IntPtr pAddInfoBuffer; + public byte byTimeDiffFlag; /*ʱֶǷЧ 0-ʱЧ 1-ʱЧ */ + public byte cTimeDifferenceH; /*UTCʱСʱ-12 ... +14 +ʾ,byTimeDiffFlagΪ1ʱЧ*/ + public byte cTimeDifferenceM; /*UTCʱӣ-30, 30, 45 +ʾbyTimeDiffFlagΪ1ʱЧ*/ + public byte byBrokenNetHttp; //־λ0-شݣ1-ش + public IntPtr pBuffer1;//ָͼͼƬ + public IntPtr pBuffer2;//ͼͼƬݣͨұͼӿڿԻȡͼ + } + + //ⱨϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_DETECTION + { + public uint dwSize; + public uint dwRelativeTime; + public uint dwAbsTime; + public uint dwBackgroundPicLen; + public NET_VCA_DEV_INFO struDevInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 30, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_RECT[] struFacePic; //ͼ򣬹һֵڴͼͼ)ķֱ + public byte byFacePicNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 255, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + public IntPtr pBackgroundPicpBuffer;//ͼͼƬ + } + + //齹 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEFOCUS_ALARM + { + public uint dwSize; /*ṹ*/ + public NET_VCA_DEV_INFO struDevInfo;/*豸Ϣ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUDIOEXCEPTION_ALARM + { + public uint dwSize; /*ṹ*/ + public byte byAlarmType;//ͣ1-Ƶ쳣2-Ƶͻ + public byte byRes1; + public ushort wAudioDecibel;//ǿȣƵͻʱõ + public NET_VCA_DEV_INFO struDevInfo;/*豸Ϣ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_BUTTON_DOWN_EXCEPTION_ALARM + { + public uint dwSize; /*ṹ*/ + public NET_VCA_DEV_INFO struDevInfo;/*豸Ϣ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FD_IMAGE_CFG + { + public uint dwWidth; //Ҷͼݿ + public uint dwHeight; //Ҷͼ߶ + public uint dwImageLen; //Ҷͼݳ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public IntPtr pImage; //Ҷͼ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FD_PROCIMG_CFG + { + public uint dwSize; //ṹС + public byte byEnable; //Ƿ񼤻; + public byte bySensitivity; //ȣ[0,5] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 22, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //ֽ + public NET_VCA_SIZE_FILTER struSizeFilter; //ߴ + public NET_VCA_POLYGON struPolygon; // + public NET_VCA_FD_IMAGE_CFG struFDImage; //ͼƬϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SUB_PROCIMG + { + public uint dwImageLen; //ͼƬݳ + public uint dwFaceScore; //,0-100 + public NET_VCA_RECT struVcaRect; //ͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public IntPtr pImage; //ͼƬ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FD_PROCIMG_RESULT + { + public uint dwSize; //ṹС + public uint dwImageId; //ͼID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public uint dwSubImageNum; //ͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_TARGET_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_SUB_PROCIMG[] struProcImg; //ͼϢ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_PICMODEL_RESULT + { + public uint dwImageLen; //ͼƬݳ + public uint dwModelLen; //ģݳ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public IntPtr pImage; //ͼƬָ + public IntPtr pModel; //ģָ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_REGISTER_PIC + { + public uint dwImageID; //ͼID + public uint dwFaceScore; //,0-100 + public NET_VCA_RECT struVcaRect; //ͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AREAINFOCFG + { + public ushort wNationalityID;// + public ushort wProvinceID;//ʡ + public ushort wCityID;// + public ushort wCountyID;// + public uint dwCode;// + } + + //ԱϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_HUMAN_ATTRIBUTE + { + public byte bySex;//Ա0-У1-Ů + public byte byCertificateType;//֤ͣ0-֤1-֤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HUMAN_BIRTHDATE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byBirthDate;//£磺201106 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; // + public NET_DVR_AREAINFOCFG struNativePlace;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCertificateNumber; //֤ + public uint dwPersonInfoExtendLen;// ԱǩϢչ + public IntPtr pPersonInfoExtend; //ԱǩϢչϢ + public byte byAgeGroup;//ΣHUMAN_AGE_GROUP_ENUM紫0xffʾδ֪ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 11, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;// + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_HUMANATTRIBUTE_COND + { + public byte bySex; //Ա0-ã1-У2-Ů + public byte byCertificateType; //֤ͣ0-ã1-֤2-֤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HUMAN_BIRTHDATE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byStartBirthDate; //ʼ£磺201106 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HUMAN_BIRTHDATE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byEndBirthDate; //ֹ£201106 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; // + public NET_DVR_AREAINFOCFG struNativePlace; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCertificateNumber; //֤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ֹϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_INFO + { + public uint dwSize;//ṹС + public uint dwRegisterID;//עIDţֻ + public uint dwGroupNo;// + public byte byType;//־0-ȫ1-2-ֹ + public byte byLevel;//ֹȼ0-ȫ1-ͣ2-У3- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + public NET_VCA_HUMAN_ATTRIBUTE struAttribute;//ԱϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRemark;//עϢ + public uint dwFDDescriptionLen;//ݳ + public IntPtr pFDDescriptionBuffer;//ָ + public uint dwFCAdditionInfoLen;//ץĿ⸽Ϣ + public IntPtr pFCAdditionInfoBuffer;//ץĿ⸽Ϣָ루FCAdditionInfoаPTZ꣩ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;// + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_PARA + { + public uint dwSize; //ṹС + public NET_VCA_BLOCKLIST_INFO struBlockListInfo; //ֹ + public uint dwRegisterPicNum; //ֹͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HUMAN_PICTURE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_PICMODEL_RESULT[] struRegisterPic; //ֹͼƬϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_COND + { + public Int32 lChannel; //ͨ + public uint dwGroupNo; // + public byte byType; //־0-ȫ1-2-ֹ + public byte byLevel; //ֹȼ0-ȫ1-ͣ2-У3- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public NET_VCA_HUMAN_ATTRIBUTE struAttribute; //ԱϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_PIC + { + public uint dwSize; //ṹС + public uint dwFacePicNum; //ͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_HUMAN_PICTURE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_PICMODEL_RESULT[] struBlockListPic; //ƬϢ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FIND_PICTURECOND + { + public Int32 lChannel;//ͨ + public NET_DVR_TIME struStartTime;//ʼʱ + public NET_DVR_TIME struStopTime;//ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + public const int MAX_FACE_PIC_LEN = 6144; //ͼƬݳ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SUB_SNAPPIC_DATA + { + public uint dwFacePicID; //ͼID + public uint dwFacePicLen; //ͼݳ + public NET_DVR_TIME struSnapTime; //ץʱ + public uint dwSimilarity; //ƶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_FACE_PIC_LEN)] + public string sPicBuf; //ͼƬ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_ADVANCE_FIND + { + public uint dwFacePicID; //ͼƬID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 36, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_NORMAL_FIND + { + public uint dwImageID; //ͼID + public uint dwFaceScore; // + public NET_VCA_RECT struVcaRect; //ͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_VCA_FIND_SNAPPIC_UNION + { + //СΪ44ֽ + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + /*[FieldOffsetAttribute(0)] + public NET_VCA_NORMAL_FIND struNormalFind; //ͨ + [FieldOffsetAttribute(0)] + public NET_VCA_ADVANCE_FIND struAdvanceFind; //߼ + * */ + } + + public enum VCA_FIND_SNAPPIC_TYPE + { + VCA_NORMAL_FIND = 0x00000000, //ͨ + VCA_ADVANCE_FIND = 0x00000001 //߼ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FIND_PICTURECOND_ADVANCE + { + public Int32 lChannel;//ͨ + public NET_DVR_TIME struStartTime;//ʼʱ + public NET_DVR_TIME struStopTime;//ʱ + public byte byThreshold; //ֵ0-100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public VCA_FIND_SNAPPIC_TYPE dwFindType;//ͣVCA_FIND_SNAPPIC_TYPE + public NET_VCA_FIND_SNAPPIC_UNION uFindParam; // + } + + //ץϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAP_INFO_ALARM + { + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + public uint dwSnapFacePicID; //ץͼID + public uint dwSnapFacePicLen; //ץͼijȣΪ0ʾûͼƬ0ʾͼƬ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public byte byFaceScore; //ָ֣ͼ,0-100 + public byte bySex;//Ա0-δ֪1-У2-Ů + public byte byGlasses;//Ƿ۾0-δ֪1-ǣ2- + /* + * ʶηΧ[byAge-byAgeDeviation,byAge+byAgeDeviation] + */ + public byte byAge;// + public byte byAgeDeviation;//ֵ + public byte byAgeGroup;//ΣHUMAN_AGE_GROUP_ENUM0xffʾδ֪ + /*ͼͼƬȼ0-͵,1-е,2-ߵ, + 㷨ͼͼƬ,̬ͨȡڵȿӰʶܵۺĽ*/ + public byte byFacePicQuality; + public byte byEthnic; //ֶԤ,ݲ + public uint dwUIDLen; // ϴıʶ + public IntPtr pUIDBuffer; //ʶָ + public float fStayDuration; //ͣʱ(λ: ) + public IntPtr pBuffer1; //ץͼͼƬ + } + + + //ֹϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_INFO_ALARM + { + public NET_VCA_BLOCKLIST_INFO struBlockListInfo; + public uint dwBlockListPicLen; //ֹͼijȣΪ0ʾûͼƬ0ʾͼƬ + public uint dwFDIDLen;// ID + public IntPtr pFDID; //Idָ + public uint dwPIDLen;// ͼƬID + public IntPtr pPID; //ͼƬIDָ + public ushort wThresholdValue; //ֵ[0,100] + public byte byIsNoSaveFDPicture;//0-ͼƬ,1-ͼƬ, ˵ͼƬ߽ģʱԭͼʱ,ֶη1,ʱͼƬٷ + public byte byRealTimeContrast;//Ƿʵʱ 0-ʵʱ 1-ʵʱ + public IntPtr pBuffer1;//ָͼƬָ + } + + //ֹȶԽϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAP_MATCH_ALARM + { + public uint dwSize; // ṹС + public float fSimilarity; //ƶȣ[0.001,1] + public NET_VCA_FACESNAP_INFO_ALARM struSnapInfo; //ץϢ + public NET_VCA_BLOCKLIST_INFO_ALARM struBlockListInfo; //ֹϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sStorageIP; //洢IPַ + public ushort wStoragePort; //洢˿ں + public byte byMatchPicNum; //ƥͼƬ0-豸ֵĬ0豸ֵΪ0ʱʾûƥͼƬϢ + public byte byPicTransType;//ͼƬݴ䷽ʽ: 0-ƣ1-url + public uint dwSnapPicLen;//豸ʶץͼƬ + public IntPtr pSnapPicBuffer;//豸ʶץͼƬָ + public NET_VCA_RECT struRegion;//Ŀ߽豸ʶץͼƬУͼ + public uint dwModelDataLen;//ģݳ + public IntPtr pModelDataBuffer;// ģָ + public byte byModelingStatus;// ģ״̬ + public byte byLivenessDetectionStatus;//״̬0-1-δ֪ʧܣ2-3-4-δ + public byte cTimeDifferenceH; /*UTCʱСʱ-12 ... +14 +ʾ,0xffЧ*/ + public byte cTimeDifferenceM; /*UTCʱӣ-30, 30, 45 +ʾ0xffЧ*/ + public byte byMask; //ץͼǷ֣0-1-δ֪2-֣3- + public byte bySmile; //ץͼǷ΢Ц0-1-δ֪2-΢Ц3-΢Ц + public byte byContrastStatus; //ȶԽ0-1-ȶԳɹ2-ȶʧ + public byte byBrokenNetHttp; //־λ0-شݣ1-ش + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_INFO_ALARM_LOG + { + public NET_VCA_BLOCKLIST_INFO struBlockListInfo; //ֹϢ + public uint dwBlockListPicID; //ֹͼIDڲͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAP_INFO_ALARM_LOG + { + public uint dwRelativeTime; // ʱ + public uint dwAbsTime; // ʱ + public uint dwSnapFacePicID; //ץͼID + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACESNAP_MATCH_ALARM_LOG + { + public uint dwSize; // ṹС + public float fSimilarity; //ƶȣ[0.001,1] + public NET_VCA_FACESNAP_INFO_ALARM_LOG struSnapInfoLog; //ץϢ + public NET_VCA_BLOCKLIST_INFO_ALARM_LOG struBlockListInfoLog; //ֹϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACEMATCH_PICCOND + { + public uint dwSize; // ṹС + public uint dwSnapFaceID; //ץͼID + public uint dwBlockListID; //ƥĽֹID + public uint dwBlockListFaceID; //ȶԵĽֹͼID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_FACEMATCH_PICTURE + { + public uint dwSize; // ṹС + public uint dwSnapFaceLen; //ץͼ + public uint dwBlockListFaceLen; //ȶԵĽֹͼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + public IntPtr pSnapFace; //ץͼͼƬ + public IntPtr pBlockListFace; //ȶԵĽֹͼ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_BLOCKLIST_FASTREGISTER_PARA + { + public uint dwSize; //ṹС + public NET_VCA_BLOCKLIST_INFO struBlockListInfo; //ֹ + public uint dwImageLen; //ͼݳ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public IntPtr pImage; //ͼ + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SINGLE_PATH + { + public byte byActive; // Ƿ,0-,1- + public byte byType; //0-洢ץģ1-洢ֹȶԱ2-洢ץĺͽֹȶԱ0xff-Ч + public byte bySaveAlarmPic; //ǷڱıͼƬ0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; // + public uint dwDiskDriver; //̷ţ0ʼ + public uint dwLeftSpace; //ԤλΪG + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //洢· + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_SAVE_PATH_CFG + { + public uint dwSize; //ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISKNUM_V30, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_SINGLE_PATH[] struPathInfo; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEV_ACCESS_CFG + { + public uint dwSize; + public NET_DVR_IPADDR struIP; //豸IPַ + public ushort wDevicePort; //˿ں + public byte byEnable; //Ƿã0-1- + public byte byRes1; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; //豸ĵ¼ʺ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; //豸ĵ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + /********************************ʶ end****************************/ + //ֱ + public const int NOT_AVALIABLE = 0; + public const int SVGA_60HZ = 52505660; + public const int SVGA_75HZ = 52505675; + public const int XGA_60HZ = 67207228; + public const int XGA_75HZ = 67207243; + public const int SXGA_60HZ = 84017212; + public const int SXGA2_60HZ = 84009020; + public const int _720P_60HZ = 83978300; + public const int _720P_50HZ = 83978290; + public const int _1080I_60HZ = 394402876; + public const int _1080I_50HZ = 394402866; + public const int _1080P_60HZ = 125967420; + public const int _1080P_50HZ = 125967410; + public const int _1080P_30HZ = 125967390; + public const int _1080P_25HZ = 125967385; + public const int _1080P_24HZ = 125967384; + public const int UXGA_60HZ = 105011260; + public const int UXGA_30HZ = 105011230; + public const int WSXGA_60HZ = 110234940; + public const int WUXGA_60HZ = 125982780; + public const int WUXGA_30HZ = 125982750; + public const int WXGA_60HZ = 89227324; + public const int SXGA_PLUS_60HZ = 91884860; + + //ʾָͨģʽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPWINDOWMODE + { + public byte byDispChanType;//ʾͨͣ0-VGA, 1-BNC, 2-HDMI, 3-DVI + public byte byDispChanSeq;//ʾͨ,1ʼVGAʾڼVGA + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byDispMode; + } + + //ʾͨϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPINFO + { + public byte byChanNums;//ͨ + public byte byStartChan;//ʼͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SUPPORT_RES, ArraySubType = UnmanagedType.U1)] + public uint[] dwSupportResolution;//ֵ֧ķֱ + } + + //ƴϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREENINFO + { + public byte bySupportBigScreenNums;//ƴ + public byte byStartBigScreenNum;//ƴʼ + public byte byMaxScreenX;//ƴģʽ + public byte byMaxScreenY; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_ABILITY_V41 + { + public uint dwSize; + public byte byDspNums;//DSP + public byte byDecChanNums;//ͨ + public byte byStartChan;//ʼͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + + public NET_DVR_DISPINFO struVgaInfo;//VGAʾͨϢ + public NET_DVR_DISPINFO struBncInfo;//BNCʾͨϢ + public NET_DVR_DISPINFO struHdmiInfo;//HDMIʾͨϢ + public NET_DVR_DISPINFO struDviInfo;//DVIʾͨϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISPNUM_V41, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISPWINDOWMODE[] struDispMode; + public NET_DVR_SCREENINFO struBigScreenInfo; + public byte bySupportAutoReboot; //Ƿ֧Զ0-֧֣1-֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 119, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int MAX_WINDOWS = 16;//󴰿 + public const int MAX_WINDOWS_V41 = 36; + + public const int STARTDISPCHAN_VGA = 1; + public const int STARTDISPCHAN_BNC = 9; + public const int STARTDISPCHAN_HDMI = 25; + public const int STARTDISPCHAN_DVI = 29; + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_VIDEO_PLATFORM + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 160, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + /*[FieldOffsetAttribute(0)] + public VideoPlatform struVideoPlatform; + [FieldOffsetAttribute(0)] + public NotVideoPlatform struNotVideoPlatform; + * */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct VideoPlatform + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecoderId; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byDecResolution; + public NET_DVR_RECTCFG struPosition; //ʾͨڵǽλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 80, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NotVideoPlatform + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 160, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*ʾͨýṹ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_VOUTCFG + { + public uint dwSize; + public byte byAudio; /*ƵǷ*/ + public byte byAudioWindowIdx; /*ƵӴ*/ + public byte byDispChanType; /*ʾͨͣ0-BNC1-VGA2-HDMI3-DVI4-YPbPr(뿨DECODER_SERVERר)*/ + public byte byVedioFormat; /*1:NTSC,2:PAL0-NULL*/ + public uint dwResolution;//ֱ + public uint dwWindowMode; /*ģʽȡ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecChan;/*ӴڹĽͨ,豸ֽ֧ԴԶʱ˲*/ + public byte byEnlargeStatus; /*ǷڷŴ״̬0Ŵ1Ŵ*/ + public byte byEnlargeSubWindowIndex;//ŴӴں + public byte byScale; /*ʾģʽ0---ʵʾ1---ʾ( BNC )*/ + public byte byUnionType;/*ֹ,0-Ƶۺƽ̨ڲʾͨã1-ʾͨ*/ + public NET_DVR_VIDEO_PLATFORM struDiff; + public uint dwDispChanNum; //ʾţ˲ȫȡʱЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 76, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*豸״̬*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISP_CHAN_STATUS_V41 + { + public byte byDispStatus; /*ʾ״̬0δʾ1ʾ*/ + public byte byBVGA; /*0-BNC1-VGA 2-HDMI3-DVI0xff-Ч*/ + public byte byVideoFormat; /*Ƶʽ1:NTSC,2:PAL,0-NON*/ + public byte byWindowMode; /*ģʽ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecChan; /*ӻĽͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byFpsDisp; /*ÿӻʾ֡*/ + public byte byScreenMode; /*Ļģʽ0-ͨ 1-*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwDispChan; /*ȡȫʾͨ״̬ʱЧʱ0*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*豸״̬*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DECODER_WORK_STATUS_V41 + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MATRIX_CHAN_STATUS[] struDecChanStatus; /*ͨ״̬*/ + /*ʾͨ״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DISPNUM_V41, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_DISP_CHAN_STATUS_V41[] struDispChanStatus; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmInStatus; /*״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byAlarmOutStatus; /*״̬*/ + public byte byAudioInChanStatus; /*Խ״̬*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 127, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*******************************ļط-Զ̻ط*******************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_DEC_REMOTE_PLAY_V41 + { + public uint dwSize; + public NET_DVR_IPADDR struIP; /* DVR IPַ */ + public ushort wDVRPort; /* ˿ں */ + public byte byChannel; /* ͨ */ + public byte byReserve; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /* û */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /* */ + public uint dwPlayMode; /* 0ļ 1ʱ*/ + public NET_DVR_TIME StartTime; + public NET_DVR_TIME StopTime; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string sFileName; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /**/ + } + + public const int MAX_BIGSCREENNUM_SCENE = 100; + + //ʾͨýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECTCFG_SCENE + { + public ushort wXCoordinate; /*ϽʼX*/ + public ushort wYCoordinate; /*ϽY*/ + public ushort wWidth; /*ο*/ + public ushort wHeight; /*θ߶*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCENEDISPCFG + { + public byte byEnable;//Ƿã0-ã1- + public byte bySoltNum;//λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byDispChanNum; + public byte byAudio; /*ƵǷ,0-1-*/ + public byte byAudioWindowIdx; /*ƵӴ*/ + public byte byVedioFormat; /*1:NTSC,2:PAL0-NULL*/ + public byte byWindowMode; /*ģʽȡ*/ + public byte byEnlargeStatus; /*ǷڷŴ״̬0Ŵ1Ŵ*/ + public byte byEnlargeSubWindowIndex;//ŴӴں + public byte byScale; /*ʾģʽ0-ʵʾ1-ʾ( BNC )*/ + public uint dwResolution;//ֱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecChan;/*ӴڹĽͨ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byJoinDecoderId;/*λ*/ + //ʾƵֱʣ1-D1,2-720P,3-1080P豸Ҫݴ//ֱʽнͨķ䣬1ó1080P豸4ͨ˽ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WINDOWS_V41, ArraySubType = UnmanagedType.I1)] + public byte[] byDecResolution; + public byte byRow;//ڵе + public byte byColumn;//ڵе + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public NET_DVR_RECTCFG struDisp; //ǽʾλ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEV_CHAN_INFO_SCENE + { + public NET_DVR_IPADDR struIP; /* DVR IPַ */ + public ushort wDVRPort; /* ˿ں */ + public byte byChannel; /* ͨţ9000豸IPC룬ͨŴ33ʼ */ + public byte byTransProtocol; /* Э0-TCP1-UDP 2-MCAST3-RTP*/ + public byte byTransMode; /* ģʽ 0 1*/ + public byte byFactoryType; /*ǰ豸*/ + public byte byDeviceType; //豸ͣ1-IPC2- ENCODER + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /* ½ʺ */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /* */ + } + + /*ý*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_STREAM_MEDIA_SERVER_CFG_SCENE + { + public byte byValid; /*Ƿýȡ,0ʾЧ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_IPADDR struDevIP; /*ýַ*/ + public ushort wDevPort; /*ý˿*/ + public byte byTransmitType; /*Э0-TCP1-UDP */ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PU_STREAM_CFG_SCENE + { + public NET_DVR_STREAM_MEDIA_SERVER_CFG_SCENE streamMediaServerCfg; + public NET_DVR_DEV_CHAN_INFO_SCENE struDevChanInfo; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CYC_SUR_CHAN_ELE_SCENE + { + public byte byEnable; /* Ƿ 0 1*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_STREAM_MEDIA_SERVER_CFG_SCENE struStreamMediaSvrCfg; + public NET_DVR_DEV_CHAN_INFO_SCENE struDecChanInfo; /*ѲͨϢ*/ + } + + //Ѳṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_LOOP_DECINFO_SCENE + { + public ushort wPoolTime; /*ѯ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CYCLE_CHAN, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CYC_SUR_CHAN_ELE_SCENE[] struChanArray; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BIGSCREENCFG_SCENE + { + public byte byAllValid; /*ʹܱ־ */ + public byte byAssociateBaseMap;//ĵͼţ0 + public byte byEnableSpartan;//ʹܣ1-0- + public byte byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LAYERNUMS, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_WINCFG[] struWinCfg; + public NET_DVR_BIGSCREENCFG struBigScreen; + + public void Init() + { + struBigScreen = new NET_DVR_BIGSCREENCFG(); + struWinCfg = new NET_DVR_WINCFG[MAX_LAYERNUMS]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_SCENECFG + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSceneName; + public byte byBigScreenNums;//ĸֵͨȡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public ushort wDecChanNums;//нͨĸ + public ushort wDispChanNums;//ʾͨĸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public IntPtr pBigScreenBuffer;//û, byBigScreenNumssizeof(NET_DVR_BIGSCREENCFG_SCENE) + public IntPtr pDecChanBuffer;//ͨû, wDecChanNumssizeof(NET_DVR_DECODECHANCFG_SCENE) + public IntPtr pDispChanBuffer;//ʾͨû, wDispChanNumssizeof(NET_DVR_SCENEDISPCFG) + public void Init() + { + sSceneName = new byte[NAME_LEN]; + byRes1 = new byte[3]; + byRes1 = new byte[12]; + } + } + public const int NET_DVR_GET_ALLWINCFG = 1503; //ڲȡ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BIGSCREENASSOCIATECFG + { + public uint dwSize; + public byte byEnableBaseMap;//ʹܵͼʾ + public byte byAssociateBaseMap;//ĵͼţ0 + public byte byEnableSpartan;//ʹܣ1-0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 21, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /**************************************************************/ + public const int MAX_WIN_COUNT = 224; //ֵ֧󿪴 + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREEN_WINCFG{ + public uint dwSize; + public byte byVaild; + public byte byInputType; //CAM_MDOE + public ushort wInputIdx; /*Դ*/ + public uint dwLayerIdx; /*ͼ㣬0Ϊײ*/ + public NET_DVR_RECTCFG struWin; //ĿĴ(ʾǽ) + public byte byWndIndex; //ں + public byte byCBD; //0-ޣ1-2- + public byte bySubWnd; //0ǣ1 + public byte byRes1; + public uint dwDeviceIndex;//豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_WINLIST + { + public uint dwSize; + public ushort wScreenSeq; //豸 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwWinNum; //豸صĴ + public IntPtr pBuffer; //ϢΪ224*sizeof(NET_DVR_WINCFG) + public uint dwBufLen; //ָ볤 + } + + public const int MAX_LAYOUT_COUNT = 16; //󲼾 + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LAYOUTCFG + { + public uint dwSize; + public byte byValid; //ǷЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLayoutName; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_WIN_COUNT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCREEN_WINCFG[] struWinCfg; //ڴڲ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LAYOUT_LIST + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LAYOUT_COUNT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_LAYOUTCFG[] struLayoutInfo; //в + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int MAX_CAM_COUNT = 224; + + public enum NET_DVR_CAM_MODE + { + NET_DVR_UNKNOW = 0,//Ч + NET_DVR_CAM_BNC, + NET_DVR_CAM_VGA, + NET_DVR_CAM_DVI, + NET_DVR_CAM_HDMI, + NET_DVR_CAM_IP, + NET_DVR_CAM_RGB, + NET_DVR_CAM_DECODER, + NET_DVR_CAM_MATRIX, + NET_DVR_CAM_YPBPR, + NET_DVR_CAM_USB, + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INPUTSTREAMCFG + { + public uint dwSize ; + public byte byValid ; + public byte byCamMode; //źԴͣNET_DVR_CAM_MODE + public ushort wInputNo; //źԴ0-224 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sCamName; //źԴ + public NET_DVR_VIDEOEFFECT struVideoEffect; //Ƶ + public NET_DVR_PU_STREAM_CFG struPuStream; //ipʱʹ + public ushort wBoardNum ; //źԴڵİ忨 + public ushort wInputIdxOnBoard; //źԴڰ忨ϵλ + public ushort wResolutionX; //ֱ + public ushort wResolutionY; + public byte byVideoFormat; //Ƶʽ0-ޣ1-NTSC2-PAL + public byte byNetSignalResolution; //; 1-CIF 2-4CIF 3-720P 4-1080P 5-500wp źԴķֱʣźԴʱ豸豸ֱԴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sGroupName; //źԴ + public byte byJointMatrix; // 0- 1- + public byte byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INPUTSTREAM_LIST + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CAM_COUNT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_INPUTSTREAMCFG[] struInputStreamInfo; //źԴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /**************************************************************/ + /*ͨ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OUTPUTPARAM + { + public uint dwSize; + public byte byMonMode; /*ģʽ,1-BNC,2-VGA,3-DVI,4-HDMI*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwResolution; /*ֱʣȡֵ֧Ľ*/ + public NET_DVR_VIDEOEFFECT struVideoEffect; /*ͨƵ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OUTPUTCFG + { + public uint dwSize; + public byte byScreenLayX; //- + public byte byScreenLayY; //- + public ushort wOutputChanNum; //ͨ0ʾ豸ֵ֧ͨȡֵʾʵͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_OUTPUTPARAM struOutputParam; /*ͨƵ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sWallName; //ǽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /**************************************************************/ + public const int SCREEN_PROTOCOL_NUM = 20; //ֵ֧Э + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREENSERVER_ABILITY + { + public uint dwSize; /*ṹ*/ + public byte byIsSupportScreenNum; /*ִ֧Ŀ*/ + public byte bySerialNums; //ڸ + public byte byMaxInputNums; + public byte byMaxLayoutNums; + public byte byMaxWinNums; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 19, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byMaxScreenLayX;//- + public byte byMaxScreenLayY;//- + public ushort wMatrixProtoNum; /*ЧĴЭĿ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SCREEN_PROTOCOL_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PROTO_TYPE[] struScreenProto;/*Эб*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + // + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREENCONTROL_ABILITY + { + public uint dwSize; /*ṹ*/ + public byte byLayoutNum; /* ָ*/ + public byte byWinNum; /*Ļڸ*/ + public byte byOsdNum; /*OSD*/ + public byte byLogoNum; /*Logo*/ + public byte byInputStreamNum; //Դ ---豸֧ͨԴԴ + public byte byOutputChanNum; //ͨ---豸֧ͨ + public byte byCamGroupNum; /**/ + public byte byPlanNum; /*Ԥ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byIsSupportPlayBack; /*Ƿֻ֧ط*/ + public byte byMatrixInputNum; //֧ + public byte byMatrixOutputNum; //֧ + public NET_DVR_DISPINFO struVgaInfo;//VGAϢ + public NET_DVR_DISPINFO struBncInfo;//BNCϢ + public NET_DVR_DISPINFO struHdmiInfo;//HDMIϢ + public NET_DVR_DISPINFO struDviInfo;//DVIϢ + public byte byMaxUserNums;//֧û + public byte byPicSpan; //ͼȣһŵͼɸǵĻ + public ushort wDVCSDevNum; //ֲʽ豸 + public ushort wNetSignalNum; //Դ + public ushort wBaseCoordinateX;//׼ + public ushort wBaseCoordinateY; + public byte byExternalMatrixNum; //Ӿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 49, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*******************************ź״̬*******************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ANALOGINPUTSTATUS + { + public uint dwLostFrame; /*Ƶ붪֡*/ + public byte byHaveSignal; /*ǷƵź*/ + public byte byVideoFormat; /*Ƶʽ1NTSC,2PAL,0*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 46, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_INPUTSTATUS_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 52, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + /*[FieldOffsetAttribute(0)] + public NET_DVR_MATRIX_CHAN_STATUS struIpInputStatus; + [FieldOffsetAttribute(0)] + public NET_DVR_ANALOGINPUTSTATUS struAnalogInputStatus; + * */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INPUTSTATUS + { + public ushort wInputNo; /*źԴ*/ + public byte byInputType; //NET_DVR_CAM_MODE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_INPUTSTATUS_UNION struStatusUnion; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREENINPUTSTATUS + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public uint dwNums; //豸صԴ״̬ + public IntPtr pBuffer; // + public uint dwBufLen; //ָ볤ȣ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREENALARMCFG + { + public uint dwSize; + public byte byAlarmType; //ͣ1-Ӱγ2-Ӱ룬3-ϵͳ״̬쳣4-ϵͳָָ 5-Դ쳣 6-¶ȱ 7-FPGA汾ƥ 8-Ԥʼ 9-Ԥ 10- 11-IPַͻ12-쳣 + public byte byBoardType; // 1- 2- 3-壬4-壬Ϊ1236ʱʹ + public byte bySubException; //쳣ʱ쳣 1- ֱı 2-˿͸ı3-ֱʴ4-ֱʸı䵼½Դ㣬رոԴӦڡ5-ֱʸı䣬ѿű1/88Χ6-ֱʻָ,7-ֱʸı䵼,豸رմ + public byte byRes1; + public ushort wStartInputNum; // 쳣Դ쳣㣩 + public ushort wEndInputNum; // 쳣Դ쳣յ㣩 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MATRIX_CFG + { + public byte byValid; //жǷģǷЧ + public byte byCommandProtocol; //ģָ4֣ + public byte byScreenType; // + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byScreenToMatrix; //ģĻĶӦϵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DIGITALSCREEN + { + public NET_DVR_IPADDR struAddress;/*豸Ϊ豸ʱIPϢ*/ + public ushort wPort; //ͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 26, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ANALOGSCREEN + { + public byte byDevSerPortNum; /*豸Ĵں*/ + public byte byScreenSerPort; /*ӴĴں*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 130, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_MATRIX_CFG struMatrixCfg; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_SCREEN_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 172, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + /*[FieldOffsetAttribute(0)] + public NET_DVR_DIGITALSCREEN struDigitalScreen; + [FieldOffsetAttribute(0)] + public NET_DVR_ANALOGSCREEN struAnalogScreen; + * */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREEN_SCREENINFO + { + public uint dwSize; + public byte byValid; //ǷЧ + public byte nLinkMode; //ӷʽ0-ڣ1- + public byte byDeviceType; //豸ͺţȡ + public byte byScreenLayX; //- + public byte byScreenLayY; //- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; /*¼û*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PASSWD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPassword; /*¼*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDevName; /*豸*/ + public NET_DVR_SCREEN_UNION struScreenUnion; + public byte byInputNum; // Դ + public byte byOutputNum; // Դ + public byte byCBDNum; //CBD + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 29, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*******************************ͼϴ*******************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_BASEMAP_CFG + { + public byte byScreenIndex; //Ļ + public byte byMapNum; /*ָ˶ٿ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] res; + public ushort wSourWidth; /* ԭͼƬĿ */ + public ushort wSourHeight; /* ԭͼƬĸ߶ */ + } + + /*******************************OSD*******************************/ + public const int MAX_OSDCHAR_NUM = 256; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_OSDCFG + { + public uint dwSize; + public byte byValid; /*ǷЧ 0Ч 1Ч*/ + public byte byDispMode; //ʾģʽ1-͸2-͸3-ģʽ + public byte byFontColorY; /*ɫY,0-255*/ + public byte byFontColorU; /*ɫU,0-255*/ + public byte byFontColorV; /*ɫV,0-255*/ + public byte byBackColorY; /*ɫY,0-255*/ + public byte byBackColorU; /*ɫU,0-255*/ + public byte byBackColorV; /*ɫV,0-255*/ + public ushort wXCoordinate; /*OSDĻϽλx*/ + public ushort wYCoordinate; /*OSDĻϽλy*/ + public ushort wWidth; /*OSD*/ + public ushort wHeight; /*OSD߶*/ + public uint dwCharCnt; /*ַĸ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_OSDCHAR_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wOSDChar; /*OSDַ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*******************************ȡϢ*******************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SERIAL_CONTROL + { + public uint dwSize ; + public byte bySerialNum; // ڸ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] bySerial; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*******************************Ļ*******************************/ + //ĻԴ + public enum INPUT_INTERFACE_TYPE + { + INTERFACE_VGA = 0, + INTERFACE_SVIDEO, // 2046NL֧֣2046NH֧ + INTERFACE_YPBPR, + INTERFACE_DVI , + INTERFACE_BNC , + INTERFACE_DVI_LOOP,//(ͨ) 2046NH֧֣2046NL֧ + INTERFACE_BNC_LOOP, //(ͨ) 2046NH֧֣2046NL.֧ + INTERFACE_HDMI, + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INPUT_INTERFACE_CTRL + { + public byte byInputSourceType; //INPUT_INTERFACE_TYPE + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ʾԪɫ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPLAY_COLOR_CTRL + { + public byte byColorType; //1- 2-Աȶ 3-Ͷ 4- + public char byScale; //-1 0+1ֵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ʾԪλÿ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DISPLAY_POSITION_CTRL + { + public byte byPositionType; //1-ˮƽλ 2-ֱλã + public char byScale; //-1 0+1ֵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 14, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_SCREEN_CONTROL_PARAM + { + /*[FieldOffsetAttribute(0)] + public NET_DVR_INPUT_INTERFACE_CTRL struInputCtrl; + [FieldOffsetAttribute(0)] + public NET_DVR_DISPLAY_COLOR_CTRL struDisplayCtrl; + [FieldOffsetAttribute(0)] + public NET_DVR_DISPLAY_POSITION_CTRL struPositionCtrl; + [FieldOffsetAttribute(0)] + * */ + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREEN_CONTROL + { + public uint dwSize; + public uint dwCommand ; /* Ʒ 1- 2- 3-ĻԴѡ 4-ʾԪɫ 5-ʾԪλÿ*/ + public byte byProtocol; //Э,1:LCD-S1,2:LCD-S2 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_SCREEN_CONTROL_PARAM struControlParam; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 52, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*******************************ĻV41*******************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SCREEN_CONTROL_V41 + { + public uint dwSize; + public byte bySerialNo; //ں + public byte byBeginAddress; //ϽĻţ1ʼ + public byte byEndAddress; //½Ļţ1ʼ + public byte byProtocol; // Э 1-LCD-S1 , 2-LCD-S2 , 3-LCD-L1 4-LCD-DLP 5-LCD-S3 , 6-LCD-H1 + public uint dwCommand ; /* Ʒ 1- 2- 3-ĻԴѡ 4-ʾԪɫ 5-ʾԪλÿ*/ + public NET_DVR_SCREEN_CONTROL_PARAM struControlParam; + public byte byWallNo; // ǽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 51, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /*******************************Ԥ*******************************/ + public const int MAX_PLAN_ACTION_NUM = 32; //Ԥ + public const int DAYS_A_WEEK = 7; //һ7 + public const int MAX_PLAN_COUNT = 16; //Ԥ + + public enum NET_DVR_PLAN_OPERATE_TYPE + { + NET_DVR_SWITCH_LAYOUT = 1, // л Ĭ + NET_DVR_SCREEN_POWER_OFF, // رմĻʾ + NET_DVR_SCREEN_POWER_ON, // 򿪴Ļʾ + } + + /*ԤϢ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLAN_INFO + { + public byte byValid; // ǷЧ + public byte byType; // NET_DVR_PLAN_OPERATE_TYPE + public ushort wLayoutNo; // ֺ + public byte byScreenStyle; //Ļͺţػã1ǵ2Ǹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwDelayTime; // һʱ, λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CYCLE_TIME + { + public byte byValid; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_TIME_EX struTime; + } + + /*Ԥ*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLAN_CFG + { + public uint dwSize; + public byte byValid; // ԤǷЧ + public byte byWorkMode; // Ԥģʽ 1ʾֶ2Զ3Ԥѭ + public byte byWallNo; //ǽţ1ʼ + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPlanName; //Ԥ + public NET_DVR_TIME_EX struTime; // ģʽΪԶʱʹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = DAYS_A_WEEK, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CYCLE_TIME[] struTimeCycle; /*ѭʱ䣬Ϊһڣꡢ¡ʹá磺struTimeCycle[0]еbyValidֵ1ʾִиԤȡֵΪ[0,6]0죬1һԴ*/ + public uint dwWorkCount; // Ԥִд0Ϊһֱѭţֵʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PLAN_ACTION_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_PLAN_INFO[] strPlanEntry; // Ԥִе + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*******************************ȡ豸״̬*******************************/ + /*Ԥб*/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLAN_LIST + { + public uint dwSize; + public uint dwPlanNums; //豸źԴ + public IntPtr pBuffer; //ָdwInputSignalNumsNET_DVR_PLAN_CFGṹСĻ + public byte byWallNo; //ǽţ1ʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwBufLen; //仺ȣڵdwInputSignalNumsNET_DVR_PLAN_CFGṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + /*******************************Ԥ*******************************/ + //ýṹΪͨÿƽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CONTROL_PARAM + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sDeviceID; //豸豸ID + public ushort wChan; //ͨ + public byte byIndex; //ȷʾʲô + public byte byRes1; + public uint dwControlParam; + public byte byMandatoryAlarm; //1-ʹ 0-ʹ + public byte byRes2; + public ushort wZoneIndex; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byOperatorCode;//ؿ + public uint dwPlanNo; //4ֽԤţͻͳһʹ4ֽڵԤţֽڵԤŲʹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + } + + /*******************************ȡ豸״̬*******************************/ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DEVICE_RUN_STATUS + { + public uint dwSize; + public uint dwMemoryTotal; //ڴ λKbyte + public uint dwMemoryUsage; //ڴʹ λKbyte + public byte byCPUUsage; //CPUʹ 0-100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 127, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //91ϵHD-SDIDVR Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACCESS_CAMERA_INFO + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sCameraInfo; // ǰϢ + public byte byInterfaceType; // ǰ˽ӿͣ1:VGA, 2:HDMI, 3:YPbPr 4:SDI 5:FC + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwChannel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AUDIO_INPUT_PARAM + { + public byte byAudioInputType; //Ƶͣ0-mic in1-line in + public byte byVolume; //volume,[0-100] + public byte byEnableNoiseFilter; //Ƿ-أ- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.I1)] + public byte[] byres; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CAMERA_DEHAZE_CFG + { + public uint dwSize; + public byte byDehazeMode; //0-ã1-Զģʽ2- + public byte byLevel; //ȼ0-100 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_INPUT_SIGNAL_LIST + { + public uint dwSize; + public uint dwInputSignalNums; //豸źԴ + public IntPtr pBuffer; //ָdwInputSignalNumsNET_DVR_INPUTSTREAMCFGṹСĻ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwBufLen; //仺ȣڵdwInputSignalNumsNET_DVR_INPUTSTREAMCFGṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ȫ״̬ + public const int PULL_DISK_SUCCESS = 1; // ȫ̳ɹ + public const int PULL_DISK_FAIL = 2; // ȫʧ + public const int PULL_DISK_PROCESSING = 3; // ֹͣ + public const int PULL_DISK_NO_ARRAY = 4; // в + public const int PULL_DISK_NOT_SUPPORT = 5; // ְ֧ȫ + + //ɨ״̬ + public const int SCAN_RAID_SUC = 1; // ɨгɹ + public const int SCAN_RAID_FAIL = 2; // ɨʧ + public const int SCAN_RAID_PROCESSING = 3; // ɨ + public const int SCAN_RAID_NOT_SUPPORT = 4; // ֧ɨ + + //ǰ״̬ + public const int SET_CAMERA_TYPE_SUCCESS = 1; // ɹ + public const int SET_CAMERA_TYPE_FAIL = 2; // ʧ + public const int SET_CAMERA_TYPE_PROCESSING = 3; // ڴ + + //9000 2.2 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORD_TIME_SPAN_INQUIRY + { + public uint dwSize; //ṹС + public byte byType; //0 Ƶ¼, 1ͼƬͨ¼, 2ANRͨ¼, 3֡ͨ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 63, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_RECORD_TIME_SPAN + { + public uint dwSize; //ṹС + public NET_DVR_TIME strBeginTime; //ʼʱ + public NET_DVR_TIME strEndTime; //ʱ + public byte byType; //0 Ƶ¼, 1ͼƬͨ¼, 2ANRͨ¼, 3֡ͨ¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 35, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DRAWFRAME_DISK_QUOTA_CFG + { + public uint dwSize; //ṹС + public byte byPicQuota; //ͼƬٷֱ [0%, 30%] + public byte byRecordQuota; //ͨ¼ٷֱ [20%, 40%] + public byte byDrawFrameRecordQuota; //֡¼ٷֱ [30%, 80%] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 61, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; //ֽ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MANUAL_RECORD_PARA + { + public NET_DVR_STREAM_INFO struStreamInfo; + public uint lRecordType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //˿ӳýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NAT_PORT + { + public ushort wEnable; + public ushort wExtPort; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //˿ӳýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_NAT_CFG + { + public uint dwSize; + public ushort wEnableUpnp; + public ushort wEnableNat; + public NET_DVR_IPADDR struIpAddr;//ʱֹͣʱ + public NET_DVR_NAT_PORT struHttpPort;//ʱֹͣʱ + public NET_DVR_NAT_PORT struCmdPort;//ʱֹͣʱ + public NET_DVR_NAT_PORT struRtspPort;//ʱֹͣʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byFriendName; + public byte byNatType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_NAT_PORT struHttpsPort;//ʱֹͣʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 76, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Upnp˿ӳ״̬ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_UPNP_PORT_STATE + { + public uint dwEnabled;//ö˿Ƿʹӳ + public ushort wInternalPort;//ӳǰĶ˿ + public ushort wExternalPort;//ӳĶ˿ + public uint dwStatus;//˿ӳ״̬0- δЧ1- δЧӳԴ˿ĿĶ˿һ£2- δЧӳ˿ںѱʹã3- Ч + public NET_DVR_IPADDR struNatExternalIp;//ӳⲿַ + public NET_DVR_IPADDR struNatInternalIp; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + //Upnp˿ӳ״̬ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_UPNP_NAT_STATE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_UPNP_PORT_STATE[] strUpnpPort;//˿ӳ״̬:0- web server˿ڣ1- ˿ڣ2- rtsp + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 200, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLAYCOND + { + public uint dwChannel; + public NET_DVR_TIME struStartTime; + public NET_DVR_TIME struStopTime; + public byte byDrawFrame; //0:֡1֡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 63, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + //¼طŽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VOD_PARA + { + public uint dwSize; //ṹС + public NET_DVR_STREAM_INFO struIDInfo; //IDϢ + public NET_DVR_TIME struBeginTime;//طſʼʱ + public NET_DVR_TIME struEndTime;//طŽʱ + public IntPtr hWnd;//طŴ + public byte byDrawFrame;//Ƿ֡0- ֡1- ֡ + public byte byVolumeType;//0-ͨ¼1-浵CVR豸ͨͨ¼񣬴浵ڱ¼ + public byte byVolumeNum;//浵 + public byte byRes1;// + public uint dwFileIndex;//浵ϵ¼ļ浵¼ʱصֵ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ATMFINDINFO + { + public byte byTransactionType; // 0-ȫ1-ѯ 2-ȡ 3- 4-޸룬5-תˣ 6-޿ѯ 7-޿ 8-̳ 9-̿ 10-Զ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public uint dwTransationAmount ; //׽ ; + } + + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct NET_DVR_SPECIAL_FINDINFO_UNION + { + [FieldOffsetAttribute(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byLenth ; + /* [FieldOffsetAttribute(0)] + public NET_DVR_ATMFINDINFO struATMFindInfo; //ATMѯ + * */ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FILECOND_V40 + { + public Int32 lChannel; + public uint dwFileType; + public uint dwIsLocked; + public uint dwUseCardNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CARDNUM_LEN_OUT, ArraySubType = UnmanagedType.I1)] + public byte[] sCardNumber; + public NET_DVR_TIME struStartTime; + public NET_DVR_TIME struStopTime; + public byte byDrawFrame; //0:֡1֡ + public byte byFindType; //0:ѯͨ1ѯ浵 + public byte byQuickSearch; //0:ͨѯ1٣ѯ + public byte bySpecialFindInfoType ; //רвѯ 0-Ч 1-ATMѯ + public uint dwVolumeNum; //浵 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = GUID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byWorkingDeviceGUID; //GUIDͨȡN+1õ + public NET_DVR_SPECIAL_FINDINFO_UNION uSpecialFindInfo ; //רвѯ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //¼ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SEARCH_EVENT_PARAM_V40 + { + public ushort wMajorType; //0-ƶ⣬1-, 2-¼ 5-pos¼ 7-Ž¼ + public ushort wMinorType; //- ͱ仯0xffffʾȫ + public NET_DVR_TIME struStartTime; //Ŀʼʱ䣬ֹͣʱ: ͬʱΪ(0, 0) ʾʱ俪ʼǰ4000¼ + public NET_DVR_TIME struEndTime; // + public byte byLockType; // 0xff-ȫ0-δ1- + public byte byQuickSearch; // Ƿÿٲѯ0-ã1-ãٲѯ᷵ļС豸ݿвѯƵӲ̣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 130, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + public UNION_EVENT_PARAM uSeniorParam; + + public void Init() + { + byRes = new byte[130]; + uSeniorParam.Init(); + } + } + + public const int SEARCH_EVENT_INFO_LEN_V40 = 800; + + [StructLayout(LayoutKind.Explicit)] + public struct UNION_EVENT_PARAM + { + [FieldOffset(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SEARCH_EVENT_INFO_LEN_V40, ArraySubType = UnmanagedType.I1)] + public byte[] byLen; + public void Init() + { + byLen = new byte[SEARCH_EVENT_INFO_LEN_V40]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struMotionParam + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.U2)] + public ushort[] wMotDetChanNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 672, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void Init() + { + wMotDetChanNo = new ushort[MAX_CHANNUM_V30]; + byRes = new byte[672]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struStreamIDParam + { + public NET_DVR_STREAM_INFO struIDInfo; + public uint dwCmdType; + public byte byBackupVolumeNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byArchiveLabel; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 656, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void Init() + { + byRes1 = new byte[3]; + byArchiveLabel = new byte[64]; + byRes = new byte[656]; + struIDInfo.Init(); + } + } + + //ҷؽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SEARCH_EVENT_RET_V40 + { + public ushort wMajorType; // + public ushort wMinorType; // + public NET_DVR_TIME struStartTime; //¼ʼʱ + public NET_DVR_TIME struEndTime; //¼ֹͣʱ䣬¼ʱͿʼʱһ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V40, ArraySubType = UnmanagedType.U2)] + public ushort[] wChan; //ͨţ0xffffʾЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 36, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public UNION_EVENT_RET uSeniorRet; + } + + [StructLayout(LayoutKind.Explicit)] + public struct UNION_EVENT_RET + { + [FieldOffset(0)] + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 800, ArraySubType = UnmanagedType.I1)] + public byte[] byLen; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struMotionRet + { + public uint dwMotDetNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 796, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int NET_SDK_MAX_TAPE_INDEX_LEN = 32; //Ŵ󳤶 + public const int NET_SDK_MAX_FILE_LEN = 256; //ļ󳤶 + + //id¼ѯ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct struStreamIDRet + { + public uint dwRecordType; //¼ 0-ʱ¼ 1-ƶ 2-¼ 3-|ƶ 4-&ƶ 5- 6-ֶ¼ 7-𶯱 8- 9-ܱ 10-ش¼ + public uint dwRecordLength; //¼С + public byte byLockFlag; // ־ 0û 1 + public byte byDrawFrameType; // 0dz֡¼ 1֡¼ + public byte byPosition;// ļڴ洢λã0-ϣ1-λϣֱأ2-ŴڣҪѴлλϣ3-ڴŴУҪѴ̲嵽Ŵ + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byFileName; //ļ + public uint dwFileIndex; // 浵ϵļ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_MAX_TAPE_INDEX_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byTapeIndex; //ļڴŴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_MAX_FILE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byFileNameEx; //ļչ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 464, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_AES_KEY_INFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] sAESKey; /*Կ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; /*ֽ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_POE_CFG + { + public NET_DVR_IPADDR struIP; //IPַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + } + + public const int MAX_PRO_PATH = 256; //Э· + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CUSTOM_PROTOCAL + { + public uint dwSize; //ṹС + public uint dwEnabled; //ǷøЭ0 1 + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = DESC_LEN)] + public string sProtocalName; //ԶЭ, 16λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //,Эչ + public uint dwEnableSubStream; //Ƿ0 1 + public byte byMainProType; //Э 1 RTSP + public byte byMainTransType; // 0Auto 1udp 2rtp over rtsp + public ushort wMainPort; //˿ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_PRO_PATH)] + public string sMainPath; //· + public byte bySubProType; //Э 1 RTSP + public byte bySubTransType; // 0Auto 1udp 2rtp over rtsp + public ushort wSubPort; //˿ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_PRO_PATH)] + public string sSubPath; //· + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 200, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + } + + //ԤV40ӿ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PREVIEWINFO + { + public Int32 lChannel;//ͨ + public uint dwStreamType; // ͣ0-1-2-33-4 Դ + public uint dwLinkMode;// 0TCPʽ,1UDPʽ,2ಥʽ,3 - RTPʽ4-RTP/RTSP,5-RSTP/HTTP + public IntPtr hPlayWnd;//Ŵڵľ,ΪNULLʾͼ + public bool bBlocked; //0-ȡ, 1-ȡ, SDKڲconnectʧܽ5sijʱܹ,ʺѯȡ. + public bool bPassbackRecord; //0-¼ش,1¼ش + public byte byPreviewMode;//Ԥģʽ0-Ԥ1-ӳԤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = STREAM_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byStreamID;//IDlChannelΪ0xffffffffʱô˲ + public byte byProtoType; //ӦòȡЭ飬0-˽Э飬1-RTSPЭ + public byte byRes1; + public byte byVideoCodingType; //ݱ 0-ͨñ 1-ȳ̽ԭʼݣ¶ݵļϢͨȥ㣬ԭʼʵ¶ֵ + public uint dwDisplayBufNum; //ſⲥŻ󻺳֡Χ1-500ʱĬΪ1 + public byte byNPQMode; //NPQֱģʽǹý 0-ֱ 1-ý + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 215, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + ///ץĻ + /// + public const int MAX_OVERLAP_ITEM_NUM = 50; //ַ + public const int NET_ITS_GET_OVERLAP_CFG = 5072;//ȡַӲãITSնˣ + public const int NET_ITS_SET_OVERLAP_CFG = 5073;//ַӲãITSնˣ + public const int NET_ITS_SET_LAMP_EXTERNAL_CFG = 5095; //ò + + //ַṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_OVERLAPCFG_COND + { + public uint dwSize; + public uint dwChannel;//ͨ + public uint dwConfigMode;//ģʽ0- նˣ1- ǰ(ֱǰ˻ն˽ǰ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + //ַϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_OVERLAP_SINGLE_ITEM_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + public byte byItemType;// + public byte byChangeLineNum;//ĻȡֵΧ[0,10]Ĭϣ0 + public byte bySpaceNum;//ĿոȡֵΧ[0-255]Ĭϣ0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + //ַýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_OVERLAP_ITEM_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_OVERLAP_ITEM_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_ITS_OVERLAP_SINGLE_ITEM_PARAM[] struSingleItem;//ַϢ + public uint dwLinePercent; + public uint dwItemsStlye; + public ushort wStartPosTop; + public ushort wStartPosLeft; + public ushort wCharStyle; + public ushort wCharSize; + public ushort wCharInterval; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + public uint dwForeClorRGB;//ǰɫRGBֵbit0~bit7: Bbit8~bit15: Gbit16~bit23: RĬϣx00FFFFFF- + public uint dwBackClorRGB;//ɫRGBֵֻͼƬЧbit0~bit7: Bbit8~bit15: Gbit16~bit23: RĬϣx00000000- + public byte byColorAdapt;//ɫǷӦ0-1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + //ַϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_OVERLAP_INFO_PARAM + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128, ArraySubType = UnmanagedType.I1)] + public byte[] bySite;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRoadNum;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byInstrumentNum;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byDirection;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byDirectionDesc;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byLaneDes;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;//ﱣƵѹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 44, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitoringSite1;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitoringSite2;//ﱣƵѹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//ﱣƵѹ + } + + //ַṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_OVERLAP_CFG + { + public uint dwSize; + public byte byEnable;//Ƿã0- ã1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;//ﱣƵѹ + public NET_ITS_OVERLAP_ITEM_PARAM struOverLapItem;//ַ + public NET_ITS_OVERLAP_INFO_PARAM struOverLapInfo;//ַϢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//ﱣƵѹ + } + + //ṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SETUPALARM_PARAM + { + public uint dwSize; + public byte byLevel;//ȼ0- һȼߣ1- ȼУ2- ȼͣ + public byte byAlarmInfoType;//ϴϢ֧֣ͣܽͨ0- ϱϢNET_DVR_PLATE_RESULT1- ±Ϣ(NET_ITS_PLATE_RESULT) + public byte byRetAlarmTypeV40; + public byte byRetDevInfoVersion; + public byte byRetVQDAlarmType; + public byte byFaceAlarmDetection; + public byte bySupport; + public byte byBrokenNetHttp; + public ushort wTaskNo; + public byte byDeployType; //ͣ0-ͻ˲1-ʵʱ + public byte bySubScription; //ģλʾδIJϱ //ռλ //Bit7-ƶ˳Ƿͼ0-ͼ(V30ϱ)1-ͼ(V40ϱ) + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public byte byAlarmTypeURL; + //bit0-ʾץıϴINTER_FACESNAP_RESULT0-ʾƴ䣬1-ʾURL䣨豸ֵ֧£豸֧ݾ屨ж,ͬʱ豸Ҫ֧URLط񣬵ǰǡƴ洢 + //bit1-ʾEVENT_JSONͼƬݳͣ0-ʾƴ䣬1-ʾURL䣨豸ֵ֧£豸֧ݾ屨жϣ + //bit2 - ȶ(ΪCOMM_SNAP_MATCH_ALARM)ͼƬϴͣ0 - ƴ䣬1 - URL + //bit3 - Ϊ(ΪCOMM_ALARM_RULE)ͼƬϴͣ0 - ƴ䣬1 - URL䣬ֶ豸Ƿ֧֣ӦӲڵǷ񷵻Ϊtrue + public byte byCustomCtrl;//Bit0- ʾָ֧ʻͼϴ: 0-ϴ,1-ϴ + } + + //բƲ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_BARRIERGATE_CFG + { + public uint dwSize; + public uint dwChannel;//ͨ + public byte byLaneNo; //բţ0-ʾЧֵ(豸ҪЧֵж),1-բ1 + public byte byBarrierGateCtrl;//0-رյբ,1-բ,2-ֹͣբ 3-բ,4~բ + public byte byEntranceNo;//ڱ [1,8] + public byte byUnlock;//ýʹܣ0~Ϊã1~ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int MAX_RELAY_NUM = 12; + public const int MAX_IOIN_NUM = 8; + public const int MAX_VEHICLE_TYPE_NUM = 8; + + public const int NET_DVR_GET_ENTRANCE_PARAMCFG = 3126; //ȡڿƲ + public const int NET_DVR_SET_ENTRANCE_PARAMCFG = 3127; //óڿƲ + + //ڿ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_BARRIERGATE_COND + { + public byte byLaneNo;//ţ0- ʾЧֵ(豸ҪЧֵж)1- 1 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //̵ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_RELAY_PARAM + { + public byte byAccessDevInfo;//0-豸1-բ2-صբ3-ͣբ4-źš5- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //Ϣܿز + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_DVR_VEHICLE_CONTROL + { + public byte byGateOperateType;//ͣ0- ޲1- բ + public byte byRes1; + public ushort wAlarmOperateType; //ͣ0- ޲bit0- ̵bit1- ϴbit3- 澯ϴֵ0-ʾأ1-ʾɸѡ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //ڿƲ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ENTRANCE_CFG + { + public uint dwSize; + public byte byEnable; + public byte byBarrierGateCtrlMode; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1;// + public uint dwRelateTriggerMode; + public uint dwMatchContent; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_RELAY_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_RELAY_PARAM[] struRelayRelateInfo;//̵Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_IOIN_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byGateSingleIO; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_VEHICLE_TYPE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_VEHICLE_CONTROL[] struVehicleCtrl;//Ϣܿ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2;// + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_GATE_VEHICLE + { + public uint dwSize; + public uint dwMatchNo; + public byte byGroupNum; + public byte byPicNo; + public byte bySecondCam; + + public byte byRes; + public ushort wLaneid; + public byte byCamLaneId; + public byte byRes1; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] byAlarmReason; + + public ushort wBackList; + public ushort wSpeedLimit; + public uint dwChanIndex; + + + public NET_DVR_PLATE_INFO struPlateInfo; + + public NET_DVR_VEHICLE_INFO struVehicleInfo; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] + public byte[] byMonitoringSiteID; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] + public byte[] byDeviceID; + + + public byte byDir; + public byte byDetectType; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] + public byte[] byRes2; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] + public byte[] byCardNo; + + public uint dwPicNum; + + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.Struct)] + public NET_ITS_PICTURE_INFO[] struPicInfo; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] bySwipeTime; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 224)] + public byte[] byRes3; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_PICTURE_INFO + { + public uint dwDataLen; + public byte byType; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] + public byte[] byRes1; + public uint dwRedLightTime; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public byte[] byAbsTime; + public NET_VCA_RECT struPlateRect; + public NET_VCA_RECT struPlateRecgRect; + public IntPtr pBuffer; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_PLATE_RESULT + { + public uint dwSize; //ṹ + public uint dwMatchNo; //ƥ,(,,)ƥ + public byte byGroupNum; //ͼƬһץĵһͼƬʱƥݣ + public byte byPicNo; //ĵͼƬţյͼƬ󣬱ʾ;ճʱͼƬʱҪɾ + public byte bySecondCam; //ǷڶץģԶץĵԶǰץĵĺĿлõ + public byte byFeaturePicNo; //Ƶ羯ȡڼͼΪдͼ,0xff-ʾȡ + public byte byDriveChan; // + public byte byVehicleType; //ͣοVTR_RESULT + public byte byDetSceneID;//ⳡ[1,4], IPCĬ0 + //ԣλʾ0- ޸(ͨ)bit1- Ʊ공(ı־)bit2- ΣƷֵ0- 1- + //ýڵѲʹ,ʹbyYellowLabelCarbyDangerousVehiclesжǷƱ공ΣƷ + public byte byVehicleAttribute; + public ushort wIllegalType; //ΥͲù궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byIllegalSubType; //Υ + public byte byPostPicNo; //ΥʱȡڼͼƬΪͼ,0xff-ʾȡ + //ͨ(Чͨź豸ϴͨһ£ں˺ ͨһ) + public byte byChanIndex; + public ushort wSpeedLimit; //ޣʱЧ + public byte byChanIndexEx; //byChanIndexEx*256+byChanIndexʾʵͨš + public byte byRes2; + public NET_DVR_PLATE_INFO struPlateInfo; //Ϣṹ + public NET_DVR_VEHICLE_INFO struVehicleInfo; //Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 48, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitoringSiteID; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 48, ArraySubType = UnmanagedType.I1)] + public byte[] byDeviceID; //豸 + public byte byDir; //ⷽ1-У򣩣2-()3-˫4-ɶ5-,6-򶫣7-ɱϣ8- + public byte byDetectType; //ⷽʽ,1-ظд2-Ƶ3-֡ʶ4-״ﴥ + //ͣοITC_RELA_LANE_DIRECTION_TYPE + //òΪŶӦȷΨһԡ + public byte byRelaLaneDirectionType; + public byte byCarDirectionType; //ʻķ0ʾ£1ʾϣʵʳʻ֣ + //wIllegalTypeΪʱʹøòwIllegalTypeΪֵʱwIllegalTypeΪ׼òЧ + public uint dwCustomIllegalType; //ΥͶ(ûԶ) + /*Ϊ0~ָʽʱΪϵΥͣwIllegalTypedwCustomIllegalTypeЧֵΥ롣 + * Ϊ1~ַʽʱpIllegalInfoBufЧϵΥͣwIllegalTypedwCustomIllegalTypeȻֵΥ*/ + public IntPtr pIllegalInfoBuf; //ΥַϢṹָ룻ָNET_ITS_ILLEGAL_INFO + public byte byIllegalFromatType; //ΥϢʽͣ 0~ָʽ 1~ַʽ + public byte byPendant;// 0-ʾδ֪,1-2- + public byte byDataAnalysis; //0-δ, 1-ѷ + public byte byYellowLabelCar; //0-ʾδ֪, 1-ǻƱ공,2-Ʊ공 + public byte byDangerousVehicles; //0-ʾδ֪, 1-ΣƷ,2-ΣƷ + //ֶΰPilotַΪʻCopilotַΪʻ + public byte byPilotSafebelt;//0-ʾδ֪,1-ϵȫ,2-ϵȫ + public byte byCopilotSafebelt;//0-ʾδ֪,1-ϵȫ,2-ϵȫ + public byte byPilotSunVisor;//0-ʾδ֪,1-,2- + public byte byCopilotSunVisor;//0-ʾδ֪, 1-,2- + public byte byPilotCall;// 0-ʾδ֪, 1-绰,2-绰 + //0-բ1-δբ (רʷƥǷբɹı־)byAlarmDataTypeΪ0-ʵʱʱ 0-δբ 1-բ + public byte byBarrierGateCtrlType; + public byte byAlarmDataType;//0-ʵʱݣ1-ʷ + public NET_DVR_TIME_V30 struSnapFirstPicTime;//˵ʱ(ms)ץĵһͼƬʱ䣩 + public uint dwIllegalTime;//Υʱ䣨ms = ץһͼƬʱ - ץĵһͼƬʱ + public uint dwPicNum; //ͼƬpicGroupNumͬϢͼƬͼƬϢstruVehicleInfoEx + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.Struct)] + public NET_ITS_PICTURE_INFO[] struPicInfo; //ͼƬϢ,Żص6ͼ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_ITS_PARK_VEHICLE + { + public uint dwSize; + public byte byGroupNum; + public byte byPicNo; + public byte byLocationNum; + public byte byParkError; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_PARKNO_LEN)] + public string byParkingNo; + public byte byLocationStatus; + public byte bylogicalLaneNum; + public ushort wUpLoadType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwChanIndex; + public NET_DVR_PLATE_INFO struPlateInfo; + public NET_DVR_VEHICLE_INFO struVehicleInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMonitoringSiteID; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDeviceID; + public uint dwPicNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.Struct)] + public NET_ITS_PICTURE_INFO[] struPicInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_GATE_INFO + { + public UNION_GATE_VEHICLE struVehicleInfo; //struAlarmTypeΪ(0x1Ƿ뱨) + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct UNION_GATE_VEHICLE + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LICENSE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sLicense;//ƺ + /*0- 1-̶2-ʱ3-Ԥ4-쳵5-Ȩ*/ + public byte byVehicleType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 111, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GATE_ALARMINFO + { + public uint dwSize; + //0x1Ƿ뱨 + //0x2բʱδر + //0x3ѹȦʱ + //0x4޿ + //0x5ٿ + //0x6쳣 + public byte byAlarmType; + public byte byExternalDevType;//豸(EXTERNAL_DEVICES_TYPE) + public byte byExternalDevStatus;//豸(EXTERNAL_DEVICES_STATUS) + public byte byRes; + public NET_DVR_TIME_V30 struAlarmTime;//ʱ + public UNION_GATE_INFO uAlarmInfo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; //Ԥ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DIAGNOSIS_UPLOAD + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = STREAM_ID_LEN)] + public string sStreamID; ///< IDС32ֽ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 64)] + public string sMonitorIP; ///< صip + public uint dwChanIndex; ///< صͨ + public uint dwWidth; ///< ͼ + public uint dwHeight; ///< ͼ߶ + public NET_DVR_TIME struCheckTime; ///< ʱ(ϲںʱֶ)ʽ2012-08-06 13:00:00 + public byte byResult; ///0-δ 1- 2-쳣 3-¼ʧ 4-ȡ쳣 + public byte bySignalResult; ///< Ƶʧ 0-δ 1- 2-쳣 + public byte byBlurResult; ///< ͼģ0-δ 1- 2-쳣 + public byte byLumaResult; ///< ͼ0-δ 1- 2-쳣 + public byte byChromaResult; ///< ƫɫ0-δ 1- 2-쳣 + public byte bySnowResult; ///< ż0-δ 1- 2-쳣 + public byte byStreakResult; ///< Ƹż0-δ 1- 2-쳣 + public byte byFreezeResult; ///< 涳0-δ 1- 2-쳣 + public byte byPTZResult; ///< ̨0-δ 1- 2-쳣 + public byte byContrastResult; //Աȶ쳣0-δ⣬1-2-쳣 + public byte byMonoResult; //ڰͼ0-δ⣬1-2-쳣 + public byte byShakeResult; //Ƶ0-δ⣬1-2-쳣 + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 256)] + public string sSNapShotURL; ///<ͼƬURLַ + public byte byFlashResult; //Ƶ0-δ⣬1-2-쳣 + public byte byCoverResult; //Ƶڵ0-δ⣬1-2-쳣 + public byte bySceneResult; //0-δ⣬1-2-쳣 + public byte byDarkResult; //ͼ0-δ⣬1-2-쳣 + public byte byStreamType; //ͣ0-Ч1-δ֪2-ͣ3-ǹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 59, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int CID_CODE_LEN = 4; + public const int ACCOUNTNUM_LEN = 6; + public const int ACCOUNTNUM_LEN_32 = 32; + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CID_ALARM + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CID_CODE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sCIDCode; //CID¼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sCIDDescribe; //CID¼ + public NET_DVR_TIME_EX struTriggerTime; //ʱ + public NET_DVR_TIME_EX struUploadTime; //ϴʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACCOUNTNUM_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sCenterAccount; //ʺ + public byte byReportType; //NET_DVR_ALARMHOST_REPORT_TYPE + public byte byUserType; //ûͣ0-û 1-û,2-ֻû,3-ϵͳû + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUserName; //ûû + public ushort wKeyUserNo; //û 0xFFFFʾЧ + public byte byKeypadNo; //̺ 0xFFʾЧ + public byte bySubSysNo; //ϵͳ 0xFFʾЧ + public ushort wDefenceNo; // 0xFFFFʾЧ + public byte byVideoChanNo; //Ƶͨ 0xFFʾЧ + public byte byDiskNo; //Ӳ̺ 0xFFʾЧ + public ushort wModuleAddr; //ģַ 0xFFFFʾЧ + public byte byCenterType; //0-Ч, 1-˺(6),2-չ˺(9) + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACCOUNTNUM_LEN_32, ArraySubType = UnmanagedType.I1)] + public byte[] sCenterAccountV40; //˺V40,ʹôֶʱsCenterAccountЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 28, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_PTZ_INFO + { + public float fPan; + public float fTilt; + public float fZoom; + public uint dwFocus;// ۽۽Χһ0-100000 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ⱨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FIREDETECTION_ALARM + { + public uint dwSize; //ṹС + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public NET_VCA_DEV_INFO struDevInfo; //ǰ豸Ϣ + public ushort wPanPos; + public ushort wTiltPos; + public ushort wZoomPos; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwPicDataLen;//ץͼƬ + public IntPtr pBuffer; //ָ + public NET_VCA_RECT struRect;// + public NET_VCA_POINT struPoint;//¶ȵ + public ushort wFireMaxTemperature;//¶[300~4000] + public ushort wTargetDistance;//Ŀ[100m ~ 10000m] + public byte byStrategyType;//ͣ0~ⱨ1~Эͬ2~ϵͳ3~ָ㱨4~ָ + public byte byAlarmSubType;//͡0~ⱨ1~ⱨ2~̻𱨾 + /*ǷPTZչ + 0~ãPTZֵwPanPoswTiltPoswZoomPosΪ׼ + 1~ãPTZֵstruPtzPosExΪ׼PTZ践ءstruPtzPosExֵתΪwPanPoswTiltPoswZoomPosֵ + */ + public byte byPTZPosExEnable; + public byte byRes2; + public NET_PTZ_INFO struPtzPosEx;// ptzչ(ָ֧߾PTZֵȷСλ) + public uint dwVisiblePicLen;//ɼͼƬ + public IntPtr pVisiblePicBuf; //ɼͼƬָ + // pSmokeBufbyAlarmSubTypeΪ1ⱨ2̻𱨾ʱЧ + public IntPtr pSmokeBuf; //ⱨָ룬ָһNET_DVR_SMOKEDETECTION_ALARMṹ + public ushort wDevInfoIvmsChannelEx; //NET_VCA_DEV_INFObyIvmsChannelܱͬʾֵϿͻbyIvmsChannelܼݣ255¿ͻ˰汾ʹwDevInfoIvmsChannelEx + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 58, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_EVENT_INFO + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; //ţΪ0Ч + public byte byCardType; //ͣ1-ͨ3-ֹ4-Ѳ5-вȿ6-7-Ϊ0Ч + public byte byAllowListNo; //,1-8Ϊ0Ч + public byte byReportChannel; //ϴͨ1-ϴ2-1ϴ3-2ϴΪ0Ч + public byte byCardReaderKind; //һ࣬0-Ч1-IC2-֤3-ά,4-ָͷ + public uint dwCardReaderNo; //ţΪ0Ч + public uint dwDoorNo; //ű(¥)Ϊ0Ч + public uint dwVerifyNo; //ؿ֤ţΪ0Ч + public uint dwAlarmInNo; //ţΪ0Ч + public uint dwAlarmOutNo; //ţΪ0Ч + public uint dwCaseSensorNo; //¼ + public uint dwRs485No; //RS485ͨţΪ0Ч + public uint dwMultiCardGroupNo; //Ⱥ + public ushort wAccessChannel; //Աͨ + public byte byDeviceNo; //豸ţΪ0Ч + public byte byDistractControlNo;//ֿţΪ0Ч + public uint dwEmployeeNo; //ţΪ0Ч + public ushort wLocalControllerID; //͵ؿţ0-Ž1-64͵ؿ + public byte byInternetAccess; //ID1-1,2-2,3-1 + public byte byType; //ͣ0:ʱ,1-24Сʱ,2-ʱ ,3-ڲ4-Կ׷ 5-𾯷 6-ܽ 7-24Сʱ 8-24Сʱ9-24Сʱ𶯷,10-Žŷ11-Žŷ 0xff- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr; //ַΪ0Ч + public byte bySwipeCardType;//ˢͣ0-Ч1-ά + public byte byMask;//Ƿ֣0-1-δ֪2-֣3- + public uint dwSerialNo; //¼ˮţΪ0Ч + public byte byChannelControllerID; //ͨIDΪ0Ч1-ͨ2-ͨ + public byte byChannelControllerLampID; //ͨưIDΪ0ЧЧΧ1-255 + public byte byChannelControllerIRAdaptorID; //ͨתӰIDΪ0ЧЧΧ1-255 + public byte byChannelControllerIREmitterID; //ͨIDΪ0ЧЧΧ1-255 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_EVENT_INFO_EXTEND + { + public int dwFrontSerialNo; //¼ˮţΪ0ЧֶΪ0ƽ̨dwSerialNoжǷʧ¼ֶβΪ0ƽ̨ݸֶκdwSerialNoֶιͬжǷʧ¼ҪڽĺdwSerialNo + public byte byUserType; //Աͣ0-Ч1-ͨˣˣ2-ÿͣ3-ֹˣ4-Ա + public byte byCurrentVerifyMode; //ǰ֤ʽ0-Ч1-ߣ2-ˢ+룬3-ˢ4-ˢ룬5-ָƣ6-ָ+룬7-ָƻˢ8-ָ+ˢ9-ָ+ˢ+룬10-ָƻˢ룬11-+ָƣ12-+룬13-+ˢ14-15-+룬16-ָƻ룬17-+ָƣ18-+ָ+룬19-+ָ+ˢ20-++ָƣ21-+22-+ˢ23-ָƻ24-ˢ룬25-ˢ26-ˢָƣ27-ˢָƻ + public byte byCurrentEvent; //ǷΪʵʱ¼0-Ч1-ǣʵʱ¼2-¼ + public byte byPurePwdVerifyEnable; //豸Ƿִ֧֤ 0-֧֣1-֧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EMPLOYEE_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byEmployeeNo; //ţԱID豸˵ʹ˹ţԱIDֶΣbyEmployeeNoһҪݣbyEmployeeNoתΪdwEmployeeNoôֶҲҪݣϲƽ̨ͻ˵ȽbyEmployeeNoֶΣֶΪգٿǽdwEmployeeNoֶΣ + public byte byAttendanceStatus; //״̬0-δ,1-ϰ࣬2-°࣬3-ʼϢ4-Ϣ5-ʼӰ࣬6-Ӱ + public byte byStatusValue; //״ֵ̬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_UUID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byUUID; //UUIDֶνڶԽөʯƽ̨вŻʹã + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_DEV_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDeviceName; //豸к + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //չṹϢV20 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_EVENT_INFO_EXTEND_V20 + { + public byte byRemoteCheck; //ǷҪԶ̺飨0-Ч1-ҪĬϣ2-Ҫ + public byte byThermometryUnit; //µλ0-϶ȣĬϣ1-϶ȣ2-ģ + public byte byIsAbnomalTemperature; //ץIJǷ¶쳣1-ǣ0- + public byte byRes2; + public float fCurrTemperature; //¶ȣȷСһλ + public NET_VCA_POINT struRegionCoordinates; //¶ + public ushort dwQRCodeInfoLen; //άϢȣΪ0DZʾ + public ushort dwVisibleLightDataLen; //ȳɼͼƬȣΪ0DZʾ + public ushort dwThermalDataLen; //ȳͼƬȣΪ0DZʾ + public IntPtr pQRCodeInfo; //άϢָ + public IntPtr pVisibleLightData; //ȳɼͼƬָ + public IntPtr pThermalData; //ȳͼƬָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byAttendanceLabel; //Զ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 960, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_ALARM_INFO + { + public uint dwSize; + public uint dwMajor; //ͣο궨 + public uint dwMinor; //ͣο궨 + public NET_DVR_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNetUser;//û + public NET_DVR_IPADDR struRemoteHostAddr ;//Զַ + public NET_DVR_ACS_EVENT_INFO struAcsEventInfo; //ϸ + public uint dwPicDataLen; //ͼƬݴСΪ0DZʾ + public IntPtr pPicData; + public ushort wInductiveEventType; //¼ͣ0-ЧͻжϸֵΪ0ֵ󣬱ͨ¼֣ͨԭбͣdwMajordwMinor + public byte byPicTransType; //ͼƬݴ䷽ʽ: 0-ƣ1-url + public byte byRes1; //ֽ + public uint dwIOTChannelNo; //IOTͨ + public IntPtr pAcsEventInfoExtend; //byAcsEventInfoExtendΪ1ʱʾָһNET_DVR_ACS_EVENT_INFO_EXTENDṹ + public byte byAcsEventInfoExtend; //pAcsEventInfoExtendǷЧ0-Ч1-Ч + public byte byTimeType; //ʱͣ0-豸ʱ䣬1-UTCʱ䣨struTimeʱ䣩 + public byte byRes2; //ֽ + public byte byAcsEventInfoExtendV20; //pAcsEventInfoExtendV20ǷЧ0-Ч1-Ч + public IntPtr pAcsEventInfoExtendV20; //byAcsEventInfoExtendV20Ϊ1ʱʾָһNET_DVR_ACS_EVENT_INFO_EXTEND_V20ṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_EVENT_DETAIL + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; //ţmacַΪ0Ч + public byte byCardType; //ͣ1-ͨ3-ֹ4-Ѳ5-вȿ6-7-8-Ϊ0Ч + public byte byAllowListNo; //,1-8Ϊ0Ч + public byte byReportChannel; //ϴͨ1-ϴ2-1ϴ3-2ϴΪ0Ч + public byte byCardReaderKind; //һ࣬0-Ч1-IC2-֤3-ά,4-ָͷ + public uint dwCardReaderNo; //ţΪ0Ч + public uint dwDoorNo; //űţ¥ţΪ0Ч + public uint dwVerifyNo; //ؿ֤ţΪ0Ч + public uint dwAlarmInNo; //ţΪ0Ч + public uint dwAlarmOutNo; //ţΪ0Ч + public uint dwCaseSensorNo; //¼ + public uint dwRs485No; //RS485ͨţΪ0Ч + public uint dwMultiCardGroupNo; //Ⱥ + public ushort wAccessChannel; //Աͨ + public byte byDeviceNo; //豸ţΪ0ЧЧΧ1-255 + public byte byDistractControlNo;//ֿţΪ0Ч + public uint dwEmployeeNo; //ţΪ0Ч + public ushort wLocalControllerID; //͵ؿţ0-Ž1-64͵ؿ + public byte byInternetAccess; //ID1-1,2-2,3-1 + public byte byType; //ͣ0:ʱ,1-24Сʱ,2-ʱ ,3-ڲ4-Կ׷ 5-𾯷 6-ܽ 7-24Сʱ 8-24Сʱ9-24Сʱ𶯷,10-Žŷ11-Žŷ 0xff- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMACAddr; //ַΪ0Ч + public byte bySwipeCardType;//ˢͣ0-Ч1-ά + public byte byEventAttribute; //¼ԣ0-δ壬1-Ϸ֤2- + public uint dwSerialNo; //¼ˮţΪ0Ч + public byte byChannelControllerID; //ͨIDΪ0Ч1-ͨ2-ͨ + public byte byChannelControllerLampID; //ͨưIDΪ0ЧЧΧ1-255 + public byte byChannelControllerIRAdaptorID; //ͨתӰIDΪ0ЧЧΧ1-255 + public byte byChannelControllerIREmitterID; //ͨIDΪ0ЧЧΧ1-255 + public uint dwRecordChannelNum; //¼ͨĿ + public IntPtr pRecordChannelData;//¼ͨСΪsizeof(DWORD)* dwRecordChannelNum + public byte byUserType; //Աͣ0-Ч1-ͨˣˣ2-ÿͣ3-ֹˣ4-Ա + public byte byCurrentVerifyMode; //ǰ֤ʽ0-Ч1-ߣ2-ˢ+룬3-ˢ4-ˢ룬5-ָƣ6-ָ+룬7-ָƻˢ8-ָ+ˢ9-ָ+ˢ+룬10-ָƻˢ룬11-+ָƣ12-+룬 + //13-+ˢ14-15-+룬16-ָƻ룬17-+ָƣ18-+ָ+룬19-+ָ+ˢ20-++ָƣ21-+22-+ˢ23-ָƻ24-ˢ룬25-ˢ26-ˢָƣ27-ˢָƻ + public byte byAttendanceStatus; //״̬0-δ,1-ϰ࣬2-°࣬3-ʼϢ4-Ϣ5-ʼӰ࣬6-Ӱ + public byte byStatusValue; //״ֵ̬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EMPLOYEE_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byEmployeeNo; //ţԱID豸˵ʹ˹ţԱIDֶΣbyEmployeeNoһҪݣbyEmployeeNoתΪdwEmployeeNoôֶҲҪݣϲƽ̨ͻ˵ȽbyEmployeeNoֶΣֶΪգٿǽdwEmployeeNoֶΣ + public byte byRes1; // + public byte byMask; //Ƿ֣0-1-δ֪2-֣3- + public byte byThermometryUnit; //µλ0-϶ȣĬϣ1-϶ȣ2-ģ + public byte byIsAbnomalTemperature; //ץIJǷ¶쳣1-ǣ0- + public float fCurrTemperature; //¶ȣȷСһλ + public NET_VCA_POINT struRegionCoordinates; //¶ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 48, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byMACAddr = new byte[CHCNetSDK.MACADDR_LEN]; + byEmployeeNo = new byte[CHCNetSDK.NET_SDK_EMPLOYEE_NO_LEN]; + byRes = new byte[48]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_EVENT_CFG + { + public uint dwSize; + public uint dwMajor; //ͣο궨 + public uint dwMinor; //ͣο궨 + public NET_DVR_TIME struTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNetUser;//û + public NET_DVR_IPADDR struRemoteHostAddr;//Զַ + public NET_DVR_ACS_EVENT_DETAIL struAcsEventInfo; //ϸ + public uint dwPicDataLen; //ͼƬݴСΪ0DZʾ + public IntPtr pPicData; + public ushort wInductiveEventType; //¼ͣ0-Чֵμ2.2½ڣͻжϸֵΪ0ֵ󣬱ͨ¼֣ͨԭбͣdwMajordwMinor + public byte byTimeType; //ʱͣ0-豸ʱ䣨Ĭϣ1-UTCʱ䣨struTimeʱ䣩 + public byte byRes1; + public uint dwQRCodeInfoLen; //άϢȣΪ0DZʾ + public uint dwVisibleLightDataLen; //ȳɼͼƬȣΪ0DZʾ + public uint dwThermalDataLen; //ȳͼƬȣΪ0DZʾ + public IntPtr pQRCodeInfo; //άϢָ + public IntPtr pVisibleLightData; //ȳɼͼƬָ + public IntPtr pThermalData; //ȳͼƬָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 36, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + sNetUser = new byte[CHCNetSDK.MAX_NAMELEN]; + struRemoteHostAddr.Init(); + struAcsEventInfo.init(); + byRes = new byte[36]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_DATE + { + public ushort wYear; // + public byte byMonth; // + public byte byDay; // + } + + //֤Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ID_CARD_INFO + { + public uint dwSize; //ṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ID_NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; // + public NET_DVR_DATE struBirth; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ID_ADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byAddr; //סַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ID_NUM_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byIDNum; //֤ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_ID_ISSUING_AUTHORITY_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byIssuingAuthority; //ǩ + public NET_DVR_DATE struStartDate; //Чʼ + public NET_DVR_DATE struEndDate; //Чֹ + public byte byTermOfValidity; //ǷЧ 0-1-ǣЧֹЧ + public byte bySex; //Ա1-У2-Ů + public byte byNation; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 101, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //չṹϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ID_CARD_INFO_EXTEND + { + public byte byRemoteCheck; //ǷҪԶ̺飨0-Ч1-ҪĬϣ2-Ҫ + public byte byThermometryUnit; //µλ0-϶ȣĬϣ1-϶ȣ2-ģ + public byte byIsAbnomalTemperature; //ץIJǷ¶쳣1-ǣ0- + public byte byRes2; + public float fCurrTemperature; //¶ȣȷСһλ + public NET_VCA_POINT struRegionCoordinates; //¶ + public uint dwQRCodeInfoLen; //άϢȣΪ0DZʾ + public uint dwVisibleLightDataLen; //ȳɼͼƬȣΪ0DZʾ + public uint dwThermalDataLen; //ȳͼƬȣΪ0DZʾ + public IntPtr pQRCodeInfo; //άϢָ + public IntPtr pVisibleLightData; //ȳɼͼƬָ + public IntPtr pThermalData; //ȳͼƬָ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 1024, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //֤Ϣ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ID_CARD_INFO_ALARM + { + public uint dwSize; //ṹ + public NET_DVR_ID_CARD_INFO struIDCardCfg;//֤Ϣ + public uint dwMajor; //ͣο궨 + public uint dwMinor; //ͣο궨 + public NET_DVR_TIME_V30 struSwipeTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] byNetUser;//û + public NET_DVR_IPADDR struRemoteHostAddr;//Զַ + public uint dwCardReaderNo; //ţΪ0Ч + public uint dwDoorNo; //űţΪ0Ч + public uint dwPicDataLen; //ͼƬݴСΪ0DZʾ + public IntPtr pPicData; + public byte byCardType; //ͣ1-ͨ3-ֹ4-Ѳ5-вȿ6-7-8-Ϊ0Ч + public byte byDeviceNo; // 豸ţΪ0ʱЧЧΧ1-255 + public byte byMask; //Ƿ֣0-1-δ֪2-֣3- + public byte byCurrentEvent;//ǷΪʵʱ¼0-Ч1-ǣʵʱ¼2-¼ + public uint dwFingerPrintDataLen; // ָݴСΪ0DZʾ + public IntPtr pFingerPrintData; + public uint dwCapturePicDataLen; // ץͼƬݴСΪ0DZʾ + public IntPtr pCapturePicData; + public uint dwCertificatePicDataLen; //֤ץͼƬݴСΪ0DZʾ + public IntPtr pCertificatePicData; + public byte byCardReaderKind; //һ࣬0-Ч1-IC2-֤3-ά,4-ָͷ + public byte byHelmet;//ѡǷȫñ0-1-δ֪2-ȫ, 3-ȫñ + public byte byRes3; + public byte byIDCardInfoExtend; //pIDCardInfoExtendǷЧ0-Ч1-Ч + public IntPtr pIDCardInfoExtend; //byIDCardInfoExtendΪ1ʱʾָһNET_DVR_ID_CARD_INFO_EXTENDṹ + public uint dwSerialNo; //¼ˮţΪ0Ч + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 168, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_VALID_PERIOD_CFG + { + public byte byEnable; //ʹЧڣ0-ʹܣ1ʹ + public byte byBeginTimeFlag; //Ƿʼʱı־0-ƣ1- + public byte byEnableTimeFlag; //Ƿֹʱı־0-ƣ1- + public byte byTimeDurationNo; //Ч,0ʼʱͨSDKøƿʱֻҪЧɣԼ + public NET_DVR_TIME_EX struBeginTime; //Чʼʱ + public NET_DVR_TIME_EX struEndTime; //Чڽʱ + public byte byTimeType; //ʱͣ0-豸ʱ䣨Ĭϣ1-UTCʱ䣨struBeginTimestruEndTimeֶЧ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CARD_COND + { + public uint dwSize; + public uint dwCardNum; //card number, 0xffffffff means to get all card information when getting + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes = new byte[64]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CARD_RECORD + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; //card No + public byte byCardType; + public byte byLeaderCard; + public byte byUserType; + public byte byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOOR_NUM_256, ArraySubType = UnmanagedType.I1)] + public byte[] byDoorRight; + public NET_DVR_VALID_PERIOD_CFG struValid; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_GROUP_NUM_128, ArraySubType = UnmanagedType.I1)] + public byte[] byBelongGroup; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CARD_PASSWORD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardPassword; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOOR_NUM_256, ArraySubType = UnmanagedType.I1)] + public ushort[] wCardRightPlan; + public uint dwMaxSwipeTimes; + public uint dwSwipeTimes; + public uint dwEmployeeNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; + //λʾ0-Ȩޣ1-Ȩ + //0λʾ籨 + //1λʾʾ + //2λʾƿͿ + //3λʾͨ + //4λʾ + //5λʾѲ + public uint dwCardRight; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byCardNo = new byte[ACS_CARD_NO_LEN]; + byDoorRight = new byte[MAX_DOOR_NUM_256]; + byBelongGroup = new byte[MAX_GROUP_NUM_128]; + byCardPassword = new byte[CARD_PASSWORD_LEN]; + wCardRightPlan = new ushort[MAX_DOOR_NUM_256]; + byName = new byte[NAME_LEN]; + byRes = new byte[256]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CARD_STATUS + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; //card No + public uint dwErrorCode; + public byte byStatus; //0-fail, 1-success + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 23, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byCardNo = new byte[ACS_CARD_NO_LEN]; + byRes = new byte[23]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CARD_SEND_DATA + { + public uint dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; //card No + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byCardNo = new byte[ACS_CARD_NO_LEN]; + byRes = new byte[16]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_PARAM_CTRL_ByCard + { + public int dwSize; + public byte byMode;//0 del by card,1 del by card reader + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_FACE_PARAM_BYCARD struProcessMode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes1 = new byte[3]; + byRes = new byte[64]; + struProcessMode = new NET_DVR_FACE_PARAM_BYCARD(); + struProcessMode.Init(); + } + } + + public const int MAX_FACE_NUM = 2; //max face number + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_PARAM_BYCARD + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.MAX_CARD_READER_NUM_512, ArraySubType = UnmanagedType.I1)] + public byte[] byEnableCardReader; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.MAX_FACE_NUM, ArraySubType = UnmanagedType.I1)] + public byte[] byFaceID; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + + public void Init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byEnableCardReader = new byte[CHCNetSDK.MAX_CARD_READER_NUM_512]; + byFaceID = new byte[CHCNetSDK.MAX_FACE_NUM]; + byRes1 = new byte[42]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_PARAM_CTRL_ByReader + { + public int dwSize; + public byte byMode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_FACE_PARAM_BYREADER struProcessMode; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes1 = new byte[3]; + byRes = new byte[64]; + struProcessMode = new NET_DVR_FACE_PARAM_BYREADER(); + struProcessMode.Init(); + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_PARAM_BYREADER + { + public int dwCardReaderNo; + public byte byClearAllCard; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 548, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + + public void Init() + { + byRes1 = new byte[3]; + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byRes = new byte[548]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_STATUS + { + public int dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ERROR_MSG_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byErrorMsg;//·ϢbyCardReaderRecvStatusΪ4ʱʾѴӦĿ + public int dwReaderNo; //ţ·󷵻 + public byte byRecvStatus; //״ֽ̬ڱʾ0-ʧܣ1-ɹ2-Ի3-ڴ()4-Ѵڸ5-ǷID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 131, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byErrorMsg = new byte[CHCNetSDK.ERROR_MSG_LEN]; + byRes = new byte[131]; + } + } + + [StructLayout(LayoutKind.Sequential)] + public struct NET_DVR_FACE_RECORD + { + public int dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN)] + public byte[] byCardNo; + public int dwFaceLen; + public IntPtr pFaceBuffer; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 128)] + public byte[] byRes; + + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byRes = new byte[128]; + } + } + + + [StructLayout(LayoutKind.Sequential)] + public struct NET_DVR_FACE_COND + { + public int dwSize; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN)] + public byte[] byCardNo;//Ŀţʱòɲã + public int dwFaceNum;// ûȡȡʱΪ0xffffffffʾȡϢ + public int dwEnableReaderNo;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 124)] + public byte[] byRes; + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byRes = new byte[124]; + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACE_PARAM_CTRL_CARDNO + { + public int dwSize; + public byte byMode;//ɾʽ0-ŷʽɾ1-ɾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public CHCNetSDK.NET_DVR_FACE_PARAM_BYCARD struByCard;//ŵķʽɾ,ʱд + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public void Init() + { + byRes1 = new byte[3]; + byRes = new byte[64]; + struByCard.Init(); + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FINGERPRINT_COND + { + public int dwSize; + public int dwFingerprintNum; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CHCNetSDK.ACS_CARD_NO_LEN)] + public byte[] byCardNo; + public int dwEnableReaderNo; + public byte byFingerPrintID; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 131)] + public byte[] byRes; + + public void init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byRes = new byte[131]; + } + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CARD_CFG_V50 + { + public uint dwSize; + public uint dwModifyParamType; + // Ҫ޸ĵĿÿʱЧλʾÿλһֲ1ΪҪ޸ģ0Ϊ޸ + // #define CARD_PARAM_CARD_VALID 0x00000001 //ǷЧ + // #define CARD_PARAM_VALID 0x00000002 //Чڲ + // #define CARD_PARAM_CARD_TYPE 0x00000004 //Ͳ + // #define CARD_PARAM_DOOR_RIGHT 0x00000008 //Ȩ޲ + // #define CARD_PARAM_LEADER_CARD 0x00000010 //׿ + // #define CARD_PARAM_SWIPE_NUM 0x00000020 //ˢ + // #define CARD_PARAM_GROUP 0x00000040 //Ⱥ + // #define CARD_PARAM_PASSWORD 0x00000080 // + // #define CARD_PARAM_RIGHT_PLAN 0x00000100 //Ȩ޼ƻ + // #define CARD_PARAM_SWIPED_NUM 0x00000200 //ˢ + // #define CARD_PARAM_EMPLOYEE_NO 0x00000400 // + // #define CARD_PARAM_NAME 0x00000800 // + // #define CARD_PARAM_DEPARTMENT_NO 0x00001000 //ű + // #define CARD_SCHEDULE_PLAN_NO 0x00002000 //Űƻ + // #define CARD_SCHEDULE_PLAN_TYPE 0x00004000 //Űƻ + // #define CARD_ROOM_NUMBER 0x00008000 // + // #define CARD_SIM_NO 0x00010000 //SIMţֻţ + // #define CARD_FLOOR_NUMBER 0x00020000 //¥ + // #define CARD_USER_TYPE 0x00040000 //û + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; // + public byte byCardValid; //ǷЧ0-Ч1-ЧɾʱΪ0ɾȡʱֶʼΪ1 + public byte byCardType; //ͣ1-ͨ3-ֹ4-Ѳ5-вȿ6-7-8-9-Ա10-Ӧ11-ӦȨʱȨޣܿţĬͨ + public byte byLeaderCard; //ǷΪ׿1-ǣ0- + public byte byUserType; // 0 C ͨû1 - Աû; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOOR_NUM_256, ArraySubType = UnmanagedType.I1)] + public byte[] byDoorRight; //Ȩ(¥ȨޡȨ)λʾ1ΪȨޣ0ΪȨޣӵλλʾţ1-NǷȨ + public NET_DVR_VALID_PERIOD_CFG struValid; //Чڲ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_GROUP_NUM_128, ArraySubType = UnmanagedType.I1)] + public byte[] byBelongGroup; //Ⱥ飬ֽڱʾ1-ڣ0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = CARD_PASSWORD_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardPassword; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOOR_NUM_256*MAX_CARD_RIGHT_PLAN_NUM, ArraySubType = UnmanagedType.U2)] + public ushort[] wCardRightPlan; //Ȩ޼ƻȡֵΪƻģţͬţͬƻģȨ޻ķʽ + public uint dwMaxSwipeTime; //ˢ0Ϊ޴ƣ + public uint dwSwipeTime; //ˢ + public ushort wRoomNumber; // + public ushort wFloorNumber; // + public uint dwEmployeeNo; //ţûID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; // + public ushort wDepartmentNo; //ű + public ushort wSchedulePlanNo; //Űƻ + public byte bySchedulePlanType; //Űƻͣ0-塢1-ˡ2- + public byte byRightType; //·Ȩͣ0-ͨȨޡ1-άȨޡ2-ȨޣӶԽ豸άȨšţ⿨ţˢЧڲȨޣţөʯAPP˺ţͨȨһ£ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + public uint dwLockID; //ID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_LOCK_CODE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byLockCode; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DOOR_CODE_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byRoomCode; // + //λʾ0-Ȩޣ1-Ȩ + //0λʾ籨 + //1λʾʾ + //2λʾƿͿ + //3λʾͨ + //4λʾ + //5λʾѲ + public uint dwCardRight; //Ȩ + public uint dwPlanTemplate; //ƻģ(ÿ)ʱǷãλʾ0--ã1- + public uint dwCardUserId; //ֿID + public byte byCardModelType; //0-գ1- MIFARE S502- MIFARE S703- FM1208 CPU4- FM1216 CPU5-CPU6-֤7- NFC + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 51, ArraySubType = UnmanagedType.I1)] + public byte[] byRes3; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] bySIMNum; //SIMţֻţ + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CHECK_FACE_PICTURE_COND + { + public uint dwSize; + public uint dwPictureNum; //ͼƬ + public byte byCheckTemplate; //0-УͼƬǷϷĬϣ1-УͼƬͽģǷƥ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 127, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GROUP_COMBINATION_INFO_V50 + { + public byte byEnable; //ǷøȺ + public byte byMemberNum; //ˢԱ + public byte bySequenceNo; //Ⱥˢ + public byte byRes; + public uint dwGroupNo; //Ⱥ,0xffffffffʾԶ̿ţ0xfffffffeʾ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MULTI_CARD_GROUP_CFG_V50 + { + public byte byEnable; //Ƿøöؿ0-ã1- + public byte byEnableOfflineVerifyMode; //Ƿʱ֤ʽԶ̿ţ1-ã0- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwTemplateNo; //öؿܵļƻģ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = GROUP_COMBINATION_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_GROUP_COMBINATION_INFO_V50[] struGroupCombination; //Ⱥϲ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_MULTI_CARD_CFG_V50 + { + public uint dwSize; + public byte byEnable; //Ƿöؿܣ0-ã1- + public byte bySwipeIntervalTimeout; //ˢʱʱ䣬1-255sĬ10s + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_MULTI_CARD_GROUP_NUM_20, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_MULTI_CARD_GROUP_CFG_V50[] struGroupCfg; //Ⱥˢ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + public const int NET_SDK_MONITOR_ID_LEN = 64; //صID + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ACS_EVENT_COND + { + public uint dwSize; + public uint dwMajor; //ͣο¼ϴ궨壬0-ȫ + public uint dwMinor; //ͣο¼ϴ궨壬0-ȫ + public NET_DVR_TIME struStartTime; //ʼʱ + public NET_DVR_TIME struEndTime; //ʱ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = ACS_CARD_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byCardNo; // + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byName; //ֿ + public byte byPicEnable; //ǷͼƬ0-ͼƬ1-ͼƬ + public byte byTimeType; //ʱͣ0-豸ʱ䣨Ĭϣ1-UTCʱ䣨struStartTimestruEndTimeʱ䣩 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; // + public uint dwBeginSerialNo; //ʼˮţΪ0ʱĬȫ + public uint dwEndSerialNo; //ˮţΪ0ʱĬȫ + public uint dwIOTChannelNo; //IOTͨţ0-Ч + public ushort wInductiveEventType; //¼ͣ0-Чֵμ2.2½ڣͻжϸֵΪ0ֵ󣬱ͨ¼֣ͨԭбͣdwMajordwMinor + public byte bySearchType; //ʽ0-1-¼ԴʱͨΪƵͨţ2-صID + public byte byEventAttribute; //¼ԣ0-δ壬1-Ϸ¼2- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_MONITOR_ID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] szMonitorID; //صID豸кšͨ͡ɣŽ㣺豸к+DOOR+űţ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_EMPLOYEE_NO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byEmployeeNo; //ţԱID + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 140, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + + public void Init() + { + byCardNo = new byte[CHCNetSDK.ACS_CARD_NO_LEN]; + byName = new byte[CHCNetSDK.NAME_LEN]; + byRes2 = new byte[2]; + byEmployeeNo = new byte[CHCNetSDK.NET_SDK_EMPLOYEE_NO_LEN]; + byRes = new byte[140]; + } + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LOCAL_GENERAL_CFG + { + public byte byExceptionCbDirectly; //0-̳ͨ߳쳣ص1-ֱ쳣صϲ + public byte byNotSplitRecordFile; //طźԤб浽¼ļƬ 0-ĬƬ1-Ƭ + public byte byResumeUpgradeEnable; //ʹܣ0-رգĬϣ1- + public byte byAlarmJsonPictureSeparate; //JSON͸ݺͼƬǷ룬0-룬1-루COMM_ISAPI_ALARMصأ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; // + public Int64 i64FileSize; //λByte + public uint dwResumeUpgradeTimeout; //ʱʱ䣬λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 236, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; //Ԥ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LOCAL_CHECK_DEV + { + public uint dwCheckOnlineTimeout; //Ѳʱλms СֵΪ30sֵ120sΪ0ʱʾĬֵ(120s) + public uint dwCheckOnlineNetFailMax; //ԭʧܵۼӴֵSDKŻصû쳣Ϊ0ʱʾʹĬֵ1 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARM_ISAPI_INFO + { + public IntPtr pAlarmData; // + public uint dwAlarmDataLen; // ݳ + public byte byDataType; // 0-invalid,1-xml,2-json + public byte byPicturesNumber; // ͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public IntPtr pPicPackData; // ͼƬ䳤 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + } + public const int MAX_FILE_PATH_LEN = 256; //ļ· + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARM_ISAPI_PICDATA + { + public uint dwPicLen; + public byte byPicType; //ͼƬʽ: 1- jpg + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_FILE_PATH_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] szFilename; + public IntPtr pPicData; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_EXTERNAL_DEVICE_STATE_UNION + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 512, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_ALARMHOST_EXTERNAL_DEVICE_STATE + { + public uint dwSize; + public byte byDevType; //1-UPS2-صԴ3-ϵͳ4-ʪȴ5-յ6-7-״̬, 8-ˮλ9-ﳾ10-ɼǡ11-ٴ״̬12-ͨչģ״̬13-ˮ״̬14-̫ܿ״̬15-SF6״̬16-״̬17-ɼϵͳ״̬18-ˮʼ״̬19-ȼϵͳ״̬20-״̬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_EXTERNAL_DEVICE_STATE_UNION struDevState; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byRes2; + } + + //豸 + public const int REGIONTYPE = 0;// + public const int MATRIXTYPE = 11;//ڵ + public const int DEVICETYPE = 2;//豸 + public const int CHANNELTYPE = 3;//ͨ + public const int USERTYPE = 5;//û + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LOG_MATRIX + { + public NET_DVR_TIME strLogTime; + public uint dwMajorType; + public uint dwMinorType; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sPanelUser; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_NAMELEN, ArraySubType = UnmanagedType.I1)] + public byte[] sNetUser; + public NET_DVR_IPADDR struRemoteHostAddr; + public uint dwParaType; + public uint dwChannel; + public uint dwDiskNumber; + public uint dwAlarmInPort; + public uint dwAlarmOutPort; + public uint dwInfoLen; + public byte byDevSequence;//λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMacAddr;//MACַ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber;//к + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = LOG_INFO_LEN - SERIALNO_LEN - MACADDR_LEN - 1)] + public string sInfo; + } + + //Ƶۺƽ̨ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct tagVEDIOPLATLOG + { + public byte bySearchCondition;//0-λ1-к 2-MACַ + public byte byDevSequence;//λţ0-79ӦϵͳIJλţ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = SERIALNO_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sSerialNumber;//к + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MACADDR_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byMacAddr;//MACַ + } + + //ؼ + public enum IVS_PARAM_KEY + { + OBJECT_DETECT_SENSITIVE = 1,//Ŀ + BACKGROUND_UPDATE_RATE = 2,//ٶ + SCENE_CHANGE_RATIO = 3,//仯Сֵ + SUPPRESS_LAMP = 4,//ǷƳͷ + MIN_OBJECT_SIZE = 5,//ܼСĿС + OBJECT_GENERATE_RATE = 6,//Ŀٶ + MISSING_OBJECT_HOLD = 7,//Ŀʧʱ + MAX_MISSING_DISTANCE = 8,//Ŀʧپ + OBJECT_MERGE_SPEED = 9,//Ŀ꽻ʱĿںٶ + REPEATED_MOTION_SUPPRESS = 10,//ظ˶ + ILLUMINATION_CHANGE = 11,//Ӱ仯ƿ + TRACK_OUTPUT_MODE = 12,//켣ģʽ0-Ŀģ1-Ŀĵײ + ENTER_CHANGE_HOLD = 13,//仯ֵ + RESUME_DEFAULT_PARAM = 255,//ָĬϹؼֲ + } + + //궨ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LF_CALIBRATION_PARAM + { + public byte byPointNum;//Ч궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CALIB_PT, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_CB_POINT[] struCBPoint;//궨 + } + + //LF˫ýṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LF_CFG + { + public uint dwSize;//ṹ + public byte byEnable;//궨ʹ + public byte byFollowChan;// ƵĴͨ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public NET_DVR_LF_CALIBRATION_PARAM struCalParam;//궨 + } + + //L/Fֶƽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LF_MANUAL_CTRL_INFO + { + public NET_VCA_POINT struCtrlPoint; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //L/FĿٽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LF_TRACK_TARGET_INFO + { + public uint dwTargetID; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 8, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_LF_TRACK_MODE + { + public uint dwSize;//ṹ + public byte byTrackMode;//ģʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//0 + [StructLayoutAttribute(LayoutKind.Explicit)] + public struct uModeParam + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] + [FieldOffsetAttribute(0)] + public uint[] dwULen; + /*[FieldOffsetAttribute(0)] + public NET_DVR_LF_MANUAL_CTRL_INFO struManualCtrl;//ֶٽṹ + [FieldOffsetAttribute(0)] + public NET_DVR_LF_TRACK_TARGET_INFO struTargetTrack;//Ŀٽṹ + * */ + } + } + + // Long config callback type + public enum NET_SDK_CALLBACK_TYPE + { + NET_SDK_CALLBACK_TYPE_STATUS = 0, //ص״ֵ̬ + NET_SDK_CALLBACK_TYPE_PROGRESS, //صֵ + NET_SDK_CALLBACK_TYPE_DATA //ص + } + + + // Long config status value + public enum NET_SDK_CALLBACK_STATUS_NORMAL + { + NET_SDK_CALLBACK_STATUS_SUCCESS = 1000, //ɹ + NET_SDK_CALLBACK_STATUS_PROCESSING, // + NET_SDK_CALLBACK_STATUS_FAILED, //ʧ + NET_SDK_CALLBACK_STATUS_EXCEPTION, //쳣 + NET_SDK_CALLBACK_STATUS_LANGUAGE_MISMATCH, //Բƥ + NET_SDK_CALLBACK_STATUS_DEV_TYPE_MISMATCH, //豸Ͳƥ + NET_DVR_CALLBACK_STATUS_SEND_WAIT //͵ȴ + } + + //SensorϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SENSOR_PARAM + { + public byte bySensorType;//SensorType:0-CCD,1-CMOS + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 31, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + public float fHorWidth;//ˮƽ ȷСλ *10000 + public float fVerWidth;//ֱ ȷСλ *10000 + public float fFold;//zoom=1ûʱĽ ȷСλ *100 + } + + + //λϢ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PTZPOS_PARAM{ + public float fPanPos;//ˮƽȷС1λ + public float fTiltPos;//ֱȷС1λ + public float fZoomPos;//䱶ȷС1λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes ; + } + + //GISϢϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GIS_UPLOADINFO + { + public uint dwSize;//ṹС + public uint dwRelativeTime; //ʱ + public uint dwAbsTime; //ʱ + public NET_VCA_DEV_INFO struDevInfo;//ǰ豸 + public float fAzimuth;//̵ķλϢλ[0.00,360.00) + public byte byLatitudeType ;//γͣ0-γ1-γ + public byte byLongitudeType ;// ͣ0-ȣ1- + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public NET_DVR_LLI_PARAM struLatitude; /*γ*/ + public NET_DVR_LLI_PARAM struLongitude; /**/ + public float fHorizontalValue;//ˮƽӳǣȷСλ + public float fVerticalValue;//ֱӳǣȷСλ + public float fVisibleRadius;//ǰӰ뾶ȷСλ + public float fMaxViewRadius;//Ӱ뾶ȷС0λԤ + public NET_DVR_SENSOR_PARAM struSensorParam;//SensorϢ + public NET_DVR_PTZPOS_PARAM struPtzPos; //ptz + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 256, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int NET_SDK_MAX_FDID_LEN = 256; + + //(ͼƬ+ͼƬϢ)ṹ塣 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_FACELIB_COND + { + public uint dwSize; // ṹС + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NET_SDK_MAX_FDID_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] szFDID; + public byte byConcurrent;//豸0- 1- ʼ + public byte byCover;//Ƿ񸲸ʽ 0-1- + public byte byCustomFaceLibID;//FDIDǷԶ壬0-ǣ1-ǣ + public byte byPictureSaveMode;//ϴԭͼģʽ0-棬1-; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byIdentityKey;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 60, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_SEND_PARAM_IN + { + public IntPtr pSendData; + public uint dwSendDataLen; + public NET_DVR_TIME_V30 struTime; + public byte byPicType; + public byte byPicURL; //ͼƬݲURLʽ 0-ͼƬݣ1-ͼƬURLʽ + public byte byUploadModeling; + public byte byRes1; + public uint dwPicMangeNo; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string sPicName; + public uint dwPicDisplayTime; + public IntPtr pSendAppendData; + public uint dwSendAppendDataLen; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 192, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public enum HKUploadType + { + IMPORT_DATA_TO_FACELIB = 39,// (ͼƬ+ͼƬϢ) + } + + public const int MAX_UPLOADFILE_URL_LEN = 240; + + //ͼƬݵĽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_UPLOAD_FILE_RET + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_UPLOADFILE_URL_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] sUrl; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 260, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;// + } + + //GPSϢṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_GPSALARMINFO + { + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = NAME_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byDeviceID;/*豸ID*/ + public NET_DVR_TIME_EX struGpsTime; /*GPSϴʱ*/ + public uint dwLongitude; /* */ + public uint dwLatitude; /* γ*/ + public int iTimeZone; /*ʱ÷ʾ+601+4808-60-4808ֶκGPSTimeһʱ*/ + public uint dwDirection; /*=ʵʷԶΪλΪ˳ʱ뷽㣩*100*/ + public ushort wSatellites; /**/ + public ushort wPrecision; /**/ + public uint dwHeight; /*߶:ףԤ*/ + public uint dwGPSSeq; /*GPSţGPSʱҪõ*/ + public ushort wSpeed;//ٶȣλkm/h + /* direction[0]:'E'or'W'(/), direction[1]:'N'or'S'(γ/γ)*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] sDirection; + public byte byLocateMode;/*λģʽ(ֵ0)1,λ,2,3,,4,Ч65,Чλ78Чλ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ȶͼϴ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_HEATMAP_RESULT + { + public uint dwSize; + public NET_VCA_DEV_INFO struDevInfo;/*豸Ϣ*/ + public NET_DVR_TIME_EX struStartTime;/*ʼʱ*/ + public NET_DVR_TIME_EX struEndTime;/*ʱ*/ + public uint dwMaxHeatMapValue;//ȶֵ + public uint dwMinHeatMapValue;//Сȶֵ + public uint dwTimeHeatMapValue;// (ʱȶֵ)ƽȶֵ + public ushort wArrayLine;//ͼƬصֵ + public ushort wArrayColumn;//ͼƬصֵ ֵΪ0ʱصֵڴϢڣ + public IntPtr pBuffer; //ȶͼƬصϢ + public byte byDetSceneID;//ⳡ[1],ǰ֧1, IPCĬ0 + public byte byBrokenNetHttp; //־λ0-شݣ1-ش + public ushort wDevInfoIvmsChannelEx; //NET_VCA_DEV_INFObyIvmsChannelܱͬʾֵϿͻbyIvmsChannelܼݣ255¿ͻ˰汾ʹwDevInfoIvmsChannelEx + public byte byTimeDiffFlag; /*ʱֶǷЧ 0-ʱЧ 1-ʱЧ */ + public byte cStartTimeDifferenceH; /*ʼʱUTCʱСʱ-12 ... +14+ʾ*/ + public byte cStartTimeDifferenceM; /*ʼʱUTCʱӣ-30, 30, 45+ʾ*/ + public byte cStopTimeDifferenceH; /*ʱUTCʱСʱ-12 ... +14 +ʾ*/ + public byte cStopTimeDifferenceM; /*ʱUTCʱӣ-30, 30, 45+ʾ*/ + public byte byArrayUnitType; //ԪͣϢÿصݵͣ1-byte2-short,4-int + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + public uint dwTotalTime;//ͣʱܺͣλ룬Աͣʱ䱨ʱϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 112, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + /********************************ӿڲṹ(end)*********************************/ + + + #region ӿں + /********************************SDKӿں*********************************/ + + /********************************************************* + Function: NET_DVR_Init + Desc: ʼSDKSDKǰᡣ + Input: + Output: + Return: TRUEʾɹFALSEʾʧܡ + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_Init(); + + /********************************************************* + Function: NET_DVR_Cleanup + Desc: ͷSDKԴڽ֮ǰ + Input: + Output: + Return: TRUEʾɹFALSEʾʧ + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_Cleanup(); + + + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessage(uint nMessage, IntPtr hWnd); + + /********************************************************* + Function: EXCEPYIONCALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void EXCEPYIONCALLBACK(uint dwType, int lUserID, int lHandle, IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetExceptionCallBack_V30(uint nMessage, IntPtr hWnd, EXCEPYIONCALLBACK fExceptionCallBack, IntPtr pUser); + + + /********************************************************* + Function: MESSCALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate int MESSCALLBACK(int lCommand, string sDVRIP, string pBuf, uint dwBufLen); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessCallBack(MESSCALLBACK fMessCallBack); + + /********************************************************* + Function: MESSCALLBACKEX + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate int MESSCALLBACKEX(int iCommand, int iUserID, string pBuf, uint dwBufLen); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessCallBack_EX(MESSCALLBACKEX fMessCallBack_EX); + + /********************************************************* + Function: MESSCALLBACKNEW + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate int MESSCALLBACKNEW(int lCommand, string sDVRIP, string pBuf, uint dwBufLen, ushort dwLinkDVRPort); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessCallBack_NEW(MESSCALLBACKNEW fMessCallBack_NEW); + + /********************************************************* + Function: MESSAGECALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate int MESSAGECALLBACK(int lCommand, System.IntPtr sDVRIP, System.IntPtr pBuf, uint dwBufLen, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessageCallBack(MESSAGECALLBACK fMessageCallBack, uint dwUser); + + + /********************************************************* + Function: MSGCallBack + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void MSGCallBack(int lCommand, ref NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessageCallBack_V30(MSGCallBack fMessageCallBack, IntPtr pUser); + + public delegate bool MSGCallBack_V31(int lCommand, ref NET_DVR_ALARMER pAlarmer, IntPtr pAlarmInfo, uint dwBufLen, IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRMessageCallBack_V31(MSGCallBack_V31 fMessageCallBack, IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetSDKLocalCfg(int enumType, IntPtr lpInBuff); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetSDKLocalCfg(int enumType, IntPtr lpOutBuff); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetConnectTime(uint dwWaitTime, uint dwTryTimes); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetReconnect(uint dwInterval, int bEnableRecon); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetLocalIP(byte[] strIP, ref uint pValidNum, ref Boolean pEnableBind); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetValidIP(uint dwIPIndex, Boolean bEnableBind); + + [DllImport(@".\HCNetSDK.dll")] + public static extern uint NET_DVR_GetSDKVersion(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern uint NET_DVR_GetSDKBuildVersion(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern Int32 NET_DVR_IsSupport(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StartListen(string sLocalIP, ushort wLocalPort); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopListen(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_StartListen_V30(String sLocalIP, ushort wLocalPort, MSGCallBack DataCallback, IntPtr pUserData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopListen_V30(Int32 lListenHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern Int32 NET_DVR_Login(string sDVRIP, ushort wDVRPort, string sUserName, string sPassword, ref NET_DVR_DEVICEINFO lpDeviceInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_Logout(int iUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern uint NET_DVR_GetLastError(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern IntPtr NET_DVR_GetErrorMsg(ref int pErrorNo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetShowMode(uint dwShowType, uint colorKey); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDVRIPByResolveSvr(string sServerIP, ushort wServerPort, string sDVRName, ushort wDVRNameLen, string sDVRSerialNumber, ushort wDVRSerialLen, IntPtr pGetIP); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDVRIPByResolveSvr_EX(string sServerIP, ushort wServerPort, byte[] sDVRName, ushort wDVRNameLen, byte[] sDVRSerialNumber, ushort wDVRSerialLen, byte[] sGetIP, ref uint dwPort); + //Ԥؽӿ + [DllImport(@".\HCNetSDK.dll")] + public static extern Int32 NET_DVR_RealPlay(int iUserID, ref NET_DVR_CLIENTINFO lpClientInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern Int32 NET_SDK_RealPlay(int iUserLogID, ref NET_DVR_CLIENTINFO lpDVRClientInfo); + /********************************************************* + Function: REALDATACALLBACK + Desc: Ԥص + Input: lRealHandle ǰԤ + dwDataType + pBuffer ݵĻָ + dwBufSize С + pUser û + Output: + Return: void + **********************************************************/ + public delegate void REALDATACALLBACK(Int32 lRealHandle, UInt32 dwDataType, IntPtr pBuffer, UInt32 dwBufSize, IntPtr pUser); + [DllImport(@".\HCNetSDK.dll")] + + /********************************************************* + Function: NET_DVR_RealPlay_V30 + Desc: ʵʱԤ + Input: lUserID [in] NET_DVR_Login()NET_DVR_Login_V30()ķֵ + lpClientInfo [in] Ԥ + cbRealDataCallBack [in] ݻص + pUser [in] û + bBlocked [in] Ƿ01 + Output: + Return: 1ʾʧܣֵΪNET_DVR_StopRealPlayȺľ + **********************************************************/ + public static extern int NET_DVR_RealPlay_V30(int iUserID, ref NET_DVR_CLIENTINFO lpClientInfo, REALDATACALLBACK fRealDataCallBack_V30, IntPtr pUser, UInt32 bBlocked); + + /********************************************************* + Function: NET_DVR_RealPlay_V40 + Desc: ʵʱԤչӿڡ + Input: lUserID [in] NET_DVR_Login()NET_DVR_Login_V30()ķֵ + lpPreviewInfo [in] Ԥ + fRealDataCallBack_V30 [in] ݻص + pUser [in] û + Output: + Return: 1ʾʧܣֵΪNET_DVR_StopRealPlayȺľ + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_RealPlay_V40(int iUserID, ref NET_DVR_PREVIEWINFO lpPreviewInfo, REALDATACALLBACK fRealDataCallBack_V30, IntPtr pUser); + + // [DllImport(@".\HCNetSDK.dll")] + // public static extern int NET_DVR_GetRealPlayerIndex(int lRealHandle); + /********************************************************* + Function: NET_DVR_StopRealPlay + Desc: ֹͣԤ + Input: lRealHandle [in] ԤNET_DVR_RealPlayNET_DVR_RealPlay_V30ķֵ + Output: + Return: + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopRealPlay(int iRealHandle); + + /********************************************************* + Function: DRAWFUN + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void DRAWFUN(int lRealHandle, IntPtr hDc, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_RigisterDrawFun(int lRealHandle, DRAWFUN fDrawFun, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetPlayerBufNumber(Int32 lRealHandle, uint dwBufNum); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ThrowBFrame(Int32 lRealHandle, uint dwNum); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetAudioMode(uint dwMode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_OpenSound(Int32 lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseSound(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_OpenSoundShare(Int32 lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseSoundShare(Int32 lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_Volume(Int32 lRealHandle, ushort wVolume); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SaveRealData(Int32 lRealHandle, string sFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopSaveRealData(Int32 lRealHandle); + + /********************************************************* + Function: REALDATACALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void SETREALDATACALLBACK(int lRealHandle, uint dwDataType, IntPtr pBuffer, uint dwBufSize, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetRealDataCallBack(int lRealHandle, SETREALDATACALLBACK fRealDataCallBack, uint dwUser); + + /********************************************************* + Function: STDDATACALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void STDDATACALLBACK(int lRealHandle, uint dwDataType, ref byte pBuffer, uint dwBufSize, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetStandardDataCallBack(int lRealHandle, STDDATACALLBACK fStdDataCallBack, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CapturePicture(Int32 lRealHandle, string sPicFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CapturePictureBlock(Int32 lRealHandle, string sPicFileName, int dwTimeOut); + + //̬I֡ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MakeKeyFrame(Int32 lUserID, Int32 lChannel);// + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MakeKeyFrameSub(Int32 lUserID, Int32 lChannel);// + + //̨ؽӿ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetPTZCtrl(Int32 lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetPTZCtrl_Other(Int32 lUserID, int lChannel); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZControl(Int32 lRealHandle, uint dwPTZCommand, uint dwStop); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZControl_Other(Int32 lUserID, Int32 lChannel, uint dwPTZCommand, uint dwStop); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_TransPTZ(Int32 lRealHandle, string pPTZCodeBuf, uint dwBufSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_TransPTZ_Other(int lUserID, int lChannel, string pPTZCodeBuf, uint dwBufSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZPreset(int lRealHandle, uint dwPTZPresetCmd, uint dwPresetIndex); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZPreset_Other(int lUserID, int lChannel, uint dwPTZPresetCmd, uint dwPresetIndex); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_TransPTZ_EX(int lRealHandle, string pPTZCodeBuf, uint dwBufSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZControl_EX(int lRealHandle, uint dwPTZCommand, uint dwStop); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZPreset_EX(int lRealHandle, uint dwPTZPresetCmd, uint dwPresetIndex); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZCruise(int lRealHandle, uint dwPTZCruiseCmd, byte byCruiseRoute, byte byCruisePoint, ushort wInput); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZCruise_Other(int lUserID, int lChannel, uint dwPTZCruiseCmd, byte byCruiseRoute, byte byCruisePoint, ushort wInput); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZCruise_EX(int lRealHandle, uint dwPTZCruiseCmd, byte byCruiseRoute, byte byCruisePoint, ushort wInput); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZTrack(int lRealHandle, uint dwPTZTrackCmd); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZTrack_Other(int lUserID, int lChannel, uint dwPTZTrackCmd); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZTrack_EX(int lRealHandle, uint dwPTZTrackCmd); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZControlWithSpeed(int lRealHandle, uint dwPTZCommand, uint dwStop, uint dwSpeed); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZControlWithSpeed_Other(int lUserID, int lChannel, uint dwPTZCommand, uint dwStop, uint dwSpeed); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZControlWithSpeed_EX(int lRealHandle, uint dwPTZCommand, uint dwStop, uint dwSpeed); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetPTZCruise(int lUserID, int lChannel, int lCruiseRoute, ref NET_DVR_CRUISE_RET lpCruiseRet); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZMltTrack(int lRealHandle, uint dwPTZTrackCmd, uint dwTrackIndex); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZMltTrack_Other(int lUserID, int lChannel, uint dwPTZTrackCmd, uint dwTrackIndex); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZMltTrack_EX(int lRealHandle, uint dwPTZTrackCmd, uint dwTrackIndex); + + //ļط + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFile(int lUserID, int lChannel, uint dwFileType, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextFile(int lFindHandle, ref NET_DVR_FIND_DATA lpFindData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_FindClose(int lFindHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextFile_V30(int lFindHandle, ref NET_DVR_FINDDATA_V30 lpFindData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextFile_V40(int lFindHandle, ref NET_DVR_FINDDATA_V40 lpFindData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFile_V30(int lUserID, ref NET_DVR_FILECOND pFindCond); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFile_V40(int lUserID, ref NET_DVR_FILECOND_V40 pFindCond); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFileByEvent_V40(int lUserID, ref NET_DVR_SEARCH_EVENT_PARAM_V40 lpSearchEventParam); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextEvent_V40(int lSearchHandle, ref NET_DVR_SEARCH_EVENT_RET_V40 lpSearchEventRet); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_FindClose_V30(int lFindHandle); + + //2007-04-16Ӳѯŵļ + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextFile_Card(int lFindHandle, ref NET_DVR_FINDDATA_CARD lpFindData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFile_Card(int lUserID, int lChannel, uint dwFileType, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_LockFileByName(int lUserID, string sLockFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_UnlockFileByName(int lUserID, string sUnlockFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_PlayBackByName(int lUserID, string sPlayBackFileName, IntPtr hWnd); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_PlayBackByTime(int lUserID, int lChannel, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime, System.IntPtr hWnd); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_PlayBackByTime_V40(int lUserID, ref NET_DVR_VOD_PARA pVodPara); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_PlayBackReverseByName(int lUserID, string sPlayBackFileName, IntPtr hWnd); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_PlayBackReverseByTime_V40(int lUserID, IntPtr hWnd, ref NET_DVR_PLAYCOND pPlayCond); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PlayBackControl(int lPlayHandle, uint dwControlCode, uint dwInValue, ref uint LPOutValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PlayBackControl_V40(int lPlayHandle, uint dwControlCode, IntPtr lpInBuffer, uint dwInValue, IntPtr lpOutBuffer, ref uint LPOutValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopPlayBack(int lPlayHandle); + + /********************************************************* + Function: PLAYDATACALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void PLAYDATACALLBACK(int lPlayHandle, uint dwDataType, IntPtr pBuffer, uint dwBufSize, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetPlayDataCallBack(int lPlayHandle, PLAYDATACALLBACK fPlayDataCallBack, uint dwUser); + + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PlayBackSaveData(int lPlayHandle, string sFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopPlayBackSave(int lPlayHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetPlayBackOsdTime(int lPlayHandle, ref NET_DVR_TIME lpOsdTime); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PlayBackCaptureFile(int lPlayHandle, string sFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetFileByName(int lUserID, string sDVRFileName, string sSavedFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetFileByTime(int lUserID, int lChannel, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime, string sSavedFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetFileByTime_V40(int lUserID, string sSavedFileName, ref NET_DVR_PLAYCOND pDownloadCond); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopGetFile(int lFileHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetDownloadPos(int lFileHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetPlayBackPos(int lPlayHandle); + + //ͼƬ + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindPicture(int lUserID, ref NET_DVR_FIND_PICTURE_PARAM pFindParam); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextPicture_V50(int lFindHandle, ref NET_DVR_FIND_PICTURE_V50 lpFindData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseFindPicture(int lFindHandle); + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetPicture(int lUserID, String sDVRFileName, String sSavedFileName); + + // + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_Upgrade(int lUserID, string sFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetUpgradeState(int lUpgradeHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetUpgradeProgress(int lUpgradeHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseUpgradeHandle(int lUpgradeHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetNetworkEnvironment(uint dwEnvironmentLevel); + + //Զ̸ʽӲ + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FormatDisk(int lUserID, int lDiskNumber); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetFormatProgress(int lFormatHandle, ref int pCurrentFormatDisk, ref int pCurrentDiskPos, ref int pFormatStatic); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseFormatHandle(int lFormatHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetIPCProtoList(int lUserID, ref NET_DVR_IPC_PROTO_LIST lpProtoList); + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetIPCProtoList_V41(int lUserID, ref NET_DVR_IPC_PROTO_LIST_V41 lpProtoList); + + // + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_SetupAlarmChan(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseAlarmChan(int lAlarmHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_SetupAlarmChan_V30(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_SetupAlarmChan_V41(int lUserID, ref NET_DVR_SETUPALARM_PARAM lpSetupParam); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseAlarmChan_V30(int lAlarmHandle); + + //Խ + /********************************************************* + Function: VOICEDATACALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void VOICEDATACALLBACK(int lVoiceComHandle, string pRecvDataBuffer, uint dwBufSize, byte byAudioFlag, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_StartVoiceCom(int lUserID, VOICEDATACALLBACK fVoiceDataCallBack, uint dwUser); + + /********************************************************* + Function: VOICEDATACALLBACKV30 + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void VOICEDATACALLBACKV30(int lVoiceComHandle, IntPtr pRecvDataBuffer, uint dwBufSize, byte byAudioFlag, System.IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_StartVoiceCom_V30(int lUserID, uint dwVoiceChan, bool bNeedCBNoEncData, VOICEDATACALLBACKV30 fVoiceDataCallBack, IntPtr pUser); + + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetVoiceComClientVolume(int lVoiceComHandle, ushort wVolume); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopVoiceCom(int lVoiceComHandle); + + //ת + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_StartVoiceCom_MR(int lUserID, VOICEDATACALLBACK fVoiceDataCallBack, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_StartVoiceCom_MR_V30(int lUserID, uint dwVoiceChan, VOICEDATACALLBACKV30 fVoiceDataCallBack, IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_VoiceComSendData(int lVoiceComHandle, string pSendBuf, uint dwBufSize); + + //㲥 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientAudioStart(); + + /********************************************************* + Function: VOICEAUDIOSTART + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void VOICEAUDIOSTART(string pRecvDataBuffer, uint dwBufSize, IntPtr pUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientAudioStart_V30(VOICEAUDIOSTART fVoiceAudioStart, IntPtr pUser); + + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientAudioStop(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_AddDVR(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_AddDVR_V30(int lUserID, uint dwVoiceChan); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DelDVR(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DelDVR_V30(int lVoiceHandle); + + + //͸ͨ + /********************************************************* + Function: SERIALDATACALLBACK + Desc: (ص) + Input: + Output: + Return: + **********************************************************/ + public delegate void SERIALDATACALLBACK(int lSerialHandle, string pRecvDataBuffer, uint dwBufSize, uint dwUser); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SerialStart(int lUserID, int lSerialPort, SERIALDATACALLBACK fSerialDataCallBack, uint dwUser); + + //485Ϊ͸ͨʱҪָͨţΪͬͨ485ÿԲͬ(粨) + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SerialSend(int lSerialHandle, int lChannel, string pSendBuf, uint dwBufSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SerialStop(int lSerialHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SendTo232Port(int lUserID, string pSendBuf, uint dwBufSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SendToSerialPort(int lUserID, uint dwSerialPort, uint dwSerialIndex, string pSendBuf, uint dwBufSize); + + // nBitrate = 16000 + [DllImport(@".\HCNetSDK.dll")] + public static extern System.IntPtr NET_DVR_InitG722Decoder(int nBitrate); + + [DllImport(@".\HCNetSDK.dll")] + public static extern void NET_DVR_ReleaseG722Decoder(IntPtr pDecHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DecodeG722Frame(IntPtr pDecHandle, ref byte pInBuffer, ref byte pOutBuffer); + + // + [DllImport(@".\HCNetSDK.dll")] + public static extern IntPtr NET_DVR_InitG722Encoder(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_EncodeG722Frame(IntPtr pEncodeHandle, ref byte pInBuffer, ref byte pOutBuffer); + + [DllImport(@".\HCNetSDK.dll")] + public static extern void NET_DVR_ReleaseG722Encoder(IntPtr pEncodeHandle); + + //Զ̿Ʊʾ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClickKey(int lUserID, int lKeyIndex); + + //Զ̿豸ֶ¼ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StartDVRRecord(int lUserID, int lChannel, int lRecordType); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopDVRRecord(int lUserID, int lChannel); + + //뿨 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_InitDevice_Card(ref int pDeviceTotalChan); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ReleaseDevice_Card(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_InitDDraw_Card(IntPtr hParent, uint colorKey); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ReleaseDDraw_Card(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_RealPlay_Card(int lUserID, ref NET_DVR_CARDINFO lpCardInfo, int lChannelNum); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ResetPara_Card(int lRealHandle, ref NET_DVR_DISPLAY_PARA lpDisplayPara); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_RefreshSurface_Card(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClearSurface_Card(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_RestoreSurface_Card(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_OpenSound_Card(int lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseSound_Card(int lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetVolume_Card(int lRealHandle, ushort wVolume); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_AudioPreview_Card(int lRealHandle, int bEnable); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetCardLastError_Card(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern System.IntPtr NET_DVR_GetChanHandle_Card(int lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CapturePicture_Card(int lRealHandle, string sPicFileName); + + //ȡ뿨кŴ˽ӿЧGetBoardDetailӿڻ(2005-12-08֧) + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetSerialNum_Card(int lChannelNum, ref uint pDeviceSerialNo); + + //־ + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindDVRLog(int lUserID, int lSelectMode, uint dwMajorType, uint dwMinorType, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextLog(int lLogHandle, ref NET_DVR_LOG lpLogData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_FindLogClose(int lLogHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindDVRLog_V30(int lUserID, int lSelectMode, uint dwMajorType, uint dwMinorType, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime, bool bOnlySmart); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextLog_V30(int lLogHandle, ref NET_DVR_LOG_V30 lpLogData); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_FindLogClose_V30(int lLogHandle); + + //ֹ200485,113ӿ + //ATM DVR + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFileByCard(int lUserID, int lChannel, uint dwFileType, int nFindType, ref byte sCardNumber, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime); + + + //2005-09-15 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CaptureJPEGPicture(int lUserID, int lChannel, ref NET_DVR_JPEGPARA lpJpegPara, string sPicFileName); + + //JPEGץͼڴ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CaptureJPEGPicture_NEW(int lUserID, int lChannel, ref NET_DVR_JPEGPARA lpJpegPara, byte[] sJpegPicBuffer, uint dwPicSize, ref uint lpSizeReturned); + + //2006-02-16 + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetRealPlayerIndex(int lRealHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetPlayBackPlayerIndex(int lPlayHandle); + + + [DllImportAttribute(@".\HCNetSDK.dll")] + //ʶϴļ + public static extern Int32 NET_DVR_UploadSend(int lUploadHandle, ref NET_DVR_SEND_PARAM_IN pstruSendParamIN, IntPtr lpOutBuffer); + + [DllImportAttribute(@".\HCNetSDK.dll")] + //ʶϴļ + public static extern Int32 NET_DVR_UploadFile_V40(int lUserID, uint dwUploadType, IntPtr lpInBuffer, uint dwInBufferSize, string sFileName, IntPtr lpOutBuffer, uint dwOutBufferSize); + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern Int32 NET_DVR_GetUploadState(int lUploadHandle, ref uint pProgress); + + //ȡǰϴĽϢ + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetUploadResult(int lUploadHandle, IntPtr lpOutBuffer, uint dwOutBufferSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_UploadClose(int lUploadHandle); + + + + //2006-08-28 704-640 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetScaleCFG(int lUserID, uint dwScale); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetScaleCFG(int lUserID, ref uint lpOutScale); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetScaleCFG_V30(int lUserID, ref NET_DVR_SCALECFG pScalecfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetScaleCFG_V30(int lUserID, ref NET_DVR_SCALECFG pScalecfg); + + //2006-08-28 ATM˿ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetATMPortCFG(int lUserID, ushort wATMPort); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetATMPortCFG(int lUserID, ref ushort LPOutATMPort); + + //2006-11-10 ֧Կ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_InitDDrawDevice(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ReleaseDDrawDevice(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetDDrawDeviceTotalNums(); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDDrawDevice(int lPlayPort, uint nDeviceNum); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZSelZoomIn(int lRealHandle, ref NET_DVR_POINT_FRAME pStruPointFrame); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_PTZSelZoomIn_EX(int lUserID, int lChannel, ref NET_DVR_POINT_FRAME pStruPointFrame); + + //豸DS-6001D/DS-6001F + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StartDecode(int lUserID, int lChannel, ref NET_DVR_DECODERINFO lpDecoderinfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopDecode(int lUserID, int lChannel); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDecoderState(int lUserID, int lChannel, ref NET_DVR_DECODERSTATE lpDecoderState); + + //2005-08-01 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDecInfo(int lUserID, int lChannel, ref NET_DVR_DECCFG lpDecoderinfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDecInfo(int lUserID, int lChannel, ref NET_DVR_DECCFG lpDecoderinfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDecTransPort(int lUserID, ref NET_DVR_PORTCFG lpTransPort); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDecTransPort(int lUserID, ref NET_DVR_PORTCFG lpTransPort); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DecPlayBackCtrl(int lUserID, int lChannel, uint dwControlCode, uint dwInValue, ref uint LPOutValue, ref NET_DVR_PLAYREMOTEFILE lpRemoteFileInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StartDecSpecialCon(int lUserID, int lChannel, ref NET_DVR_DECCHANINFO lpDecChanInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_StopDecSpecialCon(int lUserID, int lChannel, ref NET_DVR_DECCHANINFO lpDecChanInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DecCtrlDec(int lUserID, int lChannel, uint dwControlCode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DecCtrlScreen(int lUserID, int lChannel, uint dwControl); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDecCurLinkStatus(int lUserID, int lChannel, ref NET_DVR_DECSTATUS lpDecStatus); + + //· + //2007-11-30 V211֧½ӿ //11 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixStartDynamic(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DYNAMIC_DEC lpDynamicInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixStopDynamic(int lUserID, uint dwDecChanNum); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDecChanInfo(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DEC_CHAN_INFO lpInter); + + [DllImport(@"..\bin\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDecChanInfo_V41(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DEC_CHAN_INFO_V41 lpOuter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetLoopDecChanInfo(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_LOOP_DECINFO lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetLoopDecChanInfo(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_LOOP_DECINFO lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetLoopDecChanEnable(int lUserID, uint dwDecChanNum, uint dwEnable); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetLoopDecChanEnable(int lUserID, uint dwDecChanNum, ref uint lpdwEnable); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetLoopDecEnable(int lUserID, ref uint lpdwEnable); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetDecChanEnable(int lUserID, uint dwDecChanNum, uint dwEnable); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDecChanEnable(int lUserID, uint dwDecChanNum, ref uint lpdwEnable); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDecChanStatus(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DEC_CHAN_STATUS lpInter); + + //2007-12-22 ֽ֧ӿ //18 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetTranInfo(int lUserID, ref NET_DVR_MATRIX_TRAN_CHAN_CONFIG lpTranInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetTranInfo(int lUserID, ref NET_DVR_MATRIX_TRAN_CHAN_CONFIG lpTranInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetRemotePlay(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DEC_REMOTE_PLAY lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetRemotePlayControl(int lUserID, uint dwDecChanNum, uint dwControlCode, uint dwInValue, ref uint LPOutValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetRemotePlayStatus(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DEC_REMOTE_PLAY_STATUS lpOuter); + + //2009-4-13 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixStartDynamic_V30(int lUserID, uint dwDecChanNum, ref NET_DVR_PU_STREAM_CFG lpDynamicInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixStartDynamic_V41(int lUserID, uint dwDecChanNum, ref NET_DVR_PU_STREAM_CFG_V41 lpDynamicInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetLoopDecChanInfo_V30(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_LOOP_DECINFO_V30 lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetLoopDecChanInfo_V30(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_LOOP_DECINFO_V30 lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDecChanInfo_V30(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_DEC_CHAN_INFO_V30 lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetTranInfo_V30(int lUserID, ref NET_DVR_MATRIX_TRAN_CHAN_CONFIG_V30 lpTranInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetTranInfo_V30(int lUserID, ref NET_DVR_MATRIX_TRAN_CHAN_CONFIG_V30 lpTranInfo); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDisplayCfg(int lUserID, uint dwDispChanNum, ref NET_DVR_VGA_DISP_CHAN_CFG lpDisplayCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetDisplayCfg(int lUserID, uint dwDispChanNum, ref NET_DVR_VGA_DISP_CHAN_CFG lpDisplayCfg); + + [DllImport(@"..\bin\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDisplayCfg_V41(int lUserID, uint dwDispChanNum, ref NET_DVR_MATRIX_VOUTCFG lpDisplayCfg); + + [DllImport(@"..\bin\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetDisplayCfg_V41(int lUserID, uint dwDispChanNum, ref NET_DVR_MATRIX_VOUTCFG lpDisplayCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_MatrixStartPassiveDecode(int lUserID, uint dwDecChanNum, ref NET_DVR_MATRIX_PASSIVEMODE lpPassiveMode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSendData(int lPassiveHandle, System.IntPtr pSendBuf, uint dwBufSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixStopPassiveDecode(int lPassiveHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_UploadLogo(int lUserID, uint dwDispChanNum, ref NET_DVR_DISP_LOGOCFG lpDispLogoCfg, System.IntPtr sLogoBuffer); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_PicUpload(int lUserID, String sFileName, ref NET_DVR_PICTURECFG lpPictureCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetPicUploadProgress(int lUploadHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_CloseUploadHandle(int lUploadHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_GetPicUploadState(int lUploadHandle); + + public const int NET_DVR_SHOWLOGO = 1;/*ʾLOGO*/ + public const int NET_DVR_HIDELOGO = 2;/*LOGO*/ + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_LogoSwitch(int lUserID, uint dwDecChan, uint dwLogoSwitch); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetDeviceStatus(int lUserID, ref NET_DVR_DECODER_WORK_STATUS lpDecoderCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetInputSignalList_V40(int lUserID, uint dwDevNum, ref NET_DVR_INPUT_SIGNAL_LIST lpInputSignalList); + + public const int DISP_CMD_ENLARGE_WINDOW = 1; /*ʾͨŴij*/ + public const int DISP_CMD_RENEW_WINDOW = 2; /*ʾͨڻԭ*/ + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixDiaplayControl(int lUserID, uint dwDispChanNum, uint dwDispChanCmd, uint dwCmdParam); + + //end + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_RefreshPlay(int lPlayHandle); + + //ָĬֵ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_RestoreConfig(int lUserID); + + // + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SaveConfig(int lUserID); + + // + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_RebootDVR(int lUserID); + + //رDVR + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ShutDownDVR(int lUserID); + + // begin + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDVRConfig(int lUserID, uint dwCommand, int lChannel, IntPtr lpOutBuffer, uint dwOutBufferSize, ref uint lpBytesReturned); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDVRConfig(int lUserID, uint dwCommand, int lChannel, System.IntPtr lpInBuffer, uint dwInBufferSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDVRWorkState_V30(int lUserID, IntPtr pWorkState); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDVRWorkState(int lUserID, ref NET_DVR_WORKSTATE lpWorkState); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetVideoEffect(int lUserID, int lChannel, uint dwBrightValue, uint dwContrastValue, uint dwSaturationValue, uint dwHueValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetVideoEffect(int lUserID, int lChannel, ref uint pBrightValue, ref uint pContrastValue, ref uint pSaturationValue, ref uint pHueValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientGetframeformat(int lUserID, ref NET_DVR_FRAMEFORMAT lpFrameFormat); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientSetframeformat(int lUserID, ref NET_DVR_FRAMEFORMAT lpFrameFormat); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetAtmProtocol(int lUserID, ref NET_DVR_ATM_PROTOCOL lpAtmProtocol); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetAlarmOut_V30(int lUserID, IntPtr lpAlarmOutState); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetAlarmOut(int lUserID, ref NET_DVR_ALARMOUTSTATUS lpAlarmOutState); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetAlarmOut(int lUserID, int lAlarmOutPort, int lAlarmOutStatic); + + //ȡUPNP˿ӳ״̬ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetUpnpNatState(int lUserID, ref NET_DVR_UPNP_NAT_STATE lpState); + + //Ƶ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientSetVideoEffect(int lRealHandle, uint dwBrightValue, uint dwContrastValue, uint dwSaturationValue, uint dwHueValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ClientGetVideoEffect(int lRealHandle, ref uint pBrightValue, ref uint pContrastValue, ref uint pSaturationValue, ref uint pHueValue); + + //ļ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetConfigFile(int lUserID, string sFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetConfigFile(int lUserID, string sFileName); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetConfigFile_V30(int lUserID, string sOutBuffer, uint dwOutSize, ref uint pReturnSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetConfigFile_EX(int lUserID, string sOutBuffer, uint dwOutSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetConfigFile_EX(int lUserID, string sInBuffer, uint dwInSize); + + //־ļдӿ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetLogToFile(int bLogEnable, string strLogDir, bool bAutoDel); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetSDKState(ref NET_DVR_SDKSTATE pSDKState); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetSDKAbility(ref NET_DVR_SDKABL pSDKAbl); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetPTZProtocol(int lUserID, ref NET_DVR_PTZCFG pPtzcfg); + + //ǰ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_LockPanel(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_UnLockPanel(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetRtspConfig(int lUserID, uint dwCommand, ref NET_DVR_RTSPCFG lpInBuffer, uint dwInBufferSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetRtspConfig(int lUserID, uint dwCommand, ref NET_DVR_RTSPCFG lpOutBuffer, uint dwOutBufferSize); + + //Ƶۺƽ̨ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixGetSceneCfg(int lUserID, uint dwSceneNum, ref NET_DVR_MATRIX_SCENECFG lpSceneCfg); + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_MatrixSetSceneCfg(int lUserID, uint dwSceneNum, ref NET_DVR_MATRIX_SCENECFG lpSceneCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetRealHeight(int lUserID, int lChannel, ref NET_VCA_LINE lpLine, ref Single lpHeight); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetRealLength(int lUserID, int lChannel, ref NET_VCA_LINE lpLine, ref Single lpLength); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SaveRealData_V30(int lRealHandle, uint dwTransType, string sFileName); + + //Win32λ + //[DllImport(@".\HCNetSDK.dll")] + //public static extern bool NET_DVR_EncodeG711Frame(uint iType, ref byte pInBuffer, ref byte pOutBuffer); + + [DllImport(@".\HCNetSDK.dll")] + public static extern IntPtr NET_DVR_InitG711Encoder(ref NET_DVR_AUDIOENC_INFO enc_info); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_EncodeG711Frame(IntPtr handle, ref NET_DVR_AUDIOENC_PROCESS_PARAM p_enc_proc_param); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ReleaseG711Encoder(IntPtr pEncodeHandle); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_DecodeG711Frame(uint iType, ref byte pInBuffer, ref byte pOutBuffer); + + //2009-7-22 end + + //ʼ 9000_1.1 + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_EmailTest(int lUserID); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindFileByEvent(int lUserID, ref NET_DVR_SEARCH_EVENT_PARAM lpSearchEventParam); + + [DllImport(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextEvent(int lSearchHandle, ref NET_DVR_SEARCH_EVENT_RET lpSearchEventRet); + + /********************************************************* + Function: NET_DVR_Login_V30 + Desc: + Input: sDVRIP [in] 豸IPַ + wServerPort [in] 豸˿ں + sUserName [in] ¼û + sPassword [in] û + Output: lpDeviceInfo [out] 豸Ϣ + Return: -1ʾʧܣֵʾصûIDֵ + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern Int32 NET_DVR_Login_V30(string sDVRIP, Int32 wDVRPort, string sUserName, string sPassword, ref NET_DVR_DEVICEINFO_V30 lpDeviceInfo); + + [DllImport(@"HCNetSDK.dll")] + public static extern int NET_DVR_Login_V40(ref NET_DVR_USER_LOGIN_INFO pLoginInfo, ref NET_DVR_DEVICEINFO_V40 lpDeviceInfo); + /********************************************************* + Function: NET_DVR_Logout_V30 + Desc: ûע豸 + Input: lUserID [in] ûID + Output: + Return: TRUEʾɹFALSEʾʧ + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_Logout_V30(Int32 lUserID); + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindNextLog_MATRIX(int iLogHandle, ref NET_DVR_LOG_MATRIX lpLogData); + + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern int NET_DVR_FindDVRLog_Matrix(int iUserID, int lSelectMode, uint dwMajorType, uint dwMinorType, ref tagVEDIOPLATLOG lpVedioPlatLog, ref NET_DVR_TIME lpStartTime, ref NET_DVR_TIME lpStopTime); + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_STDXMLConfig(int iUserID, ref NET_DVR_XML_CONFIG_INPUT lpInputParam, ref NET_DVR_XML_CONFIG_OUTPUT lpOutputParam); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDeviceConfig(int lUserID, uint dwCommand, uint dwCount, IntPtr lpInBuffer, uint dwInBufferSize, IntPtr lpStatusList, IntPtr lpOutBuffer, uint dwOutBufferSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDeviceConfig(int lUserID, uint dwCommand, uint dwCount, IntPtr lpInBuffer, uint dwInBufferSize, IntPtr lpStatusList, IntPtr lpInParamBuffer, uint dwInParamBufferSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetDeviceConfigEx(Int32 lUserID, uint dwCommand, uint dwCount, ref NET_DVR_IN_PARAM lpInParam, ref NET_DVR_OUT_PARAM lpOutParam); + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetSTDConfig(int iUserID, uint dwCommand, ref NET_DVR_STD_CONFIG lpConfigParam); + + [DllImportAttribute(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetSTDConfig(int iUserID, uint dwCommand, ref NET_DVR_STD_CONFIG lpConfigParam); + + public delegate void RemoteConfigCallback(uint dwType, IntPtr lpBuffer, uint dwBufLen, IntPtr pUserData); + + [DllImportAttribute(@"HCNetSDK.dll")] + public static extern int NET_DVR_StartRemoteConfig(int lUserID, int dwCommand, IntPtr lpInBuffer, Int32 dwInBufferLen, RemoteConfigCallback cbStateCallback, IntPtr pUserData); + + [DllImportAttribute(@"HCNetSDK.dll")] + public static extern int NET_DVR_GetNextRemoteConfig(int lHandle, IntPtr lpOutBuff, int dwOutBuffSize); + + [DllImportAttribute(@"HCNetSDK.dll")] + public static extern bool NET_DVR_SendRemoteConfig(int lHandle, int dwDataType, IntPtr pSendBuf, int dwBufSize); + + [DllImportAttribute(@"HCNetSDK.dll")] + public static extern bool NET_DVR_StopRemoteConfig(int lHandle); + + + [DllImportAttribute(@"HCNetSDK.dll")] + public static extern bool NET_DVR_RemoteControl(int lUserID, int dwCommand, IntPtr lpInBuffer, int dwInBufferSize); + + [DllImportAttribute(@"HCNetSDK.dll")] + public static extern bool NET_DVR_RemoteControl(int lUserID, int dwCommand, ref CHCNetSDK.NET_DVR_FACE_PARAM_CTRL_CARDNO lpInBuffer, int dwInBufferSize); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ContinuousShoot(Int32 lUserID, ref NET_DVR_SNAPCFG lpInter); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_ManualSnap(Int32 lUserID, ref NET_DVR_MANUALSNAP lpInter, ref NET_DVR_PLATE_RESULT lpOuter); + + /********************************************************* + Function: NET_DVR_GetDeviceAbility + Desc: + Input: + Output: + Return: TRUEʾɹFALSEʾʧܡ + **********************************************************/ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetDeviceAbility(int lUserID, uint dwAbilityType, IntPtr pInBuf, uint dwInLength, IntPtr pOutBuf, uint dwOutLength); + + ///ȡؼ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetBehaviorParamKey(int lUserID, int lChannel, uint dwParameterKey, int nValue); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetBehaviorParamKey(int lUserID, int lChannel, uint dwParameterKey, ref int pValue); + + //ȡ/ΪĿӽӿ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetVCADrawMode(int lUserID, int lChannel, ref NET_VCA_DRAW_MODE lpDrawMode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetVCADrawMode(int lUserID, int lChannel, ref NET_VCA_DRAW_MODE lpDrawMode); + + //˫ģʽýӿ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetLFTrackMode(int lUserID, int lChannel, ref NET_DVR_LF_TRACK_MODE lpTrackMode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetLFTrackMode(int lUserID, int lChannel, ref NET_DVR_LF_TRACK_MODE lpTrackMode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetCCDCfg(int lUserID, int lChannel, ref NET_DVR_CCD_CFG lpCCDCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_SetCCDCfg(int lUserID, int lChannel, ref NET_DVR_CCD_CFG lpCCDCfg); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_GetParamSetMode(int lUserID, ref uint dwParamSetMode); + + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_DVR_InquestStartCDW_V30(int lUserID, ref NET_DVR_INQUEST_ROOM lpInquestRoom, bool bNotBurn); + #endregion + + #region Ϣ¼ + [DllImport("User32.dll", EntryPoint = "PostMessage")] + public static extern int PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + #endregion + + + //ʶ𳡾 + public enum VCA_RECOGNIZE_SCENE + { + VCA_LOW_SPEED_SCENE = 0,//ͨշվСſڡͣ + VCA_HIGH_SPEED_SCENE = 1,//ͨڡٹ·ƶ) + VCA_MOBILE_CAMERA_SCENE = 2,//ƶӦã + } + + //ʶ־ + public enum VCA_RECOGNIZE_RESULT + { + VCA_RECOGNIZE_FAILURE = 0,//ʶʧ + VCA_IMAGE_RECOGNIZE_SUCCESS,//ͼʶɹ + VCA_VIDEO_RECOGNIZE_SUCCESS_OF_BEST_LICENSE,//ƵʶŽ + VCA_VIDEO_RECOGNIZE_SUCCESS_OF_NEW_LICENSE,//Ƶʶµij + VCA_VIDEO_RECOGNIZE_FINISH_OF_CUR_LICENSE,//Ƶʶƽ + } + + + //Ƶʶ𴥷 + public enum VCA_TRIGGER_TYPE + { + INTER_TRIGGER = 0,// ģڲʶ + EXTER_TRIGGER = 1,// ⲿźŴȦ״ֶźţ + } + + public const int MAX_CHINESE_CHAR_NUM = 64; // + //ƿɶ̬޸IJ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_PLATE_PARAM + { + public NET_VCA_RECT struSearchRect;//(һ) + public NET_VCA_RECT struInvalidateRect;//Чڲ (һ) + public ushort wMinPlateWidth;//С + public ushort wTriggerDuration;//֡ + public byte byTriggerType;//ģʽ, VCA_TRIGGER_TYPE + public byte bySensitivity;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 64, ArraySubType = UnmanagedType.I1)] + public byte[] byCharPriority;// ȼ + } + + /*wMinPlateWidth:òĬΪ80أòöڳƺӳʶ˵ĵ + ʶӰ죬ùôгСƾͻ©ʶгƿձϴ󣬿԰ѸòԴ󣬱ڼٶٳƵĴڱ½Ϊ80 ڸ½Ϊ120 + wTriggerDuration ⲿźų֡京ǴӴźſʼʶֵ֡ڵٳΪ50100ٳΪ1525ƶʶʱҲⲿΪ1525Ըֳ + */ + //ʶӽṹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_PLATEINFO + { + public VCA_RECOGNIZE_SCENE eRecogniseScene;//ʶ𳡾(ٺ͸) + public NET_VCA_PLATE_PARAM struModifyParam;//ƿɶ̬޸IJ + } + + //ʶò + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_PLATECFG + { + public uint dwSize; + public byte byPicProType;//ʱͼƬʽ 0- 1-ϴ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.I1)] + public byte[] byRes;//Ϊ0 + public NET_DVR_JPEGPARA struPictureParam;//ͼƬṹ + public NET_VCA_PLATEINFO struPlateInfo;//Ϣ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT_2, ArraySubType = UnmanagedType.Struct)] + public NET_DVR_SCHEDTIME[] struAlarmTime;//ʱ + public NET_DVR_HANDLEEXCEPTION_V30 struHandleType;//ʽ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_CHANNUM_V30, ArraySubType = UnmanagedType.I1)] + public byte[] byRelRecordChan;//¼ͨ,Ϊ1ʾͨ + } + + //ʶӽṹ + [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + public struct NET_VCA_PLATE_INFO + { + public VCA_RECOGNIZE_RESULT eResultFlag;//ʶ־ + public VCA_PLATE_TYPE ePlateType;// + public VCA_PLATE_COLOR ePlateColor;//ɫ + public NET_VCA_RECT struPlateRect;//λ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes;//Ϊ0 + public uint dwLicenseLen;//Ƴ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_LICENSE_LEN)] + public string sLicense;//ƺ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = MAX_LICENSE_LEN)] + public string sBelieve;//ʶַŶȣ⵽"A12345", ŶΪ10,20,30,40,50,60,70ʾ""ȷĿֻ10%"A"ֵȷĿ20% + } + + //Ƽ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_PLATE_RESULT + { + public uint dwSize;//ṹ + public uint dwRelativeTime;//ʱ + public uint dwAbsTime;//ʱ + public byte byPlateNum;//Ƹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.I1)] + public byte[] byRes1; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_PLATE_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_PLATE_INFO[] struPlateInfo;//Ϣṹ + public uint dwPicDataLen;//ͼƬij Ϊ0ʾûͼƬ0ʾýṹͼƬ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes2;//Ϊ0 ͼƬĸ߿ + public System.IntPtr pImage;//ָͼƬָ + } + + //ܿ + [DllImport(@".\HCNetSDK.dll")] + public static extern bool NET_VCA_RestartLib(int lUserID, int lChannel); + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_LINE_SEGMENT + { + public NET_VCA_POINT struStartPoint;//ʾ߶ʱʾͷ + public NET_VCA_POINT struEndPoint;//ʾ߶ʱʾŲ + public float fValue;//߶ֵλ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //궨 + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_VCA_LINE_SEG_LIST + { + public uint dwSize;//ṹ + public byte bySegNum;//궨 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = System.Runtime.InteropServices.UnmanagedType.I1)] + public byte[] byRes;//0 + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_SEGMENT_NUM, ArraySubType = UnmanagedType.Struct)] + public NET_VCA_LINE_SEGMENT[] struSeg; + } + + //2009-8-18 ץĻ + public const int PLATE_INFO_LEN = 1024; + public const int PLATE_NUM_LEN = 16; + public const int FILE_NAME_LEN = 256; + + //liscense plate result + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_PLATE_RET + { + public uint dwSize;//ṹ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PLATE_NUM_LEN, ArraySubType = UnmanagedType.I1)] + public byte[] byPlateNum;//ƺ + public byte byVehicleType;// + public byte byTrafficLight;//0-̵ƣ1- + public byte byPlateColor;//ɫ + public byte byDriveChan;// + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 32, ArraySubType = UnmanagedType.I1)] + public byte[] byTimeInfo;/*ʱϢ*///plate_172.6.113.64_20090724155526948_197170484 + //Ŀǰ17λȷms:20090724155526948 + public byte byCarSpeed;/*λkm/h*/ + public byte byCarSpeedH;/*cm/s8λ*/ + public byte byCarSpeedL;/*cm/s8λ*/ + public byte byRes; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = PLATE_INFO_LEN - 36, ArraySubType = UnmanagedType.I1)] + public byte[] byInfo; + public uint dwPicLen; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct NET_DVR_CCD_CFG + { + public uint dwSize;//ṹ + public byte byBlc;/*ⲹ0-off; 1-on*/ + public byte byBlcMode;/*blc0-Զ1-ϣ2-£3-4-ң5-УעblcΪ on ʱЧ*/ + public byte byAwb;/*Զƽ0-Զ1; 1-Զ2; 2-Զ*/ + public byte byAgc;/*Զ0-; 1-; 2-; 3-*/ + public byte byDayNight;/*ҹת0 ɫ1ڰף2Զ*/ + public byte byMirror;/*0-;1-;2-;3-*/ + public byte byShutter;/*0-Զ; 1-1/25; 2-1/50; 3-1/100; 4-1/250;5-1/500; 6-1/1k ;7-1/2k; 8-1/4k; 9-1/10k; 10-1/100k;*/ + public byte byIrCutTime;/*IRCUTлʱ䣬5, 10, 15, 20, 25*/ + public byte byLensType;/*ͷ0-ӹȦ; 1-ԶȦ*/ + public byte byEnVideoTrig;/*Ƶʹܣ1-֧֣0-֧֡ƵģʽƵٶȰbyShutterٶȣץͼƬĿٶȰbyCapShutterٶȣץɺԶڻƵģʽ*/ + public byte byCapShutter;/*ץʱĿٶȣ1-1/25; 2-1/50; 3-1/100; 4-1/250;5-1/500; 6-1/1k ;7-1/2k; 8-1/4k; 9-1/10k; 10-1/100k; 11-1/150; 12-1/200*/ + public byte byEnRecognise;/*1-֧ʶ0-֧ʶ*/ + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct tagCAMERAPARAMCFG + { + public uint dwSize; + public uint dwPowerLineFrequencyMode;/*0-50HZ; 1-60HZ*/ + public uint dwWhiteBalanceMode;/*0ֶƽ; 1Զƽ1ΧС; 2 Զƽ2Χ2200K-15000K;3Զ3*/ + public uint dwWhiteBalanceModeRGain;/*ֶƽʱЧֶƽ R*/ + public uint dwWhiteBalanceModeBGain;/*ֶƽʱЧֶƽ B*/ + public uint dwExposureMode;/*0 ֶع 1Զع*/ + public uint dwExposureSet;/* 0-USERSET, 1-Զx22-Զ43-Զ81/25, 4-1/50, 5-1/100, 6-1/250, 7-1/500, 8-1/750, 9-1/1000, 10-1/2000, 11-1/4000,12-1/10,000; 13-1/100,000*/ + public uint dwExposureUserSet;/* ԶԶعʱ*/ + public uint dwExposureTarget;/*ֶعʱ ΧManumalЧ΢룩*/ + public uint dwIrisMode;/*0 ԶȦ 1ֶȦ*/ + public uint dwGainLevel;/*棺0-100*/ + public uint dwBrightnessLevel;/*0-100*/ + public uint dwContrastLevel;/*0-100*/ + public uint dwSharpnessLevel;/*0-100*/ + public uint dwSaturationLevel;/*0-100*/ + public uint dwHueLevel;/*0-100*/ + public uint dwGammaCorrectionEnabled;/*0 dsibale 1 enable*/ + public uint dwGammaCorrectionLevel;/*0-100*/ + public uint dwWDREnabled;/*̬0 dsibale 1 enable*/ + public uint dwWDRLevel1;/*0-F*/ + public uint dwWDRLevel2;/*0-F*/ + public uint dwWDRContrastLevel;/*0-100*/ + public uint dwDayNightFilterType;/*ҹл0 day,1 night,2 auto */ + public uint dwSwitchScheduleEnabled;/*0 dsibale 1 enable,()*/ + //ģʽ1() + public uint dwBeginTime; /*0-100*/ + public uint dwEndTime;/*0-100*/ + //ģʽ2 + public uint dwDayToNightFilterLevel;//0-7 + public uint dwNightToDayFilterLevel;//0-7 + public uint dwDayNightFilterTime;//(60) + public uint dwBacklightMode;/*ⲹ:0 USERSET 1 UP2 DOWN3 LEFT4 RIGHT5MIDDLE*/ + public uint dwPositionX1;//X1 + public uint dwPositionY1;//Y1 + public uint dwPositionX2;//X2 + public uint dwPositionY2;//Y2 + public uint dwBacklightLevel;/*0x0-0xF*/ + public uint dwDigitalNoiseRemoveEnable; /*ȥ룺0 dsibale 1 enable*/ + public uint dwDigitalNoiseRemoveLevel;/*0x0-0xF*/ + public uint dwMirror; /* 0 Left;1 Right,;2 Up;3Down */ + public uint dwDigitalZoom;/*:0 dsibale 1 enable*/ + public uint dwDeadPixelDetect;/*,0 dsibale 1 enable*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.U4)] + public uint[] dwRes; + } + + public const int NET_DVR_GET_CCDPARAMCFG = 1067; //IPCȡCCD + public const int NET_DVR_SET_CCDPARAMCFG = 1068; //IPCCCD + + //ͼǿ + //ͼǿȥ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct tagIMAGEREGION + { + public uint dwSize;//ܵĽṹ + public ushort wImageRegionTopLeftX;/* ͼǿȥx */ + public ushort wImageRegionTopLeftY;/* ͼǿȥy */ + public ushort wImageRegionWidth;/* ͼǿȥĿ */ + public ushort wImageRegionHeight;/*ͼǿȥĸ*/ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + //ͼǿȥ뼶ȶʹ + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct tagIMAGESUBPARAM + { + public NET_DVR_SCHEDTIME struImageStatusTime;//ͼ״̬ʱ + public byte byImageEnhancementLevel;//ͼǿļ0-70ʾر + public byte byImageDenoiseLevel;//ͼȥļ0-70ʾر + public byte byImageStableEnable;//ͼȶʹܣ0ʾرգ1ʾ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 9, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + public const int NET_DVR_GET_IMAGEREGION = 1062; //ͼǿͼǿȥȡ + public const int NET_DVR_SET_IMAGEREGION = 1063; //ͼǿͼǿȥȡ + public const int NET_DVR_GET_IMAGEPARAM = 1064; // ͼǿͼ(ȥ롢ǿȶʹ)ȡ + public const int NET_DVR_SET_IMAGEPARAM = 1065; // ͼǿͼ(ȥ롢ǿȶʹ) + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct tagIMAGEPARAM + { + public uint dwSize; + //ͼǿʱβãտʼ + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = MAX_DAYS * MAX_TIMESEGMENT, ArraySubType = UnmanagedType.Struct)] + public tagIMAGESUBPARAM[] struImageParamSched; + [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 16, ArraySubType = UnmanagedType.I1)] + public byte[] byRes; + } + + #region ȡģؽṹӿ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct PLAY_INFO + { + public int iUserID; //עûID + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 20)] + public string strDeviceIP; + public int iDevicePort; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 32)] + public string strDevAdmin; + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 16)] + public string strDevPsd; + public int iChannel; //ͨ(0ʼ) + public int iLinkMode; //λ(31)Ϊ0ʾΪ1ʾ030λʾӷʽ: 0TCPʽ,1UDPʽ,2ಥʽ,3 - RTPʽ4-Ƶֿ(TCP) + public bool bUseMedia; //Ƿý + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 20)] + public string strMediaIP; //ýIPַ + public int iMediaPort; //ý˿ں + } + + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SDK_Init(); + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SDK_UnInit(); + + + [DllImport("GetStream.dll")] + public static extern int CLIENT_SDK_GetStream(PLAY_INFO lpPlayInfo); // + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SetRealDataCallBack(int iRealHandle, SETREALDATACALLBACK fRealDataCallBack, uint lUser); // + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SDK_StopStream(int iRealHandle); + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SDK_GetVideoEffect(int iRealHandle, ref int iBrightValue, ref int iContrastValue, ref int iSaturationValue, ref int iHueValue); + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SDK_SetVideoEffect(int iRealHandle, int iBrightValue, int iContrastValue, int iSaturationValue, int iHueValue); + + [DllImport("GetStream.dll")] + public static extern bool CLIENT_SDK_MakeKeyFrame(int iRealHandle); + + #endregion + + + #region VOD㲥ſ + + public const int WM_NETERROR = 0x0400 + 102; //쳣Ϣ + public const int WM_STREAMEND = 0x0400 + 103; //ļŽ + + public const int FILE_HEAD = 0; //ļͷ + public const int VIDEO_I_FRAME = 1; //ƵI֡ + public const int VIDEO_B_FRAME = 2; //ƵB֡ + public const int VIDEO_P_FRAME = 3; //ƵP֡ + public const int VIDEO_BP_FRAME = 4; //ƵBP֡ + public const int VIDEO_BBP_FRAME = 5; //ƵB֡B֡P֡ + public const int AUDIO_PACKET = 10; //Ƶ + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct BLOCKTIME + { + public ushort wYear; + public byte bMonth; + public byte bDay; + public byte bHour; + public byte bMinute; + public byte bSecond; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct VODSEARCHPARAM + { + public IntPtr sessionHandle; //[in]VODͻ˾ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 50)] + public string dvrIP; // [in]DVRַ + public uint dvrPort; // [in]DVRĶ˿ڵַ + public uint channelNum; // [in]DVRͨ + public BLOCKTIME startTime; // [in]ѯĿʼʱ + public BLOCKTIME stopTime; // [in]ѯĽʱ + public bool bUseIPServer; // [in]ǷʹIPServer + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string SerialNumber; // [in]豸к + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct SECTIONLIST + { + public BLOCKTIME startTime; + public BLOCKTIME stopTime; + public byte byRecType; + public IntPtr pNext; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct VODOPENPARAM + { + public IntPtr sessionHandle; //[in]VODͻ˾ + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 50)] + public string dvrIP; // [in]DVRַ + public uint dvrPort; // [in]DVRĶ˿ڵַ + public uint channelNum; // [in]DVRͨ + public BLOCKTIME startTime; // [in]ѯĿʼʱ + public BLOCKTIME stopTime; // [in]ѯĽʱ + public uint uiUser; + public bool bUseIPServer; // [in]ǷʹIPServer + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string SerialNumber; // [in]豸к + + public VodStreamFrameData streamFrameData; + } + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct CONNPARAM + { + public uint uiUser; + public ErrorCallback errorCB; + } + + + // 쳣ص + public delegate void ErrorCallback(System.IntPtr hSession, uint dwUser, int lErrorType); + //֡ݻص + public delegate void VodStreamFrameData(System.IntPtr hStream, uint dwUser, int lFrameType, System.IntPtr pBuffer, uint dwSize); + + //ģʼ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODServerConnect(string strServerIp, uint uiServerPort, ref IntPtr hSession, ref CONNPARAM struConn, IntPtr hWnd); + + //ģ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODServerDisconnect(IntPtr hSession); + + [DllImport("PdCssVodClient.dll")] + public static extern bool VODStreamSearch(IntPtr pSearchParam, ref IntPtr pSecList); + + [DllImport("PdCssVodClient.dll")] + public static extern bool VODDeleteSectionList(IntPtr pSecList); + + // IDʱδȡ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODOpenStream(IntPtr pOpenParam, ref IntPtr phStream); + + [DllImport("PdCssVodClient.dll")] + public static extern bool VODCloseStream(IntPtr hStream); + + //IDʱδ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODOpenDownloadStream(ref VODOPENPARAM struVodParam, ref IntPtr phStream); + + [DllImport("PdCssVodClient.dll")] + public static extern bool VODCloseDownloadStream(IntPtr hStream); + + // ʼ֡ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODStartStreamData(IntPtr phStream); + [DllImport("PdCssVodClient.dll")] + public static extern bool VODPauseStreamData(IntPtr hStream, bool bPause); + [DllImport("PdCssVodClient.dll")] + public static extern bool VODStopStreamData(IntPtr hStream); + + // ʱ䶨λ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODSeekStreamData(IntPtr hStream, IntPtr pStartTime); + + + // ʱ䶨λ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODSetStreamSpeed(IntPtr hStream, int iSpeed); + + // ʱ䶨λ + [DllImport("PdCssVodClient.dll")] + public static extern bool VODGetStreamCurrentTime(IntPtr hStream, ref BLOCKTIME pCurrentTime); + + #endregion + + + #region ֡ + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct PACKET_INFO + { + public int nPacketType; // packet type + // 0: file head + // 1: video I frame + // 2: video B frame + // 3: video P frame + // 10: audio frame + // 11: private frame only for PS + + + // [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] + public IntPtr pPacketBuffer; + public uint dwPacketSize; + public int nYear; + public int nMonth; + public int nDay; + public int nHour; + public int nMinute; + public int nSecond; + public uint dwTimeStamp; + } + + + + /****************************************************************************** + * functionget a empty port number + * parameters + * return 0 - 499 : empty port number + * -1 : server is full + * comment + ******************************************************************************/ + [DllImport("AnalyzeData.dll")] + public static extern int AnalyzeDataGetSafeHandle(); + + + /****************************************************************************** + * functionopen standard stream data for analyzing + * parameterslHandle - working port number + * pHeader - pointer to file header or info header + * returnTRUE or FALSE + * comment + ******************************************************************************/ + [DllImport("AnalyzeData.dll")] + public static extern bool AnalyzeDataOpenStreamEx(int iHandle, byte[] pFileHead); + + + /****************************************************************************** + * functionclose analyzing + * parameterslHandle - working port number + * return + * comment + ******************************************************************************/ + [DllImport("AnalyzeData.dll")] + public static extern bool AnalyzeDataClose(int iHandle); + + + /****************************************************************************** + * functioninput stream data + * parameterslHandle - working port number + * pBuffer - data pointer + * dwBuffersize - data size + * returnTRUE or FALSE + * comment + ******************************************************************************/ + [DllImport("AnalyzeData.dll")] + public static extern bool AnalyzeDataInputData(int iHandle, IntPtr pBuffer, uint uiSize); //byte [] + + + /****************************************************************************** + * functionget analyzed packet + * parameterslHandle - working port number + * pPacketInfo - returned structure + * return-1 : error + * 0 : succeed + * 1 : failed + * 2 : file end (only in file mode) + * comment + ******************************************************************************/ + [DllImport("AnalyzeData.dll")] + public static extern int AnalyzeDataGetPacket(int iHandle, ref PACKET_INFO pPacketInfo); //ҪpPacketInfoתPACKET_INFOṹ + + + /****************************************************************************** + * functionget remain data from input buffer + * parameterslHandle - working port number + * pBuf - pointer to the mem which stored remain data + * dwSize - size of remain data + * return TRUE or FALSE + * comment + ******************************************************************************/ + [DllImport("AnalyzeData.dll")] + public static extern bool AnalyzeDataGetTail(int iHandle, ref IntPtr pBuffer, ref uint uiSize); + + + [DllImport("AnalyzeData.dll")] + public static extern uint AnalyzeDataGetLastError(int iHandle); + + #endregion + + + #region ¼ + + public const int DATASTREAM_HEAD = 0; //ͷ + public const int DATASTREAM_BITBLOCK = 1; //ֽ + public const int DATASTREAM_KEYFRAME = 2; //ؼ֡ + public const int DATASTREAM_NORMALFRAME = 3; //ǹؼ֡ + + + public const int MESSAGEVALUE_DISKFULL = 0x01; + public const int MESSAGEVALUE_SWITCHDISK = 0x02; + public const int MESSAGEVALUE_CREATEFILE = 0x03; + public const int MESSAGEVALUE_DELETEFILE = 0x04; + public const int MESSAGEVALUE_SWITCHFILE = 0x05; + + + + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct STOREINFO + { + public int iMaxChannels; + public int iDiskGroup; + public int iStreamType; + public bool bAnalyze; + public bool bCycWrite; + public uint uiFileSize; + + public CALLBACKFUN_MESSAGE funCallback; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct CREATEFILE_INFO + { + public int iHandle; + + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string strCameraid; + + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string strFileName; + + public BLOCKTIME tFileCreateTime; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + public struct CLOSEFILE_INFO + { + public int iHandle; + + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string strCameraid; + + [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 128)] + public string strFileName; + + public BLOCKTIME tFileSwitchTime; + } + + + + public delegate int CALLBACKFUN_MESSAGE(int iMessageType, System.IntPtr pBuf, int iBufLen); + + + [DllImport("RecordDLL.dll")] + public static extern int Initialize(STOREINFO struStoreInfo); + + [DllImport("RecordDLL.dll")] + public static extern int Release(); + + [DllImport("RecordDLL.dll")] + public static extern int OpenChannelRecord(string strCameraid, IntPtr pHead, uint dwHeadLength); + + [DllImport("RecordDLL.dll")] + public static extern bool CloseChannelRecord(int iRecordHandle); + + [DllImport("RecordDLL.dll")] + public static extern int GetData(int iHandle, int iDataType, IntPtr pBuf, uint uiSize); + + #endregion + } +} diff --git a/Camera/CHNetHelp.cs b/Camera/CHNetHelp.cs new file mode 100644 index 0000000..c3974db --- /dev/null +++ b/Camera/CHNetHelp.cs @@ -0,0 +1,514 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using static Guidaoji.Camera.CHCNetSDK; + +namespace Guidaoji.Camera +{ + public class CHNetHelp + { + private int counter = 0; + private static CHNetHelp _instance; + // 私有构造函数以防止外部实例化 + public CHNetHelp() { } + //海康辅助函数:add by lee start + private static uint iLastErr = 0; + private static Int32 m_lUserID = -1; + private static bool m_bInitSDK = false; + private static bool m_bRecord = false; + private static bool m_bTalk = false; + private static Int32 m_lRealHandle = -1;//m_lRealHandle + private static int lVoiceComHandle = -1; + private static string str; + //相机参数通过PtzGet()获得 + private static float WPanPos, WTiltPos, WZoomPos; + private static bool m_param_get_flag = false;//当获取成功后设置为true + private static int[] iChannelNum = new int[96]; + + // 公共静态方法用于获取类的实例 + public static CHNetHelp GetInstance() + { + if (_instance == null) + { + _instance = new CHNetHelp(); + } + return _instance; + } + + + //登录相关 + static CHCNetSDK.REALDATACALLBACK RealData = null; + static CHCNetSDK.LOGINRESULTCALLBACK LoginCallBack = null; + public static CHCNetSDK.NET_DVR_PTZPOS m_struPtzCfg; + public static CHCNetSDK.NET_DVR_USER_LOGIN_INFO struLogInfo; + public static CHCNetSDK.NET_DVR_DEVICEINFO_V40 DeviceInfo; + + public delegate void UpdateTextStatusCallback(string strLogStatus, IntPtr lpDeviceInfo); + + //云台相关 + private bool bAuto = false; + //private uint iLastErr = 0; + public static int PreSetNo = 0; + //public CHCNetSDK.NET_DVR_PTZPOS m_struPtzCfg; + public static CHCNetSDK.NET_DVR_PTZSCOPE m_struPtzCfg1; + public static CHCNetSDK.NET_DVR_PRESET_NAME[] m_struPreSetCfg = new CHCNetSDK.NET_DVR_PRESET_NAME[300]; + + public static void cbLoginCallBack(int lUserID, int dwResult, IntPtr lpDeviceInfo, IntPtr pUser) + { + string strLoginCallBack = "登录设备,lUserID:" + lUserID + ",dwResult:" + dwResult; + + if (dwResult == 0) + { + uint iErrCode = CHCNetSDK.NET_DVR_GetLastError(); + strLoginCallBack = strLoginCallBack + ",错误号:" + iErrCode; + } + } + + //初始化并用固定IP的登录 + public static bool CameraInit(string sIP, string sPassword) + { + PrintInfo("登录....."); + for (int i = 0; i < 64; i++) + { + iChannelNum[i] = i; + } + m_bInitSDK = CHCNetSDK.NET_DVR_Init(); + if (m_bInitSDK == false) + { + //MessageBox.Show("NET_DVR_Init error!"); + return false; + } + else + { + //保存SDK日志 To save the SDK log + CHCNetSDK.NET_DVR_SetLogToFile(3, "C:\\SdkLog\\", true); + } + //MessageBox.Show("camera Init m_bInitSDK=="+ m_bInitSDK); + + //登录 + // 固定的设备IP地址192.168.10.102 + string fixedIP = sIP; + byte[] byIP = System.Text.Encoding.Default.GetBytes(fixedIP); + struLogInfo.sDeviceAddress = new byte[129]; + byIP.CopyTo(struLogInfo.sDeviceAddress, 0); + + //设备用户名 + string fixedName = "admin"; + byte[] byUserName = System.Text.Encoding.Default.GetBytes(fixedName); + struLogInfo.sUserName = new byte[64]; + byUserName.CopyTo(struLogInfo.sUserName, 0); + + //设备密码ch123456 + string fixedPassword = sPassword; + byte[] byPassword = System.Text.Encoding.Default.GetBytes(fixedPassword); + struLogInfo.sPassword = new byte[64]; + byPassword.CopyTo(struLogInfo.sPassword, 0); + + struLogInfo.wPort = ushort.Parse("8000");//设备服务端口号 + if (LoginCallBack == null) + { + LoginCallBack = new CHCNetSDK.LOGINRESULTCALLBACK(cbLoginCallBack);//注册回调函数 + } + struLogInfo.cbLoginResult = LoginCallBack; + struLogInfo.bUseAsynLogin = false; //是否异步登录:0- 否,1- 是 + DeviceInfo = new CHCNetSDK.NET_DVR_DEVICEINFO_V40(); + + //登录设备 Login the device + m_lUserID = CHCNetSDK.NET_DVR_Login_V40(ref struLogInfo, ref DeviceInfo); + if (m_lUserID < 0) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_Login_V40 failed, error code= " + iLastErr; //登录失败,输出错误号 + //MessageBox.Show(str); + } + else + { + //登录成功 + //MessageBox.Show("Login Success!"); + } + PrintInfo("登录结束....."); + return true; + } + + //显示视频画面 + //public static void StartStopLiveView(System.Windows.Forms.Panel panel, string channel, bool isStreamID = false, string streamID = "") + //{ + // if (m_lUserID < 0) + // { + // MessageBox.Show("Please login to the device first."); + // return; + // } + + // if (m_lRealHandle < 0) + // { + // CHCNetSDK.NET_DVR_PREVIEWINFO lpPreviewInfo = new CHCNetSDK.NET_DVR_PREVIEWINFO(); + // lpPreviewInfo.hPlayWnd = panel.Handle; // 预览窗口 + // lpPreviewInfo.lChannel = Int16.Parse(channel); // 预览的设备通道 + + // lpPreviewInfo.dwStreamType = 0;//码流类型:0-主码流,1-子码流,2-码流3,3-码流4,以此类推 + // lpPreviewInfo.dwLinkMode = 0;//连接方式:0- TCP方式,1- UDP方式,2- 多播方式,3- RTP方式,4-RTP/RTSP,5-RSTP/HTTP + // lpPreviewInfo.bBlocked = true; //0- 非阻塞取流,1- 阻塞取流 + // lpPreviewInfo.dwDisplayBufNum = 1; //播放库播放缓冲区最大缓冲帧数 + // lpPreviewInfo.byProtoType = 0; + // lpPreviewInfo.byPreviewMode = 0; + + // if (isStreamID) + // { + // lpPreviewInfo.lChannel = -1; + // byte[] byStreamID = System.Text.Encoding.Default.GetBytes(streamID); + // lpPreviewInfo.byStreamID = new byte[32]; + // byStreamID.CopyTo(lpPreviewInfo.byStreamID, 0); + // } + + // // ... 实时流回调函数和预览逻辑 ... + // if (RealData == null) + // { + // RealData = new CHCNetSDK.REALDATACALLBACK(RealDataCallBack);//预览实时流回调函数 + // } + + // m_lRealHandle = CHCNetSDK.NET_DVR_RealPlay_V40(m_lUserID, ref lpPreviewInfo, RealData, IntPtr.Zero); + // if (m_lRealHandle < 0) + // { + // // ... 处理预览失败逻辑 ... + // iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + // str = "NET_DVR_RealPlay_V40 failed, error code= " + iLastErr; //预览失败,输出错误号 + // MessageBox.Show(str); + // return; + // } + // } + // else + // { + // // 停止预览 + // if (CHCNetSDK.NET_DVR_StopRealPlay(m_lRealHandle)) + // { + // m_lRealHandle = -1; + // } + // else + // { + // // ... 处理停止预览失败逻辑 ... + // } + // } + //} + + //你可以定义一个方法 RealDataCallBack,它将在有新的视频数据到达时被调用。 + public static void RealDataCallBack(Int32 lRealHandle, UInt32 dwDataType, IntPtr pBuffer, UInt32 dwBufSize, IntPtr pUser) + { + if (dwBufSize > 0) + { + byte[] sData = new byte[dwBufSize]; + Marshal.Copy(pBuffer, sData, 0, (Int32)dwBufSize); + + string str = "实时流数据.ps"; + FileStream fs = new FileStream(str, FileMode.Create); + int iLen = (int)dwBufSize; + fs.Write(sData, 0, iLen); + fs.Close(); + } + } + + /// + /// 抓拍并保存图片 + /// + /// 选择通道 + /// 照片存放路径 + /// + + public static bool JPEG(int iSelIndex, string sFilePath) + { + PrintInfo("抓图开始....."); + int lChannel = iChannelNum[iSelIndex]; //通道号 Channel number + + CHCNetSDK.NET_DVR_JPEGPARA lpJpegPara = new CHCNetSDK.NET_DVR_JPEGPARA(); + lpJpegPara.wPicQuality = 0; //图像质量 Image quality + lpJpegPara.wPicSize = 0xff; //抓图分辨率 Picture size: 0xff-Auto(使用当前码流分辨率) + //抓图分辨率需要设备支持,更多取值请参考SDK文档 + + //JPEG抓图保存成文件 Capture a JPEG picture + //string sJpegPicFileName; + //sJpegPicFileName = "filetest.jpg";//图片保存路径和文件名 the path and file name to save + if (!CHCNetSDK.NET_DVR_CaptureJPEGPicture(m_lUserID, lChannel, ref lpJpegPara, sFilePath)) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_CaptureJPEGPicture failed, error code= " + iLastErr; + PrintInfo(str); + return false; + } + else + { + str = "NET_DVR_CaptureJPEGPicture succ and the saved file is " + sFilePath; + PrintInfo(str); + } + + //JEPG抓图,数据保存在缓冲区中 Capture a JPEG picture and save in the buffer + uint iBuffSize = 400000; //缓冲区大小需要不小于一张图片数据的大小 The buffer size should not be less than the picture size + byte[] byJpegPicBuffer = new byte[iBuffSize]; + uint dwSizeReturned = 0; + + if (!CHCNetSDK.NET_DVR_CaptureJPEGPicture_NEW(m_lUserID, lChannel, ref lpJpegPara, byJpegPicBuffer, iBuffSize, ref dwSizeReturned)) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_CaptureJPEGPicture_NEW failed, error code= " + iLastErr; + PrintInfo(str); + return false; + } + else + { + //将缓冲区里的JPEG图片数据写入文件 save the data into a file + FileStream fs = new FileStream(sFilePath, FileMode.Create); + int iLen = (int)dwSizeReturned; + fs.Write(byJpegPicBuffer, 0, iLen); + fs.Close(); + + str = "NET_DVR_CaptureJPEGPicture_NEW succ and save the data in buffer to 'buffertest.jpg'."; + PrintInfo(str); + } + PrintInfo("抓图结束....."); + return true; + } + + /// + /// 设置摄像头移动 + /// + /// 运动类型 + /// 水平移动 + /// 垂直移动 + /// 焦距 + public static bool PtzSet(OperationType operationType, float fP, float fT, float fZ) + { + PrintInfo("摄像头移动开始....."); + int flag = 1; + String str1, str2, str3; + + switch ((int)operationType)//操作类型 + { + case 0: + flag = 0; + m_struPtzCfg.wAction = 1; + + str1 = Convert.ToString(fP * 10); + m_struPtzCfg.wPanPos = (ushort)(Convert.ToUInt16(str1, 16)); + str2 = Convert.ToString(fT * 10); + m_struPtzCfg.wTiltPos = (ushort)(Convert.ToUInt16(str2, 16)); + str3 = Convert.ToString(fZ * 10); + m_struPtzCfg.wZoomPos = (ushort)(Convert.ToUInt16(str3, 16)); + break; + case 1: + flag = 0; + m_struPtzCfg.wAction = 2; + + str1 = Convert.ToString(fP * 10); + m_struPtzCfg.wPanPos = (ushort)(Convert.ToUInt16(str1, 16)); + break; + case 2: + flag = 0; + m_struPtzCfg.wAction = 3; + + str2 = Convert.ToString(fT * 10); + m_struPtzCfg.wTiltPos = (ushort)(Convert.ToUInt16(str2, 16)); + break; + case 3: + flag = 0; + m_struPtzCfg.wAction = 4; + + str3 = Convert.ToString(fZ * 10); + m_struPtzCfg.wZoomPos = (ushort)(Convert.ToUInt16(str3, 16)); + break; + case 4: + flag = 0; + m_struPtzCfg.wAction = 5; + + str1 = Convert.ToString(fP * 10); + m_struPtzCfg.wPanPos = (ushort)(Convert.ToUInt16(str1, 16)); + str2 = Convert.ToString(fT * 10); + m_struPtzCfg.wTiltPos = (ushort)(Convert.ToUInt16(str2, 16)); + break; + } + + bool bFlag = false; + if (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)) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_SetDVRConfig failed, error code= " + iLastErr; + //设置POS参数失败 + //MessageBox.Show(str); + } + else + { + bFlag = true; + //MessageBox.Show("设置成功!"); + } + Marshal.FreeHGlobal(ptrPtzCfg); + } + PrintInfo("摄像头移动结束....."); + return bFlag; + } + + //获取相机焦距位置相关,P,T(ilt),zoom,m_param_get_flag 设置为true; + public static float[] PtzGet() + { + float[] ret = { -1F, -1F, -1F }; + UInt32 dwReturn = 0; + Int32 nSize = Marshal.SizeOf(m_struPtzCfg); + IntPtr ptrPtzCfg = Marshal.AllocHGlobal(nSize); + Marshal.StructureToPtr(m_struPtzCfg, ptrPtzCfg, false); + //获取参数失败 + if (!CHCNetSDK.NET_DVR_GetDVRConfig(m_lUserID, CHCNetSDK.NET_DVR_GET_PTZPOS, -1, ptrPtzCfg, (UInt32)nSize, ref dwReturn)) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_GetDVRConfig failed, error code= " + iLastErr; + //MessageBox.Show(str); + return ret; + } + else + { + m_struPtzCfg = (CHCNetSDK.NET_DVR_PTZPOS)Marshal.PtrToStructure(ptrPtzCfg, typeof(CHCNetSDK.NET_DVR_PTZPOS)); + //成功获取显示ptz参数 + ushort wPanPos = Convert.ToUInt16(Convert.ToString(m_struPtzCfg.wPanPos, 16)); + ret[0] = WPanPos = wPanPos * 0.1f; + //textBoxPanPos.Text = Convert.ToString(WPanPos); + ushort wTiltPos = Convert.ToUInt16(Convert.ToString(m_struPtzCfg.wTiltPos, 16)); + ret[1] = WTiltPos = wTiltPos * 0.1f; + // textBoxTiltPos.Text = Convert.ToString(WTiltPos); + ushort wZoomPos = Convert.ToUInt16(Convert.ToString(m_struPtzCfg.wZoomPos, 16)); + ret[2] = WZoomPos = wZoomPos * 0.1f; + //textBoxZoomPos.Text = Convert.ToString(WZoomPos); + m_param_get_flag = true; + return ret; + } + + } + + /// + /// 保存录像 + /// + /// true:开始录像;false:停止录像 + /// 选择通道 + /// 视频保存路径 + public static bool SaveViedo(bool bTranscribe, int iSelIndex, string sViedoPath) + { + PrintInfo(sViedoPath); + if (bTranscribe == true) + { + PrintInfo("保存录像开始....."); + //强制I帧 Make one key frame + int lChannel = iChannelNum[iSelIndex]; //通道号 Channel number + CHCNetSDK.NET_DVR_MakeKeyFrame(m_lUserID, lChannel); + + //开始录像 Start recording + if (!CHCNetSDK.NET_DVR_SaveRealData(m_lRealHandle, sViedoPath)) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_SaveRealData failed, error code= " + iLastErr; + PrintInfo(str); + return false; + } + else + { + PrintInfo("NET_DVR_SaveRealData succ!"); + return true; + } + } + else + { + PrintInfo("保存录像结束....."); + //停止录像 Stop recording + if (!CHCNetSDK.NET_DVR_StopSaveRealData(m_lRealHandle)) + { + iLastErr = CHCNetSDK.NET_DVR_GetLastError(); + str = "NET_DVR_StopSaveRealData failed, error code= " + iLastErr; + PrintInfo(str); + return false; + } + else + { + str = "NET_DVR_StopSaveRealData succ and the saved file is " + sViedoPath; + PrintInfo(str); + return true; + } + } + } + + /// + /// 移动摄像头过程 + /// + /// 控制类型 + /// 水平移动 + /// 垂直移动 + /// 焦距 + /// 选择通道 + /// 抓拍路径 + /// + public static bool SetCameraProcess(OperationType operationType, float fP, float fT, float fZ, int iSelIndex, string sFilePath) + { + //移动摄像头 + if (PtzSet(operationType, fP, fT, fZ)) + { + while (true) + { + float[] fCameraPose = PtzGet(); + if (fCameraPose[0] == fP && fCameraPose[1] == fT && fCameraPose[2] == fZ) + { + break; + } + Thread.Sleep(100); + } + //拍照 + if (JPEG(iSelIndex, sFilePath)) + return true; + else return false; + } + else + return false; + } + + public static void PrintInfo(string str) + { + string Folder = Environment.CurrentDirectory + @"\Logs"; + string FileNamme = Environment.CurrentDirectory + @"\Logs\Info_" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + if (!System.IO.Directory.Exists(Folder)) + { + System.IO.Directory.CreateDirectory(Folder); + } + using (TextWriter fw = new StreamWriter(FileNamme, true)) + { + try + { + FileInfo fi = new FileInfo(FileNamme); + fw.WriteLine(str); + } + catch (Exception ex) + { + fw.WriteLine(ex.Message); + } + finally + { + fw.Close(); + fw.Dispose(); + } + } + } + } + + /// + /// 操作类型 + /// + public enum OperationType + { + PTZ, //倾斜+焦距 + P, //水平运动 + T, //上下运动 + Z, //焦距 + PT //倾斜运动 + } +} diff --git a/Common/TcpClientWrapper.cs b/Common/TcpClientWrapper.cs new file mode 100644 index 0000000..f40e1a8 --- /dev/null +++ b/Common/TcpClientWrapper.cs @@ -0,0 +1,1440 @@ +using Guidaoji.Camera; +using Newtonsoft.Json.Linq; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +//using System.DirectoryServices; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Text.Encodings.Web; +using System.Text.Json; +using System.Text.RegularExpressions; +using System.Text.Unicode; +using System.Threading; +using System.Threading.Tasks; +using System.Xml.Linq; +using static Guidaoji.Camera.CHCNetSDK.NET_DVR_WIFI_CFG_EX; +//using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace Guidaoji.Common +{ + internal class TcpClientWrapper + { + public static Socket socket_commu; + public GuiDaoJi guiDaoJi = new GuiDaoJi(); + //接收Json串 + public static string sRetResule = null; + //位置 + public static string[] dPos = { "0", "0" }; + //连接成功标志 + private static bool bConnect = false; + //轨道机返回对象 + private static GuiDaoJiRet readAndSetRet = new GuiDaoJiRet(); + //轨道机返回Upload对象 + public static GuiDaoJiRet uploadRet = new GuiDaoJiRet(); + //alarm对象 + private static GuiDaoJiRet alarmRet = new GuiDaoJiRet(); + + //轨道机客户端IP 192.168.10.119 117.172.225.193 + private static string sGuidaojiClientIP = "192.168.10.119"; + private static int iGuidaojiClientPort = 20000; + //客户端IP + //private static string sClientIP = "192.168.10.104"; + private static string sClientIP = "192.168.1.142"; + private static int iClientPort = 20001; + //客户端1IP + private static string sUnityClientIP = ""; + private static int iUnityClientPort = 20002; + private static Dictionary dict = new Dictionary(); + + public static void Socket(string ip, int port) + { + PrintInfo("Socket is begin......"); + Socket server_socketListen = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + //server_socketListen.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); + + //IPAddress ips = IPAddress.Parse("192.168.10.36"); + //IPEndPoint ipNode = new IPEndPoint(ips, 20000);//网络端点:为IP地址和端口号 + // //服务端必须绑定一个端口才能listen(),要不然客户端就不知道该连哪个端口了 + //byte[] b = { 0x00, 0x6d }; + //int I = BitConverter.ToInt16(FZ(b)); + IPAddress ips = IPAddress.Parse(ip); + IPEndPoint ipNode = new IPEndPoint(ips, port); + try + { + server_socketListen.Bind(ipNode); + PrintInfo("服务器已启动......"); + sClientIP = ip; + //监听后,如果客户端这时调用connect()发出连接请求,服务器端就会接收到这个请求 + //listen函数将socket变为被动类型的,等待客户的连接请求。 + server_socketListen.Listen(10); + + //开启线程监听客户端 + Thread t = new Thread(Execute); + t.IsBackground = true; + t.Start(server_socketListen); + PrintInfo("服务器启动监听成功!"); + } + catch (Exception ex) + { + PrintInfo(ex.ToString()); + } + } + + /// + /// 监听客户端线程 + /// + /// + private static void Execute(System.Object obj) + { + Socket server = (Socket)obj; + while (true) + { + //服务端有两个socket;这里Accept()返回的相当于是客户端的socket,用于和客户端发送(send)和接收(recv)数据 + PrintInfo("等待客户端连接......"); + Socket client = server.Accept(); + //客户端IP和端口号 + string clientIP = client.RemoteEndPoint == null ? "" : client.RemoteEndPoint.ToString(); + clientIP = clientIP.Substring(0, clientIP.LastIndexOf(':')); + int clientPort = ((IPEndPoint)client.RemoteEndPoint).Port; + // 将与客户端连接的 套接字 对象添加到集合中; + dict.Add(clientPort, client); + PrintInfo(string.Format("客户端连接成功!IP:{0},端口号:{1}", clientIP, clientPort)); + Console.WriteLine(string.Format("客户端连接成功!IP:{0},端口号:{1}", clientIP, clientPort)); + + if (clientPort == iClientPort) + { + bConnect = true; + Console.WriteLine("连接成功"); + PrintInfo("客户端连接成功连接成功......"); + PrintInfo("Socket is end......"); + Thread t = new Thread(ClientExecute); + t.IsBackground = true; + t.Start(client); + } + else if (clientPort == iUnityClientPort) + { + bConnect = true; + Console.WriteLine("连接成功"); + PrintInfo("客户端连接成功连接成功......"); + PrintInfo("Socket is end......"); + Thread t = new Thread(UnityClientExecute); + t.IsBackground = true; + t.Start(client); + } + else + { + byte[] buffer = new byte[1024]; + int count = client.Receive(buffer); + if (buffer[0] == 0x43 && buffer[1] == 0x48) + { + bConnect = true; + iGuidaojiClientPort = clientPort; + Console.WriteLine("连接成功"); + PrintInfo("客户端连接成功连接成功......"); + PrintInfo("Socket is end......"); + Thread t = new Thread(GuidaojiExecute); + t.IsBackground = true; + t.Start(client); + } + } + } + } + + + /// + /// 接收轨道机客户端数据 + /// + /// + private static void GuidaojiExecute(object obj) + { + PrintInfo("GuidaojiExecute(object obj) is begin"); + Socket client = (Socket)obj; + try + { + while (true) + { + byte[] buffer = new byte[1024]; + int count = client.Receive(buffer); + Thread.Sleep(100); + //连接断开 + if (count == 0) + { + //删除字典组中的socket + if (dict.Any(kvp => kvp.Key == iGuidaojiClientPort)) + { + DeleteValue(iGuidaojiClientPort); + } + break; + } + if (count > 0) + { + //校验包头 + if (buffer[0] == 0x43 && buffer[1] == 0x48) + { + PrintInfo("校验包头成功"); + //校验长度 + byte[] length = new byte[2]; + Array.Copy(buffer, 2, length, 0, 2); + PrintByte("接收长度:" + count + ";长度:", length); + PrintInfo("接收长度:" + count + ";长度:" + BitConverter.ToInt16(FZ(length),0)); + int iCount = (int)BitConverter.ToInt16(FZ(length),0); + short sCount = BitConverter.ToInt16(FZ(length),0); + iCount = sCount; + if (count == iCount) + { + PrintInfo("校验长度成功"); + // 计算校验码 + byte[] data = new byte[count - 2]; + Array.Copy(buffer, 0, data, 0, count - 2); + ushort checkBit = ModbusCRC16.CalculateCrc(data); + PrintByte("校验码:", data); + //判断校验码 + //if ((byte)checkBit == buffer[count - 2] && (byte)(checkBit >> 8) == buffer[count - 1]) + if ((byte)checkBit == buffer[count - 1] && (byte)(checkBit >> 8) == buffer[count - 2]) + { + PrintInfo("校验码成功"); + //判断设备地址 + //todo + //处理数据 + try + { + //提取Json数据 + string jsonResult = Encoding.UTF8.GetString(data, 8, count - 10); + PrintInfo("接收唐山客户端数据:", jsonResult); + //将JSON解析为指定类型的对象 + var guiDaoJiRetTemp = JsonSerializer.Deserialize(jsonResult); + if (guiDaoJiRetTemp != null) + { + //取出在轨道机接收到的数据 + byte[] receiveData = new byte[count]; + Array.Copy(buffer, 0, receiveData, 0, count); + + if (guiDaoJiRetTemp.action == "upload") + { + //自动应答 + byte[] senddata = SendDataUpload(); + uploadRet = guiDaoJiRetTemp; + + //分别给唐山客户端、unity客户端转发数据 + if (dict.Any(kvp => kvp.Key == iClientPort)) + { + dict[iClientPort].Send(receiveData); + PrintInfo("Send to Client :", Encoding.UTF8.GetString(receiveData)); + } + if (dict.Any(kvp => kvp.Key == iUnityClientPort)) + { + dict[iUnityClientPort].Send(receiveData); + PrintInfo("Send to UnityClient :", Encoding.UTF8.GetString(receiveData)); + } + } + else if (guiDaoJiRetTemp.action == "set" || guiDaoJiRetTemp.action == "read") + { + readAndSetRet = guiDaoJiRetTemp; + PrintInfo("存放到服务器数据:", readAndSetRet.uid + ":" + readAndSetRet.data.y); + } + } + } + catch (Exception ex) + { + PrintInfo("ClientExecute(object obj) is end false", ex.Message); + //MessageBox.Show(ex.Message); + continue; + } + } + } + } + } + } + } + catch (Exception ex) + { + DeleteValue(iGuidaojiClientPort); + PrintInfo("ClientExecute(object obj) is end false", ex.Message); + //MessageBox.Show(ex.Message); + } + } + + /// + /// 接收唐山客户端数据 + /// + /// + private static void ClientExecute(object obj) + { + PrintInfo("ClientExecute(object obj) is begin"); + Socket client = (Socket)obj; + try + { + while (true) + { + byte[] buffer = new byte[1024]; + int count = client.Receive(buffer); + Thread.Sleep(100); + //连接断开 + if (count == 0) + { + //删除字典组中的socket + if (dict.Any(kvp => kvp.Key == iClientPort)) + { + DeleteValue(iClientPort); + } + break; + } + + PrintInfo("接收唐山客户端数据:", Encoding.UTF8.GetString(buffer, 0, count)); + PrintByte("接收唐山客户端数据:", buffer); + if (count == 1) + { + char cCommand = Convert.ToChar(buffer[0]); + switch (cCommand) + { + case (char)ControlCommands.F: //前进 + GuiDaoFOrB(600); + break; + case (char)ControlCommands.B: //后退 + GuiDaoFOrB(0); + break; + case (char)ControlCommands.U: //上升 + GuiDaoJiUOrD(0); + break; + case (char)ControlCommands.D: //下降 + GuiDaoJiUOrD(28); + break; + case (char)ControlCommands.S: //停止 + GuiDaoJiStop(); + break; + case (char)ControlCommands.R: //位置复位 + SendReturn(); + break; + case (char)ControlCommands.E: //故障复位 + SendReset(); + break; + default: break; + } + } + else if (count > 1) + { + //校验包头 + if (buffer[0] == 0x43 && buffer[1] == 0x48) + { + PrintInfo("校验包头成功"); + //校验长度 + byte[] length = new byte[2]; + Array.Copy(buffer, 2, length, 0, 2); + PrintByte("接收长度:" + count + ";长度:", length); + PrintInfo("接收长度:" + count + ";长度:" + BitConverter.ToInt16(FZ(length), 0)); + int iCount = (int)BitConverter.ToInt16(FZ(length), 0); + short sCount = BitConverter.ToInt16(FZ(length),0); + iCount = sCount; + if (count == iCount) + { + PrintInfo("校验长度成功"); + // 计算校验码 + byte[] data = new byte[count - 2]; + Array.Copy(buffer, 0, data, 0, count - 2); + ushort checkBit = ModbusCRC16.CalculateCrc(data); + PrintByte("校验码:", data); + //判断校验码 + //if ((byte)checkBit == buffer[count - 2] && (byte)(checkBit >> 8) == buffer[count - 1]) + if ((byte)checkBit == buffer[count - 1] && (byte)(checkBit >> 8) == buffer[count - 2]) + { + PrintInfo("校验码成功"); + //判断设备地址 + //todo + //处理数据 + try + { + //提取Json数据 + string jsonResult = Encoding.UTF8.GetString(data, 8, count - 10); + PrintInfo("接收唐山客户端数据:", jsonResult); + //将JSON解析为指定类型的对象 + var guiDaoJiRetTemp = JsonSerializer.Deserialize(jsonResult); + if (guiDaoJiRetTemp != null && guiDaoJiRetTemp.action == "alarm") + { + alarmRet = guiDaoJiRetTemp; + } + } + catch (Exception ex) + { + PrintInfo("ClientExecute(object obj) is end false", ex.Message); + //MessageBox.Show(ex.Message); + continue; + } + } + } + } + } + } + } + catch (Exception ex) + { + DeleteValue(iClientPort); + PrintInfo("ClientExecute(object obj) is end false", ex.Message); + //MessageBox.Show(ex.Message); + } + } + + /// + /// 接收Unity客户端数据 + /// + /// + private static void UnityClientExecute(object obj) + { + PrintInfo("UnityClientExecute(object obj) is begin"); + Socket client = (Socket)obj; + try + { + while (true) + { + byte[] buffer = new byte[1024]; + int count = client.Receive(buffer); + //连接断开 + if (count == 0) + { + //删除字典组中的socket + if (dict.Any(kvp => kvp.Key == iUnityClientPort)) + { + DeleteValue(iUnityClientPort); + } + break; + } + if (count > 0) + { + //将接收到的数据转换为字符串 + string response = Encoding.UTF8.GetString(buffer, 0, count); + //获取Json数据的起始位置和长度 + int startIndex = response.IndexOf('{'); + int endIndex = response.LastIndexOf('}'); + int jsonLength = endIndex - startIndex + 1; + //提取Json数据 + string jsonResult = response.Substring(startIndex, jsonLength); + //将JSON解析为指定类型的对象 + try + { + var guiDaoJiRetTemp = JsonSerializer.Deserialize(jsonResult); + if (guiDaoJiRetTemp != null) + { + if (guiDaoJiRetTemp.action == "upload") + { + //自动应答 + byte[] senddata = SendDataUpload(); + if (senddata != null) + { + if (dict.Any(kvp => kvp.Key == iUnityClientPort)) + { + dict[iUnityClientPort].Send(senddata); + PrintInfo("Send to UnityClient:", Encoding.UTF8.GetString(senddata, 0, senddata.Length)); + } + } + } + } + } + catch (Exception ex) + { + PrintInfo("UnityClientExecute(object obj) is end false", ex.Message); + //MessageBox.Show(ex.Message); + break; + } + } + + } + } + catch (Exception ex) + { + DeleteValue(iUnityClientPort); + PrintInfo("UnityClientExecute(object obj) is end false", ex.Message); + //MessageBox.Show(ex.Message); + } + } + + /// + /// 读轨道机位置 + /// + /// + public static GuiDaoJiRet SendDataRead() + { + PrintInfo("SendDataRead() is begin"); + string uid = "XJ00001"; + string action = "read"; + DateTime date = DateTime.Now; + string fort = date.ToString("yyyy-MM-dd HH:mm:ss"); + Console.WriteLine(fort); + // 创建JSON数据对象 + var json = new + { + uid = uid, + action = action, + date = fort + }; + + // 将JSON数据对象序列化为字符串 + var options = new JsonSerializerOptions { WriteIndented = true }; + string jsonString = JsonSerializer.Serialize(json, options); + Console.WriteLine(jsonString); + // 将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + + // 定义包头和设备地址 + ushort baoTou = 0x4348; + ushort ADDR1 = 0x7; + ushort ADDR2 = 0xc925; + + // 计算数据长度 + ushort length = (ushort)(10 + dataBytes.Length); + Console.WriteLine(length); + // 将数据长度转换为字节数组并存储到集合中 + List numberBytesList = new List(); + + numberBytesList.AddRange(FZ(baoTou)); + numberBytesList.AddRange(FZ(length)); + numberBytesList.AddRange(FZ(ADDR1)); + numberBytesList.AddRange(FZ(ADDR2)); + + numberBytesList.AddRange(dataBytes); + //// 将包头、数据长度、设备地址和校验码组合成一个完整的字节数组 + //List combineBytes = new List(); + //foreach (var item in numberBytesList) + //{ + // combineBytes.Add(item); + //} + //var hex = BitConverter.ToString(dataBytes, 0).Replace("-", string.Empty).ToLower(); + //Console.WriteLine(hex); + byte[] Bytes = numberBytesList.ToArray(); + + // 计算校验码 + ushort checkBit = ModbusCRC16.CalculateCrc(Bytes); + byte[] ushortBytes = BitConverter.GetBytes(checkBit); + + numberBytesList.AddRange(FZ(checkBit)); + byte[] data = numberBytesList.ToArray(); + var hex = BitConverter.ToString(data, 0).Replace("-", string.Empty).ToLower(); + Console.WriteLine(hex); + + + // 将字节数组转换为大端字节序 + //var finalBytes = Bytes.SelectMany(i => BitConverter.GetBytes(i)).ToArray(); + if (BitConverter.IsLittleEndian) + { + // 发送数据 + PrintInfo("Send data:", Encoding.UTF8.GetString(data, 0, data.Length)); + return (SendDataRead(data)); + } + PrintInfo("SendDataRead() is end false"); + return null; + } + + public static bool SendDataSet(GuiDaoJiSet guiDaoJiSet) + { + PrintInfo("SendDataSet(GuiDaoJi guiDaoJi) is begin"); + + // 将JSON数据对象序列化为字符串 + var options = new JsonSerializerOptions { Encoder = JavaScriptEncoder.Create(UnicodeRanges.All) }; + string jsonString = JsonSerializer.Serialize(guiDaoJiSet, options); + PrintInfo("Json串:" + jsonString); + + // 将JSON字符串转换为字节数组 + // 将字符串转换为GB2312编码的字节数组 + //注册 + Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); + Encoding gb2312 = Encoding.GetEncoding("GB2312"); + byte[] dataBytes = gb2312.GetBytes(jsonString); + //byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + PrintByte("---", dataBytes); + + // 定义包头和设备地址 + ushort baoTou = 0x4348; + ushort ADDR1 = 0x7; + ushort ADDR2 = 0xc925; + + // 计算数据长度 + int ushortSize = sizeof(ushort); + int totalUshortSize = 2 * ushortSize; + ushort length = (ushort)(10 + dataBytes.Length); + + // 将数据长度转换为字节数组并存储到集合中 + List numberBytesList = new List(); + + numberBytesList.AddRange(FZ(baoTou)); + numberBytesList.AddRange(FZ(length)); + numberBytesList.AddRange(FZ(ADDR1)); + numberBytesList.AddRange(FZ(ADDR2)); + + //// 将包头、数据长度、设备地址和校验码组合成一个完整的字节数组 + //List combineBytes = new List(); + //foreach (var item in numberBytesList) + //{ + // combineBytes.Add(item); + //} + numberBytesList.AddRange(dataBytes); + //var hex = BitConverter.ToString(dataBytes, 0).Replace("-", string.Empty).ToLower(); + //Console.WriteLine(hex); + byte[] Bytes = numberBytesList.ToArray(); + + // 计算校验码 + ushort checkBit = ModbusCRC16.CalculateCrc(Bytes); + + // 将校验码转换为字节数组 + byte[] ushortBytes = BitConverter.GetBytes(checkBit); + + numberBytesList.AddRange(FZ(checkBit)); + byte[] data = numberBytesList.ToArray(); + var hex = BitConverter.ToString(data, 0).Replace("-", string.Empty).ToLower(); + Console.WriteLine(hex); + + + // 将字节数组转换为大端字节序 + //var finalBytes = Bytes.SelectMany(i => BitConverter.GetBytes(i)).ToArray(); + if (BitConverter.IsLittleEndian) + { + // 发送数据 + if (SendDataSet(data) != null) + { + PrintInfo("SendDataSet(GuiDaoJi guiDaoJi) is end true"); + return true; + } + } + PrintInfo("SendDataSet(GuiDaoJi guiDaoJi) is end false"); + return false; + } + public static byte[] SendDataUpload() + { + PrintInfo("SendDataUpload() is begin"); + string uid = "XJ00001"; + string action = "upload"; + string result = "OK"; + string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + // 创建JSON数据对象 + var json = new + { + uid = uid, + action = action, + date = date, + result = result + }; + + // 将JSON数据对象序列化为字符串 + var options = new JsonSerializerOptions { WriteIndented = true }; + string jsonString = JsonSerializer.Serialize(json, options); + + // 将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + + // 定义包头和设备地址 + ushort baoTou = 0x4348; + ushort ADDR1 = 0x7; + ushort ADDR2 = 0xc925; + + // 计算数据长度 + int ushortSize = sizeof(ushort); + int totalUshortSize = 2 * ushortSize; + ushort length = (ushort)(10 + dataBytes.Length); + + // 将数据长度转换为字节数组并存储到集合中 + List numberBytesList = new List(); + + numberBytesList.AddRange(FZ(baoTou)); + numberBytesList.AddRange(FZ(length)); + numberBytesList.AddRange(FZ(ADDR1)); + numberBytesList.AddRange(FZ(ADDR2)); + + // 将包头、数据长度、设备地址和校验码组合成一个完整的字节数组 + //List combineBytes = new List(); + //foreach (var item in numberBytesList) + //{ + // combineBytes.Add(item); + //} + numberBytesList.AddRange(dataBytes); + //var hex = BitConverter.ToString(dataBytes, 0).Replace("-", string.Empty).ToLower(); + //Console.WriteLine(hex); + byte[] Bytes = numberBytesList.ToArray(); + + // 计算校验码 + ushort checkBit = ModbusCRC16.CalculateCrc(Bytes); + + // 将校验码转换为字节数组 + byte[] ushortBytes = BitConverter.GetBytes(checkBit); + + numberBytesList.AddRange(FZ(checkBit)); + byte[] data = numberBytesList.ToArray(); + var hex = BitConverter.ToString(data, 0).Replace("-", string.Empty).ToLower(); + Console.WriteLine(hex); + + + // 将字节数组转换为大端字节序 + //var finalBytes = Bytes.SelectMany(i => BitConverter.GetBytes(i)).ToArray(); + if (BitConverter.IsLittleEndian) + { + // 给轨道机客户端回数据 + //socket_commu.Send(data); + PrintInfo("SendDataUpload() is end true. 给轨道机客户端回数据:", Encoding.UTF8.GetString(data, 0, data.Length)); + return data; + } + else + { + PrintInfo("SendDataUpload() is end false"); + return null; + } + } + + /// + /// 发送报警信息 + /// + /// + /// + public static bool SendDataAlarm(string sAlarmMessage) + { + PrintInfo("SendDataAlarm(string sAlarmMessage) is begin"); + string uid = "XJ00001"; + string action = "alarm"; + string result = sAlarmMessage; + string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + // 创建JSON数据对象 + var json = new + { + uid = uid, + action = action, + date = date, + result = result + }; + + // 将JSON数据对象序列化为字符串 + var options = new JsonSerializerOptions { WriteIndented = true }; + string jsonString = JsonSerializer.Serialize(json, options); + + // 将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + + // 定义包头和设备地址 + ushort baoTou = 0x4348; + ushort ADDR1 = 0x7; + ushort ADDR2 = 0xc925; + + // 计算数据长度 + int ushortSize = sizeof(ushort); + int totalUshortSize = 2 * ushortSize; + ushort length = (ushort)(10 + dataBytes.Length); + + // 将数据长度转换为字节数组并存储到集合中 + List numberBytesList = new List(); + + numberBytesList.AddRange(FZ(baoTou)); + numberBytesList.AddRange(FZ(length)); + numberBytesList.AddRange(FZ(ADDR1)); + numberBytesList.AddRange(FZ(ADDR2)); + + // 将包头、数据长度、设备地址和校验码组合成一个完整的字节数组 + //List combineBytes = new List(); + //foreach (var item in numberBytesList) + //{ + // combineBytes.Add(item); + //} + numberBytesList.AddRange(dataBytes); + //var hex = BitConverter.ToString(dataBytes, 0).Replace("-", string.Empty).ToLower(); + //Console.WriteLine(hex); + byte[] Bytes = numberBytesList.ToArray(); + + // 计算校验码 + ushort checkBit = ModbusCRC16.CalculateCrc(Bytes); + + // 将校验码转换为字节数组 + byte[] ushortBytes = BitConverter.GetBytes(checkBit); + + numberBytesList.AddRange(FZ(checkBit)); + byte[] data = numberBytesList.ToArray(); + var hex = BitConverter.ToString(data, 0).Replace("-", string.Empty).ToLower(); + Console.WriteLine(hex); + + + // 将字节数组转换为大端字节序 + //var finalBytes = Bytes.SelectMany(i => BitConverter.GetBytes(i)).ToArray(); + if (BitConverter.IsLittleEndian) + { + if (SendDataAlarm(data) != null) + { + PrintInfo("SendDataAlarm(string sAlarmMessage) is end true"); + return true; + } + } + + PrintInfo("SendDataAlarm(string sAlarmMessage) is end false"); + return false; + } + + /// + /// 移动轨道机过程 + /// + /// 前后 + /// 上下 + /// 选择通道 + /// 保存视频路径 + /// + public static bool GuiDaoJMove(double iMoveX, double iMoveY, int iSelIndex, string sViedoPath) + { + PrintInfo("GuiDaoJMove(double iMoveX, double iMoveY, int iSelIndex, string sViedoPath)", iMoveX.ToString() + ":" + iMoveY); + if (!bConnect) + return false; + if (uploadRet.data.alarm[0] == 1) + { + PrintInfo("报警返回"); + return false; + } + + GuiDaoJiRet guiDaoJiRet = SendDataRead(); + if (guiDaoJiRet != null) + { + PrintInfo("------------1-----------"); + //如果需要移动的位置和当前位置一致 + if (iMoveX.ToString() == guiDaoJiRet.data.x && iMoveY.ToString() == guiDaoJiRet.data.y) + { + PrintInfo("------------2-----------"); + return true; + } + + CHNetHelp.SaveViedo(true, iSelIndex, sViedoPath); + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJi = new GuiDaoJiSet(); + guiDaoJi.uid = sUid; + guiDaoJi.action = "set"; + guiDaoJi.send_gap = 1; + guiDaoJi.cont = 0; + guiDaoJi.contda.@return = 0; + guiDaoJi.contda.reset = 0; + guiDaoJi.contda.lamp = 0; + guiDaoJi.move = 1; + guiDaoJi.moveda.rate = 2; + guiDaoJi.moveda.x = guiDaoJiRet.data.x; + guiDaoJi.moveda.y = iMoveY.ToString(); + guiDaoJi.voice = 0; + guiDaoJi.voiceda.@string = ""; + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + //如果轨道机在上面 + if (guiDaoJiRet.data.y != "0.0") + { + guiDaoJi.moveda.y = "0.0"; + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (SendDataSet(guiDaoJi)) + { + PrintInfo("--------------向上-------------", dPos[0] + ":" + dPos[1]); + while (true) + { + if (double.Parse(dPos[1]) == 0) + break; + Thread.Sleep(100); + } + } + } + + guiDaoJi.moveda.x = iMoveX.ToString(); + guiDaoJi.moveda.y = "0.0"; + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (SendDataSet(guiDaoJi)) + { + while (true) + { + PrintInfo("--------------向前-------------"); + if (dPos[0] == iMoveX.ToString()) + break; + Thread.Sleep(100); + } + + guiDaoJi.moveda.x = iMoveX.ToString(); + guiDaoJi.moveda.y = iMoveY.ToString(); + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + if (SendDataSet(guiDaoJi)) + { + while (true) + { + PrintInfo("--------------向下-------------"); + if (dPos[1] == iMoveY.ToString()) + { + CHNetHelp.SaveViedo(false, iSelIndex, sViedoPath); + return true; + } + Thread.Sleep(100); + } + } + } + CHNetHelp.SaveViedo(false, iSelIndex, sViedoPath); + } + return false; + + } + + /// + /// 轨道机上下移动 + /// + /// 前后 + /// + public static bool GuiDaoJiUpOrDown(double iMoveX, double iMoveY) + { + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is begin"); + if (!bConnect) + return false; + if (uploadRet.data.alarm[0] == 1) + { + PrintInfo("报警返回"); + return false; + } + + GuiDaoJiRet guiDaoJiRet1 = SendDataRead(); + if (guiDaoJiRet1 != null) + { + PrintInfo(guiDaoJiRet1.uid + ":" + guiDaoJiRet1.data.y); + ////如果需要移动的位置和当前位置一致 + //if (guiDaoJiRet1.data.y == "0.0" || guiDaoJiRet1.data.y == "-0.0") + // return true; + + PrintInfo("------------2-------------", Math.Round((double.Parse(guiDaoJiRet1.data.x) + iMoveX), 1).ToString() + ":" + Math.Round(double.Parse(guiDaoJiRet1.data.y) + iMoveY, 1).ToString()); + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJiSet = new GuiDaoJiSet(); + guiDaoJiSet.uid = sUid; + guiDaoJiSet.action = "set"; + guiDaoJiSet.send_gap = 1; + guiDaoJiSet.cont = 0; + guiDaoJiSet.contda.@return = 0; + guiDaoJiSet.contda.reset = 0; + guiDaoJiSet.contda.lamp = 0; + guiDaoJiSet.move = 1; + guiDaoJiSet.moveda.rate = 2; + guiDaoJiSet.moveda.x = Math.Round((double.Parse(guiDaoJiRet1.data.x) + iMoveX), 1).ToString(); + guiDaoJiSet.moveda.y = Math.Round(double.Parse(guiDaoJiRet1.data.y) + iMoveY, 1).ToString(); + guiDaoJiSet.voice = 0; + //Voiceda voiceda = new Voiceda(); + //voiceda.@string = ""; + //guiDaoJiSet.voiceda.Add(voiceda); + guiDaoJiSet.voiceda.@string = ""; + guiDaoJiSet.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + PrintInfo("------------3-------------", guiDaoJiSet.uid + ":" + guiDaoJiSet.moveda.y); + return SendDataSet(guiDaoJiSet); + } + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is end false"); + return false; + } + + /// + /// 轨道机前后移动 + /// + /// 前后 + /// + public static bool GuiDaoFOrB(double iMoveX) + { + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is begin"); + if (!bConnect) + return false; + if (uploadRet.data.alarm[0] == 1) + { + PrintInfo("报警返回"); + return false; + } + + GuiDaoJiRet guiDaoJiRet1 = SendDataRead(); + if (guiDaoJiRet1 != null) + { + PrintInfo(guiDaoJiRet1.uid + ":" + guiDaoJiRet1.data.y); + ////如果需要移动的位置和当前位置一致 + //if (guiDaoJiRet1.data.y == "0.0" || guiDaoJiRet1.data.y == "-0.0") + // return true; + + PrintInfo("------------2-------------", Math.Round((double.Parse(guiDaoJiRet1.data.x) + iMoveX), 1).ToString()); + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJiSet = new GuiDaoJiSet(); + guiDaoJiSet.uid = sUid; + guiDaoJiSet.action = "set"; + guiDaoJiSet.send_gap = 1; + guiDaoJiSet.cont = 0; + guiDaoJiSet.contda.@return = 0; + guiDaoJiSet.contda.reset = 0; + guiDaoJiSet.contda.lamp = 0; + guiDaoJiSet.move = 1; + guiDaoJiSet.moveda.rate = 2; + guiDaoJiSet.moveda.x = Math.Round(iMoveX, 1).ToString(); + guiDaoJiSet.moveda.y = Math.Round(double.Parse(guiDaoJiRet1.data.y), 1).ToString(); + guiDaoJiSet.voice = 0; + //Voiceda voiceda = new Voiceda(); + //voiceda.@string = ""; + //guiDaoJiSet.voiceda.Add(voiceda); + guiDaoJiSet.voiceda.@string = ""; + guiDaoJiSet.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + PrintInfo("------------3-------------", guiDaoJiSet.uid + ":" + guiDaoJiSet.moveda.y); + return SendDataSet(guiDaoJiSet); + } + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is end false"); + return false; + } + + /// + /// 轨道机上下移动 + /// + /// 上下 + /// + public static bool GuiDaoJiUOrD(double iMoveY) + { + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is begin"); + if (!bConnect) + return false; + if (uploadRet.data.alarm[0] == 1) + { + PrintInfo("报警返回"); + return false; + } + + GuiDaoJiRet guiDaoJiRet1 = SendDataRead(); + if (guiDaoJiRet1 != null) + { + PrintInfo(guiDaoJiRet1.uid + ":" + guiDaoJiRet1.data.y); + ////如果需要移动的位置和当前位置一致 + //if (guiDaoJiRet1.data.y == "0.0" || guiDaoJiRet1.data.y == "-0.0") + // return true; + + PrintInfo("------------2-------------", Math.Round(double.Parse(guiDaoJiRet1.data.y) + iMoveY, 1).ToString()); + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJiSet = new GuiDaoJiSet(); + guiDaoJiSet.uid = sUid; + guiDaoJiSet.action = "set"; + guiDaoJiSet.send_gap = 1; + guiDaoJiSet.cont = 0; + guiDaoJiSet.contda.@return = 0; + guiDaoJiSet.contda.reset = 0; + guiDaoJiSet.contda.lamp = 0; + guiDaoJiSet.move = 1; + guiDaoJiSet.moveda.rate = 2; + guiDaoJiSet.moveda.x = Math.Round(double.Parse(guiDaoJiRet1.data.x), 1).ToString(); + guiDaoJiSet.moveda.y = Math.Round(iMoveY, 1).ToString(); + guiDaoJiSet.voice = 0; + //Voiceda voiceda = new Voiceda(); + //voiceda.@string = ""; + //guiDaoJiSet.voiceda.Add(voiceda); + guiDaoJiSet.voiceda.@string = ""; + guiDaoJiSet.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + PrintInfo("------------3-------------", guiDaoJiSet.uid + ":" + guiDaoJiSet.moveda.y); + return SendDataSet(guiDaoJiSet); + } + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is end false"); + return false; + } + + public static void GuiDaoJiStop() + { + PrintInfo("------------Stop1-------------"); + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJiSet = new GuiDaoJiSet(); + guiDaoJiSet.uid = sUid; + guiDaoJiSet.action = "set"; + guiDaoJiSet.send_gap = 1; + guiDaoJiSet.cont = 0; + guiDaoJiSet.contda.@return = 0; + guiDaoJiSet.contda.reset = 0; + guiDaoJiSet.contda.lamp = 0; + guiDaoJiSet.move = 1; + guiDaoJiSet.moveda.rate = 0; + guiDaoJiSet.moveda.x = "0.0"; + guiDaoJiSet.moveda.y = "0.0"; + guiDaoJiSet.voice = 0; + guiDaoJiSet.voiceda.@string = ""; + guiDaoJiSet.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + PrintInfo("------------Stop2-------------", guiDaoJiSet.uid + ":" + guiDaoJiSet.moveda.y); + SendDataSet(guiDaoJiSet); + } + + /// + /// 轨道机上下移动 + /// + /// 前后 + /// + public static bool GuiDaoJiMove(double iMoveX, double iMoveY) + { + PrintInfo("GuiDaoJiUpOrDown(double iMoveY) is begin"); + if (!bConnect) + return false; + if (uploadRet.data.alarm[0] == 1) + { + PrintInfo("报警返回"); + return false; + } + + PrintInfo("------------2-------------"); + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJiSet = new GuiDaoJiSet(); + guiDaoJiSet.uid = sUid; + guiDaoJiSet.action = "set"; + guiDaoJiSet.send_gap = 1; + guiDaoJiSet.cont = 0; + guiDaoJiSet.contda.@return = 0; + guiDaoJiSet.contda.reset = 0; + guiDaoJiSet.contda.lamp = 0; + guiDaoJiSet.move = 1; + guiDaoJiSet.moveda.rate = 2; + guiDaoJiSet.moveda.x = Math.Round(iMoveX, 1).ToString(); + guiDaoJiSet.moveda.y = Math.Round(iMoveY, 1).ToString(); + guiDaoJiSet.voice = 0; + guiDaoJiSet.voiceda.@string = ""; + guiDaoJiSet.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + PrintInfo("------------3-------------", guiDaoJiSet.uid + ":" + guiDaoJiSet.moveda.y); + return SendDataSet(guiDaoJiSet); + } + + /// + /// 轨道机移动 + /// + /// 灯状态 + /// 语音播放内容 + public static bool SetLedAndVoice(int iLed, string sVoice) + { + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJi = new GuiDaoJiSet(); + guiDaoJi.uid = sUid; + guiDaoJi.action = "set"; + guiDaoJi.send_gap = 2; + guiDaoJi.cont = 1; + guiDaoJi.contda.@return = 0; + guiDaoJi.contda.reset = 0; + guiDaoJi.contda.lamp = iLed; + guiDaoJi.move = 0; + guiDaoJi.moveda.rate = 0; + guiDaoJi.moveda.x = "0.0"; + guiDaoJi.moveda.y = "0.0"; + guiDaoJi.voice = 1; + guiDaoJi.voiceda.@string = sVoice; + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + return SendDataSet(guiDaoJi); + } + + /// + /// 轨道故障复位 + /// + public static bool SendReset() + { + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJi = new GuiDaoJiSet(); + guiDaoJi.uid = sUid; + guiDaoJi.action = "set"; + guiDaoJi.send_gap = 2; + guiDaoJi.cont = 1; + guiDaoJi.contda.@return = 0; + guiDaoJi.contda.reset = 1; + guiDaoJi.contda.lamp = 0; + guiDaoJi.move = 0; + guiDaoJi.moveda.rate = 0; + guiDaoJi.moveda.x = "0.0"; + guiDaoJi.moveda.y = "0.0"; + guiDaoJi.voice = 0; + guiDaoJi.voiceda.@string = ""; + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + return SendDataSet(guiDaoJi); + } + + /// + /// 轨道位置复位 + /// + public static bool SendReturn() + { + string sUid = "XJ00001"; + GuiDaoJiSet guiDaoJi = new GuiDaoJiSet(); + guiDaoJi.uid = sUid; + guiDaoJi.action = "set"; + guiDaoJi.send_gap = 2; + guiDaoJi.cont = 1; + guiDaoJi.contda.@return = 1; + guiDaoJi.contda.reset = 0; + guiDaoJi.contda.lamp = 0; + guiDaoJi.move = 0; + guiDaoJi.moveda.rate = 0; + guiDaoJi.moveda.x = "0.0"; + guiDaoJi.moveda.y = "0.0"; + guiDaoJi.voice = 0; + guiDaoJi.voiceda.@string = ""; + guiDaoJi.date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + return SendDataSet(guiDaoJi); + } + + + /// + /// 向轨道机客户端发数据 + /// + /// + /// + public static GuiDaoJiRet SendDataSet(byte[] btData) + { + PrintInfo("GuiDaoJiRet SendDataSet(byte[] btData) is begin"); + if (dict.Any(kvp => kvp.Key == iGuidaojiClientPort)) + { + dict[iGuidaojiClientPort].Send(btData); + uint time = 50; + while (time-- != 0) + { + PrintInfo("time:", time.ToString()); + PrintInfo("sSetState:", "set"); + if (readAndSetRet != null && readAndSetRet.action == "set") + { + GuiDaoJiRet sData = readAndSetRet; + PrintInfo("GuiDaoJiRet SendDataSet(byte[] btData) is end true. ", readAndSetRet.uid + ":" + readAndSetRet.data.y); + PrintInfo("GuiDaoJiRet SendDataSet(byte[] btData) is end true. ", sData.uid + ":" + sData.data.y); + return sData; + } + Thread.Sleep(100); + } + } + PrintInfo("GuiDaoJiRet SendDataSet(byte[] btData) is end false"); + return null; + } + + /// + /// 向轨道机客户端发数据 + /// + /// + /// + public static GuiDaoJiRet SendDataRead(byte[] btData) + { + PrintInfo("GuiDaoJiRet SendDataRead(byte[] btData) is begin"); + if (dict.Any(kvp => kvp.Key == iGuidaojiClientPort)) + { + dict[iGuidaojiClientPort].Send(btData); + uint time = 50; + while (time-- != 0) + { + PrintInfo("time:", time.ToString()); + PrintInfo("sSetState:", "read"); + if (readAndSetRet != null && readAndSetRet.action == "read") + { + GuiDaoJiRet sData = readAndSetRet; + PrintInfo("GuiDaoJiRet SendDataRead(byte[] btData) is end true. ", readAndSetRet.uid + ":" + readAndSetRet.data.y); + PrintInfo("GuiDaoJiRet SendDataRead(byte[] btData) is end true. ", sData.uid + ":" + sData.data.y); + return sData; + } + Thread.Sleep(100); + } + } + PrintInfo("GuiDaoJiRet SendDataRead(byte[] btData) is end false"); + return null; + } + + /// + /// 向唐山客户端发数据 + /// + /// + /// + public static GuiDaoJiRet SendDataAlarm(byte[] btData) + { + PrintInfo("GuiDaoJiRet SendDataAlarm(byte[] btData) is begin"); + if (dict.Any(kvp => kvp.Key == iClientPort)) + { + dict[iClientPort].Send(btData); + uint time = 50; + while (time-- != 0) + { + PrintInfo("time:", time.ToString()); + PrintInfo("sSetState:", "alarm"); + if (alarmRet != null && alarmRet.action == "alarm") + { + GuiDaoJiRet sData = alarmRet; + PrintInfo("GuiDaoJiRet SendDataAlarm(byte[] btData) is end true. ", alarmRet.uid + ":" + alarmRet.result); + return sData; + } + Thread.Sleep(100); + } + } + PrintInfo("GuiDaoJiRet SendDataAlarm(byte[] btData) is end false"); + return null; + } + + public static void Close() + { + socket_commu.Close(); + Console.WriteLine("关闭成功"); + } + + + static byte[] FZ(ushort val) + { + byte[] bytes = BitConverter.GetBytes(val); + byte aa = bytes[0]; + bytes[0] = bytes[1]; + bytes[1] = aa; + return bytes; + } + + static byte[] FZ(byte[] bytes) + { + byte aa = bytes[0]; + bytes[0] = bytes[1]; + bytes[1] = aa; + return bytes; + } + + public static void PrintInfo(string funcName, string funcOper = null) + { + //记录时间 + string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //获取行号 + System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true); + int i = st.GetFrame(0).GetFileLineNumber(); + //组织打印信息 + string sFileInfo = "[" + i + "]:" + time + " " + funcName + " " + funcOper + "\n"; + + //创建日志文件夹. + string path = Environment.CurrentDirectory + "/Log"; + string txtName = DateTime.Now.ToString("yyyy_MM_dd") + ".txt"; + try + { + // 文件夹不存在则创建 + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + } + catch (Exception e) + { + Console.WriteLine("The process failed: {0}", e.ToString()); + } + finally { } + + try + { + //向文本中输入日志 + FileStream fileLog = new FileStream(path + @"\" + txtName + "", FileMode.Append, FileAccess.Write, FileShare.Read); + StreamWriter writeFileLog = new StreamWriter(fileLog); + writeFileLog.Write(sFileInfo); + //清空缓冲区 + writeFileLog.Flush(); + //关闭流 + writeFileLog.Close(); + fileLog.Close(); + //释放流 + fileLog.Dispose(); + + //向输出流打印日志 + System.Diagnostics.Debugger.Log(0, null, sFileInfo); + } + catch { } + } + + public static void PrintInt(string funcName, int[] funcOper = null) + { + //记录时间 + string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //获取行号 + System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true); + int i = st.GetFrame(0).GetFileLineNumber(); + //组织打印信息 + string sFileInfo = "[" + i + "]:" + time + " " + funcName + " "; + if (funcOper != null) + { + for (int j = 0; j < funcOper.Length; j++) + { + sFileInfo += funcOper[j].ToString() + " "; + } + sFileInfo += "\n"; + } + + //创建日志文件夹. + string path = Environment.CurrentDirectory + "/Log"; + string txtName = DateTime.Now.ToString("yyyy_MM_dd") + ".txt"; + try + { + // 文件夹不存在则创建 + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + } + catch (Exception e) + { + Console.WriteLine("The process failed: {0}", e.ToString()); + } + finally { } + + try + { + //向文本中输入日志 + FileStream fileLog = new FileStream(path + @"\" + txtName + "", FileMode.Append, FileAccess.Write, FileShare.Read); + StreamWriter writeFileLog = new StreamWriter(fileLog); + writeFileLog.Write(sFileInfo); + //清空缓冲区 + writeFileLog.Flush(); + //关闭流 + writeFileLog.Close(); + fileLog.Close(); + //释放流 + fileLog.Dispose(); + + //向输出流打印日志 + System.Diagnostics.Debugger.Log(0, null, sFileInfo); + } + catch { } + } + + private static void DeleteValue(int iPort) + { + //删除字典组中的socket + if (dict.Any(kvp => kvp.Key == iPort)) + { + dict[iPort].Shutdown(SocketShutdown.Both); + dict[iPort].Close(); + dict[iPort].Dispose(); + dict[iPort] = null; + dict.Remove(iPort); + } + } + + public static void PrintByte(string funcName, byte[] data) + { + string sData = BitConverter.ToString(data).Replace('-', ' '); + //记录时间 + string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //获取行号 + System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(1, true); + int i = st.GetFrame(0).GetFileLineNumber(); + //组织打印信息 + string sFileInfo = "[" + i + "]:" + time + " " + funcName + " " + sData + "\r\n"; + + //创建日志文件夹. + string path = Environment.CurrentDirectory + "/Log"; + string txtName = DateTime.Now.ToString("yyyy_MM_dd") + ".txt"; + try + { + // 文件夹不存在则创建 + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + } + catch (Exception e) + { + Console.WriteLine("The process failed: {0}", e.ToString()); + } + finally { } + + try + { + //向文本中输入日志 + FileStream fileLog = new FileStream(path + @"\" + txtName + "", FileMode.Append, FileAccess.Write, FileShare.Read); + StreamWriter writeFileLog = new StreamWriter(fileLog); + writeFileLog.Write(sFileInfo); + //清空缓冲区 + writeFileLog.Flush(); + //关闭流 + writeFileLog.Close(); + fileLog.Close(); + //释放流 + fileLog.Dispose(); + + //向输出流打印日志 + System.Diagnostics.Debugger.Log(0, null, sFileInfo); + } + catch (Exception e) + { + Console.WriteLine("The process failed: {0}", e.ToString()); + //MessageBox.Show(e.ToString()); + } + } + } +} diff --git a/DAY.cs b/DAY.cs new file mode 100644 index 0000000..8a1f5d9 --- /dev/null +++ b/DAY.cs @@ -0,0 +1,57 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class DAY + { + public List DayOfWeeks(PatrolClass item) + { + DayOfWeek dayOfWeek; + List dayOfWeeks = new List(); + var runRule = item.RunRule; + string[] days = runRule.Split(','); + foreach (var day in days) + { + switch (day) + { + case "周一": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周一"); + dayOfWeeks.Add(dayOfWeek); + break; + case "周二": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周二"); + dayOfWeeks.Add(dayOfWeek); + break; + case "周三": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周三"); + dayOfWeeks.Add(dayOfWeek); + break; + case "周四": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周四"); + dayOfWeeks.Add(dayOfWeek); + break; + case "周五": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周五"); + dayOfWeeks.Add(dayOfWeek); + break; + case "周六": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周六"); + dayOfWeeks.Add(dayOfWeek); + break; + case "周日": + dayOfWeek = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), "周日"); + dayOfWeeks.Add(dayOfWeek); + break; + } + } + return dayOfWeeks; + } + } +} diff --git a/EmergencyPlatform.csproj b/EmergencyPlatform.csproj new file mode 100644 index 0000000..74460be --- /dev/null +++ b/EmergencyPlatform.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + diff --git a/EmergencyPlatform.sln b/EmergencyPlatform.sln new file mode 100644 index 0000000..37cb8e7 --- /dev/null +++ b/EmergencyPlatform.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EmergencyPlatform", "EmergencyPlatform.csproj", "{91F53C8C-AE0B-41BA-988F-1127F4BD7381}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {91F53C8C-AE0B-41BA-988F-1127F4BD7381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91F53C8C-AE0B-41BA-988F-1127F4BD7381}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91F53C8C-AE0B-41BA-988F-1127F4BD7381}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91F53C8C-AE0B-41BA-988F-1127F4BD7381}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9BE62E3A-8CAB-4FD2-9CFA-4CDA65C4A110} + EndGlobalSection +EndGlobal diff --git a/Framework/EGFramework/EGFramework.cs b/Framework/EGFramework/EGFramework.cs new file mode 100644 index 0000000..2c3dede --- /dev/null +++ b/Framework/EGFramework/EGFramework.cs @@ -0,0 +1,216 @@ +using System; +using System.Collections.Generic; + +namespace EGFramework +{ + #region Architecture & Module + public class EGArchitecture : IArchitecture where T : EGArchitecture, new() + { + private static T Architecture; + public static IArchitecture Interface + { + get + { + if (Architecture == null) + { + MakeSureArchitecture(); + } + return Architecture; + } + } + + private static void MakeSureArchitecture() + { + if (Architecture == null) + { + Architecture = new T(); + Architecture.Init(); + } + } + + protected virtual void Init() + { + + } + + private IOCContainer ModuleContainer = new IOCContainer(); + + public void RegisterModule(TModule module) where TModule : IModule + { + ModuleContainer.Register(module); + module.Init(); + } + public TModule GetModule() where TModule : class, IModule,new() + { + if (!ModuleContainer.self.ContainsKey(typeof(TModule))) + { + this.RegisterModule(new TModule()); + } + return ModuleContainer.Get(); + } + public bool IsInitModule() where TModule : class, IModule,new() + { + if (!ModuleContainer.self.ContainsKey(typeof(TModule))) + { + return true; + }else{ + return false; + } + } + } + + public abstract class EGModule:IModule{ + IArchitecture IBelongToArchitecture.GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + void IModule.Init() + { + this.Init(); + } + public abstract void Init(); + } + #endregion + + #region Interface + public interface IArchitecture + { + void RegisterModule(T model) where T : IModule; + T GetModule() where T : class, IModule,new(); + bool IsInitModule() where T : class, IModule,new(); + } + public interface IModule : IBelongToArchitecture + { + void Init(); + } + public interface IBelongToArchitecture + { + IArchitecture GetArchitecture(); + } + + public static class CanGetModuleExtension + { + public static T GetModule(this IBelongToArchitecture self) where T : class, IModule,new() + { + return self.GetArchitecture().GetModule(); + } + } + + #endregion + + #region IOC + public class IOCContainer + { + private Dictionary Instances = new Dictionary(); + public void Register(T instance) + { + var key = typeof(T); + if (Instances.ContainsKey(key)) + { + Instances[key] = instance; + } + else + { + Instances.Add(key, instance); + } + } + public T Get() where T : class + { + var key = typeof(T); + if (Instances.TryGetValue(key, out var retInstance)) + { + return retInstance as T; + } + return null; + } + public Dictionary self => Instances; + } + #endregion + + #region Event + public interface IEasyEvent { + + } + public interface IUnRegister + { + void UnRegister(); + } + + public class EasyEvent : IEasyEvent + { + private Action OnEvent = e => { }; + public IUnRegister Register(Action onEvent) + { + OnEvent += onEvent; + return new CustomUnRegister(() => { UnRegister(onEvent); }); + } + public void UnRegister(Action onEvent) + { + OnEvent -= onEvent; + } + public void Invoke(T t) + { + OnEvent?.Invoke(t); + } + } + + public class EasyEvent : IEasyEvent + { + private Action OnEvent = () => { }; + public IUnRegister Register(Action onEvent) + { + OnEvent += onEvent; + return new CustomUnRegister(() => { UnRegister(onEvent); }); + } + public void UnRegister(Action onEvent) + { + OnEvent -= onEvent; + } + public void Invoke() + { + OnEvent?.Invoke(); + } + } + public struct CustomUnRegister : IUnRegister + { + /// + /// 委托对象 + /// + private Action OnUnRegister { get; set; } + /// + /// 带参构造函数 + /// + /// + public CustomUnRegister(Action onUnRegister) + { + OnUnRegister = onUnRegister; + } + /// + /// 资源释放 + /// + public void UnRegister() + { + OnUnRegister.Invoke(); + OnUnRegister = null; + } + } + #endregion + + #region FrameworkExtension + public interface IEGFramework{} + + public class EGArchitectureImplement:EGArchitecture{ + protected override void Init() + { + //base.Init(); + } + } + + public static class EGArchitectureImplementExtension{ + public static T GetModule(this IEGFramework self) where T : class, IModule,new() + { + return EGArchitectureImplement.Interface.GetModule(); + } + } + #endregion +} diff --git a/Framework/EGFramework/License_Third_Part/Microsoft_Data_SQLite/LICENSE.txt b/Framework/EGFramework/License_Third_Part/Microsoft_Data_SQLite/LICENSE.txt new file mode 100644 index 0000000..a616ed1 --- /dev/null +++ b/Framework/EGFramework/License_Third_Part/Microsoft_Data_SQLite/LICENSE.txt @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Framework/EGFramework/License_Third_Part/NewtonSoft_Json/LICENSE.md b/Framework/EGFramework/License_Third_Part/NewtonSoft_Json/LICENSE.md new file mode 100644 index 0000000..dfaadbe --- /dev/null +++ b/Framework/EGFramework/License_Third_Part/NewtonSoft_Json/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2007 James Newton-King + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Framework/EGFramework/License_Third_Part/source_han_sans/LICENSE.txt b/Framework/EGFramework/License_Third_Part/source_han_sans/LICENSE.txt new file mode 100644 index 0000000..ddf7b7e --- /dev/null +++ b/Framework/EGFramework/License_Third_Part/source_han_sans/LICENSE.txt @@ -0,0 +1,96 @@ +Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font +Name 'Source'. Source is a trademark of Adobe in the United States +and/or other countries. + +This Font Software is licensed under the SIL Open Font License, +Version 1.1. + +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font +creation efforts of academic and linguistic communities, and to +provide a free and open framework in which fonts may be shared and +improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply to +any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software +components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, +deleting, or substituting -- in part or in whole -- any of the +components of the Original Version, by changing formats or by porting +the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, +modify, redistribute, and sell modified and unmodified copies of the +Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in +Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the +corresponding Copyright Holder. This restriction only applies to the +primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created using +the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/Framework/EGFramework/Module/EGCQRS.cs b/Framework/EGFramework/Module/EGCQRS.cs new file mode 100644 index 0000000..fdac1bb --- /dev/null +++ b/Framework/EGFramework/Module/EGCQRS.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; + +namespace EGFramework +{ + #region Interface + public interface ICommand + { + void Execute(); + } + public interface IQuery + { + TResult Do(); + } + + public interface IEGCQRS + { + void SendCommand(ICommand command); + TResult DoQuery(IQuery query); + } + #endregion + + public class EGCQRS :EGModule, IEGCQRS + { + public void SendCommand(ICommand command) + { + command.Execute(); + } + public TResult DoQuery(IQuery query) + { + return query.Do(); + } + public override void Init() + { + + } + } + + #region Extension + public static class CanSendCommandExtension + { + public static void EGSendCommand(this IEGFramework self, ICommand command) + { + EGArchitectureImplement.Interface.GetModule().SendCommand(command); + } + } + + public static class CanQueryDataExtension + { + public static TResult EGQueryData(this IEGFramework self, IQuery query) + { + return EGArchitectureImplement.Interface.GetModule().DoQuery(query); + } + } + #endregion +} \ No newline at end of file diff --git a/Framework/EGFramework/Module/EGEvent.cs b/Framework/EGFramework/Module/EGEvent.cs new file mode 100644 index 0000000..e6723b9 --- /dev/null +++ b/Framework/EGFramework/Module/EGEvent.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; + +namespace EGFramework +{ + public interface IEGEvent{ + void SendEvent() where T : new(); + void SendEvent(T e); + IUnRegister RegisterEvent(Action onEvent); + void UnRegisterEvent(Action onEvent); + } + public class EGEvent : EGModule,IEGEvent + { + public override void Init() + { + + } + private readonly EasyEvents Events = new EasyEvents(); + public void SendEvent() where TEvent : new() + { + Events.GetEvent>()?.Invoke(new TEvent()); + } + + public void SendEvent(TEvent e) + { + Events.GetEvent>()?.Invoke(e); + } + + public IUnRegister RegisterEvent(Action onEvent) + { + var e = Events.GetOrAddEvent>(); + return e.Register(onEvent); + } + + public void UnRegisterEvent(Action onEvent) + { + var e = Events.GetEvent>(); + if (e != null) + { + e.UnRegister(onEvent); + } + } + } + + public class EasyEvents + { + private static EasyEvents GlobalEvents = new EasyEvents(); + public static T Get() where T : IEasyEvent + { + return GlobalEvents.GetEvent(); + } + public static void Register() where T : IEasyEvent, new() + { + GlobalEvents.AddEvent(); + } + private Dictionary TypeEvents = new Dictionary(); + public void AddEvent() where T : IEasyEvent, new() + { + TypeEvents.Add(typeof(T), new T()); + } + public T GetEvent() where T : IEasyEvent + { + IEasyEvent e; + if (TypeEvents.TryGetValue(typeof(T), out e)) + { + return (T)e; + } + return default; + } + public T GetOrAddEvent() where T : IEasyEvent, new() + { + var eType = typeof(T); + if (TypeEvents.TryGetValue(eType, out var e)) + { + return (T)e; + } + var t = new T(); + TypeEvents.Add(eType, t); + return t; + } + } + + + public static class CanRegisterEventExtension + { + public static IUnRegister EGRegisterEvent(this IEGFramework self, Action onEvent) + { + return EGArchitectureImplement.Interface.GetModule().RegisterEvent(onEvent); + } + public static void EGUnRegisterEvent(this IEGFramework self, Action onEvent) + { + EGArchitectureImplement.Interface.GetModule().UnRegisterEvent(onEvent); + } + } + + public static class CanSendEventExtension + { + public static void EGSendEvent(this IEGFramework self) where T : new() + { + EGArchitectureImplement.Interface.GetModule().SendEvent(); + } + public static void EGSendEvent(this IEGFramework self, T e) + { + EGArchitectureImplement.Interface.GetModule().SendEvent(e); + } + } +} \ No newline at end of file diff --git a/Framework/EGFramework/Module/EGMessage.cs b/Framework/EGFramework/Module/EGMessage.cs new file mode 100644 index 0000000..927714c --- /dev/null +++ b/Framework/EGFramework/Module/EGMessage.cs @@ -0,0 +1,320 @@ +using System; +using System.Collections.Generic; +using System.Timers; + +namespace EGFramework +{ + //before use this module,you should install NewtonSoft.Json Nuget Package + //in vscode,you can install this package by install vscode extension NuGet Package Manager GUI + //search 'Newton' and choose Newtonsoft.Json + //EGMessage, Every Message tools will be based in this class + public class EGMessage : EGModule + { + public EasyEvent OnDataReceived { set; get; } = new EasyEvent(); + public EasyEvent OnResponse { set; get; } = new EasyEvent(); + public EasyEvent OnRequest { set; get; } = new EasyEvent(); + + /// + /// Send delay in millisecond,if you don't need a Timer to delay send message,you can set it to 0. + /// + /// + public int SendDelay { set; get; } = 100; + public Queue RequestCache { set; get; } = new Queue(); + private System.Timers.Timer RequestTimer { set; get; } + + public override void Init() + { + if(SendDelay>0){ + RequestTimer = new System.Timers.Timer(SendDelay); + RequestTimer.Elapsed += ExecuteRequest; + RequestTimer.AutoReset = true; + RequestTimer.Enabled = true; + } + } + #region ReceiveFunctions + private void ReceiveResponse(ResponseMsg msg) where T :IResponse, new() + { + this.ExecuteResponse(new T(),msg.stringData,msg.byteData,msg.sender,msg.protocolType); + } + /// + /// Start to receive type of T data + /// + /// Data class of message + public void OnReceive() where T : IResponse, new() + { + OnDataReceived.Register(ReceiveResponse); + } + /// + /// Stop to receive type of T data + /// + /// Data class of message + public void OffReceive() where T : IResponse, new() + { + OnDataReceived.UnRegister(ReceiveResponse); + } + #endregion + #region request & response + + public void SendRequest(TRequest request,string sender,ProtocolType protocolType) where TRequest:IRequest + { + if(SendDelay>0){ + RequestCache.Enqueue(new RequestMsgEvent(request,sender,protocolType)); + }else{ + OnRequest.Invoke(new RequestMsgEvent(request,sender,protocolType)); + } + //ExecuteRequest(); + //OnRequest.Invoke(requestCache.Dequeue()); + } + + private void ExecuteRequest(object source, ElapsedEventArgs e){ + if(RequestCache.Count>0){ + OnRequest.Invoke(RequestCache.Dequeue()); + } + } + + private void ExecuteResponse(TResponse response,string protocolString,byte[] protocolBytes,string sender,ProtocolType protocolType) where TResponse:IResponse + { + bool isSet = response.TrySetData(protocolString,protocolBytes); + if (isSet) + { + //this.SendEvent(new ResponseMsgEvent(response, sender)); + OnResponse.Invoke(new ResponseMsgEvent(response,sender,protocolType)); + } + } + #endregion + + public void SetDelay(int millisecond){ + this.SendDelay = millisecond; + } + } + + #region interface + public interface IResponse + { + /// + /// Attempt to fill in the data. If it does not comply with the relevant protocol rules, it is recommended to return false. If false is returned here, the data response will be ignored. + /// + /// original received + /// + bool TrySetData(string protocolData,byte[] protocolBytes); + } + public interface IRequest + { + /// + /// define you message info in this function,and this return will be send to server&client by request. + /// + /// request info + string ToProtocolData(); + + byte[] ToProtocolByteData(); + } + #endregion + #region AbstractClass + + public class BaseJsonResponse : IResponse + { + private string ExceptionMsg; + public virtual string ToProtocolData() + { + return ""; + } + public virtual bool TrySetData(string json,byte[] bytes) + { + try + { + return true; + } + catch (Exception e) + { + ExceptionMsg = e.ToString(); + //PrintErr(ExceptionMsg); + return false; + } + } + } + + public class StringRequest : IRequest + { + private string RequestStr; + public StringRequest() { + RequestStr = "No message"; + } + public StringRequest(string str) { + RequestStr = str; + } + + public byte[] ToProtocolByteData() + { + return null; + } + + public string ToProtocolData() + { + return RequestStr; + } + } + #endregion + #region Extension + public static class CanRegisterMessageExtension { + /// + /// To register event until message received,if you only need message,please use: + /// this.RegisterMessageEvent(e=>{ //To execute your message}) + /// if you want to get sender,you also can to: + /// this.RegisterMessageEvent((res,sender))=>{ //To execute your message + /// Print(res.toProtocolData()); + /// Print(sender); + /// }) + /// + /// + /// + /// + /// + public static IUnRegister EGRegisterMessageEvent(this IEGFramework self, Action onEvent)where TResponse : IResponse + { + return EGArchitectureImplement.Interface.GetModule().OnResponse.Register(e=> { + if (e.res.GetType() == typeof(TResponse)) { + onEvent.Invoke((TResponse)e.res); + } + }); + } + /// + /// To register event until message received,if you only need message,please use: + /// this.RegisterMessageEvent(e=>{ //To execute your message}) + /// if you want to get sender,you also can to: + /// this.RegisterMessageEvent((res,sender))=>{ //To execute your message + /// Print(res.toProtocolData()); + /// Print(sender); + /// }) + /// + /// + /// + /// + /// + public static IUnRegister EGRegisterMessageEvent(this IEGFramework self, Action onEvent)where TResponse : IResponse + { + return EGArchitectureImplement.Interface.GetModule().OnResponse.Register(e=> { + if (e.res.GetType() == typeof(TResponse)) { + onEvent.Invoke((TResponse)e.res,e.sender); + } + }); + } + + public static IUnRegister EGRegisterMessageEvent(this IEGFramework self, Action onEvent)where TResponse : IResponse + { + return EGArchitectureImplement.Interface.GetModule().OnResponse.Register(e=> { + if (e.res.GetType() == typeof(TResponse)) { + onEvent.Invoke((TResponse)e.res,e.sender,e.protocolType); + } + }); + } + /// + /// Start to receive type of TResponse data + /// + /// + /// + public static void EGOnMessage(this IEGFramework self) where TResponse : IResponse,new() + { + EGArchitectureImplement.Interface.GetModule().OnReceive(); + } + /// + /// Stop to receive type of TResponse data + /// + /// + /// + public static void EGOffMessage(this IEGFramework self) where TResponse : IResponse,new() + { + EGArchitectureImplement.Interface.GetModule().OffReceive(); + } + } + public static class CanSendMessageExtension { + /// + /// to send message by request and define sender + /// + /// + /// + /// + /// + public static void EGSendMessage(this IEGFramework self, TRequest request,string sender,ProtocolType protocolType)where TRequest : IRequest + { + EGArchitectureImplement.Interface.GetModule().SendRequest(request,sender,protocolType); + } + } + + /// + /// this extension to link with protocol tools,such as tcp,udp,serial port,etc... + /// + public static class EGMessageEventExtension{ + public static void EGOnReceivedData(this IModule self, ResponseMsg receivedData) + { + EGArchitectureImplement.Interface.GetModule().OnDataReceived.Invoke(receivedData); + } + public static void EGRegisterSendAction(this IModule self, Action sendAction){ + EGArchitectureImplement.Interface.GetModule().OnRequest.Register(sendAction); + } + } + #endregion + #region event + + public struct ResponseMsg + { + public string sender; + public string stringData; + public byte[] byteData; + + public ProtocolType protocolType; + public ResponseMsg(string stringData_,byte[] byteData_,string sender_,ProtocolType protocolType_) + { + stringData = stringData_; + byteData = byteData_; + sender = sender_; + protocolType = protocolType_; + } + } + + public struct ResponseMsgEvent + { + public IResponse res; + public string sender; + public ProtocolType protocolType; + public ResponseMsgEvent(IResponse res_,string sender_,ProtocolType protocolType_) + { + res = res_; + sender = sender_; + protocolType = protocolType_; + } + } + + public struct RequestMsgEvent + { + public IRequest req; + public string sender; + public ProtocolType protocolType; + public RequestMsgEvent(IRequest req_ ,string sender_,ProtocolType protocolType_) + { + req = req_; + sender = sender_; + protocolType = protocolType_; + } + } + #endregion + + public enum ProtocolType{ + TCPClient = 0x00, + TCPServer = 0x01, + UDP = 0x02, + SerialPort = 0x03, + WebSocketClient = 0x10, + WebSocketServer = 0x11, + HttpServer = 0x20, + HttpGet = 0x21, + HttpPost = 0x22, + HttpPut = 0x23, + HttpPatch = 0x24, + HttpDelete = 0x25, + DLTSClient = 0x30, + DLTSServer = 0x31, + SSLClient = 0x40, + SSLServer = 0x41 + //MQTT,SSH,etc... + } +} \ No newline at end of file diff --git a/Framework/EGFramework/Module/EGObjects.cs b/Framework/EGFramework/Module/EGObjects.cs new file mode 100644 index 0000000..ea7f366 --- /dev/null +++ b/Framework/EGFramework/Module/EGObjects.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; + +namespace EGFramework +{ + public interface IEGObject + { + void RegisterObject(T object_); + T GetObject() where T : class,new(); + + } + public class EGObject : EGModule,IEGObject + { + private IOCContainer ObjectContainer = new IOCContainer(); + public override void Init() + { + + } + + public TObject GetObject() where TObject : class,new() + { + if (!ObjectContainer.self.ContainsKey(typeof(TObject))) + { + this.RegisterObject(new TObject()); + } + return ObjectContainer.Get(); + } + + public void RegisterObject(TObject object_) + { + ObjectContainer.Register(object_); + } + + public bool ContainsObject(){ + return ObjectContainer.self.ContainsKey(typeof(TObject)); + } + } + + public static class CanGetObjectExtension + { + public static T EGGetObject(this IEGFramework self) where T : class,new() + { + return EGArchitectureImplement.Interface.GetModule().GetObject(); + } + } + public static class CanRegisterObjectExtension + { + public static void EGRegisterObject(this IArchitecture self,T object_) where T : class,new() + { + self.GetModule().RegisterObject(object_); + } + public static void EGRegisterObject(this IEGFramework self,T object_) where T : class,new() + { + EGArchitectureImplement.Interface.GetModule().RegisterObject(object_); + } + } + + public static class CanContainsObjectExtension{ + public static bool EGContainsObject(this IEGFramework self) + { + return EGArchitectureImplement.Interface.GetModule().ContainsObject(); + } + } + +} diff --git a/Framework/EGFramework/Module/EGSave.cs b/Framework/EGFramework/Module/EGSave.cs new file mode 100644 index 0000000..34e4b77 --- /dev/null +++ b/Framework/EGFramework/Module/EGSave.cs @@ -0,0 +1,122 @@ +using System; +using System.IO; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace EGFramework +{ + public interface IEGSave{ + void SetDataToFile(TData data); + TData GetDataByFile() where TData : class,new(); + void InitSaveData(string fileName); + } + public class EGSave : EGModule,IEGSave + { + private string DefaultSaveFile = "Default"; + private string DefaultSaveFolder = "SaveData"; + private JObject _SaveObject; + private JObject SaveObject{ + get { + if(_SaveObject == null){ + InitSaveObject(); + } + return _SaveObject; + } + } + + public EGSave(){ + + } + /// + /// if you want to define default save data file name, please use "this.RegisterModule(new EGSave("FileName"))"in your architecture code(Init function); + /// + /// + public EGSave(string fileName){ + this.DefaultSaveFile = fileName; + } + public override void Init() + { + if (!Directory.Exists(DefaultSaveFolder)) + { + Directory.CreateDirectory(DefaultSaveFolder); + File.WriteAllText(DefaultSaveFolder + "/" + DefaultSaveFile + ".json","{}"); + }else if(!File.Exists(DefaultSaveFolder + "/" + DefaultSaveFile + ".json")){ + File.WriteAllText(DefaultSaveFolder + "/" + DefaultSaveFile + ".json","{}"); + } + } + + private void InitSaveObject(){ + using (StreamReader reader = File.OpenText(DefaultSaveFolder + "/" + DefaultSaveFile + ".json")) + { + _SaveObject = (JObject)JToken.ReadFrom(new JsonTextReader(reader)); + } + } + + /// + /// Push SaveObject data set to file + /// + public void SaveToFile(){ + SaveToFile(DefaultSaveFile); + } + private void SaveToFile(string fileName){ + File.WriteAllText(DefaultSaveFolder + "/" + fileName + ".json",JsonConvert.SerializeObject(SaveObject,Formatting.Indented)); + } + + /// + /// Push data to SaveObject object cache, this function will not save data to file, if you hope not to IO operation frequently, you can use this with SaveToFile. + /// + /// + /// + public void SetData(TData data){ + //SaveObject = JObject.FromObject(data); + if(SaveObject.ContainsKey(typeof(TData).ToString())){ + SaveObject[typeof(TData).ToString()] = JToken.FromObject(data); + }else{ + SaveObject.Add(typeof(TData).ToString(),JToken.FromObject(data)); + } + } + + /// + /// Get data from file, if your data is not in file, then get null. + /// + /// + public TData GetDataByFile() where TData : class,new(){ + if(!SaveObject.ContainsKey(typeof(TData).ToString())){ + return null; + } + TData data = SaveObject[typeof(TData).ToString()].ToObject(); + return data; + } + + /// + /// Save data to file + /// + /// your any type of data + /// + public void SetDataToFile(TData data) + { + SetData(data); + SaveToFile(); + } + + /// + /// Init a new save data file or load an other file with json suffix, if you want to load other save data, please use this function to reload; + /// + /// + public void InitSaveData(string fileName) + { + DefaultSaveFile = fileName; + if(!File.Exists(DefaultSaveFolder + "/" + DefaultSaveFile + ".json")){ + File.WriteAllText(DefaultSaveFolder + "/" + DefaultSaveFile + ".json","{}"); + } + InitSaveObject(); + } + } + + public static class CanGetEGSaveExtension{ + public static EGSave EGSave(this IEGFramework self){ + return EGArchitectureImplement.Interface.GetModule(); + } + } +} \ No newline at end of file diff --git a/Framework/EGFramework/Module/Extension/EGConvertExtension.cs b/Framework/EGFramework/Module/Extension/EGConvertExtension.cs new file mode 100644 index 0000000..ccf302d --- /dev/null +++ b/Framework/EGFramework/Module/Extension/EGConvertExtension.cs @@ -0,0 +1,203 @@ +using System; +using System.Linq; +using System.Text; + +namespace EGFramework { + //协议规则解析通用方法扩展 + public static class EGConvertExtension + { + /// + /// Hex string data to byte array,such as a string like "0x00 0xff 0x06" + /// + /// Only include A-F,0-9,hex + /// + public static byte[] ToByteArrayByHex(this string self) { + int hexLen = self.Length; + byte[] result; + if (hexLen % 2 == 1) + { + //奇数 + hexLen++; + result = new byte[(hexLen / 2)]; + self += "0" ; + } + else + { + //偶数 + result = new byte[(hexLen / 2)]; + } + int j = 0; + for (int i = 0; i < hexLen; i += 2) + { + result[j] = (byte)int.Parse(self.Substring(i, 2), System.Globalization.NumberStyles.HexNumber); + j++; + } + return result; + } + + + /// + /// get string from hex array ,like hex array {0x0a,0x11} => "0x0a 0x11" + /// + /// + /// + public static string ToStringByHex(this byte[] self) + { + StringBuilder sb = new StringBuilder(); + + foreach (byte b in self) + { + sb.Append("0x" + b.ToString("X2") + " "); + } + string result = sb.ToString().Trim(); + return result; + } + + /// + /// get hex from string ,like string "0x0a 0x11" => {0x0a,0x11} + /// + /// + /// + public static byte[] ToHexByString(this string self) + { + if (self.Length <= 2 && self.Substring(0, 2) != "0x") { + return null; + } + string[] hexStrings = self.Split(' '); + byte[] byteArray = new byte[hexStrings.Length]; + for (int i = 0; i < hexStrings.Length; i++) + { + byteArray[i] = Convert.ToByte(hexStrings[i], 16); + } + return byteArray; + } + + public static byte[] ToBytes(this ushort self){ + byte[] byteArray = BitConverter.GetBytes(self); + if (BitConverter.IsLittleEndian) + { + Array.Reverse(byteArray); + } + return byteArray; + } + + public static ushort ToUShort(this byte[] self){ + if (BitConverter.IsLittleEndian) + { + Array.Reverse(self); + } + return BitConverter.ToUInt16(self, 0); + } + + public static byte[] ToBytes(this uint self){ + byte[] byteArray = BitConverter.GetBytes(self); + if (BitConverter.IsLittleEndian) + { + Array.Reverse(byteArray); + } + return byteArray; + } + + public static uint ToUINT(this byte[] self){ + if (BitConverter.IsLittleEndian) + { + Array.Reverse(self); + } + return BitConverter.ToUInt32(self, 0); + } + + /// + /// convert and resize byte array,such as uint is 0x00FF7799 => byte array {0xFF,0x77,0x99} + /// + /// + /// + public static byte[] ToBytesAndResizeArray(this uint self){ + byte[] byteArray = BitConverter.GetBytes(self); + if (BitConverter.IsLittleEndian) + { + Array.Reverse(byteArray); + } + int startIndex = Array.FindIndex(byteArray, b => b != 0); + if (startIndex == -1) + { + byteArray = new byte[1]; + } + else + { + byteArray = byteArray.Skip(startIndex).ToArray(); + } + return byteArray; + } + + public static byte[] ToByteArray(this bool[] boolArray) + { + int numBool = boolArray.Length; + int numBytes = (numBool + 7) / 8; + byte[] byteArray = new byte[numBytes]; + + for (int i = 0; i < numBool; i++) + { + int byteIndex = i / 8; + int bitIndex = i % 8; + if (boolArray[i]) + { + byteArray[byteIndex] |= (byte)(1 << bitIndex); + } + } + + return byteArray; + } + + public static bool[] ToBoolArray(this byte[] byteArray) + { + bool[] boolArray = new bool[byteArray.Length * 8]; + for (int i = 0; i < byteArray.Length; i++) + { + byte currentByte = byteArray[i]; + + for (int j = 0; j < 8; j++) + { + boolArray[i * 8 + j] = (currentByte & (1 << j)) != 0; + } + } + + return boolArray; + } + public static bool[] ToBoolArray(this int value) + { + string binaryString = Convert.ToString(value, 2); + bool[] boolArray = new bool[binaryString.Length]; + if(binaryString.Length < 8){ + boolArray = new bool[8]; + } + for (int i = 0; i < binaryString.Length; i++) + { + boolArray[binaryString.Length - i - 1] = binaryString[i] == '1'; + } + return boolArray; + } + + public static int ToInt(this bool[] boolArray) + { + int result = 0; + for (int i = 0; i < boolArray.Length; i++) + { + if (boolArray[i]) + { + result |= (1 << i); + } + } + return result; + } + + public static ushort[] ToUShortArray(this byte[] byteArray){ + ushort[] ushortArray = new ushort[byteArray.Length / 2]; + for (int i = 0, j = 0; i < byteArray.Length; i += 2, j++) + { + ushortArray[j] = (ushort)((byteArray[i] << 8) | byteArray[i + 1]); + } + return ushortArray; + } + + } +} diff --git a/Framework/EGFramework/Module/Extension/EGCrcExtension.cs b/Framework/EGFramework/Module/Extension/EGCrcExtension.cs new file mode 100644 index 0000000..7ef38ec --- /dev/null +++ b/Framework/EGFramework/Module/Extension/EGCrcExtension.cs @@ -0,0 +1,154 @@ +using System; +using System.Security.Cryptography; + +namespace EGFramework{ + public static class EGCrcModbusExtension + { + /// CRC calculate is a common device verify algorithm + /// use + // hex = {0x80,0x05}; + // Polynomial = x^16+x^15+x^2+1 = 1 80 05 + public const ushort CRC_16_Modbus_Polynomial = 0x8005; + // hex = {0xFF,0xFF} + public const ushort CRC_16_Modbus_Start = 0xFFFF; + // hex = {0x00,0x00} + public const ushort CRC_16_Modbus_ResultXOR = 0x0000; + private static readonly ushort[] Crc_16_Table_Modbus ={ + 0x00,0xC0C1,0xC181,0x140,0xC301,0x3C0,0x280,0xC241,0xC601,0x6C0,0x780,0xC741,0x500,0xC5C1,0xC481,0x440, + 0xCC01,0xCC0,0xD80,0xCD41,0xF00,0xCFC1,0xCE81,0xE40,0xA00,0xCAC1,0xCB81,0xB40,0xC901,0x9C0,0x880,0xC841, + 0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41, + 0x1400,0xD4C1,0xD581,0x1540,0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040, + 0xF001,0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,0x3480,0xF441, + 0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80,0xFB41,0x3900,0xF9C1,0xF881,0x3840, + 0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41,0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40, + 0xE401,0x24C0,0x2580,0xE541,0x2700,0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041, + 0xA001,0x60C0,0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,0xA441, + 0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41,0x6900,0xA9C1,0xA881,0x6840, + 0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01,0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40, + 0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041, + 0x5000,0x90C1,0x9181,0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440, + 0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,0x59C0,0x5880,0x9841, + 0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1,0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41, + 0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040, + }; + public static ushort CalculateCRC16Modbus(this byte[] bytes) + { + CRC16 provider = new CRC16(Crc_16_Table_Modbus); + byte[] hash = provider.ComputeHash(bytes); + + ushort crc16 = BitConverter.ToUInt16(hash, 0); + + ushort reversedResult = (ushort)((crc16 >> 8) | (crc16 << 8)); + return reversedResult; + } + + } + public static class EGCrcUtility + { + //Crc with table + public static uint CalculateCrc(byte[] data, uint initialValue, uint xorValue, bool inputReverse, bool outputReverse,uint[] CrcTable) + { + uint crc = initialValue; + + for (int i = 0; i < data.Length; i++) + { + if (inputReverse) + data[i] = ReverseBits(data[i]); + + crc ^= (uint)(data[i] << 24); + + for (int j = 0; j < 8; j++) + { + crc = (crc << 8) ^ CrcTable[crc >> 24]; + } + } + + if (outputReverse) + crc = ReverseBits(crc); + + return crc ^ xorValue; + } + + //Crc without table + public static uint CalculateCrc(byte[] data, uint polynomial, uint initialValue, uint xorValue, bool inputReverse, bool outputReverse) + { + uint crc = initialValue; + + for (int i = 0; i < data.Length; i++) + { + if (inputReverse) + data[i] = ReverseBits(data[i]); + + crc ^= (uint)(data[i] << 24); + + for (int j = 0; j < 8; j++) + { + if ((crc & 0x80000000) != 0) + { + crc = (crc << 1) ^ polynomial; + } + else + { + crc <<= 1; + } + } + } + + if (outputReverse) + crc = ReverseBits(crc); + + return crc ^ xorValue; + } + + private static uint ReverseBits(uint value) + { + uint result = 0; + for (int i = 0; i < 8; i++) + { + result = (result << 1) | ((value >> i) & 1); + } + return result; + } + + private static byte ReverseBits(byte value) + { + byte result = 0; + for (int i = 0; i < 8; i++) + { + result = (byte)((result << 1) | ((value >> i) & 1)); + } + return result; + } + } + public class CRC16 : HashAlgorithm + { + private const ushort polynomial = 0x8005; + private ushort[] table = new ushort[256]; + private ushort crc = 0xFFFF; + + public CRC16(ushort[] table) + { + HashSizeValue = 16; + this.table = table; + } + + protected override void HashCore(byte[] array, int ibStart, int cbSize) + { + for (int i = ibStart; i < ibStart + cbSize; i++) + { + byte index = (byte)(crc ^ array[i]); + crc = (ushort)((crc >> 8) ^ table[index]); + } + } + + protected override byte[] HashFinal() + { + return BitConverter.GetBytes(crc); + } + + public override void Initialize() + { + crc = ushort.MaxValue; + } + } +} diff --git a/Framework/EGFramework/Module/Extension/EGDateTimeExtension.cs b/Framework/EGFramework/Module/Extension/EGDateTimeExtension.cs new file mode 100644 index 0000000..61d58d6 --- /dev/null +++ b/Framework/EGFramework/Module/Extension/EGDateTimeExtension.cs @@ -0,0 +1,20 @@ +using System; +namespace EGFramework{ + public static class EGDateTimeExtension + { + public static string GetFullDateMsg(this IEGFramework self) + { + return DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToString("HH:mm:ss"); + } + public static string GetDayDateMsg(this IEGFramework self) + { + return DateTime.Now.ToString("HH:mm:ss"); + } + public static long GetTimeStamp(this IEGFramework self) + { + TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 8, 0, 0, 0); + return System.Convert.ToInt64(ts.TotalSeconds); + } + } +} + diff --git a/Framework/EGFramework/Module/Extension/EGEncodingExtension.cs b/Framework/EGFramework/Module/Extension/EGEncodingExtension.cs new file mode 100644 index 0000000..d597776 --- /dev/null +++ b/Framework/EGFramework/Module/Extension/EGEncodingExtension.cs @@ -0,0 +1,79 @@ +using System; +using System.Text; + +namespace EGFramework{ + //use this extension,you should add System.Text.Encoding.CodePages package from Nuget + public static class EGEncodingExtension + { + public static bool IsInit{ set; get; } + + /// + /// get encoding from encoding params(string). + /// + /// + /// + /// + public static Encoding GetEncoding(this IEGFramework self,string encodingTxt){ + if(!IsInit){ + IsInit = true; + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + return Encoding.GetEncoding(encodingTxt); + } + + /// + /// Make a string to bytes with encoding params(string). + /// + /// + /// + /// + public static byte[] ToBytesByEncoding(this string self,string encodingTxt){ + if(!IsInit){ + IsInit = true; + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + return Encoding.GetEncoding(encodingTxt).GetBytes(self); + } + /// + /// Make a string to bytes with encoding. + /// + /// + /// + /// + public static byte[] ToBytesByEncoding(this string self,Encoding encoding){ + if(!IsInit){ + IsInit = true; + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + return encoding.GetBytes(self); + } + + /// + /// Make a bytes to string with encoding params(string). + /// + /// + /// + /// + public static string ToStringByEncoding(this byte[] self,string encodingTxt){ + if(!IsInit){ + IsInit = true; + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + return Encoding.GetEncoding(encodingTxt).GetString(self); + } + /// + /// Make a bytes to string with encoding. + /// + /// + /// + /// + public static string ToStringByEncoding(this byte[] self,Encoding encoding){ + if(!IsInit){ + IsInit = true; + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + } + return encoding.GetString(self); + } + } +} + diff --git a/Framework/EGFramework/Module/Extension/EGIpExtension.cs b/Framework/EGFramework/Module/Extension/EGIpExtension.cs new file mode 100644 index 0000000..71978a4 --- /dev/null +++ b/Framework/EGFramework/Module/Extension/EGIpExtension.cs @@ -0,0 +1,39 @@ +using System; + +namespace EGFramework { + public static class EGIpExtension + { + /// + /// Get host from IP. Such as 192.168.0.1:5555 => get 192.168.0.1 + /// + /// + /// + public static string GetHostByIp(this string ip) + { + int colonIndex = ip.IndexOf(":"); + string host = ""; + if (colonIndex != -1) + { + host = ip.Substring(0, colonIndex); + } + return host; + } + + public static int GetPortByIp(this string ip) + { + int colonIndex = ip.IndexOf(":"); + string portString = ip.Substring(colonIndex + 1); + int port; + if (int.TryParse(portString, out port)) + { + //nothing to do + } + else + { + port = 0; + } + return port; + } + } +} + diff --git a/Framework/EGFramework/Module/ProtocolExtension/EGDnsExtension.cs b/Framework/EGFramework/Module/ProtocolExtension/EGDnsExtension.cs new file mode 100644 index 0000000..564fc3d --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolExtension/EGDnsExtension.cs @@ -0,0 +1,299 @@ +using System; +using System.Collections.Generic; + +namespace EGFramework{ + /// + /// Support a class for analysis the .local(mdns) or other www.com(dns) protocol to get the message, + /// mdns protocol format type reference from https://github.com/richardschneider/net-mdns + /// nuget package is Makaretu.Dns.Multicast + /// mdns reference from https://www.rfc-editor.org/rfc/rfc6763.html + /// + public static class EGDnsExtension + { + public const string DefaultDnsServer = "1.1.1.1"; + public const int DefaultDnsPort = 53; + public const string DefaultMDnsServerIpv4 = "224.0.0.251"; + public const string DefaultMDnsServerIpv6 = "FF02::FB"; + public const int DefaultMDnsPort = 5353; + + public const string DNS_SRV_RR = "_services._dns-sd._udp.local"; + } + + /// + /// Dns's OpCode + /// + public enum DnsOpCode : ushort{ + /// + /// Standard query. + /// + Query = 0x0000, + /// + /// Inverse query (obsolete), see https://tools.ietf.org/html/rfc3425. + /// + InverseQuery = 0x0800, + /// + /// A server status request. + /// + Status = 0x1000, + /// + /// Zone change, see https://tools.ietf.org/html/rfc1996. + /// + Notify = 0x2000, + /// + /// Update message, see https://tools.ietf.org/html/rfc2136. + /// + Update = 0x2800 + } + + /// + /// A resource record or query type. + /// + public enum DnsType{ + /// + /// A host address. + /// + A = 1, + /// + /// An authoritative name server. + /// + NS = 2, + /// + /// The canonical name for an alias. + /// + CNAME = 5, + /// + /// Marks the start of a zone of authority. + /// + SOA = 6, + /// + /// A mailbox domain name (EXPERIMENTAL). + /// + MB = 7, + /// + /// A mail group member (EXPERIMENTAL). + /// + MG = 8, + /// + /// A mailbox rename domain name (EXPERIMENTAL). + /// + MR = 9, + /// + /// A Null resource record (EXPERIMENTAL). + /// + NULL = 10, + /// + /// A well known service description. + /// + WKS = 11, + /// + /// A domain name pointer. + /// + PTR = 12, + /// + /// Host information. + /// + HINFO = 13, + /// + /// Mailbox or mail list information. + /// + MINFO = 14, + /// + /// Mail exchange. + /// + MX = 15, + /// + /// Text resources. + /// + TXT = 16, + /// + /// Responsible Person. + /// + RP = 17, + /// + /// AFS Data Base location. + /// + AFSDB = 18, + /// + /// An IPv6 host address. + /// + AAAA = 28, + /// + /// A resource record which specifies the location of the server(s) for a specific protocol and domain. + /// + SRV = 33, + /// + /// Maps an entire domain name. + /// + DNAME = 39, + /// + /// Option record. + /// + OPT = 41, + /// + /// Delegation Signer. + /// + DS = 43, + /// + /// Signature for a RRSET with a particular name, class, and type. + /// + RRSIG = 46, + /// + /// Next secure owener. + /// + NSEC = 47, + /// + /// Public key cryptography to sign and authenticate resource records. + /// + DNSKEY = 48, + /// + /// Authenticated next secure owner. + /// + NSEC3 = 50, + /// + /// Parameters needed by authoritative servers to calculate hashed owner names. + /// + NSEC3PARAM = 51, + /// + /// Shared secret key. + /// + TKEY = 249, + /// + /// Transactional Signature. + /// + TSIG = 250, + /// + /// A request for a transfer of an entire zone. + /// + AXFR = 252, + /// + /// A request for mailbox-related records (MB, MG or MR). + /// + MAILB = 253, + /// + /// A request for any record(s). + /// + ANY = 255, + /// + /// A Uniform Resource Identifier (URI) resource record. + /// + URI = 256, + /// + /// A certification authority authorization. + /// + CAA = 257 + } + + /// + /// The values are maintained by IANA at https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2. + /// + public enum DnsClass : ushort + { + /// + /// The Internet. + /// + IN = 1, + /// + /// The CSNET class (Obsolete - used only for examples insome obsolete RFCs). + /// + CS = 2, + /// + /// The CHAOS class. + /// + CH = 3, + /// + /// Hesiod[Dyer 87]. + /// + HS = 4, + /// + /// Used in UPDATE message to signify no class. + /// + None = 254, + /// + /// Only used in QCLASS. + /// + ANY = 255 + } + + public struct DnsHead{ + + } + + /// + /// MDns Head + /// | TransactionID (2 bytes) | OpCode (2 bytes) | Dns Sign (2 byte) + /// + public struct MDnsHead { + /// + /// + /// + /// + public ushort TransactionID { set; get; } + + + /// + /// The requested operation. + /// + /// + public DnsOpCode OpCode { set; get; } + #region Sign Code + /// + /// A one bit field that specifies whether this message is a query(0), or a response(1). + /// + /// + public bool QR { set; get; } + + public bool AA { set; get; } + + public bool TC { set; get; } + + public bool RD { set; get; } + public bool RA { set; get; } + + public byte OpCode4Bit { set; get; } + /// + /// Reserved for future use. + /// + /// Must be zero in all queries and responses. + public byte Z { set; get; } + /// + /// Authentic data. + /// + /// true if the response data is authentic; otherwise, false. + public bool AD { get; set; } + /// + /// Checking disabled. + /// + /// true if the query does not require authenticated data; otherwise, false. + public bool CD { get; set; } + #endregion + } + + public struct DnsQuestionRequest : IRequest + { + + public byte ReplyCode { set; get; } + public ushort QuestionsCount { set; get; } + public ushort AnswerRRs { set; get; } + public ushort AuthorityRRs { set; get; } + public ushort Additional { set; get; } + + public List Data { set; get; } + + public byte QuestionType { set; get; } + + public byte QuestionClass { set; get; } + + + public byte[] ToProtocolByteData() + { + throw new NotImplementedException(); + } + + public string ToProtocolData() + { + throw new NotImplementedException(); + } + + } +} + diff --git a/Framework/EGFramework/Module/ProtocolExtension/EGModbusExtension.cs b/Framework/EGFramework/Module/ProtocolExtension/EGModbusExtension.cs new file mode 100644 index 0000000..9485e03 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolExtension/EGModbusExtension.cs @@ -0,0 +1,838 @@ +using System; +using System.Linq; + +namespace EGFramework{ + /// + /// some extensions function about Modbus-TCP and Modbus-RTU (Physic layer used RS-485) + /// not include Modbus-ASCII,because LRC verify not developed + /// + public static class EGModbusExtension + { + + //Send Protocol + //---------Modbus-TCP's Prefix--------- + //[00 00 00 00 00 06] 01 03 00 00 00 08 + //00 00 ----- info head (check for reply Any things can be defined) + //xx xx 00 00 00 06 info length ( Max length 65535 ) + public static byte[] MakeModbusTCPPrefix(this object self,ushort messageId,uint length){ + return messageId.ToBytes().Concat(length.ToBytes()).ToArray(); + } + public static byte[] MakeModbusTCPPrefix(this object self,ushort messageId,byte[] sendData){ + return messageId.ToBytes().Concat(((uint)sendData.Length).ToBytes()).ToArray(); + } + } + + /// + /// Modbus FunctionCode + /// 0x01 => Read Coils ---- OK + /// 0x02 => Read Discrete input ---- OK + /// 0x03 => Read Holding registers ---- OK + /// 0x04 => Read Input registers ---- OK + /// 0x05 => Write Single Coils ---- OK + /// 0x06 => Write Single Holding registers ---- OK + /// 0x0F => Write Multi Coils ---- OK + /// 0x10 => Write Multi Holding registers ---- OK + /// + + #region Modbus TCP Request and Response + public struct ModbusTCP_ReadCoils : IRequest + { + public const byte FunctionCode = 0x01; + public const ushort MessageId = 0xFF01; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 2000 + public ModbusTCP_ReadCoils(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = this.MakeModbusTCPPrefix(MessageId,6); + protocolRequest = protocolRequest.Append(DeviceAddress).ToArray(); + protocolRequest = protocolRequest.Append(FunctionCode).ToArray(); + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>2000){ + ReadCount = 2000; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_ReadDiscreteInput : IRequest + { + public const byte FunctionCode = 0x02; + public const ushort MessageId = 0xFF02; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 2000 + public ModbusTCP_ReadDiscreteInput(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = this.MakeModbusTCPPrefix(MessageId,6); + protocolRequest = protocolRequest.Append(DeviceAddress).ToArray(); + protocolRequest = protocolRequest.Append(FunctionCode).ToArray(); + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>2000){ + ReadCount = 2000; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_ReadHoldingRegisters : IRequest + { + public const byte FunctionCode = 0x03; + + public const ushort MessageId = 0xFF03; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 125 + public ModbusTCP_ReadHoldingRegisters(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = this.MakeModbusTCPPrefix(MessageId,6); + protocolRequest = protocolRequest.Append(DeviceAddress).ToArray(); + protocolRequest = protocolRequest.Append(FunctionCode).ToArray(); + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>125){ + ReadCount = 125; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_ReadInputRegisters : IRequest + { + public const byte FunctionCode = 0x04; + + public const ushort MessageId = 0xFF04; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 125 + public ModbusTCP_ReadInputRegisters(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = this.MakeModbusTCPPrefix(MessageId,6); + protocolRequest = protocolRequest.Append(DeviceAddress).ToArray(); + protocolRequest = protocolRequest.Append(FunctionCode).ToArray(); + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>125){ + ReadCount = 125; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_WriteSingleCoil : IRequest + { + public const byte FunctionCode = 0x05; + + public const ushort MessageId = 0xFF05; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public bool Value { set; get; } + + public ModbusTCP_WriteSingleCoil(byte deviceAddress,ushort registerAddress,bool value){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + Value = value; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = this.MakeModbusTCPPrefix(MessageId,6); + protocolRequest = protocolRequest.Append(DeviceAddress).ToArray(); + protocolRequest = protocolRequest.Append(FunctionCode).ToArray(); + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + byte[] registerValues = {0x00,0x00}; + if(Value){ + registerValues[0]=0xFF; + } + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_WriteSingleHoldingRegister : IRequest + { + public const byte FunctionCode = 0x06; + + public const ushort MessageId = 0xFF06; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort Value { set; get; } + + public ModbusTCP_WriteSingleHoldingRegister(byte deviceAddress,ushort registerAddress,ushort value){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + Value = value; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = this.MakeModbusTCPPrefix(MessageId,6); + protocolRequest = protocolRequest.Append(DeviceAddress).ToArray(); + protocolRequest = protocolRequest.Append(FunctionCode).ToArray(); + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + byte[] registerValues = Value.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_WriteMultiCoil : IRequest{ + public const byte FunctionCode = 0x0F; + + public const ushort MessageId = 0xFF0F; + public byte DeviceAddress { set; get; } + public ushort RegisterStartAddress { set; get; } + public bool[] Values { set; get; } + + /// + /// Construct the protocol + /// + /// usual use 0x01 for device address + /// + /// Values length should be less than 2000 + public ModbusTCP_WriteMultiCoil(byte deviceAddress,ushort registerStartAddress,bool[] values){ + DeviceAddress = deviceAddress; + RegisterStartAddress = registerStartAddress; + Values = values; + } + public byte[] ToProtocolByteData() + { + + byte[] protocolRequest = {DeviceAddress,FunctionCode}; + protocolRequest = protocolRequest.Concat(RegisterStartAddress.ToBytes()).ToArray(); + protocolRequest = protocolRequest.Concat(((ushort)Values.Length).ToBytes()).ToArray(); + + //Length range should be 1-2000 0x0001-0x07D0,otherwise delete the data after 2000 + if(Values.Length>2000){ + bool[] SourceValues = Values; + Values = new bool[2000]; + Array.Copy(Values,0,SourceValues,0,2000); + } + //bool array 2000 => byte array 250 + byte[] valueGroup = Values.ToByteArray(); + byte valueLength = (byte)valueGroup.Length; + protocolRequest = protocolRequest.Append(valueLength).ToArray(); + protocolRequest = protocolRequest.Concat(valueGroup).ToArray(); + byte[] protocolPrefix = this.MakeModbusTCPPrefix(MessageId,protocolRequest); + protocolRequest = protocolPrefix.Concat(protocolRequest).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + /// + /// Start write at Register start address,such as 0x03,write order by order like 0x03,0x04,0x05...,write count is the value array length + /// + public struct ModbusTCP_WriteMultiHoldingRegister : IRequest + { + public const byte FunctionCode = 0x10; + + public const ushort MessageId = 0xFF10; + public byte DeviceAddress { set; get; } + public ushort RegisterStartAddress { set; get; } + public ushort[] Values { set; get; } + + /// + /// Construct the protocol + /// + /// usual use 0x01 for device address + /// + /// Values length should be less than 125 + public ModbusTCP_WriteMultiHoldingRegister(byte deviceAddress,ushort registerStartAddress,ushort[] values){ + DeviceAddress = deviceAddress; + RegisterStartAddress = registerStartAddress; + Values = values; + } + public byte[] ToProtocolByteData() + { + + byte[] protocolRequest = {DeviceAddress,FunctionCode}; + protocolRequest = protocolRequest.Concat(RegisterStartAddress.ToBytes()).ToArray(); + protocolRequest = protocolRequest.Concat(((ushort)Values.Length).ToBytes()).ToArray(); + + //Length range should be 1-125 0x0001-0x07D,otherwise delete the data after 125 + if(Values.Length>125){ + ushort[] SourceValues = Values; + Values = new ushort[125]; + Array.Copy(Values,0,SourceValues,0,125); + } + //ushort array 125 => byte array 250 + byte[] valueGroup = {}; + foreach(ushort value in Values){ + byte[] registerValues = value.ToBytes(); + valueGroup = valueGroup.Concat(registerValues).ToArray(); + } + byte valueLength = (byte)valueGroup.Length; + protocolRequest = protocolRequest.Append(valueLength).ToArray(); + protocolRequest = protocolRequest.Concat(valueGroup).ToArray(); + byte[] protocolPrefix = this.MakeModbusTCPPrefix(MessageId,protocolRequest); + protocolRequest = protocolPrefix.Concat(protocolRequest).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusTCP_Response : IResponse + { + public bool[] Coil { set; get; } + public bool[] DiscreteInput { set; get; } + public ushort[] HoldingRegister { set; get; } + public ushort[] InputRegister { set; get; } + public byte FunctionCode { set; get; } + public byte DeviceAddress { set; get; } + public ushort RegisterStartAddress { set; get; } + public uint DataLength { set; get; } + + public byte[] SourceData { set; get; } + public ModbusFunctionType FunctionType { set; get; } + + public bool TrySetData(string protocolData, byte[] protocolBytes) + { + try + { + if(protocolBytes==null && protocolBytes.Length < 10){ + return false; + } + SourceData = protocolBytes; + DeviceAddress = protocolBytes[6]; + FunctionType = (ModbusFunctionType)protocolBytes[7]; + byte[] dataLength = new byte[4]; + Array.Copy(protocolBytes,2,dataLength,0,4); + DataLength = dataLength.ToUINT(); + if(protocolBytes.Length != DataLength+6){ + return false; + } + //every response's start should be 0xff,because the request's start is 0xff + if(protocolBytes[0]==0xff){ + switch(FunctionType){ + case ModbusFunctionType.ReadCoil: + byte readCoilLength = protocolBytes[8]; + byte[] CoilBytes = new byte[readCoilLength]; + Array.Copy(protocolBytes,9,CoilBytes,0,readCoilLength); + Coil = CoilBytes.ToBoolArray(); + return true; + case ModbusFunctionType.ReadDiscreteInput: + byte readDiscreteInputLength = protocolBytes[8]; + byte[] DiscreteInputBytes = new byte[readDiscreteInputLength]; + Array.Copy(protocolBytes,9,DiscreteInputBytes,0,readDiscreteInputLength); + DiscreteInput = DiscreteInputBytes.ToBoolArray(); + return true; + case ModbusFunctionType.ReadHoldingRegisters: + byte readHoldingRegistersLength = protocolBytes[8]; + byte[] HoldingRegistersBytes = new byte[readHoldingRegistersLength]; + Array.Copy(protocolBytes,9,HoldingRegistersBytes,0,readHoldingRegistersLength); + HoldingRegister = HoldingRegistersBytes.ToUShortArray(); + return true; + case ModbusFunctionType.ReadInputRegisters: + byte readInputRegistersLength = protocolBytes[8]; + byte[] InputRegistersBytes = new byte[readInputRegistersLength]; + Array.Copy(protocolBytes,9,InputRegistersBytes,0,readInputRegistersLength); + InputRegister = InputRegistersBytes.ToUShortArray(); + return true; + case ModbusFunctionType.WriteSingleCoil: + return true; + case ModbusFunctionType.WriteSingleHoldingRegister: + return true; + case ModbusFunctionType.WriteMultiCoil: + return true; + case ModbusFunctionType.WriteMultiHoldingRegister: + return true; + default: + return false; + } + } + } + catch (Exception) + { + return false; + } + return false; + } + } + #endregion + + #region Modbus RTU Request and Response,Used RS-485 for Physic layer + public struct ModbusRTU_ReadCoils : IRequest{ + public const byte FunctionCode = 0x01; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 2000 + public ModbusRTU_ReadCoils(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = { DeviceAddress , FunctionCode }; + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>2000){ + ReadCount = 2000; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_ReadDiscreteInput : IRequest{ + public const byte FunctionCode = 0x02; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 2000 + public ModbusRTU_ReadDiscreteInput(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = { DeviceAddress , FunctionCode }; + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>2000){ + ReadCount = 2000; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_ReadHoldingRegisters : IRequest{ + public const byte FunctionCode = 0x03; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 2000 + public ModbusRTU_ReadHoldingRegisters(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = { DeviceAddress , FunctionCode }; + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>125){ + ReadCount = 125; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_ReadInputRegisters : IRequest{ + public const byte FunctionCode = 0x04; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort ReadCount { set; get; } + + /// + /// Construct the protocol + /// + /// + /// + /// Read count should be less than 2000 + public ModbusRTU_ReadInputRegisters(byte deviceAddress,ushort registerAddress,ushort readCount){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + ReadCount = readCount; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = { DeviceAddress , FunctionCode }; + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + if(ReadCount>125){ + ReadCount = 125; + } + byte[] registerValues = ReadCount.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_WriteSingleCoil : IRequest{ + public const byte FunctionCode = 0x05; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public bool Value { set; get; } + + public ModbusRTU_WriteSingleCoil(byte deviceAddress,ushort registerAddress,bool value){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + Value = value; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = { DeviceAddress , FunctionCode }; + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + byte[] registerValues = {0x00,0x00}; + if(Value){ + registerValues[0]=0xFF; + } + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_WriteSingleHoldingRegister : IRequest{ + public const byte FunctionCode = 0x06; + public byte DeviceAddress { set; get; } + public ushort RegisterAddress { set; get; } + public ushort Value { set; get; } + + public ModbusRTU_WriteSingleHoldingRegister(byte deviceAddress,ushort registerAddress,ushort value){ + DeviceAddress = deviceAddress; + RegisterAddress = registerAddress; + Value = value; + } + public byte[] ToProtocolByteData() + { + byte[] protocolRequest = { DeviceAddress , FunctionCode }; + protocolRequest = protocolRequest.Concat(RegisterAddress.ToBytes()).ToArray(); + byte[] registerValues = Value.ToBytes(); + protocolRequest = protocolRequest.Concat(registerValues).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_WriteMultiCoil : IRequest{ + public const byte FunctionCode = 0x0F; + public byte DeviceAddress { set; get; } + public ushort RegisterStartAddress { set; get; } + public bool[] Values { set; get; } + + /// + /// Construct the protocol + /// + /// usual use 0x01 for device address + /// + /// Values length should be less than 2000 + public ModbusRTU_WriteMultiCoil(byte deviceAddress,ushort registerStartAddress,bool[] values){ + DeviceAddress = deviceAddress; + RegisterStartAddress = registerStartAddress; + Values = values; + } + public byte[] ToProtocolByteData() + { + + byte[] protocolRequest = {DeviceAddress,FunctionCode}; + protocolRequest = protocolRequest.Concat(RegisterStartAddress.ToBytes()).ToArray(); + protocolRequest = protocolRequest.Concat(((ushort)Values.Length).ToBytes()).ToArray(); + + //Length range should be 1-2000 0x0001-0x07D0,otherwise delete the data after 2000 + if(Values.Length>2000){ + bool[] SourceValues = Values; + Values = new bool[2000]; + Array.Copy(Values,0,SourceValues,0,2000); + } + //bool array 2000 => byte array 250 + byte[] valueGroup = Values.ToByteArray(); + byte valueLength = (byte)valueGroup.Length; + protocolRequest = protocolRequest.Append(valueLength).ToArray(); + protocolRequest = protocolRequest.Concat(valueGroup).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + /// + /// Start write at Register start address,such as 0x03,write order by order like 0x03,0x04,0x05...,write count is the value array length + /// + public struct ModbusRTU_WriteMultiHoldingRegister : IRequest + { + public const byte FunctionCode = 0x10; + + public const ushort MessageId = 0xFF10; + public byte DeviceAddress { set; get; } + public ushort RegisterStartAddress { set; get; } + public ushort[] Values { set; get; } + + /// + /// Construct the protocol + /// + /// usual use 0x01 for device address + /// + /// Values length should be less than 125 + public ModbusRTU_WriteMultiHoldingRegister(byte deviceAddress,ushort registerStartAddress,ushort[] values){ + DeviceAddress = deviceAddress; + RegisterStartAddress = registerStartAddress; + Values = values; + } + public byte[] ToProtocolByteData() + { + + byte[] protocolRequest = {DeviceAddress,FunctionCode}; + protocolRequest = protocolRequest.Concat(RegisterStartAddress.ToBytes()).ToArray(); + protocolRequest = protocolRequest.Concat(((ushort)Values.Length).ToBytes()).ToArray(); + + //Length range should be 1-125 0x0001-0x07D,otherwise delete the data after 125 + if(Values.Length>125){ + ushort[] SourceValues = Values; + Values = new ushort[125]; + Array.Copy(Values,0,SourceValues,0,125); + } + //ushort array 125 => byte array 250 + byte[] valueGroup = {}; + foreach(ushort value in Values){ + byte[] registerValues = value.ToBytes(); + valueGroup = valueGroup.Concat(registerValues).ToArray(); + } + byte valueLength = (byte)valueGroup.Length; + protocolRequest = protocolRequest.Append(valueLength).ToArray(); + protocolRequest = protocolRequest.Concat(valueGroup).ToArray(); + protocolRequest = protocolRequest.Concat(protocolRequest.CalculateCRC16Modbus().ToBytes()).ToArray(); + return protocolRequest; + } + + public string ToProtocolData() + { + return ""; + } + } + + public struct ModbusRTU_Response : IResponse + { + public bool[] Coil { set; get; } + public bool[] DiscreteInput { set; get; } + public ushort[] HoldingRegister { set; get; } + public ushort[] InputRegister { set; get; } + public byte FunctionCode { set; get; } + public byte DeviceAddress { set; get; } + public ushort RegisterStartAddress { set; get; } + + public byte[] SourceData { set; get; } + public ModbusFunctionType FunctionType { set; get; } + + public bool TrySetData(string protocolData, byte[] protocolBytes) + { + try + { + if(protocolBytes==null && protocolBytes.Length < 6){ + return false; + } + SourceData = protocolBytes; + DeviceAddress = protocolBytes[0]; + FunctionCode = protocolBytes[1]; + FunctionType = (ModbusFunctionType)protocolBytes[1]; + + //check crc verify is success + byte[] resultArray = new byte[protocolBytes.Length - 2]; + Array.Copy(protocolBytes, 0, resultArray, 0, protocolBytes.Length - 2); + byte[] crcArray = new byte[2]; + Array.Copy(protocolBytes, protocolBytes.Length - 2, crcArray, 0, 2); + if(resultArray.CalculateCRC16Modbus()!=crcArray.ToUShort()){ + return false; + } + + //every response's start should be 0xff,because the request's start is 0xff + switch(FunctionType){ + case ModbusFunctionType.ReadCoil: + byte readCoilLength = protocolBytes[2]; + byte[] CoilBytes = new byte[readCoilLength]; + Array.Copy(protocolBytes,3,CoilBytes,0,readCoilLength); + Coil = CoilBytes.ToBoolArray(); + return true; + case ModbusFunctionType.ReadDiscreteInput: + byte readDiscreteInputLength = protocolBytes[2]; + byte[] DiscreteInputBytes = new byte[readDiscreteInputLength]; + Array.Copy(protocolBytes,3,DiscreteInputBytes,0,readDiscreteInputLength); + DiscreteInput = DiscreteInputBytes.ToBoolArray(); + return true; + case ModbusFunctionType.ReadHoldingRegisters: + byte readHoldingRegistersLength = protocolBytes[2]; + byte[] HoldingRegistersBytes = new byte[readHoldingRegistersLength]; + Array.Copy(protocolBytes,3,HoldingRegistersBytes,0,readHoldingRegistersLength); + HoldingRegister = HoldingRegistersBytes.ToUShortArray(); + return true; + case ModbusFunctionType.ReadInputRegisters: + byte readInputRegistersLength = protocolBytes[2]; + byte[] InputRegistersBytes = new byte[readInputRegistersLength]; + Array.Copy(protocolBytes,3,InputRegistersBytes,0,readInputRegistersLength); + InputRegister = InputRegistersBytes.ToUShortArray(); + return true; + case ModbusFunctionType.WriteSingleCoil: + return true; + case ModbusFunctionType.WriteSingleHoldingRegister: + return true; + case ModbusFunctionType.WriteMultiCoil: + return true; + case ModbusFunctionType.WriteMultiHoldingRegister: + return true; + default: + return false; + } + + } + catch (Exception) + { + return false; + } + } + } + #endregion + + public enum ModbusFunctionType{ + None = 0x00, + ReadCoil = 0x01, + ReadDiscreteInput = 0x02, + ReadHoldingRegisters = 0x03, + ReadInputRegisters = 0x04, + WriteSingleCoil = 0x05, + WriteSingleHoldingRegister = 0x06, + WriteMultiCoil = 0x0f, + WriteMultiHoldingRegister = 0x10 + } +} diff --git a/Framework/EGFramework/Module/ProtocolTools/EGHttpClient.cs b/Framework/EGFramework/Module/ProtocolTools/EGHttpClient.cs new file mode 100644 index 0000000..e705c56 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/EGHttpClient.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Drawing.Printing; +using System.IO; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace EGFramework{ + public class EGHttpClient : IEGFramework, IModule + { + public HttpClient HTTPClient { set; get; } = new HttpClient(); + + public Encoding StringEncoding { set; get; } = Encoding.UTF8; + + public void Init() + { + + } + + public async Task HttpRequest(string hostUrl,IRequest request,ProtocolType protocolType = ProtocolType.HttpGet,EGFormData formData = null) where TResponse : IResponse,new(){ + // Call asynchronous network methods in a try/catch block to handle exceptions. + try + { + HttpContent httpContent = new StringContent("",Encoding.UTF8,"application/json"); + if(formData != null){ + MultipartFormDataContent formContent = new MultipartFormDataContent(); + foreach(KeyValuePair pair in formData.FormStrings){ + formContent.Add(new StringContent(pair.Value,Encoding.UTF8),pair.Key); + } + foreach(KeyValuePair pair in formData.FormBytes){ + formContent.Add(new ByteArrayContent(pair.Value),pair.Key,pair.Key+"."+formData.Suffix); + } + foreach(KeyValuePair pair in formData.FormStreams){ + formContent.Add(new StreamContent(pair.Value),pair.Key,pair.Key+"."+formData.Suffix); + } + httpContent = formContent; + } + else if(request.ToProtocolData() != null && request.ToProtocolData() != ""){ + httpContent = new StringContent(request.ToProtocolData(),Encoding.UTF8,"application/json"); + }else if (request.ToProtocolByteData() != null){ + httpContent = new ByteArrayContent(request.ToProtocolByteData()); + } + HttpResponseMessage httpResponse; + switch(protocolType){ + case ProtocolType.HttpGet: + httpResponse = await HTTPClient.GetAsync(hostUrl); + break; + case ProtocolType.HttpPost: + httpResponse = await HTTPClient.PostAsync(hostUrl,httpContent); + break; + case ProtocolType.HttpPut: + httpResponse = await HTTPClient.PostAsync(hostUrl,httpContent); + break; + case ProtocolType.HttpPatch: + httpResponse = await HTTPClient.PostAsync(hostUrl,httpContent); + break; + case ProtocolType.HttpDelete: + httpResponse = await HTTPClient.DeleteAsync(hostUrl); + break; + default: + httpResponse = await HTTPClient.GetAsync(hostUrl); + break; + } + httpResponse.EnsureSuccessStatusCode(); + byte[] responseBytes = await httpResponse.Content.ReadAsByteArrayAsync(); + string responseBody = await httpResponse.Content.ReadAsStringAsync(); + TResponse response = new TResponse(); + response.TrySetData(responseBody,responseBytes); + return response; + } + catch (HttpRequestException e) + { + Console.WriteLine(e.Message); + return default; + } + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + } + + public class EGFormData{ + public string Suffix = ""; + public Dictionary FormStrings = new Dictionary(); + public Dictionary FormBytes = new Dictionary(); + public Dictionary FormStreams = new Dictionary(); + } + public static class CanGetEGHttpClientExtension{ + public static EGHttpClient EGHttpClient(this IEGFramework self){ + return self.GetModule(); + } + } +} \ No newline at end of file diff --git a/Framework/EGFramework/Module/ProtocolTools/EGHttpServer.cs b/Framework/EGFramework/Module/ProtocolTools/EGHttpServer.cs new file mode 100644 index 0000000..a7c6236 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/EGHttpServer.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace EGFramework{ + public class EGHttpServer : IEGFramework, IModule + { + public HttpListener HttpServer { set; get; } + public Encoding StringEncoding { set; get; } = Encoding.UTF8; + + public Dictionary ResponsePools { set; get; } = new Dictionary(); + public void Init() + { + + } + + /// + /// if you are in Win7 or newest system, you should add prefix in urlacl by cmd for example: netsh http add urlacl url=http://+:6555/index/ user=Everyone + /// + /// + /// + public async void Listen(string prefix){ + if(!HttpListener.IsSupported){ + return; + } + if(HttpServer == null){ + HttpServer = new HttpListener(); + } + HttpServer.Prefixes.Add(prefix); + if(!HttpServer.IsListening){ + HttpServer.Start(); + HttpListenerContext context = await HttpServer.GetContextAsync(); + + HttpListenerRequest request = context.Request; + string responseKey = ""; + switch (request.HttpMethod) + { + case "POST": + { + Stream stream = context.Request.InputStream; + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + byte[] postBuffer = new byte[stream.Length]; + stream.Read(postBuffer,0,postBuffer.Length); + string postString = reader.ReadToEnd(); + ResponseMsg receivedMsgs = new ResponseMsg(postString,postBuffer,"GET:"+context.User.ToString(), ProtocolType.HttpServer); + this.EGOnReceivedData(receivedMsgs); + } + break; + case "GET": + { + NameValueCollection data = request.QueryString; + Dictionary getDic = data.AllKeys.ToDictionary(k=>k,k=>data[k]); + string getData = JsonConvert.SerializeObject(getDic); + byte[] getBuffer = StringEncoding.GetBytes(getData); + responseKey = "GET:"+this.GetTimeStamp().ToString(); + ResponseMsg receivedMsgs = new ResponseMsg(getData,getBuffer,responseKey, ProtocolType.HttpServer); + this.EGOnReceivedData(receivedMsgs); + } + break; + case "PUT": + { + Stream stream = context.Request.InputStream; + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + byte[] postBuffer = new byte[stream.Length]; + stream.Read(postBuffer,0,postBuffer.Length); + string postData = reader.ReadToEnd(); + ResponseMsg receivedMsgs = new ResponseMsg(postData,postBuffer,"PUT:"+context.User.ToString(), ProtocolType.HttpServer); + this.EGOnReceivedData(receivedMsgs); + } + break; + case "PATCH": + { + Stream stream = context.Request.InputStream; + StreamReader reader = new StreamReader(stream, Encoding.UTF8); + byte[] postBuffer = new byte[stream.Length]; + stream.Read(postBuffer,0,postBuffer.Length); + string postData = reader.ReadToEnd(); + ResponseMsg receivedMsgs = new ResponseMsg(postData,postBuffer,"PATCH:"+context.User.ToString(), ProtocolType.HttpServer); + this.EGOnReceivedData(receivedMsgs); + } + break; + case "DELETE": + { + NameValueCollection data = request.QueryString; + Dictionary getDic = data.AllKeys.ToDictionary(k=>k,k=>data[k]); + string getData = JsonConvert.SerializeObject(getDic); + byte[] getBuffer = StringEncoding.GetBytes(getData); + ResponseMsg receivedMsgs = new ResponseMsg(getData,getBuffer,"DELETE:"+context.User.ToString(), ProtocolType.HttpServer); + this.EGOnReceivedData(receivedMsgs); + } + break; + } + HttpListenerResponse response = context.Response; + response.AppendHeader("Access-Control-Allow-Origin", "*"); + response.AppendHeader("Access-Control-Allow-Credentials", "true"); + response.AppendHeader("Server", "MyIIS"); + response.StatusCode = 200; + + ResponsePools.Add("",response); + + } + } + + public async void Response(string responseKey,string responseString = "",byte[] responseByte = null){ + #region 返回应答 + // Construct a response. + byte[] buffer = StringEncoding.GetBytes(responseString); + // Get a response stream and write the response to it. + ResponsePools[responseKey].ContentLength64 = buffer.Length; + System.IO.Stream output = ResponsePools[responseKey].OutputStream; + await output.WriteAsync(buffer, 0, buffer.Length); + // You must close the output stream. + output.Close(); + #endregion + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + + } + + public static class CanGetEGHttpServerExtension{ + public static EGHttpServer EGHttpServer(this IEGFramework self){ + return self.GetModule(); + } + + public static void EGHttpServerListen(this IEGFramework self ,string prefix){ + self.GetModule().Listen(prefix); + } + } + +} diff --git a/Framework/EGFramework/Module/ProtocolTools/EGSerialPort.cs b/Framework/EGFramework/Module/ProtocolTools/EGSerialPort.cs new file mode 100644 index 0000000..d46fa07 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/EGSerialPort.cs @@ -0,0 +1,196 @@ +using System.IO.Ports; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EGFramework{ + public class EGSerialPort : IModule,IEGFramework,IProtocolSend,IProtocolReceived + { + public Dictionary SerialPortDevices { set; get; } = new Dictionary(); + public Dictionary SerialPortMapping { set; get; } = new Dictionary(); + + public int DefaultBaudRate { set; get; } = 115200; + + public string ErrorLogs { set; get; } + + public string ReceivedStr { set; get; } = ""; + + public Encoding StringEncoding { set; get; } = Encoding.UTF8; + + public Queue ResponseMsgs { set; get; } = new Queue(); + + public void Init() + { + this.EGRegisterSendAction(request=>{ + if(request.protocolType == ProtocolType.SerialPort){ + if(request.req.ToProtocolData() != "" && request.req.ToProtocolData() != null){ + this.SendSerialStringData(request.sender,request.req.ToProtocolData()); + } + if(request.req.ToProtocolByteData().Length > 0 && request.req.ToProtocolByteData() != null){ + this.SendSerialByteData(request.sender,request.req.ToProtocolByteData()); + } + } + }); + } + + public Queue GetReceivedMsg() + { + return this.ResponseMsgs; + } + + public void SetEncoding(Encoding encoding){ + this.StringEncoding = encoding; + } + + public Encoding GetEncoding(){ + return StringEncoding; + } + + public List RefreshSerialPort(){ + string[] portNames = SerialPort.GetPortNames(); + SerialPortMapping.Clear(); + int index = 0; + foreach (string portName in portNames) + { + SerialPortMapping.Add(portName,index); + index++; + } + return SerialPortMapping.Keys.ToList(); + } + + public void SetBaudRate(int baudRate){ + this.DefaultBaudRate = baudRate; + } + + /// + /// Open serial port with check if target serial port isOpen. + /// + /// + public bool Open(string serialPort){ + try{ + if(!SerialPortDevices.ContainsKey(serialPort)){ + SerialPort newPort = new SerialPort(serialPort, DefaultBaudRate, Parity.None, 8, StopBits.One); + SerialPortDevices.Add(serialPort,newPort); + if (!SerialPortDevices[serialPort].IsOpen) + { + SerialPortDevices[serialPort].Open(); + SerialPortDevices[serialPort].DataReceived += SerialPort_DataReceived; + } + }else{ + if(!SerialPortDevices[serialPort].IsOpen){ + SerialPortDevices[serialPort].Open(); + } + } + return true; + } + catch(Exception e){ + ErrorLogs = "[open port error]" + e.ToString(); + return false; + } + } + + /// + /// Close serial port with check if target serial port isOpen. + /// + /// + public void Close(string serialPort){ + if(SerialPortDevices.ContainsKey(serialPort)){ + if (SerialPortDevices[serialPort].IsOpen) + { + SerialPortDevices[serialPort].Close(); + SerialPortDevices.Remove(serialPort); + } + }else{ + //Not found in SerialPortDevices,need add? + } + } + + public bool SendSerialByteData(string serialPort,byte[] data){ + // if serial port not open,open first + try{ + bool isSuccessPort = Open(serialPort); + if(isSuccessPort){ + SerialPortDevices[serialPort].Write(data, 0, data.Length); + return true; + }else{ + return false; + } + }catch(Exception e){ + ErrorLogs = "[write error]" + e.ToString(); + return false; + } + } + public void SendByteData(string destination,byte[] data){ + SendSerialByteData(destination,data); + } + + public bool SendByteDataOnce(string serialPort,byte[] data){ + bool isSuccessSend = SendSerialByteData(serialPort,data); + if(isSuccessSend){ + SerialPortDevices[serialPort].Close(); + SerialPortDevices.Remove(serialPort); + } + return isSuccessSend; + } + + public bool SendSerialStringData(string serialPort,string data){ + // if serial port not open,open first + try{ + bool isSuccessPort = Open(serialPort); + if(isSuccessPort){ + byte[] encodingData = StringEncoding.GetBytes(data); + SerialPortDevices[serialPort].Write(encodingData, 0, encodingData.Length); + return true; + }else{ + return false; + } + }catch(Exception e){ + ErrorLogs = "[write error]" + e.ToString(); + return false; + } + } + public void SendStringData(string destination,string data){ + SendSerialStringData(destination,data); + } + + public bool SendStringDataOnce(string serialPort,string data){ + bool isSuccessSend = SendSerialStringData(serialPort,data); + if(isSuccessSend){ + SerialPortDevices[serialPort].Close(); + SerialPortDevices.Remove(serialPort); + } + return isSuccessSend; + } + + private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) + { + //await Task.Run(() => {}).ConfigureAwait(false); + SerialPort serialPort = (SerialPort)sender; + if(serialPort.BytesToRead > 0){ + int bufferSize = serialPort.BytesToRead; + byte[] buffer = new byte[bufferSize]; + serialPort.Read(buffer,0,serialPort.BytesToRead); + string str = StringEncoding.GetString(buffer); + Console.WriteLine(buffer.ToStringByHex()); + ResponseMsgs.Enqueue(new ResponseMsg(str,buffer,serialPort.PortName,ProtocolType.SerialPort)); + //this.EGOnReceivedData(new ResponseMsg(str,buffer,serialPort.PortName,ProtocolType.SerialPort)); + } + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + } + public static class CanGetEGSerialPortExtension{ + public static EGSerialPort EGSerialPort(this IEGFramework self){ + return self.GetModule(); + } + + public static SerialPort EGGetSerialPort(this IEGFramework self,string serial){ + return self.GetModule().SerialPortDevices[serial]; + } + } +} diff --git a/Framework/EGFramework/Module/ProtocolTools/EGTCPClient.cs b/Framework/EGFramework/Module/ProtocolTools/EGTCPClient.cs new file mode 100644 index 0000000..753f54e --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/EGTCPClient.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Net.Sockets; +using System.Threading.Tasks; +using System.Net; + +namespace EGFramework{ + public class EGTCPClient : IModule, IEGFramework, IProtocolSend, IProtocolReceived + { + public Dictionary TCPClientDevices { set; get; } = new Dictionary(); + + public string ErrorLogs { set; get; } + + public Encoding StringEncoding { set; get; } = Encoding.UTF8; + + public Queue ResponseMsgs { set; get; } = new Queue(); + + public void Init() + { + this.EGRegisterSendAction(request=>{ + if(request.protocolType == ProtocolType.TCPClient){ + if(request.req.ToProtocolData() != null && request.req.ToProtocolData() != ""){ + this.SendStringData(request.sender.GetHostByIp(),request.sender.GetPortByIp(),request.req.ToProtocolData()); + } + if(request.req.ToProtocolByteData() != null && request.req.ToProtocolByteData().Length > 0){ + this.SendByteData(request.sender.GetHostByIp(),request.sender.GetPortByIp(),request.req.ToProtocolByteData()); + } + } + }); + } + + /// + /// Connect Tcp client to server with check if target server is listened. + /// + public async Task ConnectTCP(string host,int port){ + try{ + if(!TCPClientDevices.ContainsKey(host + ":" + port)){ + TcpClient tcpClient = new TcpClient(); + await tcpClient.ConnectAsync(host,port); + //Print("Connect Tcp success in "+tcpClient.Client.RemoteEndPoint.ToString()); + TCPClientDevices.Add(host + ":" + port,tcpClient); + _ = HandleClientAsync(tcpClient,host,port); + }else{ + if(!TCPClientDevices[host + ":" + port].Connected){ + await TCPClientDevices[host + ":" + port].ConnectAsync(host,port); + _ = HandleClientAsync(TCPClientDevices[host + ":" + port],host,port); + } + } + return true; + } + catch(Exception e){ + ErrorLogs = "[open port error]" + e.ToString(); + return false; + } + } + + /// + /// Disconnect Tcp client to server. + /// + public void DisconnectTCP(string host,int port){ + if(TCPClientDevices.ContainsKey(host + ":" + port)){ + if (TCPClientDevices[host + ":" + port].Connected) + { + TCPClientDevices[host + ":" + port].Close(); + TCPClientDevices.Remove(host + ":" + port); + } + }else{ + //Not found in TCPClientDevices,need add? + } + } + + + public void SetEncoding(Encoding textEncoding) + { + this.StringEncoding = textEncoding; + } + public async void SendByteData(string host,int port,byte[] data){ + // if serial port not open,open first + try{ + bool result = await ConnectTCP(host,port); + if(result){ + await TCPClientDevices[host + ":" + port].GetStream().WriteAsync(data,0,data.Length); + } + }catch(Exception e){ + ErrorLogs = "[write error]" + e.ToString(); + } + } + public void SendByteData(string destination,byte[] data){ + SendByteData(destination.GetHostByIp(),destination.GetPortByIp(),data); + } + + public void SendByteDataOnce(string host,int port,byte[] data){ + SendByteData(host,port,data); + DisconnectTCP(host,port); + } + + public void SendStringData(string host,int port,string str){ + SendByteData(host,port,StringEncoding.GetBytes(str)); + } + + public void SendStringData(string destination,string data){ + SendStringData(destination.GetHostByIp(),destination.GetPortByIp(),data); + } + public void SendStringDataOnce(string host,int port,string str){ + SendStringData(host,port,str); + DisconnectTCP(host,port); + } + + public Queue GetReceivedMsg() + { + return ResponseMsgs; + } + + /// + /// UpdateStatus + /// + public async void CheckAndRelink(){ + foreach(TcpClient tcpClient in TCPClientDevices.Values){ + if(!tcpClient.Connected){ + await tcpClient.ConnectAsync((IPEndPoint)tcpClient.Client.RemoteEndPoint); + } + } + } + + public async Task HandleClientAsync(TcpClient client,string host,int port) + { + try + { + NetworkStream stream = client.GetStream(); + string ClientName = host+":"+port; + while (true) + { + byte[] buffer = new byte[1024]; + int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length); + if (bytesRead == 0) + { + break; + } + string data = StringEncoding.GetString(buffer, 0, bytesRead); + byte[] receivedByte = new byte[bytesRead]; + Array.Copy(buffer, 0, receivedByte, 0, bytesRead); + ResponseMsg receivedMsgs = new ResponseMsg(data,receivedByte,ClientName, ProtocolType.TCPClient); + ResponseMsgs.Enqueue(receivedMsgs); + //this.EGOnReceivedData(receivedMsgs); + } + DeleteClient(client,host,port); + } + catch (Exception) + { + } + } + + public void DeleteClient(TcpClient client,string host,int port) + { + client.Close(); + string clientName = host+":"+port; + if (TCPClientDevices.ContainsKey(clientName)) { + TCPClientDevices.Remove(clientName); + } + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + + + } + + public static class CanGetEGTCPClientExtension{ + public static EGTCPClient EGTCPClient(this IEGFramework self){ + return self.GetModule(); + } + + public static TcpClient EGGetTCPClient(this IEGFramework self,string host,int port){ + return self.GetModule().TCPClientDevices[host + ":" + port]; + } + } + +} diff --git a/Framework/EGFramework/Module/ProtocolTools/EGTCPServer.cs b/Framework/EGFramework/Module/ProtocolTools/EGTCPServer.cs new file mode 100644 index 0000000..df5c0a8 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/EGTCPServer.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; +using System.Threading; + +namespace EGFramework{ + public class EGTCPServer : IModule, IEGFramework,IProtocolReceived + { + public TcpListener TcpServer { set; get; } + + public bool IsListening { set; get; } + public Dictionary LinkedClients { set; get; } = new Dictionary(); + public Encoding StringEncoding { set; get; } = Encoding.UTF8; + public List ClientNames = new List(); + + public EasyEvent OnClientConnect { set; get; } = new EasyEvent(); + public EasyEvent OnClientDisconnect { set; get; } = new EasyEvent(); + + public Queue ResponseMsgs { set; get; } = new Queue(); + + public string ErrorLogs { set; get; } + public void Init() + { + this.EGRegisterSendAction(request => { + if(request.protocolType == ProtocolType.TCPServer){ + if(request.req.ToProtocolData() != null && request.req.ToProtocolData() != ""){ + ResponseStringData(request.sender,request.req.ToProtocolData()); + } + if(request.req.ToProtocolByteData() != null && request.req.ToProtocolByteData().Length > 0){ + ResponseByteData(request.sender,request.req.ToProtocolByteData()); + } + } + }); + } + + public Queue GetReceivedMsg() + { + return ResponseMsgs; + } + + public async void StartServer(int port) + { + IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, port); + TcpServer = new(ipEndPoint); + try + { + TcpServer.Start(); + IsListening = true; + while (IsListening) + { + TcpClient client = await TcpServer.AcceptTcpClientAsync(); + ClientNames.Add(client.Client.RemoteEndPoint.ToString()); + LinkedClients.Add(client.Client.RemoteEndPoint.ToString(), client); + OnClientConnect.Invoke(client.Client.RemoteEndPoint.ToString()); + _ = HandleClientAsync(client); + } + TcpServer.Stop(); + } + catch (Exception) + { + } + } + + public async Task HandleClientAsync(TcpClient client) + { + try + { + NetworkStream stream = client.GetStream(); + string ClientName = client.Client.RemoteEndPoint.ToString(); + while (true) + { + byte[] buffer = new byte[1024]; + int bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length); + if (bytesRead == 0) + { + break; + } + string data = StringEncoding.GetString(buffer, 0, bytesRead); + ResponseMsg receivedMsgs = new ResponseMsg(data,buffer,ClientName, ProtocolType.TCPServer); + //await Task.Run(() => OnDataReceived(receivedMsgs)).ConfigureAwait(false); + //this.EGOnReceivedData(receivedMsgs); + ResponseMsgs.Enqueue(receivedMsgs); + } + //await Task.Run(() => DeleteClient(client)).ConfigureAwait(false); + DeleteClient(client); + client.Close(); + } + catch (Exception) + { + } + } + + public async void ResponseByteData(string clientName,byte[] data){ + // if serial port not open,open first + try{ + await this.LinkedClients[clientName]?.GetStream().WriteAsync(data, 0, data.Length); + }catch(Exception e){ + ErrorLogs = "[write error]" + e.ToString(); + } + } + public void ResponseStringData(string clientName,string str){ + byte[] buffer = StringEncoding.GetBytes(str); + ResponseByteData(clientName,buffer); + } + + public void DeleteClient(TcpClient client) + { + string clientName = client.Client.RemoteEndPoint.ToString(); + if (ClientNames.Contains(clientName)) { + ClientNames.Remove(clientName); + } + if (LinkedClients.ContainsKey(clientName)) { + LinkedClients.Remove(clientName); + } + OnClientDisconnect.Invoke(clientName); + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + + } + + public static class CanGetEGTCPServerExtension{ + public static EGTCPServer EGTCPServer(this IEGFramework self){ + return self.GetModule(); + } + + public static void EGTCPServerListen(this IEGFramework self ,int port){ + self.GetModule().StartServer(port); + } + + } +} + diff --git a/Framework/EGFramework/Module/ProtocolTools/EGUDP.cs b/Framework/EGFramework/Module/ProtocolTools/EGUDP.cs new file mode 100644 index 0000000..2d98ab1 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/EGUDP.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace EGFramework{ + public class EGUDP : IEGFramework, IModule, IProtocolSend, IProtocolReceived + { + public Dictionary UDPDevices { set; get; } = new Dictionary(); + + public Encoding StringEncoding { set; get; } = Encoding.UTF8; + + public Queue ResponseMsgs { set; get; } = new Queue(); + + public void Init() + { + this.EGRegisterSendAction(request => { + if(request.protocolType == ProtocolType.UDP){ + if(request.req.ToProtocolData() != null && request.req.ToProtocolData() != ""){ + this.SendStringData(request.sender.GetHostByIp(),request.sender.GetPortByIp(),request.req.ToProtocolData()); + } + if(request.req.ToProtocolByteData() != null && request.req.ToProtocolByteData().Length > 0){ + this.SendByteData(request.sender.GetHostByIp(),request.sender.GetPortByIp(),request.req.ToProtocolByteData()); + } + } + }); + } + + public void ListenUDP(int localPort){ + if (!UDPDevices.ContainsKey(localPort)) { + try + { + UdpClient udpDevice = new UdpClient(localPort); + UDPDevices.Add(localPort,udpDevice); + HandleUDPListenAsync(udpDevice); + //StartListening(localPort); + } + catch (Exception e){ + Console.WriteLine("Error" + e); + } + } + } + + public void EndListenUDP(int localPort){ + if (UDPDevices.ContainsKey(localPort)) { + UDPDevices[localPort].Close(); + UDPDevices.Remove(localPort); + } + } + + public async void HandleUDPListenAsync(UdpClient client) + { + try + { + while (true) + { + UdpReceiveResult data = await client.ReceiveAsync(); + string dataStr = StringEncoding.GetString(data.Buffer); + ResponseMsg receivedMsgs = new ResponseMsg(dataStr,data.Buffer,data.RemoteEndPoint.ToString(), ProtocolType.UDP); + //this.EGOnReceivedData(receivedMsgs); + ResponseMsgs.Enqueue(receivedMsgs); + } + } + catch (Exception) + { + } + } + + public void SendByteData(string host,int port,byte[] data){ + UdpClient udpClient = new UdpClient(); + try{ + udpClient.Send(data, data.Length, host, port); + } + catch ( Exception e ){ + Console.WriteLine(e.ToString()); + } + udpClient.Close(); + udpClient.Dispose(); + } + public void SendByteData(string destination,byte[] data){ + SendByteData(destination.GetHostByIp(),destination.GetPortByIp(),data); + } + + public void SendStringData(string host,int port,string data){ + byte[] buffer = StringEncoding.GetBytes(data); + this.SendByteData(host,port,buffer); + } + public void SendStringData(string destination,string data){ + SendStringData(destination.GetHostByIp(),destination.GetPortByIp(),data); + } + + public void SetEncoding(Encoding textEncoding){ + StringEncoding = textEncoding; + } + + public void BroadCastUDPMessage(string host,int port,byte[] message){ + + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + + public Queue GetReceivedMsg() + { + return ResponseMsgs; + } + } + + public static class CanGetEGUDPExtension{ + public static EGUDP EGUDP(this IEGFramework self){ + return self.GetModule(); + } + + public static void EGUDPListen(this IEGFramework self ,int port){ + self.GetModule().ListenUDP(port); + } + } +} + diff --git a/Framework/EGFramework/Module/ProtocolTools/ProtocolToolsInterface.cs b/Framework/EGFramework/Module/ProtocolTools/ProtocolToolsInterface.cs new file mode 100644 index 0000000..90bb761 --- /dev/null +++ b/Framework/EGFramework/Module/ProtocolTools/ProtocolToolsInterface.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace EGFramework{ + public interface IProtocolSend{ + public void SendByteData(string destination,byte[] data); + public void SendStringData(string destination,string data); + public void SetEncoding(Encoding textEncoding); + } + public interface IProtocolReceived{ + public Queue GetReceivedMsg(); + } + + public interface IProtocolListener{ + public bool IsEnabled(string ServiceName); + } + + +} diff --git a/Framework/EGFramework/Module/SQL/EGSqlite.cs b/Framework/EGFramework/Module/SQL/EGSqlite.cs new file mode 100644 index 0000000..825994b --- /dev/null +++ b/Framework/EGFramework/Module/SQL/EGSqlite.cs @@ -0,0 +1,247 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.Data.Sqlite; +using Newtonsoft.Json; + +namespace EGFramework{ + public interface IEGSqlite{ + void SaveData(TData data) where TData : new(); + List GetDataSet() where TData : new(); + void InitDatabase(string dataBaseName); + } + public class EGSqlite : EGModule,IEGSqlite + { + public string DBName = "Default"; + private string DefaultDBFolder = "SaveData"; + public SqliteConnection SqliteConn; + public string ExceptionMsg; + + public override void Init() + { + if (!Directory.Exists(DefaultDBFolder)) + { + Directory.CreateDirectory(DefaultDBFolder); + } + InitDatabase(DBName); + } + + public void InitDatabase(string dataBaseName) + { + SqliteConn = new SqliteConnection("Data Source="+DefaultDBFolder+"/"+dataBaseName+".db;Mode=ReadWriteCreate;"); // Open the connection: + try + { + SqliteConn.Open(); + } + catch (Exception ex) + { + ExceptionMsg = ex.ToString(); + } + } + + //Save data to default sqlite database; + public void SaveData(TData data) where TData : new() + { + // if table is not exist, create table and insert data to table,else insert into data to table + if(IsTableExist()){ + InsertData(data); + }else{ + CreateTable(); + InsertData(data); + } + } + /// + /// Get data from table where named type of TData + /// + /// Table name + /// + public List GetDataSet() where TData : new() + { + // query dataSet from table TData_List + List dataSet = new List(); + if(IsTableExist()){ + dataSet = SelectData(); + }else{ + ExceptionMsg = "No such table,ensure one data with type of TData has been saved at least!"; + return null; + } + return dataSet; + } + + #region SQL Operation + /// + /// Create table where table name is type of TData + /// + /// + /// + public string CreateTable() where TData: new() { + string result = "Success:"; + try + { + string sqlCommand = "CREATE TABLE " + typeof(TData).Name; + sqlCommand += "(\"ID\" INTEGER NOT NULL UNIQUE,"; + var properties = typeof(TData).GetFields(); + foreach(var property in properties){ + if(property.FieldType == typeof(int) || property.FieldType == typeof(bool) || property.FieldType.IsEnum){ + sqlCommand += "\"" + property.Name + "\" INTEGER" + " NOT NULL,"; + }else if(property.FieldType == typeof(double) || property.FieldType == typeof(float)){ + sqlCommand += "\"" + property.Name + "\" REAL" + " NOT NULL,"; + } + else{ + sqlCommand += "\"" + property.Name + "\" TEXT" + " NOT NULL,"; + } + } + sqlCommand += "PRIMARY KEY(\"ID\" AUTOINCREMENT))"; + SqliteCommand createCommand = new SqliteCommand(sqlCommand,SqliteConn); + result = result + createCommand.ExecuteNonQuery().ToString(); + } + catch (System.Exception e) + { + return "Error:"+e; + } + return result; + } + + /// + /// Drop table where table name is type of TData + /// + /// + /// + public string DropTable() where TData: new(){ + string result = "Success:"; + try + { + string sqlCommand = "DROP TABLE " + typeof(TData).Name; + SqliteCommand createCommand = new SqliteCommand(sqlCommand,SqliteConn); + result = result + createCommand.ExecuteNonQuery().ToString(); + } + catch (System.Exception e) + { + return "Error:"+e; + } + return result; + } + + /// + /// Insert data to table where table name is type of TData + /// + /// + /// + /// success or error + public string InsertData(TData data) where TData: new(){ + string result = "Success:"; + try + { + string sqlCommand = "INSERT INTO " + typeof(TData).Name; + var properties = typeof(TData).GetFields(); + Dictionary dataParams = new Dictionary(); + foreach(var property in properties){ + dataParams.Add(property.Name,property.GetValue(data)); + if(property.FieldType==typeof(bool) || property.FieldType.IsEnum){ + // If property is bool type , save data to data base should be 0 or 1 instead of false or true; + // If property is Enum type , then transform data to int; + dataParams[property.Name] = System.Convert.ToInt32(dataParams[property.Name]); + }else if(property.FieldType.IsClass || property.FieldType.IsValueType && !property.FieldType.IsPrimitive && property.FieldType != typeof(string)){ + dataParams[property.Name] = JsonConvert.SerializeObject(dataParams[property.Name]); + } + } + sqlCommand += "("; + string keySet = ""; + foreach(string key in dataParams.Keys){ + keySet += key + ","; + } + keySet = keySet.TrimEnd(','); + sqlCommand += keySet; + sqlCommand += ") VALUES ("; + string valueSet = ""; + foreach(var value in dataParams.Values){ + if(value.GetType() == typeof(int) || value.GetType() == typeof(float) || value.GetType() == typeof(double)){ + valueSet += value + ","; + }else{ + valueSet += "'" + value + "',"; + } + } + valueSet = valueSet.TrimEnd(','); + sqlCommand += valueSet; + sqlCommand += ")"; + SqliteCommand createCommand = new SqliteCommand(sqlCommand,SqliteConn); + result = result + createCommand.ExecuteNonQuery().ToString(); + } + catch (System.Exception e) + { + ExceptionMsg = e.ToString(); + return "Error:"+ExceptionMsg; + } + return result; + } + + /// + /// Query Data and return object list with TData type,Support Data Type:ClassObject,Enum,int,string.float,struct.Not support double,if double then auto convert to float + /// + /// List of TData or null ,if null then you can print ExceptionMsg to check your error + public List SelectData() where TData: new(){ + List resultList = new List(); + try + { + string sqlCommand = "SELECT * FROM " + typeof(TData).Name; + SqliteCommand selectCommand = new SqliteCommand(sqlCommand,SqliteConn); + SqliteDataReader reader = selectCommand.ExecuteReader(); + var properties = typeof(TData).GetFields(); + + while (reader.Read()) + { + TData dataRow = new TData(); + foreach(var property in properties){ + if(property.FieldType == reader[property.Name].GetType()){ + property.SetValue(dataRow,reader[property.Name]); + }else if(property.FieldType.IsEnum){ + object propertyEnum = Enum.Parse(property.FieldType,reader[property.Name].ToString()); + property.SetValue(dataRow,propertyEnum); + } + else if(property.FieldType.IsPrimitive) { + object propertyObject = System.Convert.ChangeType(reader[property.Name],property.FieldType); + property.SetValue(dataRow,propertyObject); + }else{ + object classObject = JsonConvert.DeserializeObject(reader[property.Name].ToString(),property.FieldType); + property.SetValue(dataRow,classObject); + } + } + resultList.Add(dataRow); + } + } + catch (System.Exception e) + { + ExceptionMsg = e.ToString(); + return null; + } + return resultList; + } + + public bool IsTableExist() where TData:new(){ + try + { + string sqlCommand = "SELECT name FROM sqlite_sequence"; + SqliteCommand selectCommand = new SqliteCommand(sqlCommand,SqliteConn); + SqliteDataReader reader = selectCommand.ExecuteReader(); + while (reader.Read()){ + if(reader["name"].ToString()==typeof(TData).Name){ + return true; + } + } + } + catch (System.Exception e) + { + ExceptionMsg = e.ToString(); + return false; + } + return false; + } + #endregion + } + + public static class CanGetEGSqliteExtension{ + public static EGSqlite EGSqlite(this IEGFramework self){ + return EGArchitectureImplement.Interface.GetModule(); + } + } +} diff --git a/Framework/EGFramework/Module/WebDav/EGWebDav.cs b/Framework/EGFramework/Module/WebDav/EGWebDav.cs new file mode 100644 index 0000000..d278e51 --- /dev/null +++ b/Framework/EGFramework/Module/WebDav/EGWebDav.cs @@ -0,0 +1,232 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net; +using System.Threading.Tasks; +using WebDav; +using System.Web; +using System.Net.Http; + + +namespace EGFramework{ + public class EGWebDav : IModule + { + public string ServerUrl { set; get; } = ""; + private string UserName { set; get; } = ""; + private string Password { set; get; } = ""; + public bool IsInit { set; get; } + private WebDavClient WebDavClient { set; get; } + private string CurrentPath { set; get; } = "/"; + + public List CurrentFileList { set; get; } = new List(); + public void Init() + { + + } + + public IArchitecture GetArchitecture() + { + return EGArchitectureImplement.Interface; + } + + public void InitClient(string serverUrl, string userName,string password){ + this.ServerUrl = serverUrl; + this.UserName = userName; + this.Password = password; + Dictionary headersAdd = new Dictionary + { + { "Connection", "keep-alive" }, + { "Authorization", "Basic "+ EGWebDavExtension.EncodeCredentials(userName,password) } + }; + WebDavClient = new WebDavClient(new WebDavClientParams + { + BaseAddress = new Uri(ServerUrl), + Credentials = new NetworkCredential(userName, password), + DefaultRequestHeaders = headersAdd + }); + Console.WriteLine("Client has been init"); + } + + //---------download or upload from WebDav server---------// + + /// + /// Download a file from dav path + /// + /// Such as /dav/Picture/Picture1.jpg + /// download destination,such as C:\Users\W35\Pictures + /// you can define file by this name,or by uri + /// + public async Task DownloadFile(string downloadUri,string localPath,string fileName = ""){ + if (fileName.Equals("")){ + fileName = Path.GetFileName(downloadUri); + } + using (var response = await WebDavClient.GetRawFile(downloadUri)) + { + if(response.IsSuccessful == true){ + // use response.Stream + using (FileStream DestinationStream = File.Create(localPath + "/" + fileName)) + { + await response.Stream.CopyToAsync(DestinationStream); + //Print("【WebDav】" + fileName + "下载成功!"); + } + return true; + }else{ + return false; + } + } + } + public async Task DownloadFilProcessed(string downloadUri,string localPath,string fileName = ""){ + if (fileName.Equals("")){ + fileName = Path.GetFileName(downloadUri); + } + using (var response = await WebDavClient.GetProcessedFile(downloadUri)) + { + if(response.IsSuccessful == true){ + // use response.Stream + using (FileStream DestinationStream = File.Create(localPath + "/" + fileName)) + { + await response.Stream.CopyToAsync(DestinationStream); + //Print("【WebDav】" + fileName + "下载成功!"); + } + return true; + }else{ + return false; + } + } + } + + /// + /// Upload a file by localUrl + /// + /// Such as C:\Users\W35\Pictures\Picture1.jpg + /// upload destination,such as /dav/Picture + /// you can define file by this name,or by local url + /// + public async Task UploadFile(string localUrl,string uploadPath,string fileName = ""){ + if (fileName.Equals("")){ + fileName = Path.GetFileName(localUrl); + } + // use response.Stream + var result = await WebDavClient.PutFile(uploadPath+"/"+fileName, File.OpenRead(localUrl)); + if(result.IsSuccessful){ + return true; + }else{ + return false; + } + } + + //-----------operate disk-----------// + + /// + /// Default root path is "/",any path should be start with "/" + /// + /// + /// + public async Task> GetList(string currentPath){ + PropfindResponse result = await WebDavClient.Propfind(ServerUrl+currentPath); + List ResultFileList = new List(); + if (result.IsSuccessful) + { + foreach (WebDavResource res in result.Resources) + { + ResultFileList.Add(new WebDavFileMsg{ + FileName = res.DisplayName , + IsCollection = res.IsCollection , + ContentLength = res.ContentLength , + Uri = res.Uri , + LastUpdateTime = res.LastModifiedDate + }); + } + } + return ResultFileList; + } + + /// + /// simple CD command, prop find all file message to CurrentFileList. + /// + /// + /// + public async Task ChangeDictionary(string destinationPath){ + CurrentPath = destinationPath; + PropfindResponse result = await WebDavClient.Propfind(ServerUrl+CurrentPath); + CurrentFileList.Clear(); + if (result.IsSuccessful) + { + foreach (WebDavResource res in result.Resources) + { + CurrentFileList.Add(new WebDavFileMsg{ + FileName = res.DisplayName , + IsCollection = res.IsCollection , + ContentLength = res.ContentLength , + Uri = res.Uri , + LastUpdateTime = res.LastModifiedDate + }); + } + } + } + + /// + /// create a directory + /// + /// + /// + public async Task MakeDictionary(string dictionaryName){ + await WebDavClient.Mkcol(dictionaryName); + } + + /// + /// simple cp command, copy a file with differentName. + /// + /// + /// + /// + public async Task Copy(string sourceFile,string copyFile){ + await WebDavClient.Copy(sourceFile,copyFile); + } + + /// + /// simple mv command, move a file with change fileName or different path. + /// + /// + /// + /// + public async Task Move(string sourceFile,string moveFile){ + await WebDavClient.Move(sourceFile,moveFile); + } + + /// + /// simple rm command,delete a file. + /// + /// + /// + public async Task Remove(string fileName){ + await WebDavClient.Delete(fileName); + } + } + + public struct WebDavFileMsg{ + public string FileName { set; get; } + public bool IsCollection { set; get; } + + /// + /// unit is kb + /// + public long? ContentLength { set; get; } + public string Uri { set; get; } + public DateTime? LastUpdateTime { set; get; } + } + + public static class EGWebDavExtension{ + public static EGWebDav EGWebDav(this IEGFramework self) + { + return EGArchitectureImplement.Interface.GetModule(); + } + public static string EncodeCredentials(string username, string password) + { + string credentials = $"{username}:{password}"; + byte[] credentialsBytes = System.Text.Encoding.UTF8.GetBytes(credentials); + string encodedCredentials = Convert.ToBase64String(credentialsBytes); + return encodedCredentials; + } + } +} \ No newline at end of file diff --git a/GuiDaoJi.cs b/GuiDaoJi.cs new file mode 100644 index 0000000..d98b4a1 --- /dev/null +++ b/GuiDaoJi.cs @@ -0,0 +1,262 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Guidaoji +{ + internal class GuiDaoJi + { + /// + /// 轨道电机控制器编号 + /// + public string uid { get; set; } + /// + /// 动作类别 + /// + public string action { get; set; } + /// + /// 时间 + /// + public string date { get; set; } + /// + /// 设备名称 + /// + public string name { get; set; } = "CA"; + /// + /// 主动上报时间间隔 + /// 0:不上传,1...n默认2s,单位:秒主动上报时间间隔,0:不上传,1...n默认2s,单位:秒 + /// + public int send_gap { get; set; } + /// + /// 0,不执行命令 1为执行命令 + /// + public int cont { get; set; } + /// + /// 位置复位 + /// 0:不操作,1:复位到原点 + /// + public int @return { get; set; } + /// + /// 故障复位 + /// 0:不操作,1:故障复位 + /// + public int reset { get; set; } + /// + /// 灯光状态 + /// 0为关,1为红灯,2为红灯闪烁,3为绿灯,4为绿灯闪烁,5为黄灯,6为黄灯闪烁 + /// + public int lamp { get; set; } + /// + /// 0 不执行行走 1 为执行行走 + /// + public int move { get; set; } + /// + /// 运行速度 + /// 0为停止,1-10为低速运行等级,11-20为高速运行等级 + /// + public double rate { get; set; } + /// + /// 指定摄像机x轴坐标,单位cm,在轨道的距离 + /// + public string x { get; set; } + /// + /// 指定摄像机Y轴坐标,单位cm,推杆退出的距离 + /// + public string y { get; set; } + /// + /// 0 不播报语音 1 播报语音 + /// + public int voice { get; set; } + /// + /// 语音播放内容 + /// + public string @string { get; set; } + } + + internal class GuiDaoJiRet + { + /// + /// 轨道电机控制器编号 + /// + public string uid { get; set; } + /// + /// 动作类别 + /// + public string action { get; set; } + /// + /// 时间 + /// + public string date { get; set; } + /// + /// 设备名称 + /// + public retData data { get; set; } = new retData(); + /// + /// 返回结果 + /// + public string result { get; set; } + } + + public class retData + { + /// + /// 设备名称 + /// + public string name { get; set; } = "轨道电机控制"; + + /// + /// 主动上报时间间隔 + /// 0:不上传,1...n默认2s,单位:秒主动上报时间间隔,0:不上传,1...n默认2s,单位:秒 + /// + public int send_gap { get; set; } = 2; + + /// + /// 轨道机启停状态【0——停;1——前进中;2——后退中;3——下降中;4——上升中】 + /// + public string type { get; set; } = "1"; + + /// + /// 灯光状态 + /// 0为关,1为红灯,2为红灯闪烁,3为绿灯,4为绿灯闪烁,5为黄灯,6为黄灯闪烁 + /// + public int lamp { get; set; } = 2; + + /// + /// 运行速度 + /// 0为停止,1-10为低速运行等级,11-20为高速运行等级 + /// + public string rate { get; set; } + + /// + /// 指定摄像机x轴坐标,单位cm,在轨道的距离 + /// + public string x { get; set; } + + /// + /// 指定摄像机Y轴坐标,单位cm,推杆退出的距离 + /// + public string y { get; set; } + + /// + /// 终端供电电压,单位V + /// + public string vol { get; set; } + + /// + /// 终端工作电流,单位A + /// + public string cur { get; set; } + + /// + /// 故障 + /// + public int[] alarm { get; set; } + } + + public class GuiDaoJiSet + { + /// + /// 轨道电机控制器编号 + /// + public string uid { get; set; } + /// + /// 动作类别 + /// + public string action { get; set; } + /// + /// 时间 + /// + public string date { get; set; } + /// + /// 设备名称 + /// + public string name { get; set; } = "CA"; + /// + /// 主动上报时间间隔 + /// 0:不上传,1...n默认2s,单位:秒主动上报时间间隔,0:不上传,1...n默认2s,单位:秒 + /// + public int send_gap { get; set; } + /// + /// 0,不执行命令 1为执行命令 + /// + public int cont { get; set; } + /// + /// 0,不执行命令 1为执行命令 + /// + public Contda contda { get; set; } = new Contda(); + /// + /// 0 不执行行走 1 为执行行走 + /// + public int move { get; set; } + /// + /// 数据为数组,数组大小根据分控器数量而定 + /// + public Moveda moveda { get; set; } = new Moveda(); + /// + /// 0 不播报语音 1 播报语音 + /// + public int voice { get; set; } + /// + /// 数据为数组,数组大小根据分控器数量而定 + /// + //public List voiceda { get; set; } = new List(); + public Voiceda voiceda { get; set; } = new Voiceda(); + } + + public class Contda + { + /// + /// 位置复位 + /// 0:不操作,1:复位到原点 + /// + public int @return { get; set; } = 0; + /// + /// 故障复位 + /// 0:不操作,1:故障复位 + /// + public int reset { get; set; } + /// + /// 灯光状态 + /// 0为关,1为红灯,2为红灯闪烁,3为绿灯,4为绿灯闪烁,5为黄灯,6为黄灯闪烁 + /// + public int lamp { get; set; } + } + + public class Moveda + { + /// + /// 运行速度 + /// 0为停止,1-10为低速运行等级,11-20为高速运行等级 + /// + public double rate { get; set; } + /// + /// 指定摄像机x轴坐标,单位cm,在轨道的距离 + /// + public string x { get; set; } + /// + /// 指定摄像机Y轴坐标,单位cm,推杆退出的距离 + /// + public string y { get; set; } + } + + public class Voiceda + { + /// + /// 语音播放内容 + /// + public string @string { get; set; } + } + + public enum ControlCommands + { + F = 'F', //前进 + B = 'B', //后退 + U = 'U', //上升 + D = 'D', //下降 + S = 'S', //停止 + R = 'R', //位置复位 + E = 'E', //故障复位 + } +} diff --git a/ModbusCRC16.cs b/ModbusCRC16.cs new file mode 100644 index 0000000..071f7b6 --- /dev/null +++ b/ModbusCRC16.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Guidaoji +{ + internal class ModbusCRC16 + { + public static ushort CalculateCrc(byte[] bytes) + { + const ushort polynomial = 0xA001; + ushort crc = 0xFFFF; + for (int i = 0; i < bytes.Length; i++) + { + crc ^= (ushort)(bytes[i] & 0xFF); + for (int j = 0; j < 8; j++) + { + if ((crc & 0x0001) == 0x0001) + { + crc >>= 1; + crc ^= polynomial; + } + else + { + crc >>= 1; + } + } + } + return crc; + } + } +} diff --git a/MyClass.cs b/MyClass.cs new file mode 100644 index 0000000..34e0f58 --- /dev/null +++ b/MyClass.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class MyClass + { + public string name { get; set; } + public string result { get; set; } + } +} diff --git a/MyObject.cs b/MyObject.cs new file mode 100644 index 0000000..2f2c04a --- /dev/null +++ b/MyObject.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class MyObject + { + public string[] cabinetid { get; set; } + public string action { get; set; } + public string taskid { get; set; } + } +} diff --git a/Patrol.cs b/Patrol.cs new file mode 100644 index 0000000..6ed0de6 --- /dev/null +++ b/Patrol.cs @@ -0,0 +1,66 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Net.Http.Json; +using System.Text; +using System.Text.Json; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class Patrol + { + public async void PatrolD() + { + DAY day = new DAY(); + int j = 0; + while (true) + { + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.GetAsync("http://192.168.10.104:8080/api/Patrol"); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + var dataElement = jsonDocument.RootElement.GetProperty("data").ToString(); + List dataList = JsonConvert.DeserializeObject>(dataElement); + foreach (var item in dataList) + { + bool state = item.State; + //Console.WriteLine(state); + if (state == true) + { + if (item.RunRule == "每日") + { + await TimedTask.DailyJob(item.StartTime.ToString(), "2,2;3,3;4,4"); + } + else + { + j++; + List dayOfWeeks = day.DayOfWeeks(item); + var daysOfWeek = new HashSet(); + foreach (var i in dayOfWeeks) + { + daysOfWeek.Add(i); + } + await TimedTask.WeeklyJob(daysOfWeek, item.StartTime.ToString(),j, "2,2;3,3;4,4"); + } + } + } + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + await Task.Delay(TimeSpan.FromDays(1)); + } + } + } +} diff --git a/PatrolClass.cs b/PatrolClass.cs new file mode 100644 index 0000000..606113d --- /dev/null +++ b/PatrolClass.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class PatrolClass + { + public int Id { get; set; } + public DateTime StartTime { get; set; } + public string PatrolPoint { get; set; } + public string RunRule { get; set; } + public bool State { get; set; } + } +} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..d6cfb61 --- /dev/null +++ b/Program.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Timers; +using static System.Collections.Specialized.BitVector32; +using System.Security.Cryptography; +using System.Text.Json; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; +using Guidaoji.Camera; +using Guidaoji.Common; + +namespace Emergency_platform +{ + public class Program + { + + + static void Main(string[] args) + { + + TCP tcp = new TCP(); + Patrol patrol = new Patrol(); + //IP + string sIP = "192.168.10.102"; + //端口号 + string sPassword = "tschkj88"; + //连接轨道机服务器 + //TcpClientWrapper.Socket("192.168.10.104", 20000); + //tcp.Socket(); + //patrol.PatrolD(); + Console.WriteLine("InitSuccess"); + //登录摄像头 + //CHNetHelp.CameraInit(sIP, sPassword); + } + + + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..335e324 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +/*[assembly: AssemblyTitle("Emergency platform")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Emergency platform")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("dfadd01d-9845-42dc-ace6-0982365da0b2")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +*/ \ No newline at end of file diff --git a/TCP.cs b/TCP.cs new file mode 100644 index 0000000..9683fd3 --- /dev/null +++ b/TCP.cs @@ -0,0 +1,3155 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Text.Json; +using Newtonsoft.Json.Linq; +using static System.Collections.Specialized.BitVector32; +using System.Security.Cryptography; +using System.Timers; +using Newtonsoft.Json; +using System.Threading; +using System.Collections.Concurrent; +using System.Net.Http; +using System.Net.Http.Json; +using System.Data.Common; +using System.Diagnostics.SymbolStore; +using Guidaoji.Camera; +using Guidaoji.Common; +using System.IO; +using Guidaoji; + + +namespace Emergency_platform +{ + + public class TCP + { + Socket socket_commu; + System.Timers.Timer timer = new System.Timers.Timer(); + JObject json; + + public void Socket() + { + Socket server_socketListen = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); + IPAddress ips = IPAddress.Any; + IPEndPoint ipNode = new IPEndPoint(ips, 20001);//网络端点:为IP地址和端口号 + //服务端必须绑定一个端口才能listen(),要不然客户端就不知道该连哪个端口了 + server_socketListen.Bind(ipNode); + //监听后,如果客户端这时调用connect()发出连接请求,服务器端就会接收到这个请求 + //listen函数将socket变为被动类型的,等待客户的连接请求。 + server_socketListen.Listen(10); + //服务端有两个socket;这里Accept()返回的相当于是客户端的socket,用于和客户端发送(send)和接收(recv)数据 + socket_commu = server_socketListen.Accept(); + Console.WriteLine("连接成功"); + while (true) + { + //接收数据 + byte[] buffer = new byte[1024 * 1024]; + int bytesRead = socket_commu.Receive(buffer); + //将接收到的数据转换为字符串 + string task = Encoding.UTF8.GetString(buffer, 0, bytesRead); + //当前时间 + DateTime date1 = DateTime.Now; + //要执行的任务 + TaskRun(task, date1); + } + } + /// + /// 主任务 + /// + public async void TaskRun(string task, DateTime date) + { + var json = JObject.Parse(task); + var action = json["action"].Value(); + Console.WriteLine(action); + if (action == "numericalValue") + { + var halmet = json["halmet"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + if (halmet == "") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + //电流表、电压表、功率表只是需要读取数据返回给平台 + int taskId = json["taskid"].Value(); + string cabinetID = json["cabinetid"].Value(); + //从数据库中获取柜子坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetID); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + //CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //抓图返回给算法,返回数据 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + //Console.WriteLine("请输入电流表数值"); + string ammeter = "200"; + //按照格式返回给应急平台 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetID, + targetname = targetName, + result = ammeter + }; + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + CHNetHelp.SaveViedo(false, 1, videoPath); + } + else//需要识别安全帽 + { + //轨道机在初始位置先识别安全帽 + //原地指令 + //CHNetHelp.SaveViedo(true, 1, videoPath); + //TcpClientWrapper.GuiDaoJiMove(0, 0); + //GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + //bool guidaoji = true; + //while (guidaoji) + //{ + // if (gui.data.type == "0") + // { + // guidaoji = false; + // CHNetHelp.SetCameraProcess(OperationType.PTZ, 0, 0, 0, 1, videoPath); + // CHNetHelp.JPEG(1, picPath); + // } + //} + //Console.WriteLine("轨道机运动成功"); + //将图片发送给算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + //戴了安全帽执行下一步,没有戴则报警 + //算法返回数据 + var halmetResult = true; + if (halmetResult == true)//戴了 + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + //电流表、电压表、功率表只是需要读取数据返回给平台 + int taskId = json["taskid"].Value(); + string cabinetID = json["cabinetid"].Value(); + //从数据库中获取柜子坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetID); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //调用相机方法获取图片 + //抓图返回给算法,返回数据 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + + + //Console.WriteLine("请输入电流表数值"); + string ammeter = "150"; + //按照格式返回给应急平台 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetID, + targetname = targetName, + result = ammeter + }; + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else//没戴 + { + //报警 + //不正确 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104/api/AlarmType/type", "安全帽"); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + result = "false" + }; + } + } + } + else if (action == "switch") + { + var halmet = json["halmet"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + if (halmet == "") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + if (targetName.Contains("断路器")) + { + string taskId = json["taskid"].Value(); + string cabinetId = json["cabinetid"].Value(); + string state = json["state"].Value(); + string operate = json["operate"].Value(); + //将坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetId); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //图片给到算法 + //算法返回结果 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + + + + //Console.WriteLine("请输入开关状态"); + string stateResult = "0"; + //进行判断 操作前相等是正确的,操作后相等是不正确的 + if (operate == "0" && stateResult == state)//0是闭合,1是开 + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + //存储运行信息到数据库 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "0" && stateResult != state) + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到运行日志数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "1" && stateResult != state) + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + else if (targetName.Contains("刀闸") || targetName.Contains("小车")) + { + { + string taskId = json["taskid"].Value(); + string cabinetId = json["cabinetid"].Value(); + string state = json["state"].Value(); + string operate = json["operate"].Value(); + //将坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetId); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //图片给到算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + + //Console.WriteLine("请输入开关状态"); + string stateResult = "0"; + //进行判断 操作前相等是正确的,操作后相等是不正确的 + if (operate == "0" && stateResult == state)//0是闭合,1是开 + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + //存储运行信息到数据库 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "0" && stateResult != state) + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "1" && stateResult != state) + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + //CHNetHelp.SaveViedo(false, 1, videoPath); + } + else + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + } + } + else//需要识别安全帽 + { + //轨道机在初始位置先识别安全帽 + //原地指令 + //CHNetHelp.SaveViedo(true, 1, videoPath); + //TcpClientWrapper.GuiDaoJiMove(0, 0); + //GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + //bool guidaoji = true; + //while (guidaoji) + //{ + // if (gui.data.type == "0") + // { + // guidaoji = false; + // CHNetHelp.SetCameraProcess(OperationType.PTZ, 0, 0, 0, 1, videoPath); + // CHNetHelp.JPEG(1, picPath); + // } + //} + //Console.WriteLine("轨道机运动成功"); + //将图片发送给算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + //戴了安全帽执行下一步,没有戴则报警 + //算法返回数据 + var halmetResult = true; + if (halmetResult == true) + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + //Console.WriteLine(targetName); + if (targetName.Contains("断路器")) + { + string taskId = json["taskid"].Value(); + string cabinetId = json["cabinetid"].Value(); + string state = json["state"].Value(); + string operate = json["operate"].Value(); + //将坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetId); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //图片给到算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + + + //Console.WriteLine("请输入开关状态"); + string stateResult = "0"; + //进行判断 操作前相等是正确的,操作后相等是不正确的 + if (operate == "0" && stateResult == state)//0是闭合,1是开 + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + //存储运行信息到数据库 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "0" && stateResult != state) + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "1" && stateResult != state) + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + else if (targetName.Contains("刀闸") || targetName.Contains("小车")) + { + string taskId = json["taskid"].Value(); + string cabinetId = json["cabinetid"].Value(); + string state = json["state"].Value(); + string operate = json["operate"].Value(); + //将坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetId); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(10, 10); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, 1, 1, 1, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //图片给到算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + + + + + //Console.WriteLine("请输入开关状态"); + string stateResult = "0"; + //进行判断 操作前相等是正确的,操作后相等是不正确的 + if (operate == "0" && stateResult == state)//0是闭合,1是开 + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + //存储运行信息到数据库 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "0" && stateResult != state) + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (operate == "1" && stateResult != state) + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else + { + //不正确 + //发送tagretname来获取报警信息并亮灯 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + } + else//没戴 + { + //报警 + //不正确 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", "安全帽"); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + result = "false" + }; + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + } + else if (action == "whether") + { + var halmet = json["halmet"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + if (halmet == "") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + //剩下的都是判断有还是没有 + string cabinetId = json["cabinetid"].Value(); + string taskId = json["taskid"].Value(); + //将坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetId); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //图片给到算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + //Console.WriteLine("请输入true或者false"); + string stateResult = "true"; + if (stateResult == "true") + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else + { + //不正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //获取报警信息并亮灯 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + Console.WriteLine(manageLight); + Console.WriteLine(message); + Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + bool isRunning = true; + while (isRunning) + { + //一直抓图,直到算法一直识别知道返回值为true跳出循环 + string timerResult = await StartTimerTask(); + //将返回的路径传给算法 + //var results = AlgorithmTCP.Connect(timerResult, targetName); + + + + + + + + + + //假设返回值为result + bool result = false; + if (result == true) + { + isRunning = false; + } + await Task.Delay(TimeSpan.FromMinutes(1)); + } + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath, + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + else//需要识别安全帽 + { + //轨道机在初始位置先识别安全帽 + //原地指令 + //CHNetHelp.SaveViedo(true, 1, videoPath); + //TcpClientWrapper.GuiDaoJiMove(0, 0); + //GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + //bool guidaoji = true; + //while (guidaoji) + //{ + // if (gui.data.type == "0") + // { + // guidaoji = false; + // CHNetHelp.SetCameraProcess(OperationType.PTZ, 0, 0, 0, 1, videoPath); + // CHNetHelp.JPEG(1, picPath); + // } + //} + //Console.WriteLine("轨道机运动成功"); + //将图片发送给算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + //戴了安全帽执行下一步,没有戴则报警 + //算法返回数据 + var halmetResult = true; + if (halmetResult == true) + { + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + //剩下的都是判断有还是没有 + string cabinetId = json["cabinetid"].Value(); + string taskId = json["taskid"].Value(); + //将坐标给到轨道机 + //要发送的参数 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", cabinetId); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //图片给到算法 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + + + + + + + + + + + + + + + //Console.WriteLine("请输入true还是false"); + string stateResult = "true"; + if (stateResult == "true") + { + //正确 + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else + { + var returndata = new + { + action = action, + taskid = taskId, + date = date.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //获取报警信息并亮灯 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + bool isRunning = true; + while (isRunning) + { + //一直抓图,直到算法一直识别知道返回值为true跳出循环 + string timerResult = await StartTimerTask(); + //将返回的路径传给算法 + //var results = AlgorithmTCP.Connect(timerResult, targetName); + + + + + //假设返回值为result + bool result = false; + if (result == true) + { + isRunning = false; + } + await Task.Delay(TimeSpan.FromMinutes(1)); + } + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "false", + voiceBroadcast = true, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + } + else//没戴 + { + //报警 + //不正确 + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", "安全帽"); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + result = "false" + }; + //将JSON数据对象序列化为字符串 + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + } + else if (action == "true") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + string cabinetId = json["cabinetid"].Value(); + string taskId = json["taskid"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + var returndata = new + { + action = action, + taskid = taskId, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + //var options = new JsonSerializerOptions { WriteIndented = true }; + //string jsonString = System.Text.Json.JsonSerializer.Serialize(returndata, options); + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (action == "false") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + string cabinetId = json["cabinetid"].Value(); + string taskId = json["taskid"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + //通过目标名称targetName查询数据库获取报警信息和灯的状态 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = taskId, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "false" + }; + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将JSON数据对象序列化为字符串 + //var options = new JsonSerializerOptions { WriteIndented = true }; + //string jsonString = System.Text.Json.JsonSerializer.Serialize(returndata, options); + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else if (action == "alert") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + var obj = JsonConvert.DeserializeObject(task); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + //obj.cabinetid[] 可以得到要识别的柜子id + //把要识别的柜子id发送给硬件抓图,算法返回数据 + //把数据返回给应急平台,将柜子识别完之后返回数据 和算法交流返回的数据 + //var result = AlgorithmTCP.Connect(picPath, targetName); + + for (int i = 0; i < obj.cabinetid.Length; i++) + { + //调用轨道机方法 + Console.WriteLine(obj.cabinetid[i]); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Cabinet/id", obj.cabinetid[i]); + Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + } + //算法抓图返回 + var result = true; + if (result == true) + { + var returndata = new + { + action = action, + taskid = obj.taskid, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + result = result + }; + //将JSON数据对象序列化为字符串 + //var options = new JsonSerializerOptions { WriteIndented = true }; + //string jsonString = System.Text.Json.JsonSerializer.Serialize(returndata, options); + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + else + { + //获取报警信息 + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + //Console.WriteLine(manageLight); + //Console.WriteLine(message); + //Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + var returndata = new + { + action = action, + taskid = obj.taskid, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + result = result + }; + //将JSON数据对象序列化为字符串 + //var options = new JsonSerializerOptions { WriteIndented = true }; + //string jsonString = System.Text.Json.JsonSerializer.Serialize(returndata, options); + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + } + else if (action == "patrol") + { + var obj = JsonConvert.DeserializeObject(task); + //obj.cabinetid[] 可以得到要识别的柜子id + //把要识别的柜子id发送给硬件抓图,算法返回数据 + //把数据返回给应急平台,将柜子识别完之后返回数据 和算法交流返回的数据 + //var result = AlgorithmTCP.Connect(picPath, targetName); + for (int i = 0; i < obj.cabinetid.Length; i++) + { + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + //调用轨道机方法 + Console.WriteLine(obj.cabinetid[i]); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/CabinetInstance/id", obj.cabinetid[i]); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + string cabinetPosX = dataElement.GetProperty("cabinetPosX").GetString(); + string cabinetPosY = dataElement.GetProperty("cabinetPosY").GetString(); + float poseP = float.Parse(dataElement.GetProperty("poseP").GetString()); + float poseT = float.Parse(dataElement.GetProperty("poseT").GetString()); + float poseZ = float.Parse(dataElement.GetProperty("poseZ").GetString()); + var posX = double.Parse(cabinetPosX); + var posY = double.Parse(cabinetPosY); + //Console.WriteLine(cabinetPosX); + //Console.WriteLine(cabinetPosY); + //Console.WriteLine(poseX); + //Console.WriteLine(poseY); + //Console.WriteLine(poseP); + //Console.WriteLine(poseT); + //Console.WriteLine(poseZ); + //CHNetHelp.SaveViedo(true, 1, videoPath); + TcpClientWrapper.GuiDaoJiMove(posX, posY); + GuiDaoJiRet gui = TcpClientWrapper.SendDataRead(); + bool guidaoji = true; + while (guidaoji) + { + if (gui != null && gui.data.type == "0") + { + guidaoji = false; + CHNetHelp.SetCameraProcess(OperationType.PTZ, poseP, poseT, poseZ, 1, videoPath); + CHNetHelp.JPEG(1, picPath); + } + } + + + Console.WriteLine("轨道机运动成功"); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + + + + //发给算法 + //模拟的返回数据 + var target = new MyClass[] + { + new MyClass{ name = "1号电流表",result = "100.1"}, + new MyClass{ name = "3号指示灯",result = "亮"}, + new MyClass{ name = "停电牌",result = "无"} + }; + var returndata = new + { + action = "identify", + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = 1, + target = target + }; + //将JSON数据对象序列化为字符串 + //var options = new JsonSerializerOptions { WriteIndented = true }; + //string jsonString = System.Text.Json.JsonSerializer.Serialize(returndata, options); + string jsonString = JsonConvert.SerializeObject(returndata); + //将JSON字符串转换为字节数组 + byte[] dataBytes = Encoding.UTF8.GetBytes(jsonString); + //发送数据 + socket_commu.Send(dataBytes); + Console.WriteLine("发送成功"); + } + + } + else if (action == "patroltrue") + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + string cabinetId = json["cabinetid"].Value(); + string taskId = json["taskid"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + var returndata = new + { + action = action, + taskid = taskId, + date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + cabinetid = cabinetId, + targetname = targetName, + result = "true" + }; + //将信息存储到数据库 + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + } + else + { + //获取要识别的目标名称进行分类 + string targetName = json["targetname"].Value(); + Console.WriteLine(targetName); + string cabinetId = json["cabinetid"].Value(); + string taskId = json["taskid"].Value(); + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + string videoPath = $"D:/Video/{DateTime.Now:yyyyMMddHHmmss}.mp4"; + //获取报警信息 + if (targetName.Contains("电流表") || targetName.Contains("电压表") || targetName.Contains("功率表") || targetName.Contains("断路器")) + { + int startIndex = targetName.Length - 3; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + Console.WriteLine(manageLight); + Console.WriteLine(message); + Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + } + else + { + int startIndex = targetName.Length - 2; + string lastThreeChars = targetName.Substring(startIndex); + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/AlarmType/type", lastThreeChars); + Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + Console.WriteLine(responseBody); + JsonDocument jsonDocument = JsonDocument.Parse(responseBody); + JsonElement dataElement = jsonDocument.RootElement.GetProperty("data"); + var manageLight = int.Parse(dataElement.GetProperty("manageLight").GetString()); + string message = dataElement.GetProperty("message").GetString(); + string manageVoice = dataElement.GetProperty("manageVoice").GetString(); + Console.WriteLine(manageLight); + Console.WriteLine(message); + Console.WriteLine(manageVoice); + TcpClientWrapper.SetLedAndVoice(manageLight, manageVoice); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到数据库 + //要发送的参数 + var parameter = new + { + taskID = taskId, + runModel = "指令模式", + taskName = targetName + "抽检", + startTime = date, + endTime = DateTime.Now, + taskPoint = "点位1", + result = "true", + voiceBroadcast = false, + alarmNumber = 0, + alarmType = lastThreeChars + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Run", parameter); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + //将信息存储到运报警志数据库 + //要发送的参数 + var parameter1 = new + { + alarmType = lastThreeChars, + alarmPoint = "点位1", + alarmTime = date, + operate = videoPath + }; + using (var httpClient = new HttpClient()) + { + //发送post请求 + var response = await httpClient.PostAsJsonAsync("http://192.168.10.104:8080/api/Alarm", parameter1); + //Console.WriteLine(response); + if (response.IsSuccessStatusCode) + { + var responseBody = await response.Content.ReadAsStringAsync(); + //Console.WriteLine(responseBody); + } + else + { + //处理错误响应 + Console.WriteLine("请求失败"); + } + } + } + } + } + static async Task StartTimerTask() + { + Task task = TimerTask(); + await task; + return task.Result; + } + static async Task TimerTask() + { + string picPath = $"D:/Picture/{DateTime.Now:yyyyMMddHHmmss}.jpeg"; + CHNetHelp.JPEG(1, picPath); + return picPath; + } + + } +} + diff --git a/TimedTask.cs b/TimedTask.cs new file mode 100644 index 0000000..4a6bfc9 --- /dev/null +++ b/TimedTask.cs @@ -0,0 +1,299 @@ +using Quartz.Impl; +using Quartz; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Newtonsoft.Json.Linq; + +namespace Emergency_platform +{ + internal class TimedTask:IJob + { + public TimedTask() + { + + } + + public void pp() + { + HashSet hashSet2 = new HashSet(); + foreach (object value in Enum.GetValues(typeof(DayOfWeek))) + { + var allDaysOfTheWeek = new HashSet(); + foreach (var d in Enum.GetValues(typeof(DayOfWeek))) + { + var dayOfWeek = (DayOfWeek)d; + allDaysOfTheWeek.Add(dayOfWeek); + + if (dayOfWeek >= DayOfWeek.Monday && dayOfWeek <= DayOfWeek.Friday) + { + //mondayThroughFriday.Add(dayOfWeek); + } + } + } + //DayOfWeek dayOfWeek = (DayOfWeek)value; + //hashSet.Add(dayOfWeek); + //if (dayOfWeek >= DayOfWeek.Monday && dayOfWeek <= DayOfWeek.Friday) + //{ + // hashSet2.Add(dayOfWeek); + //} + } + + public virtual Task Execute(IJobExecutionContext context) + { + //执行控制轨道机巡逻任务 + //取出巡逻点位集合 + string[] sPatrols = context.JobDetail.JobDataMap.GetString("parameter").Split(';'); + for (int i = 0; i < sPatrols.Length; i++) + { + string[] sPatrol = sPatrols[i].Split(','); + //下达巡逻指令 + //GuiDaoJiMove(sPatrol[0], sPatrol[1]); + } + Console.WriteLine("业务逻辑" + DateTime.Now); + PrintInfo("业务逻辑" + DateTime.Now); + Thread.Sleep(60000); + return Task.CompletedTask; + } + + /////// + /////// 每天HH:mm:ss进行任务 + /////// + /////// 时间:格式必须为“HH:mm:ss” + /////// 巡逻点位计集合:格式必须为“x1,y1;x2,y2;......” + ////public static void DailyJob(string sTime, string sPatrols) + ////{ + //// int iHour = Convert.ToInt32(sTime.Substring(0, 2)); + //// int iMinute = Convert.ToInt32(sTime.Substring(3, 2)); + //// int iSecond = Convert.ToInt32(sTime.Substring(6, 2)); + //// //创建一个调度器 + //// IScheduler _temp_schheduler = StdSchedulerFactory.GetDefaultScheduler().Result; + //// // 创建作业 + //// IJobDetail job = JobBuilder.Create() + //// .WithIdentity("dailyTaskJob", "group1") + //// .Build(); + + //// // 创建触发器,每天九点 + //// ITrigger trigger = TriggerBuilder.Create() + //// .WithIdentity("dailyTaskTrigger", "group1") + //// .StartNow() + //// .WithSchedule(CronScheduleBuilder.DailyAtHourAndMinute(iHour, iMinute)) // 每天9:00执行 + //// .Build(); + + //// // 将作业和触发器加入调度器 + //// _temp_schheduler.ScheduleJob(job, trigger); + //// _temp_schheduler.Start(); + ////} + + /// + /// 每天HH:mm:ss进行任务 + /// + /// 时间:格式必须为“HH:mm:ss” + /// 巡逻点位计集合:格式必须为“x1,y1;x2,y2;......” + public static async Task DailyJob(string sTime, string sPatrols) + { + if (sTime == null) + { + return; + } + int iHour = Convert.ToInt32(sTime.Substring(0, 2)); + int iMinute = Convert.ToInt32(sTime.Substring(3, 2)); + int iSecond = Convert.ToInt32(sTime.Substring(6, 2)); + string sJob = "job" + iHour + iMinute + iSecond; + string sGroup = "group" + iHour + iMinute + iSecond; + string sTrigger = "trigger" + iHour + iMinute + iSecond; + //每天每天HH:mm:ss进行任务 + string cronExpression = string.Format("{0} {1} {2} ? * *", iSecond, iMinute, iHour); + //创建一个调度器 + IScheduler _temp_schheduler = StdSchedulerFactory.GetDefaultScheduler().Result; + // 创建作业 + IJobDetail job = JobBuilder.Create() + .WithIdentity(sJob, sGroup) + .UsingJobData("parameter", sPatrols) + .Build(); + // 创建触发器,每天上午sTime执行 + ITrigger trigger = TriggerBuilder.Create().WithIdentity(sTrigger, sGroup) + .WithCronSchedule(cronExpression) + .WithPriority(10) // 设置优先级,范围是0到255,数字越高,优先级越高 + .Build(); + // 将作业和触发器加入调度器 + await _temp_schheduler.ScheduleJob(job, trigger); + await _temp_schheduler.Start(); + } + + ///// + ///// 每天HH:mm:ss进行任务 + ///// + ///// 时间:格式必须为“HH:mm:ss” + ///// 巡逻点位计集合:格式必须为“x1,y1;x2,y2;......” + //public static void DailyJob(string sTime, string sPatrols) + //{ + // if (sTime == null) + // { + // return; + // } + // int iHour = Convert.ToInt32(sTime.Substring(0, 2)); + // int iMinute = Convert.ToInt32(sTime.Substring(3, 2)); + // int iSecond = Convert.ToInt32(sTime.Substring(6, 2)); + // string sJob = "job" + iHour + iMinute + iSecond; + // string sGroup = "group" + iHour + iMinute + iSecond; + // string sTrigger = "trigger" + iHour + iMinute + iSecond; + // //创建一个调度器 + // IScheduler _temp_schheduler = StdSchedulerFactory.GetDefaultScheduler().Result; + // // 创建作业 + // IJobDetail job = JobBuilder.Create() + // .WithIdentity(sJob, sGroup) + // //.UsingJobData("parameter", sPatrols) + // .Build(); + // // 创建触发器,每天上午sTime执行 + // ITrigger trigger = TriggerBuilder.Create() + // .WithIdentity(sTrigger, sGroup) + // .WithDailyTimeIntervalSchedule(a => + // a.WithIntervalInHours(24) + // .OnEveryDay() + // .StartingDailyAt(TimeOfDay.HourMinuteAndSecondOfDay(iHour, iMinute, iSecond))) + // //.WithPriority(10) // 设置优先级,范围是0到255,数字越高,优先级越高 + // .Build(); + // // 将作业和触发器加入调度器 + // _temp_schheduler.ScheduleJob(job, trigger); + // _temp_schheduler.Start(); + //} + + /// + /// 每周中的某几天进行任务 + /// + /// 周中某几天 + /// 时间:格式必须为“HH:mm:ss” + /// 编号(不能重复) + /// 巡逻点位计集合:格式必须为“x1,y1;x2,y2;......” + public static async Task WeeklyJob(IReadOnlyCollection onDaysOfWeek, string sTime, int iNo, string sPatrols) + { + int iHour = Convert.ToInt32(sTime.Substring(0, 2)); + int iMinute = Convert.ToInt32(sTime.Substring(3, 2)); + int iSecond = Convert.ToInt32(sTime.Substring(6, 2)); + string sJob = "jobWeek" + iNo; + string sGroup = "groupWeek" + iNo; + string sTrigger = "triggerWeek" + iNo; + //创建一个调度器 + IScheduler _temp_schheduler = StdSchedulerFactory.GetDefaultScheduler().Result; + // 创建作业 + IJobDetail job = JobBuilder.Create() + .WithIdentity(sJob, sGroup) + .UsingJobData("parameter", sPatrols) + .Build(); + // 创建触发器,每天上午sTime执行 + ITrigger trigger = TriggerBuilder.Create() + .WithIdentity(sTrigger, sGroup) + .WithDailyTimeIntervalSchedule(a => + a.OnDaysOfTheWeek(onDaysOfWeek) + .StartingDailyAt(TimeOfDay.HourMinuteAndSecondOfDay(iHour, iMinute, iSecond))) + //.WithPriority(10) // 设置优先级,范围是0到255,数字越高,优先级越高 + .Build(); + // 将作业和触发器加入调度器 + await _temp_schheduler.ScheduleJob(job, trigger); + await _temp_schheduler.Start(); + } + + ///// + ///// 每周中的某几天进行任务(暂时无法实现) + ///// + ///// 周中某几天,如"1,2,3"即每周的周一周二周三,用半角逗号隔开 + ///// 时间:格式必须为“HH:mm:ss” + ///// 编号(不能重复) + ///// 巡逻点位计集合:格式必须为“x1,y1;x2,y2;......” + //public static void WeeklyJob(string sDaysOfWeek, string sTime, int iNo, string sPatrols) + //{ + // if (sTime == null) + // { + // return; + // } + // int iHour = Convert.ToInt32(sTime.Substring(0, 2)); + // int iMinute = Convert.ToInt32(sTime.Substring(3, 2)); + // int iSecond = Convert.ToInt32(sTime.Substring(6, 2)); + // string sJob = "jobWeek" + iNo; + // string sGroup = "groupWeek" + iNo; + // string sTrigger = "triggerWeek" + iNo; + // //每周中的某几天某点进行任务 + // string cronExpression = string.Format("{0} {1} {2} ? * {3}", iSecond, iMinute, iHour, sDaysOfWeek); + // //创建一个调度器 + // IScheduler _temp_schheduler = StdSchedulerFactory.GetDefaultScheduler().Result; + // // 创建作业 + // IJobDetail job = JobBuilder.Create().WithIdentity(sJob, sGroup).Build(); + // //给任务传参 + // job.JobDataMap.Add("parameter", sPatrols); + // // 创建触发器,每周某几天某点进行作业 + // ITrigger trigger = TriggerBuilder.Create().WithIdentity(sTrigger, sGroup) + // .WithCronSchedule(cronExpression) + // .WithPriority(10) // 设置优先级,范围是0到255,数字越高,优先级越高 + // .Build(); + // // 将作业和触发器加入调度器 + // _temp_schheduler.ScheduleJob(job, trigger); + // _temp_schheduler.Start(); + //} + + /// + /// 每月中的某几天进行任务 + /// + /// 每月的某几天,如"1,5,10"即每月的1号,5号,10号执行。用半角逗号隔开 + /// 时间:格式必须为“HH:mm:ss” + /// 编号(不能重复) + /// 巡逻点位计集合:格式必须为“x1,y1;x2,y2;......” + public static async Task CertainDaysJob(string sDays, string sTime, int iNo, string sPatrols) + { + int iHour = Convert.ToInt32(sTime.Substring(0, 2)); + int iMinute = Convert.ToInt32(sTime.Substring(3, 2)); + int iSecond = Convert.ToInt32(sTime.Substring(6, 2)); + string sJob = "jobDays" + iNo; + string sGroup = "groupDays" + iNo; + string sTrigger = "triggerDays" + iNo; + // 在Quartz.NET中使用Cron表达式 + //string cronExpression = "0 15 10 5,15 * ?"; // 每月的第5号和第15号上午10点15分 + string cronExpression = string.Format("{0} {1} {2} {3} * ?", iSecond, iMinute, iHour, sDays); + //创建一个调度器 + IScheduler _temp_schheduler = StdSchedulerFactory.GetDefaultScheduler().Result; + // 创建作业 + IJobDetail job = JobBuilder.Create().WithIdentity(sJob, sGroup).Build(); + //给任务传参 + job.JobDataMap.Add("parameter", sPatrols); + // 创建触发器,每周某几天0点进行作业 + ITrigger trigger = TriggerBuilder.Create().WithIdentity(sTrigger, sGroup) + .WithCronSchedule(cronExpression) + .WithPriority(10) // 设置优先级,范围是0到255,数字越高,优先级越高 + .Build(); + // 将作业和触发器加入调度器 + await _temp_schheduler.ScheduleJob(job, trigger); + await _temp_schheduler.Start(); + } + + public static void PrintInfo(string str) + { + string Folder = Environment.CurrentDirectory + @"\Logs"; + string FileNamme = Environment.CurrentDirectory + @"\Logs\Info_" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + if (!System.IO.Directory.Exists(Folder)) + { + System.IO.Directory.CreateDirectory(Folder); + } + using (TextWriter fw = new StreamWriter(FileNamme, true)) + { + try + { + FileInfo fi = new FileInfo(FileNamme); + fw.WriteLine(str); + } + catch (Exception ex) + { + fw.WriteLine(ex.Message); + } + finally + { + fw.Close(); + fw.Dispose(); + } + } + } + } +} diff --git a/Track.cs b/Track.cs new file mode 100644 index 0000000..a9fb238 --- /dev/null +++ b/Track.cs @@ -0,0 +1,56 @@ +using Guidaoji; +using Guidaoji.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Emergency_platform +{ + public class Track + { + public void DS() + { + Timer timer = new Timer(TimerCallback, null, 0, 2000); + } + public void TimerCallback(object state) + { + for (int i = 0; i