using System; //using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; namespace ConsoleApplication16 { unsafe class forDLL { public const byte DPPNONE = 0x0; public const byte DPPDP4 = 0x1; public const byte DPPPX4 = 0x2; public const byte DPPDP4EMUL = 0x3; public const byte DPPDP5 = 0x4; [StructLayout(LayoutKind.Explicit, Size = 82)] internal struct _DPP_STATUS { [FieldOffset(0)] public double FPGA; [FieldOffset(8)] public double SerialNumber; [FieldOffset(16)] public double Firmware; [FieldOffset(17)] public char StatDevInd; [FieldOffset(18)] public char BootStatus; [FieldOffset(19)] public char PwrBtnConfig; [FieldOffset(20)] public char SwConfigRcvd; [FieldOffset(21)] public char SetFastThreshDone; [FieldOffset(22)] public char SetSlowThreshDone; [FieldOffset(23)] public char SetInputOffsetDone; [FieldOffset(31)] public double BoardTemp; [FieldOffset(39)] public double HVMonitor; [FieldOffset(47)] public double TECMonitor; [FieldOffset(55)] public double FastCount; [FieldOffset(63)] public double SlowCount; [FieldOffset(71)] public double AccumulationTime; [FieldOffset(72)] public char StatMcaEnabled; [FieldOffset(73)] public char MCSDone; [FieldOffset(74)] public char PresetCountExpired; } [DllImport("DppApi.dll", EntryPoint = "OpenDppApi")] static extern public void* OpenDppApi(); [DllImport("DppApi.dll", EntryPoint = "OpenUSBDevice")] static extern public int OpenUSBDevice(void* OpenDppApi); [DllImport("DppApi.dll", EntryPoint = "GetStatusStruct")] static extern public void GetStatusStruct(void* OpenDppApi, bool b, _DPP_STATUS status); [DllImport("DppApi.dll", EntryPoint = "SendConfigToDpp")] static extern public void SendConfigToDpp(void* OpenDppApi); [DllImport("DppApi.dll", EntryPoint = "CloseUSBDevice")] static extern public void CloseUSBDevice(void* OpenDppApi); [DllImport("DppApi.dll", EntryPoint = "CloseDppApi")] static extern public void CloseDppApi(void* OpenDppApi); [DllImport("DppApi.dll", EntryPoint = "PauseDppData")] static extern public void PauseDppData(void* OpenDppApi, bool b); [DllImport("DppApi.dll", EntryPoint = "GetStatusString")] static extern public void GetStatusString(void* OpenDppApi, int b, byte[] status, int lenOfString); [DllImport("DppApi.dll", EntryPoint = "GetDppData")] static extern public int GetDppData(void* OpenDppApi, int[] DataBuffer); [DllImport("DppApi.dll", EntryPoint = "GetConfigFromDpp")] static extern public void GetConfigFromDpp(void* OpenDppApi); //[DllImport("DppApi.dll", EntryPoint = "GetConfigFromBuffer")] //static extern public void GetConfigFromBuffer(void* OpenDppApi); [DllImport("DppApi.dll", EntryPoint = "GetConfigString")] static extern public void GetConfigString(void* OpenDppApi, byte[] Config, int lenOfString); [DllImport("DppApi.dll", EntryPoint = "GetConfigFromFile")] static extern public void GetConfigFromFile(void* OpenDppApi, byte[] file, int lenFile, byte deviceType); } }