SerialPortTestDlg.h
上传用户:guqin_vip
上传日期:2022-06-17
资源大小:1993k
文件大小:3k
源码类别:

串口编程

开发平台:

C/C++

  1. // SerialPortTestDlg.h : header file
  2. //
  3. #if !defined(AFX_SERIALPORTTESTDLG_H__556B3D06_5375_11D8_870F_00E04C3F78CA__INCLUDED_)
  4. #define AFX_SERIALPORTTESTDLG_H__556B3D06_5375_11D8_870F_00E04C3F78CA__INCLUDED_
  5. #if _MSC_VER > 1000
  6. #pragma once
  7. #endif // _MSC_VER > 1000
  8. #include "SerialPort.h"  //添加CSerailPort类的头文件
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CSerialPortTestDlg dialog
  11. class CSerialPortTestDlg : public CDialog
  12. {
  13. // Construction
  14. public:
  15. void SendNMEAData(CString &strData);
  16. BOOL GetSwitchStatus(UINT unSwitch);
  17. void SetSwitchStatus(UINT unSwtich,BOOL bStatus);
  18. HICON m_hIconRed;    //开关打开时的红灯图标句柄
  19. HICON m_hIconOff;    //开关关闭时的指示图标句柄
  20. CSerialPort m_SerialPort; //CSerailPort类对象,串口1
  21. CSerialPort m_SerialPort2; //CSerailPort类对象,串口2
  22. BOOL m_bSerialPortOpened; //标志串口1是否打开
  23. BOOL m_bSerialPortOpened2; //标志串口2是否打开
  24. UINT m_unPort;          //记录串口1的串口号
  25. UINT m_unPort2;         //记录串口2的串口号
  26. CString m_strPortRXData;  //用于储存串口1收到的数据
  27. CString m_strPortRXData2;  //用于储存串口2收到的数据
  28. CString m_strChecksum2;   //用于串口2接收数据计算校验值
  29. CSerialPortTestDlg(CWnd* pParent = NULL); // standard constructor
  30. // Dialog Data
  31. //{{AFX_DATA(CSerialPortTestDlg)
  32. enum { IDD = IDD_SERIALPORTTEST_DIALOG };
  33. CStatic m_ctrlStaticIconS1;
  34. CStatic m_ctrlStaticIconS2;
  35. CStatic m_ctrlStaticIconS3;
  36. CStatic m_ctrlStaticIconS4;
  37. CStatic m_ctrlStaticIconS5;
  38. CStatic m_ctrlStaticIconS6;
  39. CStatic m_ctrlStaticIconS7;
  40. CStatic m_ctrlStaticIconS8;
  41. CStatic m_ctrlStaticIconS9;
  42. CButton m_ctrlCheckSwitch1;
  43. CButton m_ctrlCheckSwitch2;
  44. CButton m_ctrlCheckSwitch3;
  45. CButton m_ctrlCheckSwitch4;
  46. CButton m_ctrlCheckSwitch5;
  47. CButton m_ctrlCheckSwitch6;
  48. CButton m_ctrlCheckSwitch7;
  49. CButton m_ctrlCheckSwitch8;
  50. CButton m_ctrlCheckSwitch9;
  51. CComboBox m_ctrlComboComPort2;
  52. CComboBox m_ctrlComboComPort;
  53. CString m_strEditReceiveMsg;
  54. CString m_strEditSendMsg;
  55. UINT m_unEditPosition;
  56. UINT m_unEditVelocity;
  57. UINT m_unEditVelocity2;
  58. UINT m_unEditPosition2;
  59. CString m_strEditDispData2;
  60. //}}AFX_DATA
  61. // ClassWizard generated virtual function overrides
  62. //{{AFX_VIRTUAL(CSerialPortTestDlg)
  63. protected:
  64. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  65. //}}AFX_VIRTUAL
  66. // Implementation
  67. protected:
  68. HICON m_hIcon;
  69. // Generated message map functions
  70. //{{AFX_MSG(CSerialPortTestDlg)
  71. virtual BOOL OnInitDialog();
  72. afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  73. afx_msg void OnPaint();
  74. afx_msg HCURSOR OnQueryDragIcon();
  75. afx_msg LONG OnComm(WPARAM ch, LPARAM port);
  76. afx_msg void OnButtonOpen();
  77. afx_msg void OnButtonClose();
  78. afx_msg void OnButtonSend();
  79. afx_msg void OnButtonOpen2();
  80. afx_msg void OnButtonClose2();
  81. //}}AFX_MSG
  82. DECLARE_MESSAGE_MAP()
  83. };
  84. //{{AFX_INSERT_LOCATION}}
  85. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  86. #endif // !defined(AFX_SERIALPORTTESTDLG_H__556B3D06_5375_11D8_870F_00E04C3F78CA__INCLUDED_)