⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uartdlg.h

📁 串口程序检测
💻 H
字号:
// UartDlg.h : header file
//
//{{AFX_INCLUDES()
#include "mscomm.h"
//}}AFX_INCLUDES


#if !defined(AFX_UARTDLG_H__2F03CF19_445C_4309_BA0C_551C24881950__INCLUDED_)
#define AFX_UARTDLG_H__2F03CF19_445C_4309_BA0C_551C24881950__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000



/////////////////////////////////////////////////////////////////////////////
// CUartDlg dialog

class CUartDlg : public CDialog
{
	
// Construction
public:
	enum err_code_type { SrcDataFrmErr=0 , OtherErr }; 
	enum tx_begin_mode { TimerAuto=0, DetectCts=1, Manual=2 ,DefaultBegin};
	enum tx_stop_mode { StopAuto=0, StopManual=1 , DefaultStop};
	bool m_bOpen;		
	bool m_bRxShowPause;
	
	bool m_bSwitch;                     //888888   开关变量

	BYTE m_cTxCycleIndex;
	BYTE m_cErrCycleIndex;		
	BYTE m_RxBuf[RX_BUF_SIZE];
	BYTE m_TxBuf[TX_BUF_SIZE];

	BYTE *m_TxPicBuf;                   //888888  图片发送缓冲区

	int m_iTxByteCounterConv;	
	
	int		m_iIniBaudRate;
	int		m_iIniCheckBit;
	int		m_iIniDataBit;
	int		m_iIniPortNum;
	int		m_iIniStopBit;
	int     m_iIniPicStyle;             //888888   图片格式
	int     m_iPicLength;               //888888   图片文件大小
	int     m_iPicIndex;
	
	
	CFile m_file;
	CFile m_PicFile;                    //888888   存储的图片文件

	CFileException m_file_exception;
	CString m_strFileName;
	CString m_strIniFileName;

	CString m_strRecPic;                 //888888888888

	clock_t m_tClockStart;	
	clock_t m_tClockEnd;	

	HANDLE m_hEventTxCts;	
	CWinThread* m_pThread;	

	CFont m_font;
	CBrush m_brush;
	
	bool GetTxSourceData(BYTE outBuf[], int *pdatalen);
	void TransmitData(BYTE inBuf[], int num);
	void ReceiveData();

	void ReceivePic();                        //888888   接收图片文件

	void ShowTxActualRate();	
	void DlgErrorDeal(err_code_type nErrCode);
	void TxBeginFunc(tx_begin_mode TxBeginMode);
	void TxStopFunc(tx_begin_mode TxBeginMode, tx_stop_mode TxStopMode);

	void IniFileStore(CString FileName);
	void IniFileLoad(CString FileName);



	CUartDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CUartDlg)
	enum { IDD = IDD_UART_DIALOG };
	int		m_iCountRxByte;
	int		m_iCountTxByte;
	int		m_iErrCycleNum;
	BOOL	m_bErrDetect;
	int		m_iErrBitNum;
	float	m_fErrBitRate;
	CString	m_strRxEdit;
	BOOL	m_bRxHex;
	BOOL	m_bTxAutoSpan;
	int		m_iTxAutoSpan;
	BOOL	m_bTxAutoCts;
	BOOL	m_bTxCycle;
	int		m_iTxCycleNum;
	CString	m_strTxEdit;
	BOOL	m_bTxHex;
	int		m_iTxStopByte;
	BOOL	m_bStatusBreak;
	BOOL	m_bStatusCts;
	BOOL	m_bStatusDcd;
	BOOL	m_bStatusDsr;
	BOOL	m_bStatusDtr;
	BOOL	m_bStatusRing;
	BOOL	m_bStatusRts;
	BOOL	m_bTxStopAuto;
	CMSComm	m_mscomm;	
	float	m_fErrPacketRate;
	int		m_iErrPacketNum;
	int		m_iRxBitNum;
	int		m_iRxPacketNum;
	CString	m_strPicPath;
	BOOL	m_bTxPicAutoCts;
	CString	m_strPicSavePath;
	CString	m_strPicLength;
	//}}AFX_DATA
	
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CUartDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL
	
// Implementation
protected:	
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CUartDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnOpenPort();
	afx_msg void OnRxFresh();
	afx_msg void OnTxCycle();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
	afx_msg void OnRxShowPause();
	afx_msg void OnTxModeTimer();
	afx_msg void OnTxModeManual();
	afx_msg void OnCountClr();
	afx_msg void OnErrDetect();
	afx_msg void OnErrClr();
	afx_msg void OnErrCycleRst();
	afx_msg void OnTxShowClr();
	afx_msg void OnStatusRts();
	afx_msg void OnStatusDtr();
	afx_msg void OnStatusBreak();
	afx_msg void OnTxCycleRst();
	afx_msg void OnRxShowClr();
	afx_msg void OnTxModeCts();
	afx_msg void OnOnCommMscomm();
	afx_msg void OnReset();
	afx_msg void OnOption();	
	afx_msg void OnButtonSaveFile();
	afx_msg void OnButtonStoreResult();
	afx_msg void OnClose();
	afx_msg void OnButtonPicbrowse();
	afx_msg void OnButtonSendPic();
	afx_msg void OnButtonSavepic();
	afx_msg void OnButtonPicSavePath();
	DECLARE_EVENTSINK_MAP()
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_UARTDLG_H__2F03CF19_445C_4309_BA0C_551C24881950__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -