#pragma once #include "../MyLib/StaticEx.h" // CMTerm1CommDevView 窗体视图 class CMTerm1CommDevView : public CFormView { DECLARE_DYNCREATE(CMTerm1CommDevView) // 构造 public: protected: CMTerm1CommDevView(); // 动态创建所使用的受保护的构造函数 virtual ~CMTerm1CommDevView(); #ifdef AFX_DESIGN_TIME enum { IDD = IDD_MTerm1CommDevView2 }; #endif #ifdef _DEBUG virtual void AssertValid() const; CMTerm1Doc* CMTerm1CommDevView::GetDocument() const { return reinterpret_cast(m_pDocument); } #ifndef _WIN32_WCE virtual void Dump(CDumpContext& dc) const; #endif #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: CMFCStatusBar * m_pStatusBar; enum StatusBarIndicators { idxMachineType = 0, idxProgPos = 1, idxOnline = 2, idxRunning = 3, idxMonitor = 4, idxAddress = 5, idxInfoDisp = 6, }; COLORREF OnlineColor = RGB(0, 255, 255); COLORREF ProgColor = RGB(0, 255, 0); COLORREF RunningColor = RGB(0, 255, 0); COLORREF MonitorColor = RGB(0, 255, 255); COLORREF AddressColor = RGB(0, 255, 255); virtual void OnInitialUpdate(); // CStatusBar m_wndStatusBar; // CToolBar m_wndToolBar; // CImageList m_ColorTreeImages; // CTreeCtrl m_treectrl1; typedef struct tagWLStat { uint32_t Stat; //状态 uint32_t curStat; //当前状态 uint32_t sentCount; //发送计数 uint32_t recvCount; //接收计数 uint32_t lastSendtime; //上次发送时间 uint32_t lastSenttime; //上次发送出时间 uint32_t lastRecvtime; //上次启动接收时间 uint32_t lastRecvdtime; //上次接收时间 uint32_t lastActTime; //上次动作时间 uint32_t lastAckTime; //上次应答时间 uint32_t latancy; //延迟 uint32_t cycleTime; //循环时间 uint32_t LostPackets; //丢包计数 uint32_t CtnLstPkts; //连续丢包计数 uint32_t MaxCtnLstPkts; //最大连续丢包计数 uint32_t TXErr; //发送错误计数 uint32_t RXErr; //接收错误计数 uint32_t CRCErr; //CRC错误计数 int8_t RSSI; //信号强度 int8_t SNR; //信噪比 int8_t tRSSI; //对方信号强度 int8_t tSNR; //对方信噪比 }stWLRunStat, *pstWLRunStat; afx_msg void OnClose(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg BOOL OnDeviceChange(UINT nEventType, DWORD_PTR dwData); void FindComPort(); int BInited; int m_bResourceOpened; int m_bPause; CString sComSelStr; CString sBaudSelStr; DWORD dComNum; volatile int MyThreadProc1ToRun = 0; volatile int MyThreadProc1Running = 0; CRect MainClientRect; CRect LeftRect; CRect RightRect; CRect ItemRect; CRect OrgButtonRect; CRect ButtonRect; CRect PicRect; CRect PicRectUp; CRect PicRectDown; CRect LogRect; int calLayerOuts(); int DisplayParams(); int GetParams(); int DelayInit(); int LoadResourceList(); int SaveResourceList(); int LoadModel(); int SaveModel(); int OpenResource(CStringA ResourceStr); int CloseResource(); int SaveData(CString sFilePathName); int LoadData(CString sFilePathName); int MonitorPLC(); int UpdateDataDisplay(); public: static UINT MyJumper1(LPVOID pParam); DWORD WINAPI MyThreadProc1(LPVOID pParam); bool m_bOnline = false; bool m_bRunning = false; bool m_bMonitoring = false; // Combo Com port select CComboBox m_combo_comport; // Combo Com Baud select CComboBox m_combo_com_baud; afx_msg void OnBnClickedButtonStart(); afx_msg void OnBnClickedButtonStop(); afx_msg void OnBnClickedButtonClrscr(); afx_msg void OnBnClickedButtonSend(); CEdit m_edit_display; // Combo Input CComboBox m_combo_input; afx_msg void OnCbnEditchangeComboInput(); afx_msg void OnCbnSelchangeComboRes(); afx_msg void OnBnClickedButtonDo(); afx_msg void OnCbnSelchangeComboCmdType(); afx_msg void OnCbnSelchangeComboDcount(); afx_msg void OnBnClickedButtonStartBulkTest(); afx_msg void OnBnClickedButtonStopBulkTest(); afx_msg void OnMenuDownload(); afx_msg void OnMenuUpload(); afx_msg void OnMenuOnline(); afx_msg void OnMenuOffline(); afx_msg void OnMenuMonitor(); afx_msg void OnMenuRun(); afx_msg void OnUpdateMenuRun(CCmdUI *pCmdUI); afx_msg void OnUpdateMenuMonitor(CCmdUI *pCmdUI); afx_msg void OnUpdateMenuOffline(CCmdUI *pCmdUI); afx_msg void OnUpdateMenuOnline(CCmdUI *pCmdUI); CEdit m_edit_mon1; CEdit m_edit_mon2; afx_msg void OnMenuCommset(); afx_msg void OnMenuSysregSet(); afx_msg void OnMenuStatusShow(); afx_msg void OnMenuInfoDisplay(); afx_msg void OnMenuCoilMon(); afx_msg void OnMenuDataMon(); afx_msg void OnMenuCommTool(); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnBnClickedButtonClearStat(); int Clear_COM_Stats(); afx_msg void OnBnClickedButtonRead(); afx_msg void OnBnClickedButtonConnect(); afx_msg void OnMenuEventLog(); afx_msg void OnMenuCommTest(); afx_msg void OnMenuForceIo(); afx_msg void OnMenuDatetime(); CStaticEx m_static_connect; afx_msg void OnBnClickedButtonDisconnect(); afx_msg void OnBnClickedButton11(); afx_msg void OnBnClickedButton12(); afx_msg void OnBnClickedButton13(); afx_msg void OnBnClickedButton31(); afx_msg void OnBnClickedButton2(); afx_msg void OnBnClickedButton3(); int UpdateLEDDisplay(); int UpdateStatusBar(int nIndex); };