#pragma once #if !defined(DPPUSB_H) #define DPPUSB_H #include "stdafx.h" #include ".\ADMCA\DPP\USB\guid.h" //in \sys directory #include ".\ADMCA\Dpp\Cfg\DPPConst.h" #include ".\ADMCA\DPP\USB\usbdrvd.h" //in \dll directory //=============================================================== // DPP USB Communications Class //--------------------------------------------------------------- // Purpose : Interfaces the DPP control functions to the APA USB API // Notes : // Imports : //--------------------------------------------------------------- //Revision History //--------------------------------------------------------------- // 20040528 : Initial Version // Copyright (c)2004, 2007 Amptek, All Rights Reserved //=============================================================== class CDppUSB { private: // USB PIPE handles HANDLE PipeHandle_config; HANDLE PipeHandle_configOut; HANDLE PipeHandle_statusA; HANDLE PipeHandle_dataA; HANDLE PipeHandle_statusB; HANDLE PipeHandle_dataB; HANDLE PipeHandle_Scope; HANDLE USB_Device_Handle; UINT NumUSBDevices; public: long Dropouts; // from dpp demo packet dropout test bool HaveDeviceStatus; bool DriverOpen; // connection to driver open bool PipesOpen; // pipes are open bool usb_busy; CDppUSB(void); ~CDppUSB(void); int MonitorUSBDevices(); UINT OpenUSBPipes(); UINT OpenUSB(); void CloseUSBPipes(); void CloseUSB(); UINT PauseMCAUSB(BOOLEAN boolPauseMCA); void SendUSBPacket(UCHAR buffer[]); void ClearBuffer(BOOLEAN isBufferA); BOOLEAN USBDeviceReady(); //ULONG GetDPPConfig(UCHAR Config[]); ULONG GetDPPConfig(UCHAR ConfigIn[], bool isScopeData); //DP5 Scope Data uses config in pipe 20071211 void GetDPPStatus(BOOLEAN isBufferA, UCHAR Status[]); void GetDPP_PipeOpen_Status(BOOLEAN isBufferA, UCHAR Status[]); DWORD GetDPPData(BOOLEAN isBufferA, UCHAR buffer[], UINT ExpectedCount); void SendDPPConfigUSB(UCHAR Config[], UINT Preset); void CDppUSB::SaveStringDataToFile(CString strData); bool CompareBufferArrays(UCHAR buffer[], UCHAR buffer2[]); void ClearBufferArray(UCHAR buffer[]); int USBTimer(); CString GetUSBTimerStatText(); CString DisplayBufferArray(UCHAR buffer[]); public: double dppusbFirmware; // DPP5 20070926 dpp firmware version double dppusbFPGA; // DPP5 20070926 dpp fpga version bool isDPP5; // DPP5 20070926 DPP5 indicator double UCHARVersionToDouble(UCHAR Version); // DPP5 20070926 converts version code to double long dppusbSerialNumber; int dppusbDeviceType; CString cstrDppUsbDeviceType; bool GetUSBDeviceInfo(); UINT OpenUSBEx(UINT Device); int CurrentDevice; // current USB device bool isSendingPacket; void InputOffsetFineStep(); void InputOffsetCoarseStep(); void DPPCalcFastThresh(); void ArmTrigger(); void ClearPA0IO0(); void SetPA0IO0(); void ClearPA1IO1(); void SetPA1IO1(); void ClearPA2IO2(); void SetPA2IO2(); void ClearPA3IO3(); void SetPA3IO3(); void SendDiodeCal(USHORT DCalValue); DWORD GetScopeData(UCHAR Scope[]); //void ResetUSBPipe(HANDLE ResetPipeHandle); double LongWordToDouble(int lwStart, UCHAR buffer[]); double GetDriverVersion(); CString GetPX4DeviceText(); void SendPX4DeviceText(CString strText); CString GetDP5DeviceText(); void SendDP5DeviceText(CString strText); void SendGenericDppVendorRequest(UCHAR Request, USHORT Value); // DPP5 20070928 new dp5 vendor request functions void SetTECCurrentLimit(USHORT CurrentLimit); void SetDP5BootOptions(USHORT BootOptions); void SetPC5HV(USHORT HV); void SetPC5TECTemp(USHORT Temperature); void SetDP5InputOffset(USHORT InputOffset); void SetDP5MicroAdcTempCal(USHORT MicroAdcTempCal); void SetDP5SpectrumOffset(USHORT SpectrumOffset); void RequestDigitalScopeData(); CString GetDeviceNameFromVal(int DeviceTypeVal); //void SetDeviceTypeFromStringDescriptor(CString cstrStringDescriptor); }; #endif // !defined(DPPUSB_H)