// MainDlg.h : header file // #if !defined(AFX_MainDlg_H__C192981D_5DF1_430F_AF8E_448E08BC771F__INCLUDED_) #define AFX_MainDlg_H__C192981D_5DF1_430F_AF8E_448E08BC771F__INCLUDED_ #include "DynamicLED.h" #include "IControl.h" #include "SlParaDlg.h" #include "Termlog.h" #include "EditEnter.h" #include "SerialParaDlg.h" #include "PrefDlg.h" #include "DriveButton.h" #include #include #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #define LED_ERROR 99 #define TIMER_AUTOSTATUS 1001 #define TIMER_TIMEOUT 999 #define TIMER_COMMAND_INTERVAL 1000 #define COMMAND_INTERVAL 100 #define MAX_RESPONSE 7 #define NUM_MOTOR_LEDS 11 #define NUM_SL_LEDS 16 #define NUM_SL_MOTOR_LEDS 3 #define MAX_EDITLINE_CHARS 101 #define NUM_PORT_BITS 8 #define LEDID_FIRST_MOTORA 10 #define LEDID_FIRST_MOTORB 21 #define LEDID_FIRST_MOTORC 32 #define LEDID_FIRST_MOTOR_STATUS 43 #define LEDID_FIRST_SL_IN 46 #define LEDID_FIRST_SL_OUT 62 #define LEDID_LAST_SL_OUT 79 #define MAX_LINE_LENGTH 100 #define MOTOR_IN_COMMAND_LENGTH 4 using namespace std; ///////////////////////////////////////////////////////////////////////////// // CMainDlg dialog class CMainDlg : public CDialog { // Construction public: void OnOK(); bool m_bAutoSave; bool m_bAutoSaving; void SetAutoSaving(bool autosave); bool GetAutoSaving(); string GetLogFileName(); void SwitchOffLed(string command); void SwitchOnLed(string command); void SetParamsSent(char motor,bool boolean); void UpdateControllerStatus(string response,int port); void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu); void OnDriveBtnUp(UINT nID); void OnDriveButton(UINT nID); void UpdateMotorStatus(string Motor,string response); void SetBuffer(int buffersize); int GetBuffer(); void SetInterval(int intervalparam); int GetInterval(); string SetReceivedString(string p_sLine) const; void InitLeds(); CMainDlg(CWnd* pParent = NULL); // standard constructor ~CMainDlg(); void OnLEDClick( UINT nID ); CDynamicLED m_LedMotorA[11]; //the status LEDs for all the motors and the controller are created here CDynamicLED m_LedMotorB[11]; CDynamicLED m_LedMotorC[11]; CDynamicLED m_LedSLIn[16]; CDynamicLED m_LedSLOut[16]; CDynamicLED m_LedSLMotors[3]; IControl *m_pController; //the pointers for accessing CSLControl and such instances CSerialParaDlg *m_pCommsDlg; CSlParaDlg *m_pParamDlgA; CSlParaDlg *m_pParamDlgB; CSlParaDlg *m_pParamDlgC; bool m_bAutoStatus; bool bVelocity; CPrefDlg *m_pPref; CString sCommandStr; CBrush* m_pEditBkBrush; CTermLog *m_TermLog; string GetEditLine(int nLineNumber) ;//const; void UpdateLogView(void); void UpdateTerminal(void); CString GetSysTime(void) const; string SetSentString(string p_sLine) const; void SendString(string p_sLine, string recvd); void ReceiveString(string p_sLine); // Dialog Data //{{AFX_DATA(CMainDlg) enum { IDD = IDD_SERTIGUI_DIALOG }; CDriveButton m_BtnDriveBackC; CDriveButton m_BtnDriveBackB; CDriveButton m_BtnDriveBackA; CDriveButton m_BtnDriveFwdC; CDriveButton m_BtnDriveFwdA; CDriveButton m_BtnDriveFwdB; CDriveButton m_FwdButtonA; CEdit m_LogView; CButton m_PauseButton; CEditEnter m_Terminal; CStatic m_StaticPosC; CStatic m_StaticPosB; CStatic m_StaticPosA; CEdit m_Target3; CEdit m_Target2; CEdit m_Target1; CStatic m_StatusBar; //}}AFX_DATA // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMainDlg) public: virtual BOOL PreTranslateMessage(MSG* pMsg); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: bool m_bKeyUpDown; bool m_bKeyDownDown; bool m_bKeyLeftDown; bool m_bKeyRightDown; bool m_bKeyNextDown; bool m_bKeyPriorDown; void SetLedStatus(string hexstring, int Led,int n, CDynamicLED* p_Led); void CreateParamDlg(char motorchar); HICON m_hIcon; afx_msg LRESULT OnEditComplete(WPARAM, LPARAM); // Generated message map functions //{{AFX_MSG(CMainDlg) virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnFileExit(); afx_msg void OnInitSL(); afx_msg void OnConnect(); afx_msg void OnClosePort(); afx_msg void OnButtonTermSend(); afx_msg void OnButtonStart3(); afx_msg void OnButtonStart1(); afx_msg void OnButtonStart2(); afx_msg void OnButtonStop1(); afx_msg void OnButtonStop2(); afx_msg void OnButtonStop3(); afx_msg void OnButtonCalA(); afx_msg void OnButtonCalB(); afx_msg void OnButtonCalC(); afx_msg void OnButtonReadA(); afx_msg void OnButtonReadB(); afx_msg void OnButtonReadC(); afx_msg void OnButtonReadSl(); afx_msg void OnButtonPauseLog(); afx_msg void OnConnectPortSettings(); afx_msg void OnButtonMark(); afx_msg void OnButtonSaveLog(); afx_msg void OnSetupPreferences(); afx_msg void OnHelpAbout(); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnSetupAutostatus(); afx_msg void OnUpdateSetupAutostatus(CCmdUI* pCmdUI); afx_msg void OnButtonParamA(); afx_msg void OnButtonParamB(); afx_msg void OnButtonParamC(); afx_msg void OnButtonSaveTerminal(); afx_msg void OnButtonLoadCommandFile(); afx_msg void OnButtonRunAll(); afx_msg void OnButtonPowerOn(); afx_msg void OnButtonPowerOff(); afx_msg void OnHelpHelp(); afx_msg void OnSetupAutoscroll(); afx_msg void OnUpdateSetupAutoscroll(CCmdUI* pCmdUI); afx_msg void OnButtonzeroa(); afx_msg void OnButtonzerob(); afx_msg void OnButtonzeroc(); afx_msg void OnEditClear(); afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); //}}AFX_MSG afx_msg LRESULT OnSerialMsg (WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() private: int m_interval; int m_buffer; bool m_bAutoScroll; bool m_bParamASent; bool m_bParamBSent; bool m_bParamCSent; queue< pair > commandbuffer; }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_MainDlg_H__C192981D_5DF1_430F_AF8E_448E08BC771F__INCLUDED_)