//==============================================================================================
//	API-DIG(WDM)p`t@C																	
//==============================================================================================

using System;
using System.Runtime.InteropServices;

namespace CdigCs
{
    unsafe public class Cdig
    {
		//----------------------------------------------------------------------------------------------
		//	API-PAC(W32)ʒ萔																		
		//----------------------------------------------------------------------------------------------
		// oX^Cv
		public const short DEVICE_TYPE_ISA				= 0;		// ISA
		public const short DIG_BUSTYPE_PCI				= 1;		// PCI
		public const short DEVICE_TYPE_PCMCIA			= 2;		// PCMCIA
		public const short DIG_BUSTYPE_USB				= 3;		// USB
		public const short DEVICE_TYPE_FIT				= 4;		// FIT
		public const short DEVICE_TYPE_CARDBUS			= 5;		// CardBus
		public const short DEVICE_TYPE_DEMO				= 6;		// Demo
		public const short DEVICE_TYPE_EZUSB			= 10;		// EZ-USB

		//----------------------------------------------------------------------------------------------
		//	萔																						
		//----------------------------------------------------------------------------------------------
		// ڑM
		public const short DIG_ECU_DEST_SYNC1			= 104;			// oXM1
		public const short DIG_ECU_DEST_SYNC2			= 105;			// oXM2
		public const short DIG_ECU_DEST_SYNC3			= 106;			// oXM3
		public const short DIG_ECU_DEST_SYNC_MSTHALT	= 107;			// }X^foCX~v
		public const short DIG_ECU_DEST_SYNC_SLVHALT	= 108;			// X[ufoCX~v
		public const short DIG_ECU_DEST_DIO0			= 112;			// Oo͒[q0
		public const short DIG_ECU_DEST_DIO1			= 113;			// Oo͒[q1

		// ڑM
        public const short DIG_ECU_SRC_NC				= 0;			// ڑ
        public const short DIG_ECU_SRC_CLOCK			= 4;			// fW^CUNbN
        public const short DIG_ECU_SRC_PLLCLOCK			= 10003;		// PLLNbN
        public const short DIG_ECU_SRC_RECORD			= 10000;		// 1R[hTvOIgK
        public const short DIG_ECU_SRC_STOP				= 19;			// fW^CU슮gK
        public const short DIG_ECU_SRC_PRETRG			= 10001;		// vgKgK
        public const short DIG_ECU_SRC_POSTTRG			= 10002;		// |XggKgK
        public const short DIG_ECU_SRC_DIO0				= 128;			// Oo͒[q0
        public const short DIG_ECU_SRC_DIO1				= 129;			// Oo͒[q1
        public const short DIG_ECU_SRC_SYNC1			= 136;			// X[uM1
        public const short DIG_ECU_SRC_SYNC2			= 137;			// X[uM2
        public const short DIG_ECU_SRC_SYNC3			= 138;			// X[uM3
        public const short DIG_ECU_SRC_HALT				= 432;			// fW^CUُ~gK

		// W[h
        public const short DIG_MODE_OSCILLO				= 0;			// IVXR[v[h
        public const short DIG_MODE_DIGITIZER			= 1;			// fW^CU[h
        public const short DIG_MODE_LOGGER				= 2;			// f[^K[[h
        public const short DIG_MODE_JUDGE				= 3;			// g`@[h

		// ~v
        public const uint DIG_HALT_CLOCK_ERROR			= 0x00000001;	// TvONbNG[
        public const uint DIG_HALT_JUDGE_COUNT			= 0x00000040;	// g`JEgv
        public const uint DIG_HALT_OVERRANGE_CH0		= 0x00000100;	// `l0I[o[W
        public const uint DIG_HALT_OVERRANGE_CH1		= 0x00000200;	// `l1I[o[W
        public const uint DIG_HALT_DEVMEM_OVERFLOW		= 0x10000000;	// foCXI[o[t[
        public const uint DIG_HALT_DRVMEM_OVERFLOW		= 0x80000000;	// hCoI[o[t[

		// Cxgv
		public const uint DIG_EVENT_STOP				= 0x00000001;	// fW^CU̓~
		// bZ[Wԍ
		public const int DIG_MESSAGE_STOP				= 0x2000;		// fW^CU̓~

		// TvO[h
        public const short DIG_SAMPLEMODE_REALTIME		= 0;			// A^CTvO
        public const short DIG_SAMPLEMODE_INTERLEAVE	= 1;			// {TvO
        public const short DIG_SAMPLEMODE_EQUIVALENT	= 2;			// TvO

		// `lԍ
        public const short DIG_CHANNEL0					= 0;			// `l0
        public const short DIG_CHANNEL1					= 1;			// `l1

		// L/
        public const short DIG_ENABLE					= 1;			// L
        public const short DIG_DISABLE					= 0;			// 

		// ̓W
        public const float DIG_RANGE_40VPP				= 40.0F;		// }20V
        public const float DIG_RANGE_20VPP				= 20.0F;		// }10V
        public const float DIG_RANGE_10VPP				= 10.0F;		// }5V
        public const float DIG_RANGE_4VPP				= 4.0F;			// }2V
        public const float DIG_RANGE_2VPP				= 2.0F;			// }1V
        public const float DIG_RANGE_1VPP				= 1.0F;			// }0.5V
        public const float DIG_RANGE_400MVPP			= 0.4F;			// }0.2V
        public const float DIG_RANGE_200MVPP			= 0.2F;			// }0.1V
        public const float DIG_RANGE_100MVPP			= 0.1F;			// }0.05V
        public const float DIG_RANGE_40MVPP				= 0.04F;		// }0.02V

		// ̓Cs[_X
        public const float DIG_IMPEDANCE_1M				= 1000000;		// 1M
        public const float DIG_IMPEDANCE_50				= 50;			// 50

		// ̓JbvO
        public const short DIG_COUPLING_DC				= 0;			// DCJbvO
        public const short DIG_COUPLING_AC				= 1;			// ACJbvO
        public const short DIG_COUPLING_GND				= 2;			// GNDJbvO

		// oh
        public const float DIG_BANDWIDTH_FULL			= 0;			// Sш敝
        public const float DIG_BANDWIDTH_20MHZ			= 20000000;		// 20MHzȉ

		// 
        public const float DIG_PROBE_X1					= 1;			// 1F1
        public const float DIG_PROBE_X10				= 10;			// 10F1
        public const float DIG_PROBE_X100				= 100;			// 100F1
        public const float DIG_PROBE_X1000				= 1000;			// 1000F1

		// gK
		public const short DIG_TRIGGERTYPE_AUTO			= 0;			// 
		public const short DIG_TRIGGERTYPE_DIEDGE		= 1;			// fW^GbWgK
		public const short DIG_TRIGGERTYPE_DIWINDOW		= 2;			// fW^EBhEgK
		public const short DIG_TRIGGERTYPE_AIEDGE		= 3;			// AiOGbWgK
		public const short DIG_TRIGGERTYPE_AIWINDOW		= 4;			// AiOEBhEgK
		public const short DIG_TRIGGERTYPE_SOFT			= 5;			// \tgEFAgK

		// gK
        public const short DIG_TRIGGER_SLOPE_RISE		= 0;			// オGbW
        public const short DIG_TRIGGER_SLOPE_FALL		= 1;			// GbW
        public const short DIG_TRIGGER_SLOPE_BOTH		= 2;			// GbW

		// EBhEgK
        public const short DIG_TRIGGER_WINDOW_ENTER		= 0;			// EBhE֓
        public const short DIG_TRIGGER_WINDOW_LEAVE		= 1;			// EBhEO֊Oꂽ

		// }XNf[^쐬IvV
        public const short DIG_AUTOMASK_NEW				= 0;			// VK쐬
        public const short DIG_AUTOMASK_AND				= 1;			// f[^Ƃ̘_
        public const short DIG_AUTOMASK_OR				= 2;			// f[^Ƃ̘_a

		// g`f[^
        public const short DIG_JUDGE_OK					= 0;			// OKʂ̃R[h
        public const short DIG_JUDGE_NG					= 1;			// NGʂ̃R[h

		// fW^Mo͕
        public const short DIG_JUDGE_OUT_LIMIT			= 0;			// JEgl~bg
        public const short DIG_JUDGE_OUT_OK				= 1;			// OK茋ʖ
        public const short DIG_JUDGE_OUT_NG				= 2;			// NG茋ʖ

		// o͐M`
        public const short DIG_DO_LEVEL					= 0;			// x
        public const short DIG_DO_PULSE					= 1;			// pX

		// o͘_
        public const short DIG_DO_LOGIC_POSITIVE		= 0;			// _
        public const short DIG_DO_LOGIC_NEGATIVE		= 1;			// s_

		// gKΏ
		public const short DIG_PRETRIGGER				= 0;			// vgK
		public const short DIG_POSTTRIGGER				= 1;			// |XggK

		// Xe[^X
		public const uint DIG_STATUS_BUSY				= 0x00000001;	// fW^CU쒆
		public const uint DIG_STATUS_PRETRG_WAIT		= 0x00000010;	// vgK҂
		public const uint DIG_STATUS_POSTTRG_WAIT		= 0x00000020;	// |XggK҂
		public const uint DIG_STATUS_OVERRANGE_CH0		= 0x00000100;	// `l0I[o[W
		public const uint DIG_STATUS_OVERRANGE_CH1		= 0x00000200;	// `l1I[o[W
		public const uint DIG_STATUS_IMPEDANCE_CHANGE_CH0	= 0x00000400;	// `l0I[o[W
		public const uint DIG_STATUS_IMPEDANCE_CHANGE_CH1	= 0x00000800;	// `l1I[o[W
		public const uint DIG_STATUS_MASTER_HALT_REQUEST= 0x00001000;	// }X^foCX̒~v
		public const uint DIG_STATUS_SLAVE_HALT_REQUEST	= 0x00002000;	// X[ufoCX̒~v
		public const uint DIG_STATUS_DRVMEM_OVERFLOW	= 0x00010000;	// hCoI[o[t[
		public const uint DIG_STATUS_DDRMEM_OVERFLOW	= 0x00020000;	// DDRI[o[t[
		public const uint DIG_STATUS_PREMEM_OVERFLOW	= 0x00040000;	// vgKTvpI[o[t[
		public const uint DIG_STATUS_POSTMEM_OVERFLOW	= 0x00080000;	// |XggKTvpI[o[t[
		public const uint DIG_STATUS_CLOCK_ERROR		= 0x00100000;	// TvONbNG[

		// R[h擾IvV
		public const int DIG_RECORD_DATA				= 1;			// R[hf[^
		public const int DIG_RECORD_JUDGE				= 2;			// g`茋ʊTv
		public const int DIG_RECORD_DETAIL				= 4;			// g`茋ʏڍ
		public const int DIG_RECORD_ALL					= 7;			// ׂẴf[^

		// g`茋ʏڍ
		public const short DIG_JUDGE_INRANGE			= 0;			// }XNf[^͈͓̔
		public const short DIG_JUDGE_UNDERRANGE			= 1;			// lI[o[
		public const short DIG_JUDGE_OVERRANGE			= 2;			// lI[o[

		// tB^
		public const short DIG_FILTER_NONE				= 0;			// tB^Ȃ
		public const short DIG_FILTER_25				= 25;			// 25usec

		// Lu[V
		public const short DIG_CALIB_ADCOFFSET			= 0;			// ADCItZbg
		public const short DIG_CALIB_ADCGAIN			= 1;			// ADCQC
		public const short DIG_CALIB_DACGAIN			= 2;			// DACQC

		// I/OAhX
		public const short DIG_ADDRESS_LOCAL			= 0;			// [J
		public const short DIG_ADDRESS_MASTER			= 1;			// oX}X^

		//----------------------------------------------------------------------------------------------
		//	G[R[h																				
		//----------------------------------------------------------------------------------------------
		public const int DIG_ERR_SUCCESS					= 0;		// I
		public const int DIG_ERR_INI_RESOURCE				= 1;		// \[X̎擾Ɏs܂
		public const int DIG_ERR_INI_INTERRUPT				= 2;		// 荞݃[`̓o^Ɏs܂
		public const int DIG_ERR_INI_MEMORY					= 3;		// ̊蓖ĂɎs܂
		public const int DIG_ERR_INI_REGISTRY				= 4;		// WXg̃ANZXɎs܂
		public const int DIG_ERR_INI_BM_ADDRESS				= 5;		// oX}X^o^ɐݒ肷AhX̒lُł
		public const int DIG_ERR_INI_CREATE_ADAPTER			= 6;		// A_v^IuWFNg̐Ɏs܂
		public const int DIG_ERR_SYS_RECOVERED_FROM_STANDBY	= 7;		// X^oC[h畜A߁ADigResetDevice֐sĂ
		public const int DIG_ERR_INI_NOT_FOUND_SYS_FILE		= 8;		// cdig.syst@CȂߏł܂
		public const int DIG_ERR_INI_DLL_FILE_VERSION		= 9;		// cdig.dllt@C̃o[W񂪎擾łȂߏł܂
		public const int DIG_ERR_INI_SYS_FILE_VERSION		= 10;		// cdig.syst@C̃o[W񂪎擾łȂߏł܂
		public const int DIG_ERR_INI_NO_MATCH_DRV_VERSION	= 11;		// cdig.dllcdig.sys̃o[W񂪈vȂߏł܂

		public const int DIG_ERR_DLL_DEVICE_NAME			= 10000;	// ݒt@Cɓo^ĂȂfoCXw肳܂
		public const int DIG_ERR_DLL_INVALID_ID				= 10001;	// IDw肳܂
		public const int DIG_ERR_DLL_CALL_DRIVER			= 10002;	// hCoĂяo܂(ioctlɎs)
		public const int DIG_ERR_DLL_CREATE_FILE			= 10003;	// t@C̍쐬Ɏs܂(opens)
		public const int DIG_ERR_DLL_CLOSE_FILE				= 10004;	// t@C̃N[YɎs܂(closes)
		public const int DIG_ERR_DLL_CREATE_THREAD			= 10005;	// Xbh̍쐬Ɏs܂
		public const int DIG_ERR_DLL_DEVICE_NOT_FOUND		= 10006;	// foCXt܂
		public const int DIG_ERR_DLL_DEVICETYPE_NOT_FOUND	= 10013;	// foCX^Cvt܂
		public const int DIG_ERR_XML_MASTER_NOT_FOUND		= 10060;	// }X^RtBOt@C݂܂
		public const int DIG_ERR_XML_ROOT_NOT_FOUND_IN_MST	= 10061;	// }X^RtBOt@CɃ[gGg݂܂
		public const int DIG_ERR_XML_LIST_NOT_FOUND_IN_MST	= 10062;	// }X^RtBOt@CɃfoCXXg݂܂
		public const int DIG_ERR_XML_NODE_NOT_FOUND_IN_MST	= 10063;	// }X^RtBOt@CɃfoCXm[h݂܂
		public const int DIG_ERR_XML_USER_NOT_FOUND			= 10064;	// [U[RtBOt@C݂܂
		public const int DIG_ERR_XML_ROOT_NOT_FOUND_IN_USR	= 10065;	// [U[RtBOt@CɃ[gGg݂܂
		public const int DIG_ERR_XML_NODE_NOT_FOUND_IN_USR	= 10066;	// [U[RtBOt@CɃfoCXm[h݂܂
		public const int DIG_ERR_XML_CREATE_CLONE			= 10067;	// N[m[h̍쐬Ɏs܂
		public const int DIG_ERR_XML_SAVE					= 10068;	// [U[RtBOt@C̕ۑɎs܂
		public const int DIG_ERR_XML_INVALID_DEVICE			= 10069;	// قȂfoCXXMLt@Cł
		public const int DIG_ERR_XML_UNKNOWN_VERSION		= 10070;	// }X^RtBOt@C̃o[Wsł
		public const int DIG_ERR_XML_INVALID_VERSION		= 10071;	// }X^RtBOt@C̃o[Wv܂

		public const int DIG_ERR_DLL_PARAM1_RANGE			= 10100;	// p[^1͈͊Oł
		public const int DIG_ERR_DLL_PARAM2_RANGE			= 10101;	// p[^2͈͊Oł
		public const int DIG_ERR_DLL_PARAM3_RANGE			= 10102;	// p[^3͈͊Oł
		public const int DIG_ERR_DLL_PARAM4_RANGE			= 10103;	// p[^4͈͊Oł
		public const int DIG_ERR_DLL_PARAM5_RANGE			= 10104;	// p[^5͈͊Oł
		public const int DIG_ERR_DLL_PARAM6_RANGE			= 10105;	// p[^6͈͊Oł
		public const int DIG_ERR_DLL_PARAM7_RANGE			= 10106;	// p[^7͈͊Oł
		public const int DIG_ERR_DLL_PARAM8_RANGE			= 10107;	// p[^8͈͊Oł
		public const int DIG_ERR_DLL_PARAM1_NULL			= 10110;	// p[^1ُlł
		public const int DIG_ERR_DLL_PARAM2_NULL			= 10111;	// p[^2ُlł
		public const int DIG_ERR_DLL_PARAM3_NULL			= 10112;	// p[^3ُlł
		public const int DIG_ERR_DLL_PARAM4_NULL			= 10113;	// p[^4ُlł
		public const int DIG_ERR_DLL_PARAM5_NULL			= 10114;	// p[^5ُlł
		public const int DIG_ERR_DLL_MEMORY_OVERFLOW		= 10120;	// hCoI[o[t[Ă܂
		public const int DIG_ERR_DLL_RECORD_NUMBER			= 10121;	// w肵R[h̃f[^݂܂
		public const int DIG_ERR_DLL_TIMEOUT				= 10122;	// ^CAEg܂
		public const int DIG_ERR_DLL_DEVICE_BUSY			= 10123;	// fW^CU쒆ł
		public const int DIG_ERR_DLL_DAQMODE				= 10124;	// ̓샂[hł͎gpł܂
		public const int DIG_ERR_DLL_DATA_EMPTY				= 10125;	// ϊꂽf[^݂܂
		public const int DIG_ERR_DLL_RECORDS_NOT_ENOUGH		= 10126;	// R[hf[^sĂ܂
		public const int DIG_ERR_DLL_INVALID_MASKSIZE		= 10127;	// Õ}XNf[^ƃTCYv܂
		public const int DIG_ERR_DLL_CALIB_ACCURACY1		= 10128;	// Od̐xs\ł(΂)
		public const int DIG_ERR_DLL_CALIB_ACCURACY2		= 10129;	// Od̐xs\ł()
		public const int DIG_ERR_DLL_CALIB_50OHM			= 10130;	// ̓Cs[_X50ɐ؂ւ邱Ƃł܂
		public const int DIG_ERR_DLL_OPEN_FILE				= 10131;	// t@C̓ǂݍ݂Ɏs܂

		public const int DIG_ERR_SYS_MEMORY					= 20000;	// ̊mۂɎs܂
		public const int DIG_ERR_SYS_NOT_SUPPORTED			= 20001;	// ̃foCXł͂̊֐͎gpł܂
		public const int DIG_ERR_SYS_BOARD_EXECUTING		= 20002;	// foCX쒆̂ߎsł܂
		public const int DIG_ERR_SYS_USING_OTHER_PROCESS	= 20003;	// ̃vZXfoCXgpĂ邽߁Asł܂
		public const int DIG_ERR_SYS_NOT_FOUND_PROCESS_DATA	= 20004;	// vZX񂪌܂

		public const int DIG_ERR_SYS_EEPROM_BUSY			= 20120;	// EEPROMُł
		public const int DIG_ERR_SYS_PLL_BUSY				= 20121;	// PLLHُł
		public const int DIG_ERR_SYS_RELAY_BUSY				= 20122;	// [Hُł
		public const int DIG_ERR_SYS_CALIB_BUSY				= 20123;	// Lu[Vُł
		public const int DIG_ERR_SYS_PLL_DETECT				= 20124;	// PLLNbNMo܂
		public const int DIG_ERR_BM_BUFFER					= 21100;	// oX}X^]ݒŃobt@傫Ċmۂł܂ł
		public const int DIG_ERR_BM_LOCK_MEMORY				= 21101;	// oX}X^]ݒŃbNł܂ł
		public const int DIG_ERR_BM_PARAM					= 21102;	// oX}X^]ݒŃp[^G[܂
		public const int DIG_ERR_BM_SEQUENCE				= 21103;	// oX}X^]ݒŎs菇G[܂

		//----------------------------------------------------------------------------------------------
		//	cdig.dllGNX|[g֐																	
		//----------------------------------------------------------------------------------------------
        [DllImport("cdig.dll")] public static extern int DigInit(string DeviceName, ref short Id);
        [DllImport("cdig.dll")] public static extern int DigExit(short Id);
        [DllImport("cdig.dll")] public static extern int DigResetProcess(string DeviceName);
        [DllImport("cdig.dll")] public static extern int DigResetDevice(short Id);
        [DllImport("cdig.dll")] public static extern int DigSetEcuSignal(short Id, short Destination, short Source);
        [DllImport("cdig.dll")] public static extern int DigGetEcuSignal(short Id, short Destination, ref short Source);
        [DllImport("cdig.dll")] public static extern int DigAutoSetup(short Id);
        [DllImport("cdig.dll")] public static extern int DigLoadConfig(short Id, string FilePath);
        [DllImport("cdig.dll")] public static extern int DigSaveConfig(short Id, string FilePath);
        [DllImport("cdig.dll")] public static extern int DigSetDigitizerMode(short Id, short Mode);
        [DllImport("cdig.dll")] public static extern int DigSetHaltCondition(short Id, int Condition);
        [DllImport("cdig.dll")] public static extern int DigSetEvent(short Id, int hWnd, int Factor);
        [DllImport("cdig.dll")] public static extern int DigSetReferenceClock(short Id, short ClockSource);
        [DllImport("cdig.dll")] public static extern int DigSetClockSource(short Id, short ClockSource);
        [DllImport("cdig.dll")] public static extern int DigSetSampleRate(short Id, float SampleRate);
        [DllImport("cdig.dll")] public static extern int DigSetSampleClock(short Id, int SampleClock);
        [DllImport("cdig.dll")] public static extern int DigSetRecordLength(short Id, int RecordLength);
        [DllImport("cdig.dll")] public static extern int DigSetDutyCycle(short Id, float DutyCycle);
        [DllImport("cdig.dll")] public static extern int DigSetPreSampleTimes(short Id, int SampleTimes);
        [DllImport("cdig.dll")] public static extern int DigSetPostSampleTimes(short Id, int SampleTimes);
        [DllImport("cdig.dll")] public static extern int DigSetRecordNumber(short Id, int RecordNumber);
        [DllImport("cdig.dll")] public static extern int DigGetSampleRate(short Id, ref float SampleRate);
        [DllImport("cdig.dll")] public static extern int DigGetSampleClock(short Id, ref int SampleClock);
        [DllImport("cdig.dll")] public static extern int DigGetRecordLength(short Id, ref int RecordLength);
        [DllImport("cdig.dll")] public static extern int DigGetRecordNumber(short Id, ref int RecordNumber);
        [DllImport("cdig.dll")] public static extern int DigGetDutyCycle(short Id, ref float DutyCycle);
        [DllImport("cdig.dll")] public static extern int DigGetPreSampleTimes(short Id, ref int SampleTimes);
        [DllImport("cdig.dll")] public static extern int DigGetPostSampleTimes(short Id, ref int SampleTimes);
        [DllImport("cdig.dll")] public static extern int DigGetMaxDriverMemorySize(short Id, ref int Size);
        [DllImport("cdig.dll")] public static extern int DigGetMaxDriverMemoryRecords(short Id, ref int Records);
        [DllImport("cdig.dll")] public static extern int DigGetMaxDriverMemorySamples(short Id, ref int Samples);
        [DllImport("cdig.dll")] public static extern int DigSetChannel(short Id, short Channel, short Enable);
        [DllImport("cdig.dll")] public static extern int DigSetRange(short Id, short Channel, float Range);
        [DllImport("cdig.dll")] public static extern int DigSetOffset(short Id, short Channel, float Offset);
        [DllImport("cdig.dll")] public static extern int DigSetImpedance(short Id, short Channel, float Impedance);
        [DllImport("cdig.dll")] public static extern int DigSetCoupling(short Id, short Channel, short Coupling);
        [DllImport("cdig.dll")] public static extern int DigSetBandWidth(short Id, short Channel, float BandWidth);
        [DllImport("cdig.dll")] public static extern int DigSetProbeAttenuation(short Id, short Channel, float Attenuation);
        [DllImport("cdig.dll")] public static extern int DigSetAutoLimitRange(short Id, short Channel, short Enable);
        [DllImport("cdig.dll")] public static extern int DigGetChannel(short Id, short Channel, ref short Enable);
        [DllImport("cdig.dll")] public static extern int DigGetChannels(short Id, ref short Channels);
        [DllImport("cdig.dll")] public static extern int DigGetRange(short Id, short Channel, ref float Range);
        [DllImport("cdig.dll")] public static extern int DigGetImpedance(short Id, short Channel, ref float Impedance);
        [DllImport("cdig.dll")] public static extern int DigSetPreTriggerType(short Id, short TriggerType);
        [DllImport("cdig.dll")] public static extern int DigSetPreTriggerDiEdge(short Id, short TriggerSource, short Slope, int TriggerCount);
        [DllImport("cdig.dll")] public static extern int DigSetPreTriggerAiEdge(short Id, short TriggerSource, float Level, short Slope, int TriggerCount);
        [DllImport("cdig.dll")] public static extern int DigSetPreTriggerAiEdgeHysterisis(short Id, short TriggerSource, float Hysterisis);
        [DllImport("cdig.dll")] public static extern int DigSetPreTriggerAiWindow(short Id, short TriggerSource, short EnterOrLeave, 
            float HighLevel, float LowLevel, short StateType, int State1, int State2);
        [DllImport("cdig.dll")] public static extern int DigSetPostTriggerType(short Id, short TriggerType);
        [DllImport("cdig.dll")] public static extern int DigSetPostTriggerDiEdge(short Id, short TriggerSource, short Slope, int TriggerCount);
        [DllImport("cdig.dll")] public static extern int DigSetPostTriggerAiEdge(short Id, short TriggerSource, float Level, short Slope, int TriggerCount);
        [DllImport("cdig.dll")] public static extern int DigSetPostTriggerAiEdgeHysterisis(short Id, short TriggerSource, float Hysterisis);
        [DllImport("cdig.dll")] public static extern int DigSetPostTriggerAiWindow(short Id, short TriggerSource, short EnterOrLeave, 
            float HighLevel, float LowLevel, short StateType, int State1, int State2);
        [DllImport("cdig.dll")] public static extern int DigGetPostTriggerType(short Id, ref short TriggerType);
        [DllImport("cdig.dll")] public static extern int DigGetPostTriggerAiEdge(short Id, ref short TriggerSource, ref float Level, 
        	ref short Slope, ref int TriggerCount);
        [DllImport("cdig.dll")] public static extern int DigSetJudgeChannel(short Id, short Channel, short Enable);
        [DllImport("cdig.dll")] public static extern int DigSetAutoMask(short Id, short Channel, int Hmargin, int Vmargin, short Option);
        [DllImport("cdig.dll")] public static extern int DigSetJudgeData(short Id, short Channel, int DataSize, [MarshalAs(UnmanagedType.LPArray)] float[] UpperData, [MarshalAs(UnmanagedType.LPArray)] float[] LowerData);
        [DllImport("cdig.dll")] public static extern int DigSetJudgeData32(short Id, short Channel, int DataSize, [MarshalAs(UnmanagedType.LPArray)] int[] UpperData, [MarshalAs(UnmanagedType.LPArray)] int[] LowerData);
        [DllImport("cdig.dll")] public static extern int DigGetJudgeData(short Id, short Channel, int DataSize, [MarshalAs(UnmanagedType.LPArray)] float[] UpperData, [MarshalAs(UnmanagedType.LPArray)] float[] LowerData);
        [DllImport("cdig.dll")] public static extern int DigGetJudgeData32(short Id, short Channel, int DataSize, [MarshalAs(UnmanagedType.LPArray)] int[] UpperData, [MarshalAs(UnmanagedType.LPArray)] int[] LowerData);
        [DllImport("cdig.dll")] public static extern int DigSetJudgeCountLimit(short Id, short Channel, short Condition, int Limit);
        [DllImport("cdig.dll")] public static extern int DigSetJudgeSignalOut(short Id, short Channel, short Mode, 
            short Signal, short Logic, short Destination, float PulseWidth);
        [DllImport("cdig.dll")] public static extern int DigStart(short Id);
        [DllImport("cdig.dll")] public static extern int DigStartSync(short Id, float Timeout);
        [DllImport("cdig.dll")] public static extern int DigSoftTrigger(short Id, short TriggerType);
        [DllImport("cdig.dll")] public static extern int DigStop(short Id);
        [DllImport("cdig.dll")] public static extern int DigGetStatus(short Id, ref int Status);
        [DllImport("cdig.dll")] public static extern int DigGetDigitizedSamples(short Id, ref int Samples);
        [DllImport("cdig.dll")] public static extern int DigGetAcquiredSamples(short Id, ref int Samples);
        [DllImport("cdig.dll")] public static extern int DigGetDriverMemorySamples(short Id, ref int Samples);
        [DllImport("cdig.dll")] public static extern int DigGetDigitizedRecords(short Id, ref int Records);
        [DllImport("cdig.dll")] public static extern int DigGetAcquiredRecords(short Id, ref int Records);
        [DllImport("cdig.dll")] public static extern int DigGetDriverMemoryRecords(short Id, ref int Records);
        [DllImport("cdig.dll")] public static extern int DigGetJudgeCount(short Id, ref int JudgeCount);
        [DllImport("cdig.dll")] public static extern int DigReadEarliestRecords(short Id, int Option, int RecordNum,
        	[MarshalAs(UnmanagedType.LPArray)] float[] RecordData, [MarshalAs(UnmanagedType.LPArray)] short[] Judge, [MarshalAs(UnmanagedType.LPArray)] short[] JudgeDetail);
        [DllImport("cdig.dll")] public static extern int DigReadEarliestRecords32(short Id, int Option, int RecordNum,
        	[MarshalAs(UnmanagedType.LPArray)] int[] RecordData, [MarshalAs(UnmanagedType.LPArray)] short[] Judge, [MarshalAs(UnmanagedType.LPArray)] short[] JudgeDetail);
        [DllImport("cdig.dll")] public static extern int DigReadLatestRecords(short Id, int Option, int RecordNum,
        	[MarshalAs(UnmanagedType.LPArray)] float[] RecordData, [MarshalAs(UnmanagedType.LPArray)] short[] Judge, [MarshalAs(UnmanagedType.LPArray)] short[] JudgeDetail);
        [DllImport("cdig.dll")] public static extern int DigReadLatestRecords32(short Id, int Option, int RecordNum,
        	[MarshalAs(UnmanagedType.LPArray)] int[] RecordData, [MarshalAs(UnmanagedType.LPArray)] short[] Judge, [MarshalAs(UnmanagedType.LPArray)] short[] JudgeDetail);
        [DllImport("cdig.dll")] public static extern int DigReadSamples32(short Id, ref int Samples, [MarshalAs(UnmanagedType.LPArray)] int[] SampleData, ref int TriggerPoint);
        [DllImport("cdig.dll")] public static extern int DigReadSamples(short Id, ref int Samples, [MarshalAs(UnmanagedType.LPArray)] float[] SampleData, ref int TriggerPoint);
        [DllImport("cdig.dll")] public static extern int DigReadSingleData(short Id, short DataSize, [MarshalAs(UnmanagedType.LPArray)] float[] Data);
        [DllImport("cdig.dll")] public static extern int DigReadSingleData32(short Id, short DataSize, [MarshalAs(UnmanagedType.LPArray)] int[] Data);
        [DllImport("cdig.dll")] public static extern int DigSetControlFilter(short Id, short Signal, float Value);
        [DllImport("cdig.dll")] public static extern int DigGetTemperature(short Id, ref float Temperature);
        [DllImport("cdig.dll")] public static extern int DigGetErrorString(int ErrorCode, System.Text.StringBuilder ErrorString);
        [DllImport("cdig.dll")] public static extern int DigQueryDeviceName(short Index, System.Text.StringBuilder DeviceName,
        	System.Text.StringBuilder Device);
        [DllImport("cdig.dll")] public static extern int DigGetDeviceType(string Device, ref short DeviceType);

		//----------------------------------------------------------------------------------------------
		//	֐vg^Cv																			
		//----------------------------------------------------------------------------------------------
        public Cdig()
        {
        }
        public int Init(string DeviceName, out short Id)
        {
            Id = 0;
            return DigInit(DeviceName, ref Id);
        }
        public int Exit(short Id)
        {
            return DigExit(Id);
        }
        public int ResetProcess(string DeviceName)
        {
            return DigResetProcess(DeviceName);
        }
        public int ResetDevice(short Id)
        {
            return DigResetDevice(Id);
        }
		public int SetEcuSignal(short Id, short Destination, short Source)
		{
			return DigSetEcuSignal(Id, Destination, Source);
		}
		public int GetEcuSignal(short Id, short Destination, out short Source)
		{
			Source = 0;
			return DigGetEcuSignal(Id, Destination, ref Source);
		}
        public int AutoSetup(short Id)
        {
            return DigAutoSetup(Id);
        }
        public int LoadConfig(short Id, string FilePath)
        {
			return DigLoadConfig(Id, FilePath);
		}
        public int SaveConfig(short Id, string FilePath)
        {
			return DigSaveConfig(Id, FilePath);
		}
        public int SetDigitizerMode(short Id, short Mode)
        {
            return DigSetDigitizerMode(Id, Mode);
        }
        public int SetHaltCondition(short Id, uint Condition)
        {
            return DigSetHaltCondition(Id, (int)Condition);
        }
        public int SetEvent(short Id, int hWnd, uint Factor)
        {
            return DigSetEvent(Id, hWnd, (int)Factor);
		}
        public int SetReferenceClock(short Id, short ClockSource)
        {
            return DigSetReferenceClock(Id, ClockSource);
        }
        public int SetClockSource(short Id, short ClockSource)
        {
            return DigSetClockSource(Id, ClockSource);
        }
        public int SetSampleRate(short Id, float SampleRate)
        {
            return DigSetSampleRate(Id, SampleRate);
        }
        public int SetSampleClock(short Id, int SampleClock)
        {
            return DigSetSampleClock(Id, SampleClock);
        }
        public int SetRecordLength(short Id, int RecordLength)
        {
            return DigSetRecordLength(Id, RecordLength);
        }
        public int SetDutyCycle(short Id, float DutyCycle)
        {
            return DigSetDutyCycle(Id, DutyCycle);
        }
        public int SetPreSampleTimes(short Id, int SampleTimes)
        {
            return DigSetPreSampleTimes(Id, SampleTimes);
        }
        public int SetPostSampleTimes(short Id, int SampleTimes)
        {
            return DigSetPostSampleTimes(Id, SampleTimes);
        }
        public int SetRecordNumber(short Id, int RecordNumber)
        {
            return DigSetRecordNumber(Id, RecordNumber);
        }
        public int GetSampleRate(short Id, out float SampleRate)
        {
            SampleRate = 0;
            return DigGetSampleRate(Id, ref SampleRate);
        }
        public int GetSampleClock(short Id, out int SampleClock)
        {
            SampleClock = 0;
            return DigGetSampleClock(Id, ref SampleClock);
        }
        public int GetRecordLength(short Id, out int RecordLength)
        {
            RecordLength = 0;
            return DigGetRecordLength(Id, ref RecordLength);
        }
        public int GetRecordNumber(short Id, out int RecordNumber)
        {
            RecordNumber = 0;
            return DigGetRecordNumber(Id, ref RecordNumber);
        }
        public int GetDutyCycle(short Id, out float DutyCycle)
        {
            DutyCycle = 0;
            return DigGetDutyCycle(Id, ref DutyCycle);
        }
        public int GetPreSampleTimes(short Id, out int SampleTimes)
        {
            SampleTimes = 0;
            return DigGetPreSampleTimes(Id, ref SampleTimes);
        }
        public int GetPostSampleTimes(short Id, out int SampleTimes)
        {
            SampleTimes = 0;
            return DigGetPostSampleTimes(Id, ref SampleTimes);
        }
        public int GetMaxDriverMemorySize(short Id, out int Size)
        {
            Size = 0;
            return DigGetMaxDriverMemorySize(Id, ref Size);
        }
        public int GetMaxDriverMemoryRecords(short Id, out int Records)
        {
            Records = 0;
            return DigGetMaxDriverMemoryRecords(Id, ref Records);
        }
        public int GetMaxDriverMemorySamples(short Id, out int Samples)
        {
            Samples = 0;
            return DigGetMaxDriverMemorySamples(Id, ref Samples);
        }
        public int SetChannel(short Id, short Channel, short Enable)
        {
            return DigSetChannel(Id, Channel, Enable);
        }
        public int SetRange(short Id, short Channel, float Range)
        {
            return DigSetRange(Id, Channel, Range);
        }
        public int SetOffset(short Id, short Channel, float Offset)
        {
            return DigSetOffset(Id, Channel, Offset);
        }
        public int SetImpedance(short Id, short Channel, float Impedance)
        {
            return DigSetImpedance(Id, Channel, Impedance);
        }
        public int SetCoupling(short Id, short Channel, short Coupling)
        {
            return DigSetCoupling(Id, Channel, Coupling);
        }
        public int SetBandWidth(short Id, short Channel, float BandWidth)
        {
            return DigSetBandWidth(Id, Channel, BandWidth);
        }
        public int SetProbeAttenuation(short Id, short Channel, float Attenuation)
        {
            return DigSetProbeAttenuation(Id, Channel, Attenuation);
        }
        public int SetAutoLimitRange(short Id, short Channel, short Enable)
        {
            return DigSetAutoLimitRange(Id, Channel, Enable);
        }
        public int GetChannel(short Id, short Channel, out short Enable)
        {
			Enable = 0;
			return DigGetChannel(Id, Channel, ref Enable);
		}
        public int GetChannels(short Id, out short Channels)
        {
            Channels = 0;
            return DigGetChannels(Id, ref Channels);
        }
        public int GetRange(short Id, short Channel, out float Range)
        {
			Range = 0;
			return DigGetRange(Id, Channel, ref Range);
		}
        public int GetImpedance(short Id, short Channel, out float Impedance)
        {
			Impedance = 0;
			return DigGetImpedance(Id, Channel, ref Impedance);
		}
        public int SetPreTriggerType(short Id, short TriggerType)
        {
            return DigSetPreTriggerType(Id, TriggerType);
        }
        public int SetPreTriggerDiEdge(short Id, short TriggerSource, short Slope, int TriggerCount)
        {
            return DigSetPreTriggerDiEdge(Id, TriggerSource, Slope, TriggerCount);
        }
        public int SetPreTriggerAiEdge(short Id, short TriggerSource, float Level, short Slope, int TriggerCount)
        {
            return DigSetPreTriggerAiEdge(Id, TriggerSource, Level, Slope, TriggerCount);
        }
        public int SetPreTriggerAiEdgeHysterisis(short Id, short TriggerSource, float Hysterisis)
        {
            return DigSetPreTriggerAiEdgeHysterisis(Id, TriggerSource, Hysterisis);
        }
        public int SetPreTriggerAiWindow(short Id, short TriggerSource, short EnterOrLeave,
            float HighLevel, float LowLevel, short StateType, int State1, int State2)
        {
            return DigSetPreTriggerAiWindow(Id, TriggerSource, EnterOrLeave, HighLevel, LowLevel, StateType, State1, State2);
        }
        public int SetPostTriggerType(short Id, short TriggerType)
        {
            return DigSetPostTriggerType(Id, TriggerType);
        }
        public int SetPostTriggerDiEdge(short Id, short TriggerSource, short Slope, int TriggerCount)
        {
            return DigSetPostTriggerDiEdge(Id, TriggerSource, Slope, TriggerCount);
        }
        public int SetPostTriggerAiEdge(short Id, short TriggerSource, float Level, short Slope, int TriggerCount)
        {
            return DigSetPostTriggerAiEdge(Id, TriggerSource, Level, Slope, TriggerCount);
        }
        public int SetPostTriggerAiEdgeHysterisis(short Id, short TriggerSource, float Hysterisis)
        {
            return DigSetPostTriggerAiEdgeHysterisis(Id, TriggerSource, Hysterisis);
        }
        public int SetPostTriggerAiWindow(short Id, short TriggerSource, short EnterOrLeave,
            float HighLevel, float LowLevel, short StateType, int State1, int State2)
        {
            return DigSetPostTriggerAiWindow(Id, TriggerSource, EnterOrLeave, HighLevel, LowLevel, StateType, State1, State2);
        }
        public int GetPostTriggerType(short Id, out short TriggerType)
        {
			TriggerType = 0;
			return DigGetPostTriggerType(Id, ref TriggerType);
		}
        public int GetPostTriggerAiEdge(short Id, out short TriggerSource, out float Level, out short Slope, out int TriggerCount)
        {
			TriggerSource = 0;
			Level = 0;
			Slope = 0;
			TriggerCount = 0;
			return DigGetPostTriggerAiEdge(Id, ref TriggerSource, ref Level, ref Slope, ref TriggerCount);
		}
        public int SetJudgeChannel(short Id, short Channel, short Enable)
        {
            return DigSetJudgeChannel(Id, Channel, Enable);
        }
        public int SetAutoMask(short Id, short Channel, int Hmargin, int Vmargin, short Option)
        {
            return DigSetAutoMask(Id, Channel, Hmargin, Vmargin, Option);
        }
        public int SetJudgeData(short Id, short Channel, int DataSize, float[] UpperData, float[] LowerData)
        {
            return DigSetJudgeData(Id, Channel, DataSize, UpperData, LowerData);
        }
        public int SetJudgeData32(short Id, short Channel, int DataSize, int[] UpperData, int[] LowerData)
        {
            return DigSetJudgeData32(Id, Channel, DataSize, UpperData, LowerData);
        }
        public int GetJudgeData(short Id, short Channel, int DataSize, ref float[] UpperData, ref float[] LowerData)
        {
            return DigGetJudgeData(Id, Channel, DataSize, UpperData, LowerData);
        }
        public int GetJudgeData32(short Id, short Channel, int DataSize, ref int[] UpperData, ref int[] LowerData)
        {
            return DigGetJudgeData32(Id, Channel, DataSize, UpperData, LowerData);
        }
        public int SetJudgeCountLimit(short Id, short Channel, short Condition, int Limit)
        {
            return DigSetJudgeCountLimit(Id, Channel, Condition, Limit);
        }
        public int SetJudgeSignalOut(short Id, short Channel, short Mode, short Signal, short Logic, short Destination, float PulseWidth)
        {
            return DigSetJudgeSignalOut(Id, Channel, Mode, Signal, Logic, Destination, PulseWidth);
        }
        public int Start(short Id)
        {
            return DigStart(Id);
        }
        public int StartSync(short Id, float Timeout)
        {
            return DigStartSync(Id, Timeout);
        }
        public int SoftTrigger(short Id, short TriggerType)
        {
            return DigSoftTrigger(Id, TriggerType);
        }
        public int Stop(short Id)
        {
            return DigStop(Id);
        }
        public int GetStatus(short Id, out int Status)
        {
            Status = 0;
            return DigGetStatus(Id, ref Status);
        }
        public int GetDigitizedSamples(short Id, out int Samples)
        {
            Samples = 0;
            return DigGetDigitizedSamples(Id, ref Samples);
        }
        public int GetAcquiredSamples(short Id, out int Samples)
        {
            Samples = 0;
            return DigGetAcquiredSamples(Id, ref Samples);
        }
        public int GetDriverMemorySamples(short Id, out int Samples)
        {
            Samples = 0;
            return DigGetDriverMemorySamples(Id, ref Samples);
        }
        public int GetDigitizedRecords(short Id, out int Records)
        {
            Records = 0;
            return DigGetDigitizedRecords(Id, ref Records);
        }
        public int GetAcquiredRecords(short Id, out int Records)
        {
            Records = 0;
            return DigGetAcquiredRecords(Id, ref Records);
        }
        public int GetDriverMemoryRecords(short Id, out int Records)
        {
            Records = 0;
            return DigGetDriverMemoryRecords(Id, ref Records);
        }
        public int GetJudgeCount(short Id, out int JudgeCount)
        {
            JudgeCount = 0;
            return DigGetJudgeCount(Id, ref JudgeCount);
        }
		// 7ʂ̃I[o[Ch
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
        	ref float[] RecordData, ref short[] Judge, ref short[] JudgeDetail)
        {
            return DigReadEarliestRecords(Id, Option, RecordNum, RecordData, Judge, JudgeDetail);
        }
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
			ref float[] RecordData, ref short[] Judge, int Null1)
		{
			short[] temp1 = new short[1];
			return DigReadEarliestRecords(Id, Option, RecordNum, RecordData, Judge, temp1);
		}
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
			ref float[] RecordData, int Null1, ref short[] JudgeDetail)
		{
			short[] temp1 = new short[1];
			return DigReadEarliestRecords(Id, Option, RecordNum, RecordData, temp1, JudgeDetail);
		}
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, ref short[] JudgeDetail)
		{
			float[] temp1 = new float[1];
			return DigReadEarliestRecords(Id, Option, RecordNum, temp1, Judge, JudgeDetail);
		}
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
			ref float[] RecordData, int Null1, int Null2)
		{
			short[] temp1 = new short[1];
			short[] temp2 = new short[1];
			return DigReadEarliestRecords(Id, Option, RecordNum, RecordData, temp1, temp2);
		}
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, int Null2)
		{
			float[] temp1 = new float[1];
			short[] temp2 = new short[1];
			return DigReadEarliestRecords(Id, Option, RecordNum, temp1, Judge, temp2);
		}
		public int ReadEarliestRecords(short Id, int Option, int RecordNum,
			int Null1, int Null2, ref short[] JudgeDetail)
		{
			float[] temp1 = new float[1];
			short[] temp2 = new short[1];
			return DigReadEarliestRecords(Id, Option, RecordNum, temp1, temp2, JudgeDetail);
		}
		// 7ʂ̃I[o[Ch
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, ref short[] Judge, ref short[] JudgeDetail)
		{
			return DigReadEarliestRecords32(Id, Option, RecordNum, RecordData, Judge, JudgeDetail);
		}
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, ref short[] Judge, int Null1)
		{
			short[] temp1 = new short[1];
			return DigReadEarliestRecords32(Id, Option, RecordNum, RecordData, Judge, temp1);
		}
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, int Null1, ref short[] JudgeDetail)
		{
			short[] temp1 = new short[1];
			return DigReadEarliestRecords32(Id, Option, RecordNum, RecordData, temp1, JudgeDetail);
		}
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, ref short[] JudgeDetail)
		{
			int[] temp1 = new int[1];
			return DigReadEarliestRecords32(Id, Option, RecordNum, temp1, Judge, JudgeDetail);
		}
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, int Null1, int Null2)
		{
			short[] temp1 = new short[1];
			short[] temp2 = new short[1];
			return DigReadEarliestRecords32(Id, Option, RecordNum, RecordData, temp1, temp2);
		}
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, int Null2)
		{
			int[] temp1 = new int[1];
			short[] temp2 = new short[1];
			return DigReadEarliestRecords32(Id, Option, RecordNum, temp1, Judge, temp2);
		}
		public int ReadEarliestRecords32(short Id, int Option, int RecordNum,
			int Null1, int Null2, ref short[] JudgeDetail)
		{
			int[] temp1 = new int[1];
			short[] temp2 = new short[1];
			return DigReadEarliestRecords32(Id, Option, RecordNum, temp1, temp2, JudgeDetail);
		}
		// 7ʂ̃I[o[Ch
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
        	ref float[] RecordData, ref short[] Judge, ref short[] JudgeDetail)
        {
            return DigReadLatestRecords(Id, Option, RecordNum, RecordData, Judge, JudgeDetail);
        }
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
			ref float[] RecordData, ref short[] Judge, int Null1)
		{
			short[] temp1 = new short[1];
			return DigReadLatestRecords(Id, Option, RecordNum, RecordData, Judge, temp1);
		}
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
			ref float[] RecordData, int Null1, ref short[] JudgeDetail)
		{
			short[] temp1 = new short[1];
			return DigReadLatestRecords(Id, Option, RecordNum, RecordData, temp1, JudgeDetail);
		}
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, ref short[] JudgeDetail)
		{
			float[] temp1 = new float[1];
			return DigReadLatestRecords(Id, Option, RecordNum, temp1, Judge, JudgeDetail);
		}
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
			ref float[] RecordData, int Null1, int Null2)
		{
			short[] temp1 = new short[1];
			short[] temp2 = new short[1];
			return DigReadLatestRecords(Id, Option, RecordNum, RecordData, temp1, temp2);
		}
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, int Null2)
		{
			float[] temp1 = new float[1];
			short[] temp2 = new short[1];
			return DigReadLatestRecords(Id, Option, RecordNum, temp1, Judge, temp2);
		}
		public int ReadLatestRecords(short Id, int Option, int RecordNum,
			int Null1, int Null2, ref short[] JudgeDetail)
		{
			float[] temp1 = new float[1];
			short[] temp2 = new short[1];
			return DigReadLatestRecords(Id, Option, RecordNum, temp1, temp2, JudgeDetail);
		}
		// 7ʂ̃I[o[Ch
        public int ReadLatestRecords32(short Id, int Option, int RecordNum,
        	ref int[] RecordData, ref short[] Judge, ref short[] JudgeDetail)
        {
            return DigReadLatestRecords32(Id, Option, RecordNum, RecordData, Judge, JudgeDetail);
        }
		public int ReadLatestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, ref short[] Judge, int Null1)
		{
			short[] temp1 = new short[1];
			return DigReadLatestRecords32(Id, Option, RecordNum, RecordData, Judge, temp1);
		}
		public int ReadLatestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, int Null1, ref short[] JudgeDetail)
		{
			short[] temp1 = new short[1];
			return DigReadLatestRecords32(Id, Option, RecordNum, RecordData, temp1, JudgeDetail);
		}
		public int ReadLatestRecords32(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, ref short[] JudgeDetail)
		{
			int[] temp1 = new int[1];
			return DigReadLatestRecords32(Id, Option, RecordNum, temp1, Judge, JudgeDetail);
		}
		public int ReadLatestRecords32(short Id, int Option, int RecordNum,
			ref int[] RecordData, int Null1, int Null2)
		{
			short[] temp1 = new short[1];
			short[] temp2 = new short[1];
			return DigReadLatestRecords32(Id, Option, RecordNum, RecordData, temp1, temp2);
		}
		public int ReadLatestRecords32(short Id, int Option, int RecordNum,
			int Null1, ref short[] Judge, int Null2)
		{
			int[] temp1 = new int[1];
			short[] temp2 = new short[1];
			return DigReadLatestRecords32(Id, Option, RecordNum, temp1, Judge, temp2);
		}
		public int ReadLatestRecords32(short Id, int Option, int RecordNum,
			int Null1, int Null2, ref short[] JudgeDetail)
		{
			int[] temp1 = new int[1];
			short[] temp2 = new short[1];
			return DigReadLatestRecords32(Id, Option, RecordNum, temp1, temp2, JudgeDetail);
		}
        public int ReadSamples32(short Id, ref int Samples, ref int[] SampleData, out int TriggerPoint)
        {
            TriggerPoint = 0;
            return DigReadSamples32(Id, ref Samples, SampleData, ref TriggerPoint);
        }
        public int ReadSamples(short Id, ref int Samples, ref float[] SampleData, out int TriggerPoint)
        {
            TriggerPoint = 0;
            return DigReadSamples(Id, ref Samples, SampleData, ref TriggerPoint);
        }
        public int ReadSingleData(short Id, short DataSize, ref float[] Data)
        {
            return DigReadSingleData(Id, DataSize, Data);
        }
        public int ReadSingleData32(short Id, short DataSize, ref int[] Data)
        {
            return DigReadSingleData32(Id, DataSize, Data);
        }
        public int SetControlFilter(short Id, short Signal, float Value)
        {
            return DigSetControlFilter(Id, Signal, Value);
        }
        public int GetTemperature(short Id, out float Temperature)
        {
            Temperature = 0;
            return DigGetTemperature(Id, ref Temperature);
        }
        public int GetErrorString(int ErrorCode, out string ErrorString)
        {
            ErrorString = new String('0', 1);
            System.Text.StringBuilder errorstring = new System.Text.StringBuilder(256);
            int ret = DigGetErrorString(ErrorCode, errorstring);
            if (ret == 0)
            {
                ErrorString = errorstring.ToString();
            }
            return ret;
        }
        public int QueryDeviceName(short Index, out string DeviceName, out string Device)
        {
            DeviceName = new String('0', 1);
            Device = new String('0', 1);
            System.Text.StringBuilder devicename = new System.Text.StringBuilder(256);
            System.Text.StringBuilder device = new System.Text.StringBuilder(256);
            int ret = DigQueryDeviceName(Index, devicename, device);
            if (ret == 0)
            {
                DeviceName = devicename.ToString();
                Device = device.ToString();
            }
            return ret;
        }
        public int GetDeviceType(string Device, out short DeviceType)
        {
            DeviceType = 0;
            return DigGetDeviceType(Device, ref DeviceType);
        }
    }
}
