- // GpsSCDoc.h : interface of the CGpsSCDoc class
- //
- /////////////////////////////////////////////////////////////////////////////
- #if !defined(AFX_GPSSCDOC_H__58804DED_631B_11D8_B346_0060975FFAEE__INCLUDED_)
- #define AFX_GPSSCDOC_H__58804DED_631B_11D8_B346_0060975FFAEE__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #define MAXBLOCK 4096
- #define XON 0x11
- #define XOFF 0x13
- #define FC_DTRDSR 0x01
- #define FC_RTSCTS 0x02
- #define FC_XONXOFF 0x04
- #define ASCII_BEL 0x07
- #define ASCII_BS 0x08
- #define ASCII_LF 0x0A
- #define ASCII_CR 0x0D
- #define ASCII_XON 0x11
- #define ASCII_XOFF 0x13
- UINT CommProc(LPVOID pParam);
- class CGpsSCDoc : public CDocument
- {
- protected: // create from serialization only
- CGpsSCDoc();
- DECLARE_DYNCREATE(CGpsSCDoc)
- // Attributes
- public:
- CWinThread *m_pThread; //代表辅助线程
- volatile BOOL m_bConnected; //表示连接否,用来标识菜单串口连接和断开连接是否可用
- volatile HWND m_hTermWnd; //辅助窗口
- volatile HANDLE m_hPostMsgEvent; //用于WM_COMMNOTIFY消息的事件对象
- volatile HANDLE m_hCom; //串行口句柄
- OVERLAPPED m_osRead, m_osWrite; //用于重叠读/写
- int m_nBaud; //数据传输速率
- int m_nDataBits; //数据位
- int m_nParity; //校验位
- CString m_sPort; //串行端口
- int m_nStopBits; //停止位
- // Operations
- public:
- BOOL ConfigConnection();
- BOOL OpenConnection();
- void CloseConnection();
- DWORD WriteComm(char *buff,DWORD dwLength);
- DWORD ReadComm(char *buff,DWORD dwLength);
- BOOL OnConnetComm();
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CGpsSCDoc)
- public:
- virtual BOOL OnNewDocument();
- virtual void Serialize(CArchive& ar);
- virtual BOOL CanCloseFrame(CFrameWnd* pFrame);
- //}}AFX_VIRTUAL
- // Implementation
- public:
- virtual ~CGpsSCDoc();
- #ifdef _DEBUG
- virtual void AssertValid() const;
- virtual void Dump(CDumpContext& dc) const;
- #endif
- protected:
- // Generated message map functions
- protected:
- //{{AFX_MSG(CGpsSCDoc)
- afx_msg void OnUpdateCconnetComm(CCmdUI* pCmdUI);
- afx_msg void OnCdisconnetComm();
- afx_msg void OnUpdateCdisconnetComm(CCmdUI* pCmdUI);
- afx_msg void OnCsetComm();
- afx_msg void OnUpdateCsetComm(CCmdUI* pCmdUI);
- afx_msg void OnReadonesm();
- afx_msg void OnAddclientd();
- afx_msg void OnClientlist();
- afx_msg void OnUpdateClientlist(CCmdUI* pCmdUI);
- afx_msg void OnUpdateAddclientd(CCmdUI* pCmdUI);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
- /////////////////////////////////////////////////////////////////////////////
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_GPSSCDOC_H__58804DED_631B_11D8_B346_0060975FFAEE__INCLUDED_)