// vcDP5Dlg.h : header file // #pragma once #include "stdafx.h" #include "afxwin.h" #include "Resource.h" #include "SCommon.h" #include "ParsePacket.h" #include "Label.h" #include "PlotCanvas.h" #include "DP5CfgWnd.h" #define LINEAR_PLOT_SCALE 0 #define LOG_PLOT_SCALE 1 #define SOLID_PLOT_TYPE 0 #define LINE_PLOT_TYPE 1 typedef struct _SpectrumFileType { string strTag; string strDescription; short m_iNumChan; unsigned long SerialNumber; string strStartTime; string strSpectrumConfig; string strSpectrumStatus; } SpectrumFileType; // CvcDP5Dlg dialog class CvcDP5Dlg : public CDialog { // Construction public: CvcDP5Dlg(CWnd* pParent = NULL); // standard constructor ~CvcDP5Dlg(); // Dialog Data enum { IDD = IDD_vcDP5_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support // Implementation protected: HICON m_hIcon; // Generated message map functions virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: bool BOOL_TO_bool(BOOL bValue); afx_msg void OnBnClickedButtonFindDevice(); afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData); afx_msg void OnDestroy(); unsigned long DataTest(); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnBnClickedButtonArmTrigger(); afx_msg void OnBnClickedButtonSaveFile(); afx_msg void OnBnClickedButtonClearDataAndGraph(); afx_msg void OnBnClickedButtonSingleUpdate(); afx_msg void OnBnClickedButtonClearMiscData(); afx_msg void OnBnClickedButtonReadMiscData(); afx_msg void OnBnClickedButtonWriteMiscData(); void ShowStatus(CString strStatus); void ParsePacketEx(Packet_In PIN, DppStateType DppState); void ProcessDiagDataEx(Packet_In PIN, DppStateType DppState); void ProcessStatusEx(Packet_In PIN, DppStateType DppState); void ConvertStatusDP5ToDP4(DP4_FORMAT_STATUS m_DP5_Status); void ProcessSpectrumEx(Packet_In PIN, DppStateType DppState); void ProcessScopeDataEx(Packet_In PIN, DppStateType DppState); void ProcessTextDataEx(Packet_In PIN, DppStateType DppState); void ProcessAck(unsigned char PID2); void DisplayError(Packet_In PIN, DppStateType DppState); void RequestScopeData(BOOL ScopeDataReady); void SendCommand(TRANSMIT_PACKET_TYPE XmtCmd); void SendCommandConfig(TRANSMIT_PACKET_TYPE XmtCmd); string CreateSpectrumConfig(string strRawCfgIn); void SendCommandData(TRANSMIT_PACKET_TYPE XmtCmd, unsigned char DataOut[]); void RemCallParsePacket(unsigned char PacketIn[]); // Communications Timers // RS232 100ms Timer 1 UINT_PTR m_nTmrRS232Id; // return SetTimer Return Value (0=false,TimerID if OK) UINT_PTR m_nTmrRS232EventId; // Timer Event Identifier UINT m_nTmrRS232Elapse; // Timeout value in milliseconds // AutoSpectrum 1000ms Timer 2 UINT_PTR m_nTmrSpectrumId; // return SetTimer Return Value (0=false,TimerID if OK) UINT_PTR m_nTmrSpectrumEventId; // Timer Event Identifier UINT m_nTmrSpectrumElapse; // Timeout value in milliseconds // General Purpose Event Timeout Flag 10ms Timer 3 UINT_PTR m_nTmrTimeoutId; // return SetTimer Return Value (0=false,TimerID if OK) UINT_PTR m_nTmrTimeoutEventId; // Timer Event Identifier UINT m_nTmrTimeoutElapse; // Timeout value in milliseconds BOOL TimeoutFlag; //CStatic m_PicturePlot; // plot display CPlotCanvas m_PicturePlot; // plot display void PlotData(long DataBuffer[8192], int NumChan); // calculates plot data void UpdatePlot(); // draws plot display long PlotBuffer[8192]; // holds plot data char szSettings[3000]; // holds settings for mca plot long XPlotMAX; long YPlotMAX; BOOL HavePlot; CStatic m_PictureScope; // plot display void ScopeDisplay(unsigned char ScopeData[2048]); // calculates plot data void UpdateScope(); // draws plot display unsigned char ScopeBuffer[2048]; // holds plot data BOOL HaveTrace; void EnableDPPFunctions(BOOL isEnabled); afx_msg void OnBnClickedButtonDiag(); //void OnReceive(int nErrorCode); //Sockets Comm afx_msg LONG OnReceive(UINT, LONG); afx_msg void OnBnClickedButtonSelectComm(); CLabel lblSelectCommunications; //CStatic CLabel lblStatus; //CStatic IDC_STATIC_STATUS CLabel lblMiscStatus; //CStatic IDC_STATIC_MISC_STATUS afx_msg LONG OnCommunication(UINT, LONG); void OnComm(); void OnResetCommunications(); afx_msg void OnBnClickedButtonGetSpectrum(); afx_msg void OnBnClickedButtonStartAcquisition(); afx_msg void OnBnClickedButtonStopAcquisition(); afx_msg void OnBnClickedButtonEditConfig(); CString GetDeviceNameFromVal(int DeviceTypeVal); BOOL isConnectedTest(); afx_msg LRESULT DppSendConfigToHw(WPARAM wParam, LPARAM lParam); void ProcessCfgReadEx(Packet_In PIN, DppStateType DppState); //==== Configuration //============================================================== string GetCmdData(string strCmd, string strCfgData); CString GetCmdDataMS(CString strCmd, CString strCfgData); string GetCmdDesc(string strCmd); CString GetCmdDescMS(CString strCmd); string ReplaceCmdDesc(string strCmd, string strCfgData); CString ReplaceCmdDescMS(CString strCmd, CString strCfgData); string AppendCmdDesc(string strCmd, string strCfgData); vector Dp5CmdList; //void MakeDp5CmdList(CStringArray *strCfgArr); vector CvcDP5Dlg::MakeDp5CmdList(); void CopyDp5CfgToClip(CString strCfg, CString strDesc); afx_msg LRESULT CallReadDppConfig(WPARAM wParam, LPARAM lParam); afx_msg LRESULT CallReadDppConfigEx(WPARAM wParam, LPARAM lParam); afx_msg LRESULT CallReadScaConfig(WPARAM wParam, LPARAM lParam); //============================================================== afx_msg void OnBnClickedButtonShowConfig(); afx_msg void OnBnClickedRadioPlotScaleLinear(); afx_msg void OnBnClickedRadioPlotScaleLog(); afx_msg void OnBnClickedRadioPlotTypeSolid(); afx_msg void OnBnClickedRadioPlotTypeLine(); //==== Configuration //============================================================== void SaveMCAFile(string strFilename, string strMCA); afx_msg void OnBnClickedBtnSaveFile(); string CreateMCAData(long m_larDataBuffer[], SpectrumFileType sfInfo, DP4_FORMAT_STATUS cfgStatusLst); void SetStartTime(); //============================================================== CPoint CursorPosition; int CurrentChannel; afx_msg void OnStnClickedPlotpicturecontrol(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); virtual BOOL PreTranslateMessage(MSG* pMsg); afx_msg void OnBnClickedOk(); afx_msg void OnBnClickedCancel(); void SetPlotChannel(); afx_msg void OnBnClickedButtonClearRoi(); afx_msg void OnBnClickedButtonRoiEnd(); afx_msg void OnBnClickedButtonRoiStart(); afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult); afx_msg void TuneFastSlowThresh(); afx_msg void OnBnClickedButtonAutotune(); double GetPixPerChannel(); ////////////////////////////////////////////// ////// optional for preset status tests ////// ////////////////////////////////////////////// //BOOL TestAcqStatusExt(); //void UpdateAcqStatusExt(); //int StatMcaEnabled_OLD; //int PresetCountExpired_OLD; //int PresetRtDone_OLD; //int AcqMode_OLD; //int MCSDone_OLD; //int m_acqStatus_OLD; ////////////////////////////////////////////// ////// optional for preset status tests ////// ////////////////////////////////////////////// string CreateDTS(string strFormat); ///////////////////////////////////////////////// ////// Manufacturing Text Block Read/Write ////// ///////////////////////////////////////////////// CString strLowerMiscData; // lower 256 bytes of misc data buffer CString strUpperMiscData; // upper 256 bytes of misc data buffer CString ParsePerformanceNotes(CString str); CString TextToBlockString(CString &str, char *prefix); CString CreateTextBlockTest(); void SendDppInfoTextBlock(CString strLowerTextBlock, CString strInfoTextBlock); //////BOOL CvcDP5Dlg::ReadTextBlockString(CString& rString) void WriteTextBlock(); void ParseTextBlockNotes(CString strTextBlock); BOOL ExtractNote(CString& rString, LPCTSTR lpszFullString, int iSubString, TCHAR chSep); void CopyTextToClip(CString strTextIn); void OnBnClickedButtonWriteTextBlock(); bool SendManufacturingTextBlock(CString generalNotes); };