gccDppConsole Test C++ SDK
20170920
DPP C++ Console Demonstration
|
00001 00003 #pragma once 00004 #include <stdio.h> 00005 #include <stdlib.h> 00006 #include "DP5Protocol.h" 00007 #include "DppUtilities.h" 00008 00009 typedef enum _PX5_OPTIONS 00010 { 00011 PX5_OPTION_NONE=0, 00012 PX5_OPTION_HPGe_HVPS=1, 00013 PX5_OPTION_TEST_TEK=4, 00014 PX5_OPTION_TEST_MOX=5, 00015 PX5_OPTION_TEST_AMP=6, 00016 PX5_OPTION_TEST_MODE_1=8, 00017 PX5_OPTION_TEST_MODE_2=9 00018 } PX5_OPTIONS; 00019 00020 //PX5_OPTION_TEST_MODE_1 reserved for future use 00021 //PX5_OPTION_TEST_MODE_2 reserved for future use 00022 00023 typedef struct DP5_DP4_FORMAT_STATUS 00024 { 00025 unsigned char RAW[64]; 00026 unsigned long SerialNumber; 00027 double FastCount; 00028 double SlowCount; 00029 unsigned char FPGA; 00030 unsigned char Firmware; 00031 unsigned char Build; 00032 double AccumulationTime; 00033 double RealTime; 00034 double LiveTime; 00035 double HV; 00036 double DET_TEMP; 00037 double DP5_TEMP; 00038 bool PX4; 00039 bool AFAST_LOCKED; 00040 bool MCA_EN; 00041 bool PRECNT_REACHED; 00042 bool PresetRtDone; 00043 bool PresetLtDone; 00044 bool SUPPLIES_ON; 00045 bool SCOPE_DR; 00046 bool DP5_CONFIGURED; 00047 double GP_COUNTER; 00048 bool AOFFSET_LOCKED; 00049 bool MCS_DONE; 00050 bool RAM_TEST_RUN; 00051 bool RAM_TEST_ERROR; 00052 double DCAL; 00053 unsigned char PZCORR; // or single? 00054 unsigned char UC_TEMP_OFFSET; 00055 double AN_IN; 00056 double VREF_IN; 00057 unsigned long PC5_SN; 00058 bool PC5_PRESENT; 00059 bool PC5_HV_POL; 00060 bool PC5_8_5V; 00061 double ADC_GAIN_CAL; 00062 unsigned char ADC_OFFSET_CAL; 00063 long SPECTRUM_OFFSET; // or single? 00064 bool b80MHzMode; 00065 bool bFPGAAutoClock; 00066 unsigned char DEVICE_ID; 00067 bool ReBootFlag; 00068 unsigned char DPP_options; 00069 bool HPGe_HV_INH; 00070 bool HPGe_HV_INH_POL; 00071 double TEC_Voltage; 00072 unsigned char DPP_ECO; 00073 bool AU34_2; 00074 bool isAscInstalled; 00075 bool isAscEnabled; 00076 bool bScintHas80MHzOption; 00077 bool isDP5_RevDxGains; 00078 } DP4_FORMAT_STATUS, *PDP4_FORMAT_STATUS; 00079 00080 typedef struct _DiagDataType 00081 { 00082 float ADC_V[12]; 00083 float PC5_V[4]; 00084 bool PC5_PRESENT; 00085 long PC5_SN; 00086 unsigned char Firmware; 00087 unsigned char FPGA; 00088 bool SRAMTestPass; 00089 long SRAMTestData; 00090 int TempOffset; 00091 string strTempRaw; 00092 string strTempCal; 00093 bool PC5Initialized; 00094 float PC5DCAL; 00095 bool IsPosHV; 00096 bool Is8_5VPreAmp; 00097 bool Sup9VOn; 00098 bool PreAmpON; 00099 bool HVOn; 00100 bool TECOn; 00101 unsigned char DiagData[192]; 00102 } DiagDataType, *PDDiagDataType; 00103 00104 class CDP5Status 00105 { 00106 public: 00107 CDP5Status(void); 00108 ~CDP5Status(void); 00109 00111 CDppUtilities DppUtil; 00112 00114 DP4_FORMAT_STATUS m_DP5_Status; 00116 DiagDataType DiagData; 00118 void Process_Status(DP4_FORMAT_STATUS *m_DP5_Status); 00119 string DP5_Dx_OptionFlags(unsigned char DP5_Dx_Options); 00121 string ShowStatusValueStrings(DP4_FORMAT_STATUS m_DP5_Status); 00122 string PX5_OptionsString(DP4_FORMAT_STATUS m_DP5_Status); 00123 string GetStatusValueStrings(DP4_FORMAT_STATUS m_DP5_Status); 00124 00126 void Process_Diagnostics(Packet_In PIN, DiagDataType *dd, int device_type); 00128 string DiagnosticsToString(DiagDataType dd, int device_type); 00130 string DiagStrPX5Option(DiagDataType dd, int device_type); 00131 00133 string FmtHvPwr(float fVal); 00135 string FmtPc5Pwr(float fVal); 00137 string FmtPc5Temp(float fVal) ; 00139 string FmtHex(long FmtHex, long HexDig); 00141 string FmtLng(long lVal); 00143 string VersionToStr(unsigned char bVersion); 00145 string OnOffStr(bool bOn); 00147 string IsAorB(bool bIsA, string strA, string strB); 00149 string GetDeviceNameFromVal(int DeviceTypeVal) ; 00151 string DisplayBufferArray(unsigned char buffer[], unsigned long bufSizeIn); 00153 void SaveStringDataToFile(string strData); 00154 00155 }; 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175