mainfrm.h

来自「串口收发工具」· C头文件 代码 · 共 228 行

H
228
字号
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_MAINFRM_H__1B4DE6BB_F8A5_4EB2_B9B0_C33523A9E47D__INCLUDED_)
#define AFX_MAINFRM_H__1B4DE6BB_F8A5_4EB2_B9B0_C33523A9E47D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "maintaindoc.h"
#include "dlgcomset.h"
#include "serialcomm.h"
#include "public.h"
#include "maintainview.h"
#include "dlgsms.h"
#include "dlggongzhuang.h"
#include "MenuExt.h"
#include "GroupStation.h"
#include "dlgAlarmerView.h"

class CMainFrame : public CFrameWnd
{
public:
	bool bGzWndShow;
	inline void GzWndDestroy()
	{bGzWndShow=false;}
	bool bAlarm_InfWndShow;
//	inline void A_InfWndDestroy()
//	{bAlarm_InfWndShow=false;}
private:
	CMenuExt m_MenuExt;
	
	CDlgGongzhuang* dlgGongzhuang;
	CDlgAlarmerView* dlgAlarmerView;
	
	SMS_SETUP sms;
	CDlgSms dlgSms;
	CGroupStation dlgGroupStation;
	GROUPSTATION m_GroupStation;
	void ClearDataWindow();
	BOOL m_bSkinned;
	void ShowList(bool bShow);
	CMaintainDoc* m_pDoc;
	bool m_bOpened;         //串口已经打开
	HANDLE hEvent1;
	int nExtFunc;			//扩展功能码
	int nSerialNo;			//发送文件的序号
	CString strFileName;	//当前操作的文件名
	int nSendFileCount;		//文件需发送的次数
	CMaintainView* m_view;
	int nRtn;
	BYTE byRecBuf[1024];		//接收缓冲区
	BYTE dataBuf[DATALENGTH];	//数据缓冲区,放置上装的文件
	int nAddrNo;
	int nGroupNo;
	int nCurRecDataLen;			//接收缓冲区中当前数据长度
	int nCanshuUploadFlag;      //参数上装时区分是新参数还是老参数
	MODBUS_PARA modbus;


	void SetActionExpain(int nIndex, CString str);
	BYTE IsNAK();
	bool IsACK();
	bool ValidateParity();
	void CreateBMP();
	bool OrganiseData(int,int nSendSerial = 0,CString filename="");
	bool OrganiseSendData(BYTE*,int extfunc,int nSendSerial,CString filename);
	
	void CreateParaFile();
	void OrganiseBmpHead(BYTE*);//组织BMP位图的前62个字节
	bool ChangeFileAttribute(CString strFile);
	int GetFileSendCount(CString);
	void NameCanshuFile(CString& file);
	DWORD Long_byte_trans(DWORD dwtrans);
public:
	bool IsGongzhuangStatus(){return bGzWndShow;}
	bool IsQueryAlarmerStatus(){return bAlarm_InfWndShow;}
	void TransBuf(BYTE* buf,int len);
	int m_nIndex;
	void SetSpecialChar(BYTE byChar);
	void OnKeyboard(int nKeyIndex);
	unsigned short Check_Coe(BYTE* buf,int len);
	// void SetModuleInfo(int nModType,int nModNo);
	void SetComParaToStatusBar(int open);
	inline bool IsSerialLineOpen()
	{return m_bOpened;}
	void ReceiveData(BYTE *pData, int nLength);
	void ShowSendData(BYTE *pData, int nLen);
	void ShowRecData(BYTE *pData, int nLen);
	void StopSend();
	void ClearList();
	void SetGroupAddress(int nGroup,int nAddr);
	void SetModbusPara(MODBUS_PARA p);
	void AddSOEToList(int,int,int,int,int,int,int,int);
	inline int GetExtFunc()
	{return nExtFunc;}
	inline CMaintainDoc* GetDoc()
	{return m_pDoc;}
	ZLP_COE para;
	inline GetPara(ZLP_COE &p)
	{p=para;}
	inline SetPara(ZLP_COE &p)
	{para=p;}
	DF0241_COE df0241_para;
	inline GetDF0241Para(DF0241_COE &p)
	{p=df0241_para;}
	inline SetDF0241Para(DF0241_COE &p)
	{df0241_para=p;}
	inline int GetGroupNo()
	{return nGroupNo;}
	inline int GetAddrNo()
	{return nAddrNo;}

protected: // create from serialization only
	CMainFrame();
	DECLARE_DYNCREATE(CMainFrame)

// Attributes
public:
	CSplitterWnd m_wndSplitter1,m_wndSplitter2;
// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMainFrame)
	public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void ActivateFrame(int nCmdShow = -1);
	protected:
	virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
	//}}AFX_VIRTUAL

// Implementation
public:
	void GetSMSInfo(SMS_SETUP info);
	void PutParaToStruct(BYTE *buf, int len);
	void InformationDesplay(BYTE inf);
	void SetupSmsReturn(int);
	bool CallSMS();
	void SetSMS(SMS_SETUP info);
	void CallAlarmer();
	void DownloadAlarmer(GROUPSTATION m_GroupStation);
	virtual ~CMainFrame();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:  // control bar embedded members
	CStatusBar  m_wndStatusBar;
	CToolBar    m_wndToolBar;

// Generated message map functions
protected:
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnCalculator();
	afx_msg void OnAscii();
	afx_msg void OnOpencom();
	afx_msg void OnClosecom();
	afx_msg void OnUpdateOpencom(CCmdUI* pCmdUI);
	afx_msg void OnUpdateClosecom(CCmdUI* pCmdUI);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnGroup();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnDownCanshufile();
	afx_msg void OnSetnewChange();
	afx_msg void OnSetnewNew();
	afx_msg void OnSetoldChange();
	afx_msg void OnSetoldNew();
	afx_msg void OnUploadcanshuOld();
	afx_msg void OnUploadcanshuNew();
	afx_msg void OnUpbmp();
	afx_msg void OnDownbmp();
	afx_msg void OnDownProgram();
	afx_msg void OnDownMaintainprogram();
	afx_msg void OnDownAcsii();
	afx_msg void OnDownChinese();
	afx_msg void OnDown88();
	afx_msg void OnReset();
	afx_msg void OnNaturalStatus();
	afx_msg void OnMaintainStatus();
	afx_msg void OnKeyboard();
	afx_msg void OnClock();
	afx_msg void OnYk();
	afx_msg void OnYt();
	afx_msg void OnYcYx();
	afx_msg void OnManualFrame();
	afx_msg void OnUpdownLoad();
	afx_msg void OnStopSend();
	afx_msg void OnGuiyueFdk();
	afx_msg void OnUpdateGuiyueFdk(CCmdUI* pCmdUI);
	afx_msg void OnGuiyueCdt();
	afx_msg void OnUpdateGuiyueCdt(CCmdUI* pCmdUI);
	afx_msg void OnGuiyueDf0420();
	afx_msg void OnUpdateGuiyueDf0420(CCmdUI* pCmdUI);
	afx_msg void OnGuiyueDf0241();
	afx_msg void OnUpdateGuiyueDf0241(CCmdUI* pCmdUI);
	afx_msg void OnGuiyueBus();
	afx_msg void OnUpdateGuiyueBus(CCmdUI* pCmdUI);
	afx_msg void OnSmssetup();
	afx_msg void OnUnicode();
	afx_msg void OnSmsreset();
	afx_msg void OnGongzhuang();
	afx_msg void OnDestroy();
	afx_msg void OnGzWndDestroy();
	afx_msg void OnGuiyueJdxj();
	afx_msg void OnUpdateGuiyueJdxj(CCmdUI* pCmdUI);
	afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
	afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct);
	afx_msg LRESULT OnMenuChar(UINT nChar, UINT nFlags, CMenu* pMenu);
	afx_msg void OnComset();
	afx_msg void OnQueryalarm();
	afx_msg void OnAlarmersetup();
	//}}AFX_MSG
	afx_msg void OnDropDown(NMHDR* pNotifyStruct, LRESULT* pResult);
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

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

#endif // !defined(AFX_MAINFRM_H__1B4DE6BB_F8A5_4EB2_B9B0_C33523A9E47D__INCLUDED_)

⌨️ 快捷键说明

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