📄 fibertestclientdoc.h
字号:
// FiberTestClientDoc.h : interface of the CFiberTestClientDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_FIBERTESTCLIENTDOC_H__36CCBD4C_FA46_4F4F_97A2_731E0CFF209E__INCLUDED_)
#define AFX_FIBERTESTCLIENTDOC_H__36CCBD4C_FA46_4F4F_97A2_731E0CFF209E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//定义最大数据块、XON字符和XOFF字符
#define MAXBLOCK 4096
#define XON 0x11
#define XOFF 0x13
UINT ComProc(LPVOID pParam);//全局性的公用线程函数
class CFiberTestClientDoc : public CDocument
{
protected: // create from serialization only
CFiberTestClientDoc();
DECLARE_DYNCREATE(CFiberTestClientDoc)
// Attributes
public:
CWinThread* m_pThread; // 代表辅助线程
volatile BOOL m_bConnected; //串口是否联接,用来标识菜单串口连接和断开连接是否可用
volatile HWND m_hTermWnd; //保存视图的窗口句柄
volatile HANDLE m_hPostMsgEvent; // 用于WM_COMMNOTIFY消息的事件对象
OVERLAPPED m_osRead, m_osWrite; // 用于重叠读/写
volatile HANDLE m_hCom; // 串行口句柄
int m_nBaud; //波特率
int m_nDataBits; //停止位
int m_nParity; //校验位
CString m_strPort; //串口号
int m_nStopBits; //停止位
/* int m_nFlowCtrl; //流控制选项
BOOL m_bEcho; //是否在本地回显
BOOL m_bNewLine; //是否自动换行*/
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CFiberTestClientDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
DWORD ReadComm(char *buf, DWORD dwLength); //读串口
DWORD WriteComm(char *buf, DWORD dwLength); //写串口
BOOL ConfigConnection(); //配置连接
void CloseConnection(); //关闭连接
BOOL OpenConnection(); //打开串口
virtual ~CFiberTestClientDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CFiberTestClientDoc)
afx_msg void OnCommConnect();
afx_msg void OnCommDisconnect();
afx_msg void OnCommSettings();
afx_msg void OnUpdateCommConnect(CCmdUI* pCmdUI);
afx_msg void OnUpdateCommDisconnect(CCmdUI* pCmdUI);
afx_msg void OnUpdateCommSettings(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_FIBERTESTCLIENTDOC_H__36CCBD4C_FA46_4F4F_97A2_731E0CFF209E__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -