#pragma once #include "stdafx.h" #include "DppConst.h" #include "scafn.h" #include "vcDP5_Shared_HIDD.h" #include "vcDP5.h" //#include "SProfile.h" #define WM_SETPAGEFOCUS WM_APP+2 //Communications #include "DppSocket.h" #include "DppWinUSB.h" #include "DppComm.h" #include "DP5Status.h" #include "ParsePacket.h" #include "DP5Protocol.h" #include "SendCommand.h" #include "DP5ControlUtil.h" #include "DppConfig.h" #include ".\plot.h" #include ".\spectralist.h" #include "WinusbNotify.h" // Get/Save a double format value #define GETPD(p1, i1, data) str = Get(p1, #i1, data); i1 = atof(str) #define PUTPD(p1, i1) str.Format("%g", i1); Put(p1, #i1, str) // Get/Save a parameter value #define GETP1(p1, i1, data) i1 = Get(p1, #i1, data) #define PUTP1(p1, i1) Put(p1, #i1, i1) const CString regDP5Comm = "DP5_Communication"; const CString regDP5Device = "DP5_Device"; const CString regDP5Config = "DP5_Configuration"; class CSProfile { public: CString profile; int device_type; // DPP Device Type int data_refresh; // usb data refresh rate in milli seconds CString strDevice; // Holds the live device type name for display // DPP5 20071010_1245 //DP5 Settings BOOL SendCoarseFineGain; // FALSE=Send GAIN, TRUE=Send GAIA,GAIF CScaFn scafn; CSca sca; BOOL SCAEnabled; unsigned long SockAddr; // Current Ip Address UINT ComPort; // current com port int baud_rate; // current baud rate unsigned char CurrentInterface; // interface in use (RS232/USB/ETHERNET) public: CSProfile(){}; ~CSProfile(){}; }; class CSCommon { public: CSCommon(void); ~CSCommon(void); CString GetDeviceNameFromVal(int DeviceTypeVal) { CString strDeviceType; switch(DeviceTypeVal) { case dppDP5: strDeviceType = "DP5"; break; case dppPX5: strDeviceType = "PX5"; break; case dppDP5G: strDeviceType = "DP5G"; break; case dppMCA8000D: strDeviceType = "MCA8000D"; break; case dppTB5: strDeviceType = "TB5"; break; case dppDP5X: strDeviceType = "DP5-X"; break; default: //if unknown set to DP5 strDeviceType = "DP5"; break; } return strDeviceType; } CPlot m_plot; // = new CPlot; CPlot *plot; CSpectraList spectraList; CSpectrum m_Spectrum; // we only have one spectrum CScaFn scafn; CSca sca; BOOL SCAEnabled; //Communications CDppComm m_DppPort; // RS232 Serial Port CDppWinUSB DppWinUSB; // WinUSB CDppSocket m_DppSck; // Ethernet/Sockets CWinusbNotify WinusbNotify; int DppCommStatusInd; // dpp communications status indicator int DppCommStatusIndOld; // //DP5 Protocol Support CDP5Status DP5Stat; CParsePacket ParsePkt; CDP5Protocol DP5Proto; CSendCommand SndCmd; //CDppConfig DppConfig; CStringArray Dp5CmdList; CString HwCfgDP5; CString HwCfgDP5Out; BOOL HwCfgReady; BOOL HwCfgExReady; // Save/Load Registry Settings Support functions CString Get(LPCTSTR profile, LPCTSTR entry, LPCTSTR def); int Get(LPCTSTR profile, LPCTSTR entry, int def); BOOL Put(LPCTSTR profile, LPCTSTR entry, LPCTSTR def); BOOL Put(LPCTSTR profile, LPCTSTR entry, int def); void LoadProfile(); void SaveProfile(); // Shared Communications Interface Settings unsigned char CurrentInterface; // interface in use (RS232/USB/ETHERNET) BOOL isDppFound[3]; // device found on interface=TRUE ([0]=RS232/[1]=USB/[2]=ETHERNET) BOOL isDppConnected; // CurrentInterface selected and device found // Serial Port Settings UINT ComPort; int baud_rate; // WinUSB Settings // Serial Number // Ethernet Settings BOOL NetfinderActive; unsigned long SockAddr; CString strSockAddr; CSProfile profileCls; CSProfile *profile; // DP5 Configuration Helper Functions BOOL ReloadCfg; BOOL HaveConfig; BOOL FindCommand; int FindCtrlID; CDP5ControlUtil CtrlUtil; DP5_CONFIGURATION m_DP5Cfg[MAX_DP5_CONFIGURATIONS]; void CreateDP5Cfg(); void DP5CfgCmd(DP5_CMD_INDEX idxDP5Cfg, // dp5 command index CString Command, // 4-char COMMAND mnemonic int ListCtrlID, // combobox control ID if any int TextCtrlID, // text control ID if any DP5_CTRL_TYPE CtrlType, // control type DP5_CTRL_GROUP CtrlGroup, // control group (page) CString Description, // COMMAND Description CString Units, // COMMAND units CString Limits); // COMMAND limits CDppConfig DppConfig; HWND hWnd_Main; //CString HwCfgDP5; //CString HwCfgDP5Out; //BOOL HwCfgReady; //BOOL HwCfgExReady; //CSProfile profileCls; //CSProfile *profile; CString strHelpFilePath; // save plot type BOOL isScaleLog; //TRUE=log, FALSE=linear, default=FALSE BOOL isPlotLine; //TRUE=line, FALSE=solid, default=FALSE }; extern CSCommon s;