#pragma once #include "ViewTree.h" #include "KMachine.h" #include class CNavToolBar : public CMFCToolBar { virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler) { CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler); } virtual BOOL AllowShowOnList() const { return FALSE; } }; #define MENU_DEVICE 0x10000000 #define MENU_PROPERTY 0x01000000 #define MENU_PORT 0x00100000 #define MENU_REMOTE_DEVICE 0x00010000 // #pragma anon_unions typedef struct tagChnStat { unsigned short Stat; unsigned short SendPackets; unsigned short RecvPackets; unsigned short LastSentTimeTick; unsigned short LostPackets; unsigned short CtnLstPkts; unsigned short MaxCtnLstPkts; unsigned short NotPkgErr; unsigned short PkgLenErr; unsigned short BCCErr; unsigned short TimeOutErr; unsigned short Delay; unsigned short MaxDelay; unsigned short SendTimeInterval; union { unsigned short ClientDatas[10]; struct { unsigned short ClientRecvPkts; // unsigned short ClientSendPkts; // unsigned short ClientNotPktErr; // unsigned short ClientMisIdPkts; // // unsigned int ClientNoEndErr; // unsigned short ClientPkgLenErr; // unsigned short ClientBccErr; // unsigned short ClientTimeOutErr; // }; }; } stChnStat; typedef struct tagKwChnStat { union { unsigned char MStat; struct { unsigned char bOnline : 1; unsigned char bErr1 : 1; unsigned char bErr2 : 1; unsigned char bReq : 1; }; }; unsigned char SStat; uint32_t sentCount; //发送计数 uint32_t recvCount; //接收计数 uint32_t latancy; //延迟 uint32_t cycleTime; //循环时间 uint16_t LostPackets; //丢包计数 uint16_t CtnLstPkts; //连续丢包计数 uint16_t MaxCtnLstPkts; //最大连续丢包计数 uint16_t TXErr; //发送错误计数 uint16_t RXErr; //接收错误计数 uint16_t CRCErr; //CRC错误计数 uint16_t PktErr; //包错误 ; uint16_t ChnErr; //频道错误; uint16_t nErrChn; //错误的频道号; uint16_t StepErr1; //步骤错误1 uint16_t StepErr2; //步骤错误2 uint16_t Err1Count; //微闪报警次数 uint16_t Err2Count; //大闪报警次数 uint16_t Err3Count; //严重丢失信号次数 int8_t RSSI; //信号强度 int8_t SNR; //信噪比 int8_t tRSSI; //对方信号强度 int8_t tSNR; //对方信噪比 uint32_t targetSentCount; //对方发送数量 uint32_t targetRecvdCount; //对方接受数量 } stKwChnStat; class CNavView : public CDockablePane { public: CNavView() noexcept; virtual ~CNavView(); void AdjustLayout(); void OnChangeVisualStyle(); stDeviceDef m_DeviceInfo = {0}; stKMInfoBlock m_infoblock; int bPortRegsUpdated[8] = { 0 }; stPortDef PortDefs[8]; std::vector PortDeviceList[8]; int bPortDeviceUpdated[16] = { 0 }; stDeviceInfo PortDeviceInfos[16]; int LastUpdateIndex[16] = { 0 }; protected: CNavToolBar m_wndToolBar; CViewTree m_NavViewTree; // HTREEITEM hRoot1; CImageList m_NavViewImages; UINT m_nCurrSort; void FillDeviceView(); // 重写 public: virtual BOOL PreTranslateMessage(MSG* pMsg); protected: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnClassAddMemberFunction(); afx_msg void OnClassAddMemberVariable(); afx_msg void OnClassDefinition(); afx_msg void OnClassProperties(); afx_msg void OnNewFolder(); afx_msg void OnSetComm(); afx_msg void OnConnect(); afx_msg void OnDisConnect(); afx_msg void OnPaint(); afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg LRESULT OnChangeActiveTab(WPARAM, LPARAM); afx_msg void OnSort(UINT id); afx_msg void OnUpdateSort(CCmdUI* pCmdUI); afx_msg void OnNMDblclkNavTree1(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnNMClkNavTree1(NMHDR *pNMHDR, LRESULT *pResult); DECLARE_MESSAGE_MAP() public: afx_msg void OnTimer(UINT_PTR nIDEvent); int DelayInit(); int UpdateDisplay(); int nDisplayCount = 0; afx_msg void OnMenuNavSetConn(); afx_msg void OnMenuNavConnect(); afx_msg void OnMenuNavDisconnect(); int GetDocCount(); afx_msg void OnMenuNvUpdateFirmware(); afx_msg void OnMenuNvDeviceReadInfo(); afx_msg void OnRemoteRefreshData(); afx_msg void OnRemoteBlinkLED(); afx_msg void OnRemoteUpdateFirmware(); afx_msg void OnLedBlink(); afx_msg void OnResetDevice(); afx_msg void OnRemoteDeviceReset(); afx_msg void OnRemoteBlinkLedAll(); afx_msg void OnPortReset(); afx_msg void OnPortResetAllChild(); afx_msg void OnCommtest(); afx_msg void OnDeviceConfig(); };