From 65f7136c6dfebde14a07c89c4366fb8bed2fe37f Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期二, 10 五月 2022 14:22:45 +0800 Subject: [PATCH] add factory config mode --- MTerm2/KLink.cpp | 201 ++ MTerm2/MTerm2CommDevView.cpp | 154 ++ MTerm2/MTerm2CommDevView.h | 4 MTerm2/ViewTree.cpp | 74 + MTerm2/PropOutputCfg.h | 23 MTerm2/MTerm2.cpp | 1 MTerm2/PropSysReg1.cpp | 6 MTerm2/PropModeCfg.cpp | 34 MTerm2/AnsiParser.cpp | 2 MTerm2/DialogCoilMon.cpp | 2 MTerm2/PropCommCfg.cpp | 34 MTerm2/DialogProgress.cpp | 2 MTerm2/DialogFactCfg.h | 94 + MTerm2/PropModeCfg.h | 23 MTerm2/design1.txt | 103 + MTerm2/DialogStatusShow.cpp | 4 MTerm2/KLink2.lib | 0 MTerm2/PropMemCfg.cpp | 34 MTerm2/DialogDateTime.h | 0 MTerm2/DialogFactCfg.cpp | 602 ++++++++++ MTerm2/PropCommCfg.h | 23 MTerm2/MainFrm.cpp | 18 MTerm2/MTerm2.vcxproj.filters | 230 ++- MTerm2/DialogForceIO.cpp | 2 MTerm2/DialogDataMon.cpp | 2 MTerm2/res/sort_hc.bmp | 0 MTerm2/res/class_view_hc.ico | 0 MTerm2/NavView.h | 54 MTerm2/pch.h | 6 MTerm2/res/classview.bmp | 0 MTerm2/PropSysReg1.h | 2 MTerm2/DataParser1.cpp | 2 MTerm2/DialogForceIO.h | 0 KLink2/KLink2.vcxproj | 2 MTerm2/KLink.h | 36 MTerm2/ViewTree.h | 24 MTerm2/devices.cfg | 147 ++ MTerm2/DialogInfoDisplay.h | 0 MTerm2/DialogCommSet1.cpp | 2 MTerm2/res/classview_hc.bmp | 0 MTerm2/DialogProgress.h | 0 MTerm2/NavView.cpp | 322 +++++ MTerm2/DialogDateTime.cpp | 2 MTerm2/0prog3.kpg | 97 + MTerm2/AnsiParser.h | 0 MTerm2/MTerm2Doc.cpp | 79 MTerm2/PropInputCfg.cpp | 34 MTerm2/DialogEventLog.cpp | 2 MTerm2/MTerm2View.h | 2 MTerm2/resource.h | 107 + MTerm2/MTerm2Doc.h | 11 MTerm2/DialogDataMon.h | 0 MTerm2/MTerm2.vcxproj | 79 MTerm2/0prog2.kpg | 156 +- MTerm2/res/sort.bmp | 0 MTerm2/DialogEventLog.h | 0 MTerm2/MTerm2.rc | 0 MTerm2/DialogCoilMon.h | 0 MTerm2/DialogStatusShow.h | 0 MTerm2/res/bitmap1.bmp | 0 MTerm2/PropInputCfg.h | 23 MTerm2/DialogSysRegSet.cpp | 328 +++++ MTerm2/DialogCommSet1.h | 0 MTerm2/DataParser1.h | 0 MTerm2/DialogSysRegSet.h | 65 + MTerm2/HvSerialPort.cpp | 8 MTerm2/MTerm2View.cpp | 10 MTerm2/MainFrm.h | 5 /dev/null | 35 MTerm2/PropOutputCfg.cpp | 34 MTerm2/PropMemCfg.h | 23 MTerm2/KDefine.h | 144 ++ MTerm2/MTerm2.h | 2 MTerm2/DialogInfoDisplay.cpp | 2 MTerm2/res/class_view.ico | 0 75 files changed, 3,162 insertions(+), 355 deletions(-) diff --git a/KLink2/KLink2.vcxproj b/KLink2/KLink2.vcxproj index cf49369..83f73d4 100644 --- a/KLink2/KLink2.vcxproj +++ b/KLink2/KLink2.vcxproj @@ -168,7 +168,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> - <PreprocessorDefinitions>_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>KLINK_EXPORTS;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> </ClCompile> <Link> diff --git a/MTerm2/0prog2.kpg b/MTerm2/0prog2.kpg index eab9672..b119e3f 100644 --- a/MTerm2/0prog2.kpg +++ b/MTerm2/0prog2.kpg @@ -3,18 +3,32 @@ ST R18 ST SR13 PSHS -MV K20 DT1 -MV K51 DT11 -MV K20 DT12 MV K10 DT0 +MV K20 DT1 +RDS +MV K5 DT11 +MV K50 DT12 +MV K20 DT13 POPS -MV K50 DT13 -MV K20 DT14 +MV K5 DT14 +MV K50 DT15 +MV K20 DT16 SET R0 ST R0 TMX 1 DT1 DF SET R10 +ST R0 +AN R1 +AN R2 +AN R3 +AN R4 +AN R5 +AN R9 +AN R10 +AN R11 +AN R15 +AN R16 ST X0 DF SET R10 @@ -25,11 +39,12 @@ AN R51 AN R52 AN R53 -ADD3 DT21 DT31 DT32 +ADD3 DT22 DT32 DT33 ST R10 AN R54 AN R55 AN R56 +ADD3 DT25 DT35 DT36 ADD3 DT23 DT33 DT34 ST R10 DF @@ -37,81 +52,94 @@ AN/ R12 AN/ R13 AN/ R14 +AN/ R15 +AN/ R16 SET R14 ST R10 PSHS AN R11 +TMX 11 DT11 +RESET R11 +SET R12 +RDS +AN R12 DF SET R51 RESET R52 RESET R53 -RESET R54 -RESET R55 -SET R56 -RDS -AN R11 -PSHS -TMX 11 DT11 -RESET R11 -SET R12 -POPS -SUB3 SV11 EV11 DT21 -AN<= DT21 K30 -PSHS -DIV DT21 K10 DT31 -RDS -AN>= DT32 K5 -SET R51 -POPS -AN< DT32 K5 -RESET R51 RDS AN R12 -DF -RESET R51 -SET R52 -RDS -AN R12 +PSHS TMX 12 DT12 RESET R12 SET R13 POPS -AN R12 +SUB3 SV12 EV12 DT22 +AN<= DT22 K30 +PSHS +DIV DT22 K10 DT32 +RDS +AN>= DT33 K5 +RESET R51 +POPS +AN< DT33 K5 +SET R51 +RDS +AN R13 +DF +RESET R51 +SET R52 +RDS +AN R13 +TMX 13 DT13 +RESET R52 +SET R53 +RESET R13 +SET R14 +POPS +AN R13 OUT R52 ST R10 PSHS -AN R13 +AN R14 +TMX 14 DT14 +RESET R14 +SET R15 +RDS +AN R15 DF RESET R52 SET R53 SET R54 RESET R56 RDS -AN R13 -TMX 13 DT13 -RESET R13 -SET R14 +AN R15 +TMX 15 DT15 +RESET R15 +SET R16 RDS -AN R13 -SUB3 SV13 EV13 DT23 -AN<= DT23 K30 +AN R15 +SUB3 SV15 EV15 DT25 +AN<= DT25 K30 PSHS -DIV DT23 K10 DT33 +DIV DT25 K10 DT35 RDS -AN>= DT34 K5 +AN>= DT36 K5 SET R54 POPS -AN< DT34 K5 +AN< DT36 K5 RESET R54 RDS -AN R14 +AN R16 DF RESET R54 SET R55 POPS -AN R14 -TMX 14 DT14 -RESET R14 +AN R16 +TMX 16 DT16 +RESET R55 +SET R56 +RESET R16 SET R11 ST SR1 PSHS @@ -226,27 +254,17 @@ R54 绿灯2 R55 黄灯2 R56 红灯2 -DT11 绿灯1时间 -DT12 黄灯1时间 -DT13 绿灯2时间 -DT14 黄灯2时间 -DT21 绿灯1剩余时间 -DT23 绿灯2剩余时间 -DT31 剩余秒数 -DT32 余数 -DT33 绿灯2剩余秒数 -DT34 绿灯2 秒余数 +DT11 绿灯1延迟时间 +DT12 绿灯1时间 +DT13 黄灯1时间 +DT14 绿灯2延迟时间 +DT32 剩余秒数 +DT33 余数 +DT15 绿灯2时间 +DT16 黄灯2时间 +DT25 绿灯2剩余时间 +DT35 绿灯2剩余秒数 +DT36 绿灯2 秒余数 +DT22 绿灯1剩余时间 [MONCOILLIST] [MONDATALIST] -ST] -] -T14 黄灯2时间 -DT21 绿灯1剩余时间 -DT23 绿灯2剩余时间 -DT31 剩余秒数 -DT32 余数 -DT33 绿灯2剩余秒数 -DT34 绿灯2 秒余数 -[MONCOILLIST] -[MONDATALIST] -TALIST] diff --git a/MTerm2/0prog3.kpg b/MTerm2/0prog3.kpg new file mode 100644 index 0000000..da52969 --- /dev/null +++ b/MTerm2/0prog3.kpg @@ -0,0 +1,97 @@ +[SYSCFG] +[PROG] +ST R0 +AN R1 +ST R2 +AN R3 +ORS +ST R4 +AN R5 +ST R6 +AN R7 +ORS +ANS +ST R8 +AN R9 +AN R10 +AN R11 +ORS +PSHS +AN R70 +SET R71 +POPS +SET R72 +SET R73 +[COMMENT] +SR0 OFF +SR1 ON +SR13 初始脉冲 +R0 R0的注释 +R1 R1的注释 +R2 R2的注释 +R4 R4的注释 +R6 R6的注释 +R8 R8的注释 +R9 R9的注释 +R10 R10的注释 +R11 R11的注释 +R12 R12的注释 +R13 R13的注释 +R14 R14的注释 +R15 R15的注释 +R16 R16的注释 +R17 R17的注释 +X00 开始 +X01 停止 +X02 X02的注释 +X03 X03的注释 +X04 X04的注释 +X05 X05的注释 +X06 X06的注释 +X07 X07的注释 +X08 X08的注释 +X09 X09的注释 +Y00 Y00的注释 +Y01 Y01的注释 +Y02 绿灯1 +Y03 黄灯1 +Y04 红灯1 +Y05 绿灯2 +Y06 黄灯2 +Y07 红灯2 +Y08 Y08的注释 +Y09 Y09的注释 +DT0 DT0的注释 +DT1 DT1的注释 +DT2 DT2的注释 +DT3 DT3的注释 +DT4 DT4的注释 +DT5 DT5的注释 +DT6 DT6的注释 +DT7 DT7的注释 +DT8 DT8的注释 +DT9 DT9的注释 +R5 R5的注释 +SR2 SR2 +SR3 SR3 +SR4 SR4 +R51 绿灯1 +R52 黄灯1 +R53 红灯1 +R54 绿灯2 +R55 黄灯2 +R56 红灯2 +DT11 绿灯1延迟时间 +DT12 绿灯1时间 +DT13 黄灯1时间 +DT14 绿灯2延迟时间 +DT32 剩余秒数 +DT33 余数 +DT15 绿灯2时间 +DT16 黄灯2时间 +DT25 绿灯2剩余时间 +DT35 绿灯2剩余秒数 +DT36 绿灯2 秒余数 +DT22 绿灯1剩余时间 +[MONCOILLIST] +[MONDATALIST] diff --git a/MTerm2/CAnsiParser.cpp b/MTerm2/AnsiParser.cpp similarity index 99% rename from MTerm2/CAnsiParser.cpp rename to MTerm2/AnsiParser.cpp index 24193cf..d5c5ab9 100644 --- a/MTerm2/CAnsiParser.cpp +++ b/MTerm2/AnsiParser.cpp @@ -1,5 +1,5 @@ #include "pch.h" -#include "CAnsiParser.h" +#include "AnsiParser.h" static inline int AnsiToT(CStringA & Src, CString & Dest) { diff --git a/MTerm2/CAnsiParser.h b/MTerm2/AnsiParser.h similarity index 100% rename from MTerm2/CAnsiParser.h rename to MTerm2/AnsiParser.h diff --git a/MTerm2/CDialogSysRegSet.cpp b/MTerm2/CDialogSysRegSet.cpp deleted file mode 100644 index f570a53..0000000 --- a/MTerm2/CDialogSysRegSet.cpp +++ /dev/null @@ -1,165 +0,0 @@ -锘�// CDialogSysRegSet.cpp: 瀹炵幇鏂囦欢 -// - -#include "pch.h" -#include "MTerm2.h" -#include "CDialogSysRegSet.h" -#include "afxdialogex.h" -#include "CPropSysReg1.h" - -// CDialogSysRegSet 瀵硅瘽妗� - -IMPLEMENT_DYNAMIC(CDialogSysRegSet, CDialogEx) - -CDialogSysRegSet::CDialogSysRegSet(CWnd* pParent /*=nullptr*/) - : CDialogEx(IDD_DIALOG_SYSREG_SET, pParent) -{ - -} - -CDialogSysRegSet::~CDialogSysRegSet() -{ -} - -void CDialogSysRegSet::DoDataExchange(CDataExchange* pDX) -{ - CDialogEx::DoDataExchange(pDX); - DDX_Control(pDX, IDC_SCROLLBAR1, m_prop_scrollbar1); -} - - -BEGIN_MESSAGE_MAP(CDialogSysRegSet, CDialogEx) - ON_WM_VSCROLL() - ON_WM_MOUSEWHEEL() -END_MESSAGE_MAP() - - -// CDialogSysRegSet 娑堟伅澶勭悊绋嬪簭 - - -BOOL CDialogSysRegSet::OnInitDialog() -{ - CDialogEx::OnInitDialog(); - - // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲 - - //GetDlgItem(IDC_STATIC_PROP)-> - m_propsysreg1.Create(IDD_PROPPAGE_SYSREG1, this); - m_propsysreg1.ShowWindow(SW_SHOW); - m_propsysreg1.EnableWindow(true); - m_propsysreg1.GetClientRect(&rect0); - m_nPropHeight = rect0.bottom - rect0.top; - - GetDlgItem(IDC_STATIC_PROP)->GetClientRect(&rect1); - m_nFrameheight = rect1.bottom - rect1.top; - GetDlgItem(IDC_STATIC_PROP)->ClientToScreen(&rect1); - this->ScreenToClient(&rect1); - - m_propsysreg1.MoveWindow(&rect1, true); - - int nNewPos = m_nScrollPos; - int Scrolldel = nNewPos - m_nScrollPos; - m_propsysreg1.ScrollWindow(0, Scrolldel); - m_nScrollPos += Scrolldel; - - SCROLLINFO si; - si.cbSize = sizeof(SCROLLINFO); - si.fMask = SIF_ALL; - si.nMin = 0; - si.nMax = m_nPropHeight;//浣犳粦鍔ㄧ敾闈㈢殑楂樺害 - si.nPage = m_nFrameheight; //杩欎釜鏄綘鏄剧ず鐢婚潰鐨勯珮搴� - si.nPos = 0;//杩欎釜鏄粦鍧楃殑浣嶇疆 鍒濆鍖栫殑鏃跺�欐槸0 浠ュ悗浼氭牴鎹綘鐨勬搷浣滃彉鍔� -// GetDlgItem(IDC_STATIC_PROP)->SetScrollInfo(SB_VERT, &si); -// m_propsysreg1.SetScrollInfo(SB_VERT, &si); - - m_prop_scrollbar1.SetScrollInfo(&si, true); - -// m_prop_scrollbar1.SetScrollRange(1, 100); -// m_prop_scrollbar1.SetScrollPos(20); - return TRUE; // return TRUE unless you set the focus to a control - // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE -} - -void CDialogSysRegSet::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) -{ - // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ�� - int nMin, nMax; - pScrollBar->GetScrollRange(&nMin, &nMax); //鍙栧緱婊氬姩鏉¤寖鍥� - int TempPos = pScrollBar->GetScrollPos(); - CString s1; -// s1.Format(_T("DialogSysReg OnVScroll %d %d %d"), nSBCode, nPos,TempPos); -// SysLog(s1); - switch (nSBCode) - { - case SB_THUMBPOSITION://鎷栧姩婊戝潡 - case SB_THUMBTRACK: - pScrollBar->SetScrollPos(nPos); - TempPos = nPos; - break; - case SB_LINEUP://鐐瑰嚮涓婅竟/宸﹁竟鐨勭澶� - if (TempPos > 1) - { - TempPos--; - } - pScrollBar->SetScrollPos(TempPos); - break; - case SB_LINEDOWN://鐐瑰嚮涓嬭竟/鍙宠竟鐨勭澶� - if (TempPos < nMax) - { - TempPos++; - } - pScrollBar->SetScrollPos(TempPos); - - break; - - case SB_PAGEUP: // 濡傛灉鍚戜笂/宸︽粴鍔ㄤ竴椤� - if (TempPos >10) TempPos -= 10; - pScrollBar->SetScrollPos(TempPos); - break; - - case SB_PAGEDOWN: // 濡傛灉鍚戜笅/鍙虫粴鍔ㄤ竴椤� - if (TempPos < nMax - 10) TempPos += 10; - pScrollBar->SetScrollPos(TempPos); - break; - } - int nNewPos = -TempPos; - int Scrolldel = nNewPos - m_nScrollPos; -// s1.Format(_T("DialogSysReg Scroll %d %d %d"), m_nScrollPos, nNewPos, Scrolldel); -// SysLog(s1); - - m_propsysreg1.ScrollWindow(0, Scrolldel); - m_nScrollPos += Scrolldel; - -// m_propsysreg1.ScrollWindow(0, -TempPos); - - CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar); -} - - -BOOL CDialogSysRegSet::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) -{ - // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ�� - int nNewPos=m_nScrollPos; - if (zDelta < 0) - { - if (-m_nScrollPos < m_nPropHeight -m_nFrameheight - 30) - nNewPos = m_nScrollPos - 30; - else - nNewPos = - (m_nPropHeight - m_nFrameheight); - } - else if (zDelta > 0) - { - if (-m_nScrollPos > 30) - nNewPos = m_nScrollPos + 30; - else - nNewPos = 0; - } - else - { - } - int Scrolldel = nNewPos - m_nScrollPos; - m_propsysreg1.ScrollWindow(0, Scrolldel); - m_nScrollPos += Scrolldel; - m_prop_scrollbar1.SetScrollPos(-m_nScrollPos); - return CDialogEx::OnMouseWheel(nFlags, zDelta, pt); -} diff --git a/MTerm2/CDialogSysRegSet.h b/MTerm2/CDialogSysRegSet.h deleted file mode 100644 index 9dd6f0c..0000000 --- a/MTerm2/CDialogSysRegSet.h +++ /dev/null @@ -1,35 +0,0 @@ -锘�#pragma once -#include "CPropSysReg1.h" - -// CDialogSysRegSet 瀵硅瘽妗� -//class CPropSysReg1; - -class CDialogSysRegSet : public CDialogEx -{ - DECLARE_DYNAMIC(CDialogSysRegSet) - -public: - CDialogSysRegSet(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� - virtual ~CDialogSysRegSet(); - RECT rect0; - RECT rect1; - int m_nPropHeight; - int m_nFrameheight; - int m_nScrollPos = 0; - -// 瀵硅瘽妗嗘暟鎹� -#ifdef AFX_DESIGN_TIME - enum { IDD = IDD_DIALOG_SYSREG_SET }; -#endif - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 - CPropSysReg1 m_propsysreg1; - - DECLARE_MESSAGE_MAP() -public: - virtual BOOL OnInitDialog(); - CScrollBar m_prop_scrollbar1; - afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); - afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); -}; diff --git a/MTerm2/CDataParser1.cpp b/MTerm2/DataParser1.cpp similarity index 98% rename from MTerm2/CDataParser1.cpp rename to MTerm2/DataParser1.cpp index f1821b1..6221b9e 100644 --- a/MTerm2/CDataParser1.cpp +++ b/MTerm2/DataParser1.cpp @@ -1,5 +1,5 @@ #include "pch.h" -#include "CDataParser1.h" +#include "DataParser1.h" CDataParser1::CDataParser1() { diff --git a/MTerm2/CDataParser1.h b/MTerm2/DataParser1.h similarity index 100% rename from MTerm2/CDataParser1.h rename to MTerm2/DataParser1.h diff --git a/MTerm2/CDialogCoilMon.cpp b/MTerm2/DialogCoilMon.cpp similarity index 94% rename from MTerm2/CDialogCoilMon.cpp rename to MTerm2/DialogCoilMon.cpp index 84aadf3..4ee8623 100644 --- a/MTerm2/CDialogCoilMon.cpp +++ b/MTerm2/DialogCoilMon.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogCoilMon.h" +#include "DialogCoilMon.h" #include "afxdialogex.h" diff --git a/MTerm2/CDialogCoilMon.h b/MTerm2/DialogCoilMon.h similarity index 100% rename from MTerm2/CDialogCoilMon.h rename to MTerm2/DialogCoilMon.h diff --git a/MTerm2/CDialogCommSet1.cpp b/MTerm2/DialogCommSet1.cpp similarity index 99% rename from MTerm2/CDialogCommSet1.cpp rename to MTerm2/DialogCommSet1.cpp index 19f4618..7bc8350 100644 --- a/MTerm2/CDialogCommSet1.cpp +++ b/MTerm2/DialogCommSet1.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogCommSet1.h" +#include "DialogCommSet1.h" #include "afxdialogex.h" #include <devguid.h> #include <SetupAPI.h> diff --git a/MTerm2/CDialogCommSet1.h b/MTerm2/DialogCommSet1.h similarity index 100% rename from MTerm2/CDialogCommSet1.h rename to MTerm2/DialogCommSet1.h diff --git a/MTerm2/CDialogDataMon.cpp b/MTerm2/DialogDataMon.cpp similarity index 94% rename from MTerm2/CDialogDataMon.cpp rename to MTerm2/DialogDataMon.cpp index 6240deb..e039aa0 100644 --- a/MTerm2/CDialogDataMon.cpp +++ b/MTerm2/DialogDataMon.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogDataMon.h" +#include "DialogDataMon.h" #include "afxdialogex.h" diff --git a/MTerm2/CDialogDataMon.h b/MTerm2/DialogDataMon.h similarity index 100% rename from MTerm2/CDialogDataMon.h rename to MTerm2/DialogDataMon.h diff --git a/MTerm2/CDialogDateTime.cpp b/MTerm2/DialogDateTime.cpp similarity index 99% rename from MTerm2/CDialogDateTime.cpp rename to MTerm2/DialogDateTime.cpp index 97c96b2..037abec 100644 --- a/MTerm2/CDialogDateTime.cpp +++ b/MTerm2/DialogDateTime.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogDateTime.h" +#include "DialogDateTime.h" #include "afxdialogex.h" #include "KLink.h" #include "MTerm2Doc.h" diff --git a/MTerm2/CDialogDateTime.h b/MTerm2/DialogDateTime.h similarity index 100% rename from MTerm2/CDialogDateTime.h rename to MTerm2/DialogDateTime.h diff --git a/MTerm2/CDialogEventLog.cpp b/MTerm2/DialogEventLog.cpp similarity index 99% rename from MTerm2/CDialogEventLog.cpp rename to MTerm2/DialogEventLog.cpp index f7b7a57..f1fe66f 100644 --- a/MTerm2/CDialogEventLog.cpp +++ b/MTerm2/DialogEventLog.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogEventLog.h" +#include "DialogEventLog.h" #include "afxdialogex.h" #include "KLinkDefine.h" #include "KLink.h" diff --git a/MTerm2/CDialogEventLog.h b/MTerm2/DialogEventLog.h similarity index 100% rename from MTerm2/CDialogEventLog.h rename to MTerm2/DialogEventLog.h diff --git a/MTerm2/DialogFactCfg.cpp b/MTerm2/DialogFactCfg.cpp new file mode 100644 index 0000000..ad10b8f --- /dev/null +++ b/MTerm2/DialogFactCfg.cpp @@ -0,0 +1,602 @@ +锘�// DialogFactCfg.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "DialogFactCfg.h" +#include "afxdialogex.h" + +#include "MTerm2Doc.h" + +// CDialogFactCfg 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CDialogFactCfg, CDialogEx) + +CDialogFactCfg::CDialogFactCfg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_DIALOG_FACT_CFG, pParent) +{ + InitDataItems(); +} + +CDialogFactCfg::~CDialogFactCfg() +{ +} + +void CDialogFactCfg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CDialogFactCfg, CDialogEx) + ON_BN_CLICKED(IDC_BUTTON_CONN, &CDialogFactCfg::OnBnClickedButtonConn) + ON_BN_CLICKED(IDC_BUTTON_DISCONN, &CDialogFactCfg::OnBnClickedButtonDisconn) + ON_BN_CLICKED(IDC_BUTTON_READDATA, &CDialogFactCfg::OnBnClickedButtonReaddata) + ON_BN_CLICKED(IDC_BUTTON_WRITEDATA, &CDialogFactCfg::OnBnClickedButtonWritedata) +END_MESSAGE_MAP() + +// CDialogFactCfg 娑堟伅澶勭悊绋嬪簭 +int CDialogFactCfg::AddDataItem(int nOffset, int nSize, int nType, CString sName) +{ + FactoryDataItems[nFactoryDataItemsCount] = { nOffset,nSize,nType,sName }; + nFactoryDataItemsCount++; + return 0; +} + +int CDialogFactCfg::InitDataItems() +{ + AddDataItem(0, 2, typeBIN, _T("寮�濮嬫爣蹇�")); + AddDataItem(2, 2, typeINT, _T("搴忓彿")); + AddDataItem(4, 2, typeHEX, _T("ModelNo")); + AddDataItem(6, 2, typeHEX, _T("ModelVer")); + AddDataItem(8, 4, typeUINT, _T("nLotNo")); + AddDataItem(12, 4, typeDATETIME, _T("nProductDate")); + AddDataItem(16, 4, typeHEX, _T("nSN1")); + AddDataItem(20, 4, typeHEX, _T("nProtocalVer")); + AddDataItem(24, 4, typeHEX, _T("nDefaultFuncr")); + AddDataItem(28, 16, typeString, _T("sModelStr")); + AddDataItem(44, 16, typeString, _T("sLot_No")); + AddDataItem(60, 16, typeString, _T("sSNStr")); + AddDataItem(76, 2, typeHEX, _T("CRC1")); + AddDataItem(78, 2, typeHEX, _T("EndSign")); + return 0; +} + +int CDialogFactCfg::FindIdByName(CString sName) +{ + for (int i = 0; i < nFactoryDataItemsCount; i++) { + if (FactoryDataItems[i].sName == sName) { + return i; + } + } + return -1; +} + +int CDialogFactCfg::GetDataByOffset(void * pDataBlock, int nOffset) +{ + return 0; +} +int CDialogFactCfg::GetDataByName(void * pDataBlock, CString sName) +{ + return 0; +} +CString CDialogFactCfg::GetDataStrByName(void * pDataBlock, CString sName) +{ + UCHAR * pBuf2 = (UCHAR *)pDataBlock; + CString s1; + UCHAR buf3[256]; + CString s3; + int nIdx = FindIdByName(sName); + if (nIdx >= 0) + { + CTime ctime1; + int nType = FactoryDataItems[nIdx].nType; + int nSize = FactoryDataItems[nIdx].nSize; + int nOffset = FactoryDataItems[nIdx].nOffset; + int nValue; + UINT uValue; + switch (nType) + { + case typeINT: + if (nSize == 1) { + nValue = *((char *)(pBuf2 + nOffset)); + } + else if (nSize == 2) { + nValue = *(short *)(pBuf2 + nOffset); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + nValue = *(int *)(pBuf2 + nOffset); + } + s1.Format(_T("%d"), nValue); + break; + case typeUINT: + if (nSize == 1) { + uValue = *((UCHAR *)(pBuf2 + nOffset)); + } + else if (nSize == 2) { + uValue = *(USHORT *)(pBuf2 + nOffset); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + uValue = *(UINT *)(pBuf2 + nOffset); + } + s1.Format(_T("%u"), uValue); + break; + case typeHEX: + if (nSize == 1) { + uValue = *((UCHAR *)(pBuf2 + nOffset)); + s1.Format(_T("%02X"), uValue); + } + else if (nSize == 2) { + uValue = *(USHORT *)(pBuf2 + nOffset); + s1.Format(_T("%04X"), uValue); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + uValue = *(UINT *)(pBuf2 + nOffset); + s1.Format(_T("%08X"), uValue); + } + + break; + case typeBIN: + if (nSize == 1) { + uValue = *((UCHAR *)(pBuf2 + nOffset)); + s1.Format(_T("%02X"), uValue); + } + else if (nSize == 2) { + uValue = *(USHORT *)(pBuf2 + nOffset); + s1.Format(_T("%04X"), uValue); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + uValue = *(UINT *)(pBuf2 + nOffset); + s1.Format(_T("%08X"), uValue); + } + + break; + case typeFLOAT: + break; + case typeFIX: + break; + case typeBIT: + break; + case typeString: + for (int j = 0; j < nSize; j++) + { + buf3[j] = pBuf2[nOffset + j]; + } + buf3[nSize] = 0; + s3 = buf3; + s1.Format(_T("%s"), s3); + break; + case typeDATETIME: + nValue = *(UINT *)(pBuf2 + nOffset); + ctime1 = nValue; + ctime1 = CStringToCTime(_T("2000-01-01 08:00:00")); + ctime1 += nValue; + s3 = ctime1.Format(_T("%Y-%m-%d %H:%M:%S")); + s1.Format(_T("%s"), s3); + break; + default: + break; + } + } + return s1; +} +int CDialogFactCfg::SetDataByName(void * pDataBlock, CString sName, UINT uValue) +{ + UCHAR * pBuf2 = (UCHAR *)pDataBlock; +// UCHAR buf3[256]; + int nIdx = FindIdByName(sName); + if (nIdx >= 0) + { + CTime ctime1; + CTime ctime2; + CTimeSpan ctime3; + int nType = FactoryDataItems[nIdx].nType; + int nSize = FactoryDataItems[nIdx].nSize; + int nOffset = FactoryDataItems[nIdx].nOffset; + int nValue; + switch (nType) + { + case typeINT: + if (nSize == 1) { + *((char *)(pBuf2 + nOffset)) = uValue; + } + else if (nSize == 2) { + *(short *)(pBuf2 + nOffset) = uValue; + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + *(int *)(pBuf2 + nOffset) = uValue; + } + break; + case typeUINT: + if (nSize == 1) { + *((UCHAR *)(pBuf2 + nOffset)) = uValue; + } + else if (nSize == 2) { + *(USHORT *)(pBuf2 + nOffset) = uValue; + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + *(UINT *)(pBuf2 + nOffset) = uValue; + } + break; + case typeBIN: + if (nSize == 1) { + *((UCHAR *)(pBuf2 + nOffset)) = uValue; + } + else if (nSize == 2) { + *(USHORT *)(pBuf2 + nOffset) = uValue; + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + *(UINT *)(pBuf2 + nOffset) = uValue; + } + + break; + case typeFLOAT: + break; + case typeFIX: + break; + case typeBIT: + break; + case typeString: + break; + case typeDATETIME: + ctime1 = CStringToCTime(_T("2000-01-01 08:00:00")); + ctime2 = uValue; + ctime3 = ctime2 - ctime1; + nValue = ctime3.GetTotalSeconds(); + *(UINT *)(pBuf2 + nOffset) = uValue; + + break; + default: + break; + } + } + return 0; +} +int CDialogFactCfg::SetDataByName(void * pDataBlock, CString sName, CString sValue) +{ + UCHAR * pBuf2 = (UCHAR *)pDataBlock; +// UCHAR buf3[256]; + CStringA s3; + int nIdx = FindIdByName(sName); + if (nIdx >= 0) + { + CTime ctime1; + CTime ctime2; + CTimeSpan ctime3; + int nType = FactoryDataItems[nIdx].nType; + int nSize = FactoryDataItems[nIdx].nSize; + int nOffset = FactoryDataItems[nIdx].nOffset; + int nValue; + int len; + switch (nType) + { + case typeINT: + if (nSize == 1) { + *((char *)(pBuf2 + nOffset)) = _tstoi(sValue); + } + else if (nSize == 2) { + *(short *)(pBuf2 + nOffset) = _tstoi(sValue); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + *(int *)(pBuf2 + nOffset) = _tstoi(sValue); + } + break; + case typeUINT: + if (nSize == 1) { + *((UCHAR *)(pBuf2 + nOffset)) = _tstoi(sValue); + } + else if (nSize == 2) { + *(USHORT *)(pBuf2 + nOffset) = _tstoi(sValue); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + *(UINT *)(pBuf2 + nOffset) = _tstoi(sValue); + } + break; + case typeBIN: + if (nSize == 1) { + *((UCHAR *)(pBuf2 + nOffset)) = _tstoi(sValue); + } + else if (nSize == 2) { + *(USHORT *)(pBuf2 + nOffset) = _tstoi(sValue); + } + else if (nSize == 3) { + + } + else if (nSize == 4) { + *(UINT *)(pBuf2 + nOffset) = _tstoi(sValue); + } + + break; + case typeFLOAT: + break; + case typeFIX: + break; + case typeBIT: + break; + case typeString: + s3 = sValue; + len = s3.GetLength(); + for (int j = 0; j < nSize; j++) { + if (j < len) { + pBuf2[nOffset + j] = s3[j]; + }else { + pBuf2[nOffset + j] = ' '; + } + } + break; + case typeDATETIME: + ctime1 = CStringToCTime(_T("2000-01-01 08:00:00")); + ctime2 = CStringToCTime(sValue);; + ctime3 = ctime2 - ctime1; + nValue = ctime3.GetTotalSeconds(); + *(UINT *)(pBuf2 + nOffset) = nValue; + + break; + default: + break; + } + } + return 0; +} + + + +CMTerm2Doc * CDialogFactCfg::GetDocument() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd; + CMDIChildWnd *pChild = (CMDIChildWnd *)pFrame->GetActiveFrame(); + CView *pV = (CView*)pChild->GetActiveView(); + CMTerm2Doc* pDoc = (CMTerm2Doc *)(pV->GetDocument()); + return pDoc; +} + +int CDialogFactCfg::Connect() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CString s1; + CMTerm2Doc* pDoc = (CMTerm2Doc *)GetDocument(); + + + int r = pDoc->Connect(); + s1.Format(_T("Open %s = %d"), pDoc->myHvSerialPort1.m_strResult, r); + SysLog(s1); + if (r == pDoc->myHvSerialPort1.R_OK) + { + pDoc->MyKLink1.Open(); + return false; + } + return true; + return 0; +} + + +int CDialogFactCfg::Disconnect() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CMTerm2Doc* pDoc = (CMTerm2Doc *)GetDocument(); + + pDoc->DisConnect(); + pDoc->MyKLink1.Close(); + return 0; +} + +int CDialogFactCfg::ReadData() +{ + CMTerm2Doc* pDoc = (CMTerm2Doc *)GetDocument(); + + unsigned short buf1[1024]; + int res = pDoc->MyKLink1.GetInfo(1, 0, 0, 16, buf1); + SysLog(pDoc->MyKLink1.m_resultStr); + CString s1; + s1.Format(_T("GetInfo = %d "), res); + if (res == KLink::KL_OK) + { + s1.Append(_T("\r\n")); + for (int i = 0; i < 16 / 2; i++) + { + s1.AppendFormat(_T("%04X "), buf1[i]); + } + } + SysLog(s1); + + s1.Format(_T("%04X"), buf1[0]); + SetDlgItemText(IDC_EDIT_DEVICE_TYPE, s1); + s1.Format(_T("%04X"), buf1[1]); + SetDlgItemText(IDC_EDIT_FIRM_VER, s1); + s1.Format(_T("%04X"), buf1[2]); + SetDlgItemText(IDC_EDIT_KLINK_VER, s1); + s1.Format(_T("%04X"), buf1[3]); + SetDlgItemText(IDC_EDIT_CAP, s1); + + CString s2; + CString s3; + unsigned char buf2[1024]; + res = pDoc->MyKLink1.GetUID(1, 0, 0, 12, (unsigned short *)buf2); + SysLog(pDoc->MyKLink1.m_resultStr); + s1.Format(_T("GetUID = %d "), res); + + if (res == KLink::KL_OK) + { + s1.Append(_T("\r\n")); + for (int i = 0; i < 12; i++) + { + s1.AppendFormat(_T("%02X "), buf2[i]); + s2.AppendFormat(_T("%02X"), buf2[12-i-1]); + // s3.AppendFormat(_T("%c"), buf2[12 - i - 1]); + } + } + SysLog(s1); + SetDlgItemText(IDC_EDIT_DEVICE_UID, s2); + + + res = pDoc->MyKLink1.GetSN(1, 0, 0, 4, (unsigned short *)buf2); + SysLog(pDoc->MyKLink1.m_resultStr); + s1.Format(_T("GetSN = %d "), res); + s2.Empty(); + if (res == KLink::KL_OK) + { + s1.Append(_T("\r\n")); + for (int i = 0; i < 4; i++) + { + s1.AppendFormat(_T("%02X "), buf2[i]); + s2.AppendFormat(_T("%02X"), buf2[4-i-1]); + // s3.AppendFormat(_T("%c"), buf2[12 - i - 1]); + } + } + SysLog(s1); + SetDlgItemText(IDC_EDIT_ORG_FACT_SN, s2); + + res = pDoc->MyKLink1.GetFactoryData(1, 0, 0, 80, (unsigned short *)buf2); + SysLog(pDoc->MyKLink1.m_resultStr); + s1.Format(_T("GetFactoryData = %d "), res); + s2.Empty(); + if (res == KLink::KL_OK) + { + s1.Append(_T("\r\n")); + for (int i = 0; i < 80; i++) + { + s1.AppendFormat(_T("%02X "), buf2[i]); + s2.AppendFormat(_T("%02X"), buf2[4 - i - 1]); + // s3.AppendFormat(_T("%c"), buf2[12 - i - 1]); + } + } + SysLog(s1); +// SetDlgItemText(IDC_EDIT_ORG_FACT_SN, s2); + +// unsigned char buf3[1024]; + CTime ctime1; + for (int i = 0; i < nFactoryDataItemsCount; i++) + { +// int nType = FactoryDataItems[i].nType; +// int nSize = FactoryDataItems[i].nSize; +// int nOffset = FactoryDataItems[i].nOffset; + CString sName = FactoryDataItems[i].sName; + s3 = GetDataStrByName(buf2,sName); + s1.Format(_T("%d %s %s"), i, sName, s3); + SysLog(s1); + } + + s3=GetDataStrByName(buf2, _T("nLotNo")); + SetDlgItemText(IDC_EDIT_ORG_LOT_NO, s3); + + s3 = GetDataStrByName(buf2, _T("nProductDate")); + SetDlgItemText(IDC_EDIT_ORG_FAC_DATE, s3); + + + return 0; +} + + + +int CDialogFactCfg::WriteData() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + + CString s1; + CMTerm2Doc* pDoc = (CMTerm2Doc *)GetDocument(); + unsigned short buf1[1024]; +// unsigned char buf2[1024]; +// unsigned char buf3[1024]; +/* + AddDataItem(0, 2, typeBIN, _T("寮�濮嬫爣蹇�")); + AddDataItem(2, 2, typeINT, _T("搴忓彿")); + AddDataItem(4, 2, typeBIN, _T("ModelNo")); + AddDataItem(6, 2, typeBIN, _T("ModelVer")); + AddDataItem(8, 4, typeUINT, _T("nLotNo")); + AddDataItem(12, 4, typeDATETIME, _T("nProductDate")); + AddDataItem(16, 4, typeBIN, _T("nSN1")); + AddDataItem(20, 4, typeBIN, _T("nProtocalVer")); + AddDataItem(24, 4, typeBIN, _T("nDefaultFuncr")); + AddDataItem(28, 16, typeString, _T("sModelStr")); + AddDataItem(44, 16, typeString, _T("sLot_No")); + AddDataItem(60, 16, typeString, _T("sSNStr")); + AddDataItem(76, 2, typeBIN, _T("CRC1")); + AddDataItem(78, 2, typeBIN, _T("EndSign")); +*/ + UINT uValue; + + SetDataByName(buf1, _T("寮�濮嬫爣蹇�"), 0x55AA); + SetDataByName(buf1, _T("搴忓彿"), 0x0002); + SetDataByName(buf1, _T("ModelNo"), 0x0008); + SetDataByName(buf1, _T("ModelVer"), 0x0100); + GetDlgItemText(IDC_EDIT_LOT_NO, s1); uValue = _tstoi(s1); + SetDataByName(buf1, _T("nLotNo"), uValue); + SetDataByName(buf1, _T("nProductDate"), 0x2996c000); + + GetDlgItemText(IDC_EDIT_FACT_SN, s1); uValue = _tstoi(s1); + SetDataByName(buf1, _T("nSN1"), uValue); + SetDataByName(buf1, _T("nProtocalVer"), 0x01000100); + SetDataByName(buf1, _T("nDefaultFuncr"), 0x00000001); + SetDataByName(buf1, _T("sModelStr"), _T("12122121")); + SetDataByName(buf1, _T("sLot_No"), _T("34344343")); + SetDataByName(buf1, _T("sSNStr"), _T("56566565")); + SetDataByName(buf1, _T("CRC1"), 0xEFEF); + SetDataByName(buf1, _T("EndSign"), 0x55AA); + + + int res = pDoc->MyKLink1.WriteFactoryData(1, 0, 0, 80, buf1); + SysLog(pDoc->MyKLink1.m_resultStr); + s1.Format(_T("WriteFactoryData = %d "), res); + + return 0; +} + +void CDialogFactCfg::OnBnClickedButtonReaddata() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + ReadData(); +} + +void CDialogFactCfg::OnBnClickedButtonConn() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + Connect(); + +} + + +void CDialogFactCfg::OnBnClickedButtonDisconn() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + Disconnect(); + +} + + + + +void CDialogFactCfg::OnBnClickedButtonWritedata() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + WriteData(); + +} + diff --git a/MTerm2/DialogFactCfg.h b/MTerm2/DialogFactCfg.h new file mode 100644 index 0000000..ec7107f --- /dev/null +++ b/MTerm2/DialogFactCfg.h @@ -0,0 +1,94 @@ +锘�#pragma once + + +// CDialogFactCfg 瀵硅瘽妗� +class CMTerm2Doc; + +class CDialogFactCfg : public CDialogEx +{ + DECLARE_DYNAMIC(CDialogFactCfg) + +public: + CDialogFactCfg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CDialogFactCfg(); + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_DIALOG_FACT_CFG }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + + DECLARE_MESSAGE_MAP() +public: + enum DataItemType + { + typeINT, + typeUINT, + typeHEX, + typeBIN, + typeFLOAT, + typeFIX, + typeBIT, + typeString, + typeDATE, + typeTIME, + typeDATETIME, + + }; + typedef struct tagDataItemDef + { + int nOffset; + int nSize; + int nType; + CString sName; + }stDataItemDef; + + typedef struct tagFactoryData //宸ュ巶閲忎骇鍙傛暟鏁版嵁銆� + { + USHORT Sign1; + USHORT Seq1; + USHORT nModelNo; + USHORT nModelVer; + UCHAR LOT_NO[16]; // + UINT nProductDateTime; + UINT SN1; + unsigned int nProtocalVer; + unsigned int nLotNo; + unsigned int nDefaultFunc; + char ModelStr[16]; + char SNStr[16]; + unsigned short CRC1; + unsigned short EndSign1; + + }stFactoryData, *pFactoryData; + + stDataItemDef FactoryDataItems[50]; + int nFactoryDataItemsCount = 0; + + int AddDataItem(int nOffset, int nSize, int nType, CString sName); + + int InitDataItems(); + + int Connect(); + int Disconnect(); + int ReadData(); + afx_msg void OnBnClickedButtonConn(); + afx_msg void OnBnClickedButtonDisconn(); + afx_msg void OnBnClickedButtonWritedata(); + afx_msg void OnBnClickedButtonReaddata(); + int WriteData(); + CMTerm2Doc * GetDocument(); + + int FindIdByName(CString sName); + + int GetDataByOffset(void * pDataBlock, int nOffset); + int GetDataByName(void * pDataBlock, CString sName); + + CString GetDataStrByName(void * pDataBlock, CString sName); + + int SetDataByName(void * pDataBlock, CString sName, UINT uValue); + int SetDataByName(void * pDataBlock, CString sName, CString sValue); + +}; diff --git a/MTerm2/CDialogForceIO.cpp b/MTerm2/DialogForceIO.cpp similarity index 98% rename from MTerm2/CDialogForceIO.cpp rename to MTerm2/DialogForceIO.cpp index 2e7e439..4688a97 100644 --- a/MTerm2/CDialogForceIO.cpp +++ b/MTerm2/DialogForceIO.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogForceIO.h" +#include "DialogForceIO.h" #include "afxdialogex.h" diff --git a/MTerm2/CDialogForceIO.h b/MTerm2/DialogForceIO.h similarity index 100% rename from MTerm2/CDialogForceIO.h rename to MTerm2/DialogForceIO.h diff --git a/MTerm2/CDialogInfoDisplay.cpp b/MTerm2/DialogInfoDisplay.cpp similarity index 94% rename from MTerm2/CDialogInfoDisplay.cpp rename to MTerm2/DialogInfoDisplay.cpp index 8065fc0..f105bcf 100644 --- a/MTerm2/CDialogInfoDisplay.cpp +++ b/MTerm2/DialogInfoDisplay.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogInfoDisplay.h" +#include "DialogInfoDisplay.h" #include "afxdialogex.h" diff --git a/MTerm2/CDialogInfoDisplay.h b/MTerm2/DialogInfoDisplay.h similarity index 100% rename from MTerm2/CDialogInfoDisplay.h rename to MTerm2/DialogInfoDisplay.h diff --git a/MTerm2/CDialogProgress.cpp b/MTerm2/DialogProgress.cpp similarity index 98% rename from MTerm2/CDialogProgress.cpp rename to MTerm2/DialogProgress.cpp index 7bb988c..10bd8f0 100644 --- a/MTerm2/CDialogProgress.cpp +++ b/MTerm2/DialogProgress.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogProgress.h" +#include "DialogProgress.h" #include "afxdialogex.h" diff --git a/MTerm2/CDialogProgress.h b/MTerm2/DialogProgress.h similarity index 100% rename from MTerm2/CDialogProgress.h rename to MTerm2/DialogProgress.h diff --git a/MTerm2/CDialogStatusShow.cpp b/MTerm2/DialogStatusShow.cpp similarity index 99% rename from MTerm2/CDialogStatusShow.cpp rename to MTerm2/DialogStatusShow.cpp index 2739947..9099b00 100644 --- a/MTerm2/CDialogStatusShow.cpp +++ b/MTerm2/DialogStatusShow.cpp @@ -3,9 +3,9 @@ #include "pch.h" #include "MTerm2.h" -#include "CDialogStatusShow.h" +#include "DialogStatusShow.h" #include "afxdialogex.h" -#include "KLink.h" +//#include "KLink.h" #include "MTerm2Doc.h" // CDialogStatusShow 瀵硅瘽妗� diff --git a/MTerm2/CDialogStatusShow.h b/MTerm2/DialogStatusShow.h similarity index 100% rename from MTerm2/CDialogStatusShow.h rename to MTerm2/DialogStatusShow.h diff --git a/MTerm2/DialogSysRegSet.cpp b/MTerm2/DialogSysRegSet.cpp new file mode 100644 index 0000000..586f333 --- /dev/null +++ b/MTerm2/DialogSysRegSet.cpp @@ -0,0 +1,328 @@ +锘�// CDialogSysRegSet.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "DialogSysRegSet.h" +#include "afxdialogex.h" +#include "PropSysReg1.h" + +// CDialogSysRegSet 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CDialogSysRegSet, CDialogEx) + +CDialogSysRegSet::CDialogSysRegSet(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_DIALOG_SYSREG_SET, pParent) +{ + +} + +CDialogSysRegSet::~CDialogSysRegSet() +{ +} + +void CDialogSysRegSet::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); + DDX_Control(pDX, IDC_SCROLLBAR1, m_prop_scrollbar1); + DDX_Control(pDX, IDC_LIST_SEL1, m_listSel1); +} + + +BEGIN_MESSAGE_MAP(CDialogSysRegSet, CDialogEx) + ON_WM_VSCROLL() + ON_WM_MOUSEWHEEL() + ON_LBN_SELCHANGE(IDC_LIST_SEL1, &CDialogSysRegSet::OnLbnSelchangeListSel1) +END_MESSAGE_MAP() + + +// CDialogSysRegSet 娑堟伅澶勭悊绋嬪簭 + +int CDialogSysRegSet::AddPropPage(CString sName, CDialogEx & rDlg) +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + m_listSel1.AddString(sName); + if (rDlg.GetSafeHwnd() == NULL ) { } + + m_PropPages[m_nTotalProp] = &rDlg; + m_nTotalProp++; + return 0; +} + +BOOL CDialogSysRegSet::OnInitDialog() +{ + CDialogEx::OnInitDialog(); + + // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲 + + m_listSel1.GetCount(); + AddPropPage(_T("宸ヤ綔妯″紡璁剧疆1"), m_propmodecfg1); + AddPropPage(_T("鍐呭瓨鍒嗛厤1"), m_propmemcfg1); + AddPropPage(_T("淇濇寔/闈炰繚鎸�11"), m_propmodecfg1); + AddPropPage(_T("淇濇寔/闈炰繚鎸�21"), m_propmodecfg1); + AddPropPage(_T("232閫氫俊绔彛璁剧疆1"), m_propcommcfg1); + AddPropPage(_T("485閫氫俊绔彛璁剧疆1"), m_propcommcfg2); + AddPropPage(_T("杈撳叆鏃堕棿甯告暟璁剧疆1"), m_propinputcfg1); + AddPropPage(_T("杈撳叆鏃堕棿甯告暟璁剧疆2"), m_propinputcfg2); + AddPropPage(_T("杈撳叆鏃堕棿甯告暟璁剧疆3"), m_propinputcfg3); + AddPropPage(_T("杈撳叆鏃堕棿甯告暟璁剧疆4"), m_propinputcfg4); + AddPropPage(_T("杈撳嚭淇濇寔鏃堕棿璁剧疆1"), m_propoutputcfg1); + AddPropPage(_T("杈撳嚭淇濇寔鏃堕棿璁剧疆2"), m_propoutputcfg2); + AddPropPage(_T("杈撳叆鏃堕棿甯告暟璁剧疆3"), m_propoutputcfg3); + AddPropPage(_T("杈撳嚭淇濇寔鏃堕棿璁剧疆4"), m_propoutputcfg4); + AddPropPage(_T("485閫氫俊绔彛璁剧疆2"), m_propcommcfg3); + AddPropPage(_T("鍐呯疆SPI绔彛璁剧疆1"), m_propmodecfg1); + AddPropPage(_T("澶栫疆鎵╁睍SPI绔彛璁剧疆1"), m_propmodecfg1); + + //GetDlgItem(IDC_STATIC_PROP)-> + + GetDlgItem(IDC_STATIC_PROP)->GetClientRect(&rect1); + m_nFrameheight = rect1.bottom - rect1.top; + GetDlgItem(IDC_STATIC_PROP)->ClientToScreen(&rect1); + this->ScreenToClient(&rect1); + + m_propsysreg1.Create(IDD_PROP_SYSREG1, this); + m_propsysreg1.EnableWindow(true); + m_propsysreg1.GetClientRect(&rect0); + m_nPropHeight = rect0.bottom - rect0.top; +// m_propsysreg1.ShowWindow(SW_SHOW); + + m_propmodecfg1.Create(IDD_PROP_MODE_CFG1, this); + m_propmodecfg1.EnableWindow(true); + m_propmodecfg1.MoveWindow(&rect1, true); + m_propmodecfg1.ShowWindow(SW_SHOW); + + m_propmemcfg1.Create(IDD_PROP_MEM_CFG, this); + m_propmemcfg1.MoveWindow(&rect1, true); + m_propmemcfg1.EnableWindow(true); + + + m_propcommcfg1.Create(IDD_PROP_COMM_CFG, this); + m_propcommcfg1.MoveWindow(&rect1, true); + m_propcommcfg1.EnableWindow(true); + + m_propcommcfg2.Create(IDD_PROP_COMM_CFG, this); + m_propcommcfg2.MoveWindow(&rect1, true); + m_propcommcfg2.EnableWindow(true); + + m_propcommcfg3.Create(IDD_PROP_COMM_CFG, this); + m_propcommcfg3.MoveWindow(&rect1, true); + m_propcommcfg3.EnableWindow(true); + + m_propinputcfg1.Create(IDD_PROP_INPUT_CFG, this); + m_propinputcfg1.MoveWindow(&rect1, true); + m_propinputcfg1.EnableWindow(true); + + m_propinputcfg2.Create(IDD_PROP_INPUT_CFG, this); + m_propinputcfg2.MoveWindow(&rect1, true); + m_propinputcfg2.EnableWindow(true); + + m_propinputcfg3.Create(IDD_PROP_INPUT_CFG, this); + m_propinputcfg3.MoveWindow(&rect1, true); + m_propinputcfg3.EnableWindow(true); + + m_propinputcfg4.Create(IDD_PROP_INPUT_CFG, this); + m_propinputcfg4.MoveWindow(&rect1, true); + m_propinputcfg4.EnableWindow(true); + + m_propoutputcfg1.Create(IDD_PROP_OUTPUT_SET, this); + m_propoutputcfg1.MoveWindow(&rect1, true); + m_propoutputcfg1.EnableWindow(true); + + m_propoutputcfg2.Create(IDD_PROP_OUTPUT_SET, this); + m_propoutputcfg2.MoveWindow(&rect1, true); + m_propoutputcfg2.EnableWindow(true); + + m_propoutputcfg3.Create(IDD_PROP_OUTPUT_SET, this); + m_propoutputcfg3.MoveWindow(&rect1, true); + m_propoutputcfg3.EnableWindow(true); + + m_propoutputcfg4.Create(IDD_PROP_OUTPUT_SET, this); + m_propoutputcfg4.MoveWindow(&rect1, true); + m_propoutputcfg4.EnableWindow(true); + + m_propsysreg1.MoveWindow(&rect1, true); + + int nNewPos = m_nScrollPos; + int Scrolldel = nNewPos - m_nScrollPos; + m_propsysreg1.ScrollWindow(0, Scrolldel); + m_nScrollPos += Scrolldel; + + SCROLLINFO si; + si.cbSize = sizeof(SCROLLINFO); + si.fMask = SIF_ALL; + si.nMin = 0; + si.nMax = m_nPropHeight;//浣犳粦鍔ㄧ敾闈㈢殑楂樺害 + si.nPage = m_nFrameheight; //杩欎釜鏄綘鏄剧ず鐢婚潰鐨勯珮搴� + si.nPos = 0;//杩欎釜鏄粦鍧楃殑浣嶇疆 鍒濆鍖栫殑鏃跺�欐槸0 浠ュ悗浼氭牴鎹綘鐨勬搷浣滃彉鍔� +// GetDlgItem(IDC_STATIC_PROP)->SetScrollInfo(SB_VERT, &si); +// m_propsysreg1.SetScrollInfo(SB_VERT, &si); + + m_prop_scrollbar1.SetScrollInfo(&si, true); + +// m_prop_scrollbar1.SetScrollRange(1, 100); +// m_prop_scrollbar1.SetScrollPos(20); + return TRUE; // return TRUE unless you set the focus to a control + // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE +} + +void CDialogSysRegSet::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ�� + int nMin, nMax; + pScrollBar->GetScrollRange(&nMin, &nMax); //鍙栧緱婊氬姩鏉¤寖鍥� + int TempPos = pScrollBar->GetScrollPos(); + CString s1; +// s1.Format(_T("DialogSysReg OnVScroll %d %d %d"), nSBCode, nPos,TempPos); +// SysLog(s1); + switch (nSBCode) + { + case SB_THUMBPOSITION://鎷栧姩婊戝潡 + case SB_THUMBTRACK: + pScrollBar->SetScrollPos(nPos); + TempPos = nPos; + break; + case SB_LINEUP://鐐瑰嚮涓婅竟/宸﹁竟鐨勭澶� + if (TempPos > 1) + { + TempPos--; + } + pScrollBar->SetScrollPos(TempPos); + break; + case SB_LINEDOWN://鐐瑰嚮涓嬭竟/鍙宠竟鐨勭澶� + if (TempPos < nMax) + { + TempPos++; + } + pScrollBar->SetScrollPos(TempPos); + + break; + + case SB_PAGEUP: // 濡傛灉鍚戜笂/宸︽粴鍔ㄤ竴椤� + if (TempPos >10) TempPos -= 10; + pScrollBar->SetScrollPos(TempPos); + break; + + case SB_PAGEDOWN: // 濡傛灉鍚戜笅/鍙虫粴鍔ㄤ竴椤� + if (TempPos < nMax - 10) TempPos += 10; + pScrollBar->SetScrollPos(TempPos); + break; + } + int nNewPos = -TempPos; + int Scrolldel = nNewPos - m_nScrollPos; +// s1.Format(_T("DialogSysReg Scroll %d %d %d"), m_nScrollPos, nNewPos, Scrolldel); +// SysLog(s1); + + m_propsysreg1.ScrollWindow(0, Scrolldel); + m_nScrollPos += Scrolldel; + +// m_propsysreg1.ScrollWindow(0, -TempPos); + + CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar); +} + + +BOOL CDialogSysRegSet::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +{ + // TODO: 鍦ㄦ娣诲姞娑堟伅澶勭悊绋嬪簭浠g爜鍜�/鎴栬皟鐢ㄩ粯璁ゅ�� +/* + int nNewPos=m_nScrollPos; + if (zDelta < 0) + { + if (-m_nScrollPos < m_nPropHeight -m_nFrameheight - 30) + nNewPos = m_nScrollPos - 30; + else + nNewPos = - (m_nPropHeight - m_nFrameheight); + } + else if (zDelta > 0) + { + if (-m_nScrollPos > 30) + nNewPos = m_nScrollPos + 30; + else + nNewPos = 0; + } + else + { + } + int Scrolldel = nNewPos - m_nScrollPos; + m_propsysreg1.ScrollWindow(0, Scrolldel); + m_nScrollPos += Scrolldel; + m_prop_scrollbar1.SetScrollPos(-m_nScrollPos); +*/ + return CDialogEx::OnMouseWheel(nFlags, zDelta, pt); + +} + + +void CDialogSysRegSet::OnLbnSelchangeListSel1() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + CString s1; + int j = m_listSel1.GetCurSel(); + s1.Format(_T("LbnSelChange %d"),j); + SysLog(s1); + m_PropPages[m_nCurProp]->ShowWindow(SW_HIDE); + + m_PropPages[j]->ShowWindow(SW_SHOW); + m_PropPages[j]->MoveWindow(&rect1, true); + m_PropPages[j]->EnableWindow(true); +/* + switch (j) + { + case 0: + m_propmodecfg1.ShowWindow(SW_SHOW); + m_propmodecfg1.MoveWindow(&rect1, true); + break; + case 1: + m_propmemcfg1.ShowWindow(SW_SHOW); + m_propmodecfg1.MoveWindow(&rect1, true); + break; + case 2: + //m_propmodecfg1.ShowWindow(SW_SHOW); + break; + case 3: + //m_propmodecfg1.ShowWindow(SW_SHOW); + break; + case 4: + m_propcommcfg1.ShowWindow(SW_SHOW); + m_propmodecfg1.MoveWindow(&rect1, true); + break; + case 5: + m_propcommcfg2.ShowWindow(SW_SHOW); + m_propmodecfg1.MoveWindow(&rect1, true); + break; + case 6: + m_propinputcfg1.ShowWindow(SW_SHOW); + break; + case 7: + m_propinputcfg2.ShowWindow(SW_SHOW); + break; + case 8: + m_propinputcfg3.ShowWindow(SW_SHOW); + break; + case 9: + m_propinputcfg4.ShowWindow(SW_SHOW); + break; + case 10: + m_propoutputcfg1.ShowWindow(SW_SHOW); + break; + case 11: + m_propoutputcfg2.ShowWindow(SW_SHOW); + break; + case 12: + m_propoutputcfg3.ShowWindow(SW_SHOW); + break; + case 13: + m_propoutputcfg4.ShowWindow(SW_SHOW); + break; + + case 14: + m_propcommcfg3.ShowWindow(SW_SHOW); + break; + default: + break; + } +*/ + m_nCurProp = j; +} + diff --git a/MTerm2/DialogSysRegSet.h b/MTerm2/DialogSysRegSet.h new file mode 100644 index 0000000..5de57b9 --- /dev/null +++ b/MTerm2/DialogSysRegSet.h @@ -0,0 +1,65 @@ +锘�#pragma once +#include "PropSysReg1.h" +#include "PropModeCfg.h" +#include "PropMemCfg.h" +#include "PropCommCfg.h" +#include "PropInputCfg.h" +#include "PropOutputCfg.h" +#include "PropSysReg1.h" + + +// CDialogSysRegSet 瀵硅瘽妗� +//class CPropSysReg1; + +class CDialogSysRegSet : public CDialogEx +{ + DECLARE_DYNAMIC(CDialogSysRegSet) + +public: + CDialogSysRegSet(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CDialogSysRegSet(); + RECT rect0; + RECT rect1; + int m_nPropHeight; + int m_nFrameheight; + int m_nScrollPos = 0; + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_DIALOG_SYSREG_SET }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + CPropSysReg1 m_propsysreg1; + CPropModeCfg m_propmodecfg1; + CPropMemCfg m_propmemcfg1; + + CPropCommCfg m_propcommcfg1; + CPropCommCfg m_propcommcfg2; + CPropInputCfg m_propinputcfg1; + CPropInputCfg m_propinputcfg2; + CPropInputCfg m_propinputcfg3; + CPropInputCfg m_propinputcfg4; + CPropOutputCfg m_propoutputcfg1; + CPropOutputCfg m_propoutputcfg2; + CPropOutputCfg m_propoutputcfg3; + CPropOutputCfg m_propoutputcfg4; + CPropCommCfg m_propcommcfg3; + + DECLARE_MESSAGE_MAP() +public: + virtual BOOL OnInitDialog(); + CScrollBar m_prop_scrollbar1; + afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); + afx_msg void OnLbnSelchangeListSel1(); + CListBox m_listSel1; + + int m_nTotalProp = 0; + int m_nCurProp = 0; + CDialogEx * m_PropPages[30]; + + + int AddPropPage(CString sName, CDialogEx & rDlg); +}; diff --git a/MTerm2/HvSerialPort.cpp b/MTerm2/HvSerialPort.cpp index 49b4dbe..6780f9b 100644 --- a/MTerm2/HvSerialPort.cpp +++ b/MTerm2/HvSerialPort.cpp @@ -253,10 +253,10 @@ int LastSpeedTime = (int)GetTimemS(); int nThisRecv = 0; - COMSTAT cs; - OVERLAPPED os; - DWORD dwTrans; - DWORD dwReaded; +// COMSTAT cs; +// OVERLAPPED os; +// DWORD dwTrans; +// DWORD dwReaded; for (; MyThreadProc1ToRun == 1;) { diff --git a/MTerm2/KDefine.h b/MTerm2/KDefine.h index 9d5faa1..1ffe483 100644 --- a/MTerm2/KDefine.h +++ b/MTerm2/KDefine.h @@ -1,4 +1,4 @@ -/* +锘�/* @@ -84,6 +84,138 @@ }; +enum enInputFilter +{ + InputFilter_None = 0, + InputFilter_1mS = 1, + InputFilter_2mS = 2, + InputFilter_4mS = 3, + InputFilter_8mS = 4, + InputFilter_16mS = 5, + InputFilter_32mS = 6, + InputFilter_64mS = 7, + InputFilter_128mS = 8, + InputFilter_256mS = 9, +}; + +enum enOutputHold +{ + Output_Hold = 0, + Output_Set_0 = 1, + Output_Set_1 = 2, +}; + +enum enPortType +{ + PortType_Com = 0, //录脝脣茫禄煤脥篓脩露 + PortType_Gen = 1, //脥篓脫脙脥篓脩露拢卢脳脭脫脡驴脷 + PortType_KLink = 2, //Klink脥篓脩露 + PortType_KBus = 3, //KBus脥篓脩露 + PortType_KNet = 4, // KNet脥篓脩露 + PortType_ModbusRTU = 5, //Modbus RTU 脥篓脩露 +}; + +enum enKeventType +{ + EventTypeNone = 0, + EventTypePowerUp = 1, + EventTypePowerDown = 2, + EventTypePowerRecover = 3, + EventTypeConnected = 4, + EventTypeLostCon = 5, + EventTypeSetTime = 6, + EventTypeSysCfg = 7, + EventTypeProg = 8, + EventTypeForce = 9, + EventTypeClearEvent = 10, + + + EventType +}; +typedef struct tagInfoBlock +{ + USHORT nDeviceType; + USHORT ProgVer; + USHORT KlinkVer; + USHORT nCapacity; + UCHAR nDInput; + UCHAR nDOutput; + UCHAR nAInput; + UCHAR nAOutput; + UCHAR nHInput; + UCHAR nHOutput; + UCHAR nExt1; + UCHAR nEXT2; + +}stKMInfoBlock; + +typedef struct tagKMFuncParam +{ + USHORT EnablePLC : 1; //浣胯兘鍐呴儴PLC鍔熻兘 + USHORT RunMode; //宸ヤ綔妯″紡 +}stKMFuncParam; + +//杈撳叆杈撳嚭鍦板潃鏄犲皠 +typedef struct tagAddrMapping +{ + USHORT InputAddr; + USHORT OutputAddr; + USHORT WRAddr; + USHORT DTAddr; +}stAddrMapping; +typedef struct tagComPortParam +{ + USHORT PortType : 4; /* 0-5=Com,Gen,KLink,KBus,KNet,RTU */ + USHORT ByteSize : 2; /* 0-1=Number of bits/byte, 7-8 */ + USHORT Parity : 4; /* 0-4=None,Odd,Even,Mark,Space */ + USHORT StopBits : 2; /* 0,1,2 = 1, 1.5, 2 */ + USHORT EofChar : 2; /* 0,1,2 = None, CR, CR+LF, ETX; End of character */ + USHORT SofChar : 2; /* 0,1,2 = None, STX */ + USHORT BaudRate; /* =*100 Baudrate at which running */ +}stComPortParam; + +typedef struct tagInputFilterParam +{ + BYTE Filter0 : 4; + BYTE Filter1 : 4; + +}stInputFilterParam; + +typedef struct tagOutputHoldParam +{ + BYTE Hold1 : 4; + BYTE Hold2 : 4; +}stOutputHoldParam; +// 纭欢鎻忚堪鏂囦欢 + +typedef struct tagMSysCfg +{ + unsigned short Sign1; //2 + unsigned short Seq1; //2 + UINT cfgvar2; //4 + stComPortParam Ports[2]; //2*4B + stOutputHoldParam OutputParams[16]; //16B + stInputFilterParam InputParams[16]; //16B + + UINT cfgvar3; + UINT cfgvar4; + UINT cfgvar5; + UINT cfgvar6; + UINT cfgvar7; + UINT cfgvar8; + UINT cfgvar9; + UINT cfgvar10; + UINT cfgvar11; + UINT cfgvar12; + UINT cfgvar13; + UINT cfgvar14; + UINT cfgvar15; + UINT cfgvar16; //14*4 56B + UINT Space1[5]; // 20B + + unsigned short CRC1; //2B + unsigned short EndSign1; //2B +}stKMSysCfg, *pKMSysCfg; //128B typedef struct tagTimer @@ -236,8 +368,8 @@ unsigned short nParamAddr; }stBinProg1; typedef struct stBinProg15 -{ //定时器 - //单参数高级指令 +{ //瀹氭椂鍣� + //鍗曞弬鏁伴珮绾ф寚浠� unsigned char nOp; unsigned char nOpNum; unsigned short nParamAddr1; @@ -246,8 +378,8 @@ unsigned short resvr2; }stBinProg15; typedef struct stBinProg2 -{ //比较指令 - //双参数高级指令 +{ //姣旇緝鎸囦护 + //鍙屽弬鏁伴珮绾ф寚浠� unsigned char nOp; unsigned char nOpNum; unsigned short nParamAddr1; @@ -256,7 +388,7 @@ unsigned short nParamAddr2; }stBinProg2; typedef struct stBinProg3 -{ //三参数高级指令 +{ //涓夊弬鏁伴珮绾ф寚浠� unsigned char nOp; unsigned char nOpNum; unsigned short nParamAddr1; diff --git a/MTerm2/KLink.cpp b/MTerm2/KLink.cpp index 6e3fdfc..53ba599 100644 --- a/MTerm2/KLink.cpp +++ b/MTerm2/KLink.cpp @@ -238,6 +238,18 @@ PkgLen1 = sizeof(stKLReqPacket) + Datalen; break; case KLCmdGetInfo: + case KLCmdGetSN: + Datalen = 0; + PkgLen1 = sizeof(stKLReqPacket) + 4 + Datalen; + break; + case KLCmdGetFactoryData: + Datalen = 0; + PkgLen1 = sizeof(stKLReqPacket) + 4 + Datalen; + break; + case KLCmdWriteFactoryData: + Datalen = nCount; + memcpy(pPacket->Params + 4, pData, Datalen); + PkgLen1 = sizeof(stKLReqPacket) + 4 + Datalen; break; case KLCmdRead: Datalen = 0; @@ -442,12 +454,21 @@ case KLCmdPing: case KLCmdPingReply: *nCount = Datalen; - memcpy(pPacket->Datas, pData, Datalen); + memcpy(pData, pPacket->Datas, Datalen); break; case KLCmdGetInfo: case KLCmdVerInfo: *nCount = Datalen; - memcpy(pPacket->Datas, pData, Datalen); + memcpy(pData, pPacket->Datas, Datalen); + break; + case KLCmdGetUid: + case KLCmdGetSN: + case KLCmdGetFactoryData: + *nCount = Datalen; + memcpy(pData, pPacket->Datas, Datalen); + break; + case KLCmdWriteFactoryData: + *nCount = Datalen; break; case KLCmdRead: case KLCmdReadReply: @@ -534,7 +555,7 @@ int len2=RecvPacket(m_RecvBuf, numToRead); unsigned char nCmd; - unsigned short nCount; + unsigned short nCount=0; ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nCount, m_DataBuf); Value[0] = m_DataBuf[0]; return KL_OK; @@ -547,23 +568,23 @@ SendPacket(m_Packetbuf, len1); int len2 = RecvPacket(m_RecvBuf, 64); unsigned char nCmd; - unsigned short nCount; + unsigned short nCount=0; ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nCount, m_DataBuf); return KL_OK; } -int KLink::ReadBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values) +int KLink::ReadBits(UCHAR nDst, UCHAR nType, USHORT nBitAddr, UCHAR nBitCount, UCHAR * Values) { return KL_OK; } -int KLink::WriteBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values) +int KLink::WriteBits(UCHAR nDst, UCHAR nType, USHORT nBitAddr, UCHAR nBitCount, UCHAR * Values) { return KL_OK; } -int KLink::ReadBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values) +int KLink::ReadBitsByWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT *Values) { return KL_OK; } -int KLink::WriteBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values) +int KLink::WriteBitsByWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT *Values) { return KL_OK; } @@ -575,7 +596,7 @@ return m_nSeq; } -int KLink::ReadDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values) +int KLink::ReadDataByte(UCHAR nDst, UCHAR nType, USHORT nByteAddr, UCHAR nByteCount, UCHAR * Values) { m_Dst = nDst; m_resultStr.Empty(); @@ -598,7 +619,7 @@ m_resultStr += s1; } unsigned char nCmd ; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); if (res == KL_OK) { @@ -613,22 +634,24 @@ return KL_OK; } -int KLink::WriteDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values) +int KLink::WriteDataByte(UCHAR nDst, UCHAR nType, USHORT nByteAddr, UCHAR nByteCount, UCHAR * Values) { m_Dst = nDst; UCHAR nExpSeq = GetNextSeq(); int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteDataByte, nType, nByteAddr/2, nByteCount, Values); SendPacket(m_Packetbuf, len1); - int len2 = RecvPacket(m_RecvBuf, 64); - if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } + nByteCount = 0; + int numToRead = sizeof(stKLRplyPktHdr) + nByteCount; + int len2 = RecvPacket(m_RecvBuf, numToRead); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); return res; } -int KLink::ReadDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values) +int KLink::ReadDataWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) { m_Dst = nDst; UCHAR nExpSeq = GetNextSeq(); @@ -640,7 +663,7 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); for (int i = 0; i < nnCount/2; i++) { @@ -649,23 +672,25 @@ } return res; } -int KLink::WriteDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values) +int KLink::WriteDataWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) { m_Dst = nDst; UCHAR nExpSeq = GetNextSeq(); int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteDataWord, nType, nWordAddr, nWordCount, Values); SendPacket(m_Packetbuf, len1); - int len2 = RecvPacket(m_RecvBuf, 64); - if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } + nWordCount = 0; + int numToRead = sizeof(stKLRplyPktHdr) + nWordCount; + int len2 = RecvPacket(m_RecvBuf, nWordCount); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, nWordCount); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); Values[0] = m_DataBuf[0]; return res; } -int KLink::ReadData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values) +int KLink::ReadData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) { m_Dst = nDst; UCHAR nExpSeq = GetNextSeq(); @@ -675,14 +700,14 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); for (int i=0;i<nnCount;i++) Values[i] = m_DataBuf[i]; return res; return KL_OK; } -int KLink::WriteData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values) +int KLink::WriteData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) { m_Dst = nDst; UCHAR nExpSeq = GetNextSeq(); @@ -692,30 +717,128 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); // Values[0] = m_DataBuf[0]; return res; return KL_OK; } -int KLink::GetInfo(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values) +int KLink::GetInfo(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) { m_Dst = nDst; UCHAR nExpSeq = GetNextSeq(); int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdGetInfo, nType, nWordAddr, nWordCount, Values); + CString s1; + for (int i = 0; i < len1; i++) { + s1.AppendFormat(_T("%02X "), m_Packetbuf[i]); + } + m_resultStr = s1; SendPacket(m_Packetbuf, len1); - int len2 = RecvPacket(m_RecvBuf, 64); - if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } + int numToRead = sizeof(stKLRplyPktHdr) + nWordCount; + int len2 = RecvPacket(m_RecvBuf, numToRead); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; + int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, Values); + // Values[0] = m_DataBuf[0]; + return res; + + return KL_OK; +} +int KLink::GetSN(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) +{ + m_Dst = nDst; + UCHAR nExpSeq = GetNextSeq(); + int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdGetSN, nType, nWordAddr, nWordCount, Values); + CString s1; + for (int i = 0; i < len1; i++) { + s1.AppendFormat(_T("%02X "), m_Packetbuf[i]); + } + m_resultStr = s1; + SendPacket(m_Packetbuf, len1); + nWordCount = 4; + int numToRead = sizeof(stKLRplyPktHdr) + nWordCount; + int len2 = RecvPacket(m_RecvBuf, numToRead); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } + if (len2 == 0) return KL_ERR; + unsigned char nCmd; + unsigned short nnCount = 0; + int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, Values); + // Values[0] = m_DataBuf[0]; + return res; + + return KL_OK; + return 0; +} +int KLink::GetUID(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) +{ + m_Dst = nDst; + UCHAR nExpSeq = GetNextSeq(); + int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdGetUid, nType, nWordAddr, nWordCount, Values); + CString s1; + for (int i = 0; i < len1; i++) { + s1.AppendFormat(_T("%02X "), m_Packetbuf[i]); + } + m_resultStr = s1; + SendPacket(m_Packetbuf, len1); + int numToRead = sizeof(stKLRplyPktHdr) + nWordCount; + int len2 = RecvPacket(m_RecvBuf, numToRead); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } + if (len2 == 0) return KL_ERR; + unsigned char nCmd; + unsigned short nnCount = 0; + int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, Values); + // Values[0] = m_DataBuf[0]; + return res; + + return KL_OK; + return 0; +} + +int KLink::GetFactoryData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) +{ + m_Dst = nDst; + UCHAR nExpSeq = GetNextSeq(); + int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdGetFactoryData, nType, nWordAddr, nWordCount, Values); + CString s1; + for (int i = 0; i < len1; i++) { + s1.AppendFormat(_T("%02X "), m_Packetbuf[i]); + } + m_resultStr = s1; + SendPacket(m_Packetbuf, len1); + int numToRead = sizeof(stKLRplyPktHdr) + nWordCount; + int len2 = RecvPacket(m_RecvBuf, numToRead); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } + if (len2 == 0) return KL_ERR; + unsigned char nCmd; + unsigned short nnCount = 0; + int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, Values); + // Values[0] = m_DataBuf[0]; + return res; + return KL_OK; +} +int KLink::WriteFactoryData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values) +{ + m_Dst = nDst; + UCHAR nExpSeq = GetNextSeq(); + int len1 = MakeReqPacketEx(m_Packetbuf, nDst, m_Stat1.StatByte, KLCmdWriteFactoryData, nType, nWordAddr, nWordCount, Values); + SendPacket(m_Packetbuf, len1); + nWordCount = 0; + int numToRead = sizeof(stKLRplyPktHdr) + nWordCount; + int len2 = RecvPacket(m_RecvBuf, numToRead); + if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } + if (len2 == 0) return KL_ERR; + unsigned char nCmd; + unsigned short nnCount = 0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); // Values[0] = m_DataBuf[0]; return res; return KL_OK; } + int KLink::GetEventLogCount(UCHAR nDst, int * nCount) { m_Dst = nDst; @@ -726,7 +849,7 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); nCount[0] = *(int *)m_DataBuf; return res; @@ -744,7 +867,7 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; int res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); memcpy(theEventLogs, m_DataBuf, nCount * sizeof(stEventLog)); @@ -757,7 +880,7 @@ int KLink::GetDateTime32(UCHAR nDst, UINT * pValue) { int res = KL_OK; - res = ReadDataByte(nDst, 4, KLDataTypeSDT, 36, (UCHAR *)pValue); + res = ReadDataByte(nDst, KLDataTypeSDT, 36, 4, (UCHAR *)pValue); return res; } @@ -765,7 +888,7 @@ int KLink::SetDateTime32(UCHAR nDst, UINT Value) { int res = KL_OK; - res = WriteDataByte(nDst, 4, KLDataTypeSDT, 36, (UCHAR *)&Value); + res = WriteDataByte(nDst, KLDataTypeSDT, 36, 4, (UCHAR *)&Value); return res; } @@ -781,7 +904,7 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); return res; @@ -800,7 +923,7 @@ if (len2 == 0) { len2 = RecvPacket(m_RecvBuf, 64); } if (len2 == 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); return res; @@ -821,7 +944,7 @@ if (len2 <= 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } if (len2 <= 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); unsigned char * values2 = (unsigned char *)Values; for (int i = 0; i < nnCount; i++) values2[i] = m_DataBuf[i]; @@ -840,7 +963,7 @@ if (len2 <= 0) { len2 = RecvPacket(m_RecvBuf, 6); } if (len2 <= 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); return res; @@ -857,7 +980,7 @@ if (len2 <= 0) { len2 = RecvPacket(m_RecvBuf, 6, 30); } if (len2 <= 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); // Values[0] = m_DataBuf[0]; return res; @@ -875,7 +998,7 @@ if (len2 <= 0) { len2 = RecvPacket(m_RecvBuf, 6, 30); } if (len2 <= 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); return res; } @@ -893,7 +1016,7 @@ if (len2 <= 0) { len2 = RecvPacket(m_RecvBuf, numToRead); } if (len2 <= 0) return KL_ERR; unsigned char nCmd; - unsigned short nnCount; + unsigned short nnCount=0; res = ParseRplyPacket(m_RecvBuf, len2, &nCmd, &m_DstStat.StatByte, &nnCount, m_DataBuf); unsigned char * values2 = (unsigned char *)Values; for (int i = 0; i < nnCount; i++) values2[i] = m_DataBuf[i]; diff --git a/MTerm2/KLink.h b/MTerm2/KLink.h index 8cdfb8f..de83e9d 100644 --- a/MTerm2/KLink.h +++ b/MTerm2/KLink.h @@ -196,8 +196,10 @@ KLCmdResetMachine, KLCmdGetUid, KLCmdSetTime, + KLCmdGetSN, - KLCmdMC, + + KLCmdMC = 0x70, KLCmdMD, KLCmdMG, @@ -543,6 +545,9 @@ for (int i = 0; i < ReTryCount; i++) { int len1= RecvPkgFunc(pBufByte + len2, LenToRead - len2); + if (len1 <= 0 || len1 > 256) { + continue; + } len2 += len1; if (len2 >= LenToRead) break; } @@ -580,9 +585,12 @@ int ProcessPacket(void *pBuf, int nLen); int ParseRplyPacket(void *pBuf, int nPkgLen, UCHAR * nCmd, UCHAR * Status, USHORT* nCount, void * pData); -int GetInfo(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values); -int GetSN(UCHAR nDst, int * nCount); -int GetUID(UCHAR nDst, int * nCount); +int GetInfo(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); +int GetSN(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); +int GetUID(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); +int GetFactoryData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); +int WriteFactoryData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); + //int GetTime32(UCHAR nDst, int * nCount); //int SetTime32(UCHAR nDst, int * nCount); int GetDateTime32(UCHAR nDst, UINT * pValue); @@ -595,19 +603,19 @@ int ReadBit(UCHAR nDst, UCHAR nType,USHORT nBitAddr, UCHAR * Value);//Read 1 Single bit int WriteBit(UCHAR nDst, UCHAR nType,USHORT nBitAddr, UCHAR Value);//Write 1 Single bit -int ReadBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values); -int WriteBits(UCHAR nDst, UCHAR nBitCount, UCHAR nType, USHORT nBitAddr, UCHAR * Values); -int ReadBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values); -int WriteBitsByWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT *Values); +int ReadBits(UCHAR nDst, UCHAR nType, USHORT nBitAddr, UCHAR nBitCount, UCHAR * Values); +int WriteBits(UCHAR nDst, UCHAR nType, USHORT nBitAddr, UCHAR nBitCount, UCHAR * Values); +int ReadBitsByWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT *Values); +int WriteBitsByWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT *Values); -int ReadDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values); -int WriteDataByte(UCHAR nDst, UCHAR nByteCount, UCHAR nType, USHORT nByteAddr, UCHAR * Values); +int ReadDataByte(UCHAR nDst, UCHAR nType, USHORT nByteAddr, UCHAR nByteCount, UCHAR * Values); +int WriteDataByte(UCHAR nDst, UCHAR nType, USHORT nByteAddr, UCHAR nByteCount, UCHAR * Values); -int ReadDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values); -int WriteDataWord(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values); +int ReadDataWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); +int WriteDataWord(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); -int ReadData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values); -int WriteData(UCHAR nDst, UCHAR nWordCount, UCHAR nType, USHORT nWordAddr, USHORT * Values); +int ReadData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); +int WriteData(UCHAR nDst, UCHAR nType, USHORT nWordAddr, UCHAR nWordCount, USHORT * Values); int GetMode(UCHAR nDst, UCHAR nType); int ChangeMode(UCHAR nDst, UCHAR nType); diff --git a/MTerm2/KLink2.lib b/MTerm2/KLink2.lib new file mode 100644 index 0000000..0f1defc --- /dev/null +++ b/MTerm2/KLink2.lib Binary files differ diff --git a/MTerm2/MTerm2.cpp b/MTerm2/MTerm2.cpp index 3d6e525..277b30b 100644 --- a/MTerm2/MTerm2.cpp +++ b/MTerm2/MTerm2.cpp @@ -69,6 +69,7 @@ CMTerm2App::CMTerm2App() noexcept { + m_bHiColorIcons = TRUE; // 鏀寔閲嶆柊鍚姩绠$悊鍣� m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS; #ifdef _MANAGED diff --git a/MTerm2/MTerm2.h b/MTerm2/MTerm2.h index deec139..f1371a7 100644 --- a/MTerm2/MTerm2.h +++ b/MTerm2/MTerm2.h @@ -80,6 +80,8 @@ virtual int ExitInstance(); // 瀹炵幇 + bool m_bHiColorIcons; + afx_msg void OnAppAbout(); DECLARE_MESSAGE_MAP() afx_msg void OnFileNew(); diff --git a/MTerm2/MTerm2.rc b/MTerm2/MTerm2.rc index 4d4d8da..8247f7c 100644 --- a/MTerm2/MTerm2.rc +++ b/MTerm2/MTerm2.rc Binary files differ diff --git a/MTerm2/MTerm2.vcxproj b/MTerm2/MTerm2.vcxproj index 9bdc6a9..e133630 100644 --- a/MTerm2/MTerm2.vcxproj +++ b/MTerm2/MTerm2.vcxproj @@ -87,6 +87,7 @@ </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LinkIncremental>false</LinkIncremental> + <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;x64\Release</LibraryPath> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -189,10 +190,11 @@ </ResourceCompile> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="CAnsiParser.h" /> - <ClInclude Include="CDataParser1.h" /> - <ClInclude Include="CDialogCoilMon.h" /> - <ClInclude Include="CDialogCommSet1.h" /> + <ClInclude Include="AnsiParser.h" /> + <ClInclude Include="DataParser1.h" /> + <ClInclude Include="DialogCoilMon.h" /> + <ClInclude Include="DialogCommSet1.h" /> + <ClInclude Include="DialogFactCfg.h" /> <ClInclude Include="DialogIoComment.h" /> <ClInclude Include="DialogSetCoil.h" /> <ClInclude Include="DialogSetData.h" /> @@ -200,16 +202,21 @@ <ClInclude Include="KMachine.h" /> <ClInclude Include="MTerm2CommDevView.h" /> <ClInclude Include="MTerm2CommTestView.h" /> - <ClInclude Include="CDialogDataMon.h" /> - <ClInclude Include="CDialogDateTime.h" /> - <ClInclude Include="CDialogEventLog.h" /> - <ClInclude Include="CDialogForceIO.h" /> - <ClInclude Include="CDialogInfoDisplay.h" /> - <ClInclude Include="CDialogProgress.h" /> - <ClInclude Include="CDialogStatusShow.h" /> - <ClInclude Include="CDialogSysRegSet.h" /> + <ClInclude Include="DialogDataMon.h" /> + <ClInclude Include="DialogDateTime.h" /> + <ClInclude Include="DialogEventLog.h" /> + <ClInclude Include="DialogForceIO.h" /> + <ClInclude Include="DialogInfoDisplay.h" /> + <ClInclude Include="DialogProgress.h" /> + <ClInclude Include="DialogStatusShow.h" /> + <ClInclude Include="DialogSysRegSet.h" /> <ClInclude Include="ChildFrm.h" /> - <ClInclude Include="CPropSysReg1.h" /> + <ClInclude Include="PropCommCfg.h" /> + <ClInclude Include="PropInputCfg.h" /> + <ClInclude Include="PropMemCfg.h" /> + <ClInclude Include="PropModeCfg.h" /> + <ClInclude Include="PropOutputCfg.h" /> + <ClInclude Include="PropSysReg1.h" /> <ClInclude Include="HvSerialPort.h" /> <ClInclude Include="KLinkDefine.h" /> <ClInclude Include="KLink.h" /> @@ -229,32 +236,40 @@ <ClInclude Include="MyDialogLog.h" /> <ClInclude Include="MyFormLog.h" /> <ClInclude Include="MyPaneLog.h" /> + <ClInclude Include="NavView.h" /> <ClInclude Include="pch.h" /> <ClInclude Include="Resource.h" /> <ClInclude Include="targetver.h" /> + <ClInclude Include="ViewTree.h" /> </ItemGroup> <ItemGroup> <ClCompile Include="..\MyLib\StaticEx.cpp" /> - <ClCompile Include="CAnsiParser.cpp" /> - <ClCompile Include="CDataParser1.cpp" /> - <ClCompile Include="CDialogCoilMon.cpp" /> - <ClCompile Include="CDialogCommSet1.cpp" /> + <ClCompile Include="AnsiParser.cpp" /> + <ClCompile Include="DataParser1.cpp" /> + <ClCompile Include="DialogCoilMon.cpp" /> + <ClCompile Include="DialogCommSet1.cpp" /> + <ClCompile Include="DialogFactCfg.cpp" /> <ClCompile Include="DialogIoComment.cpp" /> <ClCompile Include="DialogSetCoil.cpp" /> <ClCompile Include="DialogSetData.cpp" /> <ClCompile Include="KMachine.cpp" /> <ClCompile Include="MTerm2CommDevView.cpp" /> <ClCompile Include="MTerm2CommTestView.cpp" /> - <ClCompile Include="CDialogDataMon.cpp" /> - <ClCompile Include="CDialogDateTime.cpp" /> - <ClCompile Include="CDialogEventLog.cpp" /> - <ClCompile Include="CDialogForceIO.cpp" /> - <ClCompile Include="CDialogInfoDisplay.cpp" /> - <ClCompile Include="CDialogProgress.cpp" /> - <ClCompile Include="CDialogStatusShow.cpp" /> - <ClCompile Include="CDialogSysRegSet.cpp" /> + <ClCompile Include="DialogDataMon.cpp" /> + <ClCompile Include="DialogDateTime.cpp" /> + <ClCompile Include="DialogEventLog.cpp" /> + <ClCompile Include="DialogForceIO.cpp" /> + <ClCompile Include="DialogInfoDisplay.cpp" /> + <ClCompile Include="DialogProgress.cpp" /> + <ClCompile Include="DialogStatusShow.cpp" /> + <ClCompile Include="DialogSysRegSet.cpp" /> <ClCompile Include="ChildFrm.cpp" /> - <ClCompile Include="CPropSysReg1.cpp" /> + <ClCompile Include="PropCommCfg.cpp" /> + <ClCompile Include="PropInputCfg.cpp" /> + <ClCompile Include="PropMemCfg.cpp" /> + <ClCompile Include="PropModeCfg.cpp" /> + <ClCompile Include="PropOutputCfg.cpp" /> + <ClCompile Include="PropSysReg1.cpp" /> <ClCompile Include="HvSerialPort.cpp" /> <ClCompile Include="KLink.cpp" /> <ClCompile Include="MTerm2ProgTxt.cpp" /> @@ -272,35 +287,45 @@ <ClCompile Include="MyDialogLog.cpp" /> <ClCompile Include="MyFormLog.cpp" /> <ClCompile Include="MyPaneLog.cpp" /> + <ClCompile Include="NavView.cpp" /> <ClCompile Include="pch.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> </ClCompile> + <ClCompile Include="ViewTree.cpp" /> </ItemGroup> <ItemGroup> <ResourceCompile Include="MTerm2.rc" /> </ItemGroup> <ItemGroup> + <None Include="devices.cfg" /> <None Include="res\MTerm2.rc2" /> </ItemGroup> <ItemGroup> + <Image Include="res\bitmap1.bmp" /> <Image Include="res\bmp00001.bmp" /> <Image Include="res\bmp00002.bmp" /> <Image Include="res\bmp00003.bmp" /> + <Image Include="res\classview.bmp" /> + <Image Include="res\classview_hc.bmp" /> + <Image Include="res\class_view.ico" /> + <Image Include="res\class_view_hc.ico" /> <Image Include="res\ico00001.ico" /> <Image Include="res\ico00002.ico" /> <Image Include="res\idr_mult.ico" /> <Image Include="res\mainfram.bmp" /> <Image Include="res\MTerm2.ico" /> <Image Include="res\MTerm2Doc.ico" /> + <Image Include="res\sort.bmp" /> + <Image Include="res\sort_hc.bmp" /> <Image Include="res\Toolbar.bmp" /> <Image Include="res\toolbar1.bmp" /> <Image Include="res\toolbar2.bmp" /> </ItemGroup> <ItemGroup> - <Text Include="..\MTerm1\Prog.txt" /> + <Text Include="design1.txt" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/MTerm2/MTerm2.vcxproj.filters b/MTerm2/MTerm2.vcxproj.filters index 632582c..e835c87 100644 --- a/MTerm2/MTerm2.vcxproj.filters +++ b/MTerm2/MTerm2.vcxproj.filters @@ -57,45 +57,6 @@ <ClInclude Include="MTerm2ProgTxt.h"> <Filter>澶存枃浠�</Filter> </ClInclude> - <ClInclude Include="CAnsiParser.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDataParser1.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogCoilMon.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogCommSet1.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogDataMon.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogDateTime.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogEventLog.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogForceIO.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogInfoDisplay.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogProgress.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogStatusShow.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CDialogSysRegSet.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> - <ClInclude Include="CPropSysReg1.h"> - <Filter>澶存枃浠�</Filter> - </ClInclude> <ClInclude Include="HvSerialPort.h"> <Filter>澶存枃浠�</Filter> </ClInclude> @@ -144,6 +105,69 @@ <ClInclude Include="KMachine.h"> <Filter>澶存枃浠�</Filter> </ClInclude> + <ClInclude Include="NavView.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="ViewTree.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="AnsiParser.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DataParser1.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogCoilMon.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogCommSet1.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogDataMon.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogDateTime.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogEventLog.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogForceIO.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogInfoDisplay.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogProgress.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogStatusShow.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogSysRegSet.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="PropSysReg1.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="PropMemCfg.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="PropModeCfg.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="PropCommCfg.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="PropInputCfg.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="PropOutputCfg.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="DialogFactCfg.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="MainFrm.cpp"> @@ -177,45 +201,6 @@ <Filter>婧愭枃浠�</Filter> </ClCompile> <ClCompile Include="MTerm2ProgTxt.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CAnsiParser.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDataParser1.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogCoilMon.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogCommSet1.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogDataMon.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogDateTime.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogEventLog.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogForceIO.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogInfoDisplay.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogProgress.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogStatusShow.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CDialogSysRegSet.cpp"> - <Filter>婧愭枃浠�</Filter> - </ClCompile> - <ClCompile Include="CPropSysReg1.cpp"> <Filter>婧愭枃浠�</Filter> </ClCompile> <ClCompile Include="HvSerialPort.cpp"> @@ -263,6 +248,69 @@ <ClCompile Include="KMachine.cpp"> <Filter>婧愭枃浠�</Filter> </ClCompile> + <ClCompile Include="NavView.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="ViewTree.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogSysRegSet.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogStatusShow.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogProgress.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogInfoDisplay.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogForceIO.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogEventLog.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogDateTime.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogDataMon.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogCommSet1.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogCoilMon.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DataParser1.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="AnsiParser.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="PropSysReg1.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="PropMemCfg.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="PropModeCfg.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="PropCommCfg.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="PropInputCfg.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="PropOutputCfg.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="DialogFactCfg.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ResourceCompile Include="MTerm2.rc"> @@ -273,6 +321,7 @@ <None Include="res\MTerm2.rc2"> <Filter>璧勬簮鏂囦欢</Filter> </None> + <None Include="devices.cfg" /> </ItemGroup> <ItemGroup> <Image Include="res\Toolbar.bmp"> @@ -311,10 +360,29 @@ <Image Include="res\toolbar2.bmp"> <Filter>璧勬簮鏂囦欢</Filter> </Image> + <Image Include="res\class_view.ico"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> + <Image Include="res\class_view_hc.ico"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> + <Image Include="res\sort.bmp"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> + <Image Include="res\classview.bmp"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> + <Image Include="res\classview_hc.bmp"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> + <Image Include="res\sort_hc.bmp"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> + <Image Include="res\bitmap1.bmp"> + <Filter>璧勬簮鏂囦欢</Filter> + </Image> </ItemGroup> <ItemGroup> - <Text Include="..\MTerm1\Prog.txt"> - <Filter>婧愭枃浠�</Filter> - </Text> + <Text Include="design1.txt" /> </ItemGroup> </Project> \ No newline at end of file diff --git a/MTerm2/MTerm2CommDevView.cpp b/MTerm2/MTerm2CommDevView.cpp index cf8583f..da7e706 100644 --- a/MTerm2/MTerm2CommDevView.cpp +++ b/MTerm2/MTerm2CommDevView.cpp @@ -17,23 +17,23 @@ #include <SetupAPI.h> #include "../MyLib/Functions.hpp" #include "../MyLib/UI_Func/UI_Func.hpp" -#include "CAnsiParser.h" -#include "CDataParser1.h" +#include "AnsiParser.h" +#include "DataParser1.h" #include "KLink.h" //#include "../MyLib/SerialCom/SerialCom.hpp" #include <Dbt.h> -#include "CDialogCommSet1.h" -#include "CDialogSysRegSet.h" -#include "CDialogStatusShow.h" -#include "CDialogInfoDisplay.h" +#include "DialogCommSet1.h" +#include "DialogSysRegSet.h" +#include "DialogStatusShow.h" +#include "DialogInfoDisplay.h" -#include "CDialogCoilMon.h" -#include "CDialogDataMon.h" +#include "DialogCoilMon.h" +#include "DialogDataMon.h" -#include "CDialogProgress.h" -#include "CDialogEventLog.h" -#include "CDialogDateTime.h" -#include "CDialogForceIO.h" +#include "DialogProgress.h" +#include "DialogEventLog.h" +#include "DialogDateTime.h" +#include "DialogForceIO.h" #include "HvSerialPort.h" #ifdef _DEBUG @@ -140,6 +140,9 @@ // ON_BN_CLICKED(IDC_BUTTON11, &CMTerm2CommDevView::OnBnClickedButton11) ON_BN_CLICKED(IDC_BUTTON12, &CMTerm2CommDevView::OnBnClickedButton12) ON_BN_CLICKED(IDC_BUTTON13, &CMTerm2CommDevView::OnBnClickedButton13) + ON_BN_CLICKED(IDC_BUTTON31, &CMTerm2CommDevView::OnBnClickedButton31) + ON_BN_CLICKED(IDC_BUTTON2, &CMTerm2CommDevView::OnBnClickedButton2) + ON_BN_CLICKED(IDC_BUTTON3, &CMTerm2CommDevView::OnBnClickedButton3) END_MESSAGE_MAP() @@ -546,6 +549,7 @@ //DrawPic1(); // MyLogger1.UpdateLogDisplay(0); UpdateDataDisplay(); + UpdateLEDDisplay(); } else if (nIDEvent == 3) { @@ -971,7 +975,7 @@ { DataType = pDoc->MyKLink1.KLDataTypeWX; DCount = 16; - res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.WXB[DAddr]); + res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.WXB[DAddr]); nCount = DCount; if (res == pDoc->MyKLink1.KL_OK) { @@ -993,7 +997,7 @@ { DataType = pDoc->MyKLink1.KLDataTypeWY; DCount = 16; - res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.WYB[DAddr]); + res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.WYB[DAddr]); nCount = DCount; if (res == pDoc->MyKLink1.KL_OK) { @@ -1013,7 +1017,7 @@ { DataType = pDoc->MyKLink1.KLDataTypeWR; DCount = 32; - res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.WRB[DAddr]); + res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.WRB[DAddr]); nCount = DCount; if (res == pDoc->MyKLink1.KL_OK) { @@ -1032,7 +1036,7 @@ { DataType = pDoc->MyKLink1.KLDataTypeDT; DCount = 96; - res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, DAddr, &pDoc->MyKLink1.MEM.DTB[DAddr]); + res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, DAddr, DCount, &pDoc->MyKLink1.MEM.DTB[DAddr]); nCount = DCount; if (res == pDoc->MyKLink1.KL_OK) { @@ -1054,7 +1058,7 @@ DataType = pDoc->MyKLink1.KLDataTypeSDT; ByteAddr = nBlock * 128; DCount = 128; - res = pDoc->MyKLink1.ReadDataByte(DstAddr, DCount, DataType, ByteAddr, &pDoc->MyKLink1.MEM.SDB[ByteAddr]); + res = pDoc->MyKLink1.ReadDataByte(DstAddr, DataType, ByteAddr, DCount, &pDoc->MyKLink1.MEM.SDB[ByteAddr]); nCount = DCount; if (res == pDoc->MyKLink1.KL_OK) { @@ -1595,7 +1599,7 @@ // s3.Format("%d %d ",recv2length,wCount2);AppendText(s3); s1.Format(_T("R %d(Try %d %d)=%d->"), dNumtoRead, nTryCount, nTryCount2, wCount2); - for (DWORD i = 0; i < 8 && i < wCount2; i++) + for (DWORD i = 0; i < 16 && i < wCount2; i++) { s1.AppendFormat(_T("%02X "), recv1[i]); } @@ -2106,4 +2110,118 @@ } +enum enStat +{ + normal=0, + setchn=1, + setvalue=2, + setonoff=3, + +}; +int nStat = 0; +int ntimecount = 0; +#define MaxTimeOut 50 + +int nCurChn = 0; +int nValue[4] = { 100,200,300,400 }; +int LedOn[4] = { 0 }; +int flickTimer = 0; +int CMTerm2CommDevView::UpdateLEDDisplay() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + flickTimer++; + int bHide = 0; + if ((flickTimer & 0x7) > 3) { bHide = 1; } + + CString s1; + s1 = _T("0000"); + + s1.Format(_T("%d%03d"), nCurChn, nValue[nCurChn]); + if (nStat == setchn && bHide) + { + s1.Format(_T(" %03d"), nValue[nCurChn]); + } + if (nStat == setvalue && bHide) + { + s1.Format(_T("%d "),nCurChn); + } + if (nStat == setonoff && bHide) + { + s1.Format(_T(" "), nCurChn); + } + + SetDlgItemText(IDC_EDIT31, s1); + + s1.Format(_T("%d %d %d %d"), LedOn[0], LedOn[1], LedOn[2], LedOn[3]); + SetDlgItemText(IDC_EDIT32, s1); + + ntimecount++; + if (ntimecount >= MaxTimeOut) { nStat = normal; } + return 0; +} + +void CMTerm2CommDevView::OnBnClickedButton31() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + ntimecount = 0; + if (nStat == setchn) + { + nCurChn++; + if (nCurChn >= 4) { nCurChn = 0; } + } + if (nStat == setvalue) + { + nValue[nCurChn] ++; + if (nValue[nCurChn] > 999) { nValue[nCurChn] = 999; } + } + if (nStat == setonoff) + { + LedOn[nCurChn] =1; + } +} + + +void CMTerm2CommDevView::OnBnClickedButton2() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + ntimecount = 0; + if (nStat == setchn) + { + nCurChn--; + if (nCurChn <0) { nCurChn = 3; } + } + if (nStat == setvalue) + { + nValue[nCurChn] --; + if (nValue[nCurChn] <= 0) { nValue[nCurChn] = 0; } + } + if (nStat == setonoff) + { + LedOn[nCurChn] = 0; + } +} + + +void CMTerm2CommDevView::OnBnClickedButton3() +{ + // TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜 + ntimecount = 0; + if (nStat == normal) + { + nStat = setchn; + } else if (nStat == setchn) + { + nStat = setvalue; + } else if (nStat == setvalue) + { + nStat = setonoff; + } + else if (nStat == setonoff) + { + nStat = setchn; + } + +} + + diff --git a/MTerm2/MTerm2CommDevView.h b/MTerm2/MTerm2CommDevView.h index c769ab1..c4a0038 100644 --- a/MTerm2/MTerm2CommDevView.h +++ b/MTerm2/MTerm2CommDevView.h @@ -153,4 +153,8 @@ afx_msg void OnBnClickedButton12(); afx_msg void OnBnClickedButton13(); + afx_msg void OnBnClickedButton31(); + afx_msg void OnBnClickedButton2(); + afx_msg void OnBnClickedButton3(); + int UpdateLEDDisplay(); }; diff --git a/MTerm2/MTerm2Doc.cpp b/MTerm2/MTerm2Doc.cpp index 067073d..8500f61 100644 --- a/MTerm2/MTerm2Doc.cpp +++ b/MTerm2/MTerm2Doc.cpp @@ -26,8 +26,10 @@ #include "MTerm2CommDevView.h" #include <propkey.h> -#include "CDialogCommSet1.h" -#include "CDialogStatusShow.h" +#include "DialogCommSet1.h" +#include "DialogStatusShow.h" +#include "DialogSysRegSet.h" +#include "DialogFactCfg.h" #include "HvSerialPort.h" #include <functional> @@ -37,7 +39,7 @@ #endif // CMTerm2Doc -CMTerm2Doc::stTypeDef CMTerm2Doc::CoilTypeDef[] = +CMTerm2Doc::stTypeNameDef CMTerm2Doc::CoilTypeNameDef[] = { {KLCoilTypeX,"X"}, {KLCoilTypeY,"Y"}, @@ -49,9 +51,9 @@ {KLCoilTypeC,"C"}, {KLCoilTypeT,"T"}, }; -int CMTerm2Doc::nCoilTypeDefCount = sizeof(CMTerm2Doc::CoilTypeDef) / sizeof(stTypeDef); +int CMTerm2Doc::nCoilTypeDefCount = sizeof(CMTerm2Doc::CoilTypeNameDef) / sizeof(stTypeNameDef); -CMTerm2Doc::stTypeDef CMTerm2Doc::DataTypeDef[] = +CMTerm2Doc::stTypeNameDef CMTerm2Doc::DataTypeNameDef[] = { {KLDataTypeDEC,"K"}, {KLDataTypeHEX,"H"}, @@ -67,7 +69,7 @@ {KLDataTypeSV,"SV"}, {KLDataTypeLD,"LD"}, }; -int CMTerm2Doc::nDataTypeDefCount = sizeof(CMTerm2Doc::DataTypeDef) / sizeof(stTypeDef); +int CMTerm2Doc::nDataTypeDefCount = sizeof(CMTerm2Doc::DataTypeNameDef) / sizeof(stTypeNameDef); CMTerm2Doc::stOpDef CMTerm2Doc::OpDef[] = { @@ -154,6 +156,7 @@ ON_COMMAND(ID_SIMULATE, &CMTerm2Doc::OnSimulate) ON_UPDATE_COMMAND_UI(ID_SIMULATE, &CMTerm2Doc::OnUpdateSimulate) ON_COMMAND(ID_MENU_STATUS_SHOW, &CMTerm2Doc::OnMenuStatusShow) + ON_COMMAND(ID_MENU_FACT_CFG, &CMTerm2Doc::OnMenuFactCfg) END_MESSAGE_MAP() @@ -178,7 +181,8 @@ } int CMTerm2Doc::RecvPacket(void * pBuf, int Len) { - int j = myHvSerialPort1.Recv((char *)pBuf, Len); + int j = 0; + j = myHvSerialPort1.Recv((char *)pBuf, Len); if (j <= 0) { CString s1; @@ -467,10 +471,10 @@ Typetxt.MakeUpper(); for (int i = 0; i < nCoilTypeDefCount; i++) { - if (Typetxt.Find( CoilTypeDef[i].TypeTxt)==0) { - *nCoilType = CoilTypeDef[i].nType; - *nCoilAddr = atoi(Typetxt.Mid(CoilTypeDef[i].TypeTxt.GetLength())); - return CoilTypeDef[i].nType; + if (Typetxt.Find( CoilTypeNameDef[i].TypeTxt)==0) { + *nCoilType = CoilTypeNameDef[i].nType; + *nCoilAddr = atoi(Typetxt.Mid(CoilTypeNameDef[i].TypeTxt.GetLength())); + return CoilTypeNameDef[i].nType; } } return false;; @@ -480,8 +484,8 @@ { for (int i = 0; i < nCoilTypeDefCount; i++) { - if (CoilTypeDef[i].nType == nType){ - typeTxt = CoilTypeDef[i].TypeTxt; + if (CoilTypeNameDef[i].nType == nType){ + typeTxt = CoilTypeNameDef[i].TypeTxt; return true; } } @@ -493,9 +497,9 @@ Typetxt.MakeUpper(); for (int i = 0; i < nDataTypeDefCount; i++) { - if (Typetxt.Find(DataTypeDef[i].TypeTxt) == 0) { - *nDataType = DataTypeDef[i].nType; - *nDataAddr = atoi(Typetxt.Mid(DataTypeDef[i].TypeTxt.GetLength())); + if (Typetxt.Find(DataTypeNameDef[i].TypeTxt) == 0) { + *nDataType = DataTypeNameDef[i].nType; + *nDataAddr = atoi(Typetxt.Mid(DataTypeNameDef[i].TypeTxt.GetLength())); return true; } } @@ -507,8 +511,8 @@ { for (int i = 0; i < nDataTypeDefCount; i++) { - if (DataTypeDef[i].nType == nType) { - typeTxt = DataTypeDef[i].TypeTxt; + if (DataTypeNameDef[i].nType == nType) { + typeTxt = DataTypeNameDef[i].TypeTxt; return true; } } @@ -560,7 +564,7 @@ int CMTerm2Doc::SetAnno(unsigned short nType, unsigned short nAddr, CString sCoilName, CString sAnno) { // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. -// 浜屽垎娉� 鏌ユ壘銆� +// 浜屽垎娉�? 鏌ユ壘銆� // map. for (int i = 0; i < nCoilAnnoCount; i++) { if (mCoilAnnos[i].nType == nType && mCoilAnnos[i].nAddr == nAddr) { @@ -1360,6 +1364,23 @@ void CMTerm2Doc::OnPlcSysregSet() { // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + CDialogSysRegSet dialog1; + INT_PTR r = dialog1.DoModal(); + if (r == IDOK) + { + + } +} + +void CMTerm2Doc::OnMenuFactCfg() +{ + // TODO: 鍦ㄦ娣诲姞鍛戒护澶勭悊绋嬪簭浠g爜 + CDialogFactCfg dialog1; + INT_PTR r = dialog1.DoModal(); + if (r == IDOK) + { + + } } @@ -1645,7 +1666,7 @@ return nDataAddr; } - MyKLink1.ReadDataWord(1, 2, nDataType, nDataAddr, value);// (unsigned char *)&KMem.DT[nDataAddr]); + MyKLink1.ReadDataWord(1, nDataType, nDataAddr, 2, value);// (unsigned char *)&KMem.DT[nDataAddr]); svalue = value[0]; return svalue; } @@ -1730,7 +1751,7 @@ unsigned short svalue[10]; svalue[0]=nDataValue; int res = 0; - res = MyKLink1.WriteDataWord(1, 2, nDataType, nDataAddr, svalue); + res = MyKLink1.WriteDataWord(1, nDataType, nDataAddr, 2, svalue); return res; } @@ -1830,7 +1851,7 @@ int nDataType = MyKLink1.KLDataTypeWX; int nDataAddr = 0; int nDataCount = 4; - int res; +// int res; for (int i = 0; i < nDataCount; i++) { KMem.WX[i] = myKMachine1.KMem.WX[i]; } @@ -1880,32 +1901,32 @@ int nDataAddr = 0; int nDataCount = 4; int res; - res = MyKLink1.ReadDataWord(1, nDataCount, nDataType, nDataAddr, KMem.WX);// (unsigned char *)&KMem.DT[nDataAddr]); + res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.WX);// (unsigned char *)&KMem.DT[nDataAddr]); nDataType = MyKLink1.KLDataTypeWY; nDataAddr = 0; nDataCount = 4; - res = MyKLink1.ReadDataWord(1, nDataCount, nDataType, nDataAddr, KMem.WY);// (unsigned char *)&KMem.DT[nDataAddr]); + res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.WY);// (unsigned char *)&KMem.DT[nDataAddr]); nDataType = MyKLink1.KLDataTypeWR; nDataAddr = 0; nDataCount = 10; - res = MyKLink1.ReadDataWord(1, nDataCount, nDataType, nDataAddr, KMem.WR);// (unsigned char *)&KMem.DT[nDataAddr]); + res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.WR);// (unsigned char *)&KMem.DT[nDataAddr]); nDataType = MyKLink1.KLDataTypeDT; nDataAddr = 0; nDataCount = 80; - res = MyKLink1.ReadDataWord(1, nDataCount, nDataType, nDataAddr, KMem.DT);// (unsigned char *)&KMem.DT[nDataAddr]); + res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.DT);// (unsigned char *)&KMem.DT[nDataAddr]); nDataType = MyKLink1.KLDataTypeSV; nDataAddr = 0; nDataCount = 40; - res = MyKLink1.ReadDataWord(1, nDataCount, nDataType, nDataAddr, KMem.SV);// (unsigned char *)&KMem.DT[nDataAddr]); + res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.SV);// (unsigned char *)&KMem.DT[nDataAddr]); nDataType = MyKLink1.KLDataTypeEV; nDataAddr = 0; nDataCount = 40; - res = MyKLink1.ReadDataWord(1, nDataCount, nDataType, nDataAddr, KMem.EV);// (unsigned char *)&KMem.DT[nDataAddr]); + res = MyKLink1.ReadDataWord(1, nDataType, nDataAddr, nDataCount, KMem.EV);// (unsigned char *)&KMem.DT[nDataAddr]); } @@ -1936,3 +1957,5 @@ } } + + diff --git a/MTerm2/MTerm2Doc.h b/MTerm2/MTerm2Doc.h index 10965a4..513e170 100644 --- a/MTerm2/MTerm2Doc.h +++ b/MTerm2/MTerm2Doc.h @@ -5,8 +5,8 @@ #pragma once #include "HvSerialPort.h" -#include "CAnsiParser.h" -#include "CDataParser1.h" +#include "AnsiParser.h" +#include "DataParser1.h" #include "KDefine.h" #include "KLink.h" #include "KMachine.h" @@ -53,15 +53,15 @@ CString ProgTxt; - struct stTypeDef + struct stTypeNameDef { int nType; CStringA TypeTxt; }; - static stTypeDef CoilTypeDef[]; + static stTypeNameDef CoilTypeNameDef[]; static int nCoilTypeDefCount; - static stTypeDef DataTypeDef[]; + static stTypeNameDef DataTypeNameDef[]; static int nDataTypeDefCount; stKMem KMem; @@ -278,4 +278,5 @@ int ClearMonitor(); int DoPLCMonitor(); afx_msg void OnMenuStatusShow(); + afx_msg void OnMenuFactCfg(); }; diff --git a/MTerm2/MTerm2View.cpp b/MTerm2/MTerm2View.cpp index 067a778..1b960d2 100644 --- a/MTerm2/MTerm2View.cpp +++ b/MTerm2/MTerm2View.cpp @@ -196,8 +196,8 @@ xform1.eM12 = 0; xform1.eM21 = 0; xform1.eM22 = 1; - xform1.eDx = -scroll1.x; - xform1.eDy = -scroll1.y; + xform1.eDx = float(-scroll1.x); + xform1.eDy = float(-scroll1.y); XFORM xform2 = { 1, 0, 0, 1, 0, 0 }; @@ -2385,7 +2385,7 @@ Progsec += thisprogsec; } DbgLog(_T("\r\n")+ sProg); - int n = Progsec.Progs.size(); + int n = int(Progsec.Progs.size()); s1.Format(_T("progSec steps %d "), n); DbgLog(s1); for (int i = 0; i < n; i++) { @@ -2402,7 +2402,7 @@ allprogs += Progsec; } //杈撳嚭绋嬪簭 - int n=allprogs.Progs.size(); + int n=(int)allprogs.Progs.size(); s1.Format(_T("all prog steps %d "), n); DbgLog(s1); for (int i = 0; i < n; i++) { @@ -2414,7 +2414,7 @@ OpTxt = OpTxtA; OpShowTxt = OpShowTxtA; s1.Format(_T("%d %s %s"), optype, OpTxt, OpShowTxt); - DbgLog(s1); +// DbgLog(s1); } return 0; } diff --git a/MTerm2/MTerm2View.h b/MTerm2/MTerm2View.h index b235098..538a257 100644 --- a/MTerm2/MTerm2View.h +++ b/MTerm2/MTerm2View.h @@ -97,7 +97,7 @@ return 0; }; int Append(struct stProgSection progsec){ - int n=progsec.Progs.size(); + int n=(int)progsec.Progs.size(); for (int i = 0; i < n; i++) { Progs.push_back(progsec.Progs[i]); } diff --git a/MTerm2/MainFrm.cpp b/MTerm2/MainFrm.cpp index c1df827..0786029 100644 --- a/MTerm2/MainFrm.cpp +++ b/MTerm2/MainFrm.cpp @@ -71,6 +71,19 @@ // m_dlgMyLog.Create(m_dlgMyLog.IDD, GetParent()); // m_dlgMyLog.ShowWindow(SW_SHOW); +// BOOL bNameValid; + + // 鍒涘缓绫昏鍥� + CString strNavView; +// bNameValid = strNavView.LoadString(IDS_CLASS_VIEW); +// ASSERT(bNameValid); + strNavView = _T("瀵艰埅瑙嗗浘"); + if (!m_wndNavView.Create(strNavView, this, CRect(0, 0, 200, 200), TRUE, ID_VIEW_NAVVIEW, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI)) + { + TRACE0("鏈兘鍒涘缓鈥滃鑸鍥锯�濈獥鍙n"); + return FALSE; // 鏈兘鍒涘缓 + } + if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { @@ -167,6 +180,11 @@ m_wndMyPaneLog.EnableDocking(CBRS_ALIGN_ANY); // EnableDocking(CBRS_ALIGN_ANY); + m_wndNavView.EnableDocking(CBRS_ALIGN_ANY); + DockPane(&m_wndNavView); +// CDockablePane* pTabbedBar = nullptr; +// m_wndNavView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); + ///* m_wndToolBar_InputShow.EnableDocking(CBRS_ALIGN_ANY); diff --git a/MTerm2/MainFrm.h b/MTerm2/MainFrm.h index cd7ce08..7265ef7 100644 --- a/MTerm2/MainFrm.h +++ b/MTerm2/MainFrm.h @@ -3,6 +3,7 @@ // #pragma once +#include "NavView.h" #include "MyPaneLog.h" //class CMyPaneLog; @@ -41,10 +42,10 @@ CMFCToolBar m_wndToolBar_InputShow; CMFCToolBar m_wndToolBar_Comments; + CNavView m_wndNavView; + CEdit m_InputShowEdit; - CStaticEx m_InputShowStatic; - CMFCStatusBar m_wndStatusBar; CMyPaneLog m_wndMyPaneLog; diff --git a/MTerm2/NavView.cpp b/MTerm2/NavView.cpp new file mode 100644 index 0000000..08975a1 --- /dev/null +++ b/MTerm2/NavView.cpp @@ -0,0 +1,322 @@ +锘� +#include "pch.h" +#include "framework.h" +#include "Resource.h" +#include "MainFrm.h" +#include "NavView.h" + +#include "MTerm2.h" + +class CClassViewMenuButton : public CMFCToolBarMenuButton +{ + friend class CNavView; + + DECLARE_SERIAL(CClassViewMenuButton) + +public: + CClassViewMenuButton(HMENU hMenu = nullptr) noexcept : CMFCToolBarMenuButton((UINT)-1, hMenu, -1) + { + } + + virtual void OnDraw(CDC* pDC, const CRect& rect, CMFCToolBarImages* pImages, BOOL bHorz = TRUE, + BOOL bCustomizeMode = FALSE, BOOL bHighlight = FALSE, BOOL bDrawBorder = TRUE, BOOL bGrayDisabledButtons = TRUE) + { + pImages = CMFCToolBar::GetImages(); + + CAfxDrawState ds; + pImages->PrepareDrawImage(ds); + + CMFCToolBarMenuButton::OnDraw(pDC, rect, pImages, bHorz, bCustomizeMode, bHighlight, bDrawBorder, bGrayDisabledButtons); + + pImages->EndDrawImage(ds); + } +}; + +IMPLEMENT_SERIAL(CClassViewMenuButton, CMFCToolBarMenuButton, 1) + +////////////////////////////////////////////////////////////////////// +// 鏋勯��/鏋愭瀯 +////////////////////////////////////////////////////////////////////// + +CNavView::CNavView() noexcept +{ + m_nCurrSort = ID_SORTING_GROUPBYTYPE; +} + +CNavView::~CNavView() +{ +} + +BEGIN_MESSAGE_MAP(CNavView, CDockablePane) + ON_WM_CREATE() + ON_WM_SIZE() + ON_WM_CONTEXTMENU() +// ON_COMMAND(ID_CLASS_ADD_MEMBER_FUNCTION, OnClassAddMemberFunction) +// ON_COMMAND(ID_CLASS_ADD_MEMBER_VARIABLE, OnClassAddMemberVariable) +// ON_COMMAND(ID_CLASS_DEFINITION, OnClassDefinition) +// ON_COMMAND(ID_CLASS_PROPERTIES, OnClassProperties) + ON_COMMAND(ID_NEW_FOLDER, OnNewFolder) + ON_WM_PAINT() + ON_WM_SETFOCUS() + ON_COMMAND_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS, OnSort) + ON_UPDATE_COMMAND_UI_RANGE(ID_SORTING_GROUPBYTYPE, ID_SORTING_SORTBYACCESS, OnUpdateSort) + +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CNavView 娑堟伅澶勭悊绋嬪簭 + +int CNavView::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CDockablePane::OnCreate(lpCreateStruct) == -1) + return -1; + + CRect rectDummy; + rectDummy.SetRectEmpty(); + + // 鍒涘缓瑙嗗浘: + const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | TVS_LINESATROOT | TVS_HASLINES | TVS_HASBUTTONS | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // + + if (!m_wndNavView.Create(dwViewStyle, rectDummy, this, 2)) + { + TRACE0("鏈兘鍒涘缓瀵艰埅鏍忚鍥綷n"); + return -1; // 鏈兘鍒涘缓 + } + + // 鍔犺浇鍥惧儚: + m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_SORT); + m_wndToolBar.LoadToolBar(IDR_SORT, 0, 0, TRUE /* 宸查攣瀹�*/); + + OnChangeVisualStyle(); + + m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY); + m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT)); + + m_wndToolBar.SetOwner(this); + + // 鎵�鏈夊懡浠ゅ皢閫氳繃姝ゆ帶浠惰矾鐢憋紝鑰屼笉鏄�氳繃涓绘鏋惰矾鐢�: + m_wndToolBar.SetRouteCommandsViaFrame(FALSE); + + CMenu menuSort; + menuSort.LoadMenu(IDR_POPUP_SORT); + + m_wndToolBar.ReplaceButton(ID_SORT_MENU, CClassViewMenuButton(menuSort.GetSubMenu(0)->GetSafeHmenu())); + + CClassViewMenuButton* pButton = DYNAMIC_DOWNCAST(CClassViewMenuButton, m_wndToolBar.GetButton(0)); + + if (pButton != nullptr) + { + pButton->m_bText = FALSE; + pButton->m_bImage = TRUE; + pButton->SetImage(GetCmdMgr()->GetCmdImage(m_nCurrSort)); + pButton->SetMessageWnd(this); + } + + // 濉叆涓�浜涢潤鎬佹爲瑙嗗浘鏁版嵁(姝ゅ鍙渶濉叆铏氭嫙浠g爜锛岃�屼笉鏄鏉傜殑鏁版嵁) + FillClassView(); + + return 0; +} + +void CNavView::OnSize(UINT nType, int cx, int cy) +{ + CDockablePane::OnSize(nType, cx, cy); + AdjustLayout(); +} + +void CNavView::FillClassView() +{ + HTREEITEM hRoot1 = m_wndNavView.InsertItem(_T("杩炴帴鐘舵��"), 0, 0); + m_wndNavView.SetItemState(hRoot1, TVIS_BOLD, TVIS_BOLD); + + HTREEITEM hClass1 = m_wndNavView.InsertItem(_T("KL10-E16D-N1"), 1, 1, hRoot1); + m_wndNavView.InsertItem(_T("宸ヤ綔妯″紡"), 3, 3, hClass1); + m_wndNavView.InsertItem(_T("鐘舵��"), 3, 3, hClass1); + m_wndNavView.InsertItem(_T("绯荤粺鍙傛暟"), 3, 3, hClass1); + m_wndNavView.Expand(hRoot1, TVE_EXPAND); + + HTREEITEM hClass2 = m_wndNavView.InsertItem(_T("CFakeAboutDlg"), 1, 1, hRoot1); + m_wndNavView.InsertItem(_T("CFakeAboutDlg()"), 3, 3, hClass2); + + HTREEITEM hClass3 = m_wndNavView.InsertItem(_T("CFakeAppDoc"), 1, 1, hRoot1); + m_wndNavView.InsertItem(_T("CFakeAppDoc()"), 4, 4, hClass3); + m_wndNavView.InsertItem(_T("~CFakeAppDoc()"), 3, 3, hClass3); + m_wndNavView.InsertItem(_T("OnNewDocument()"), 3, 3, hClass3); + + HTREEITEM hClass4 = m_wndNavView.InsertItem(_T("CFakeAppView"), 1, 1, hRoot1); + m_wndNavView.InsertItem(_T("CFakeAppView()"), 4, 4, hClass4); + m_wndNavView.InsertItem(_T("~CFakeAppView()"), 3, 3, hClass4); + m_wndNavView.InsertItem(_T("GetDocument()"), 3, 3, hClass4); + m_wndNavView.Expand(hClass4, TVE_EXPAND); + + HTREEITEM hClass5 = m_wndNavView.InsertItem(_T("Globals"), 2, 2, hRoot1); + m_wndNavView.InsertItem(_T("theFakeApp"), 5, 5, hClass5); + m_wndNavView.Expand(hClass5, TVE_EXPAND); + + HTREEITEM hRoot2 = m_wndNavView.InsertItem(_T("杩炴帴鐘舵��2"), 0, 0); + m_wndNavView.SetItemState(hRoot2, TVIS_BOLD, TVIS_BOLD); + + +} + +void CNavView::OnContextMenu(CWnd* pWnd, CPoint point) +{ + CTreeCtrl* pWndTree = (CTreeCtrl*)&m_wndNavView; + ASSERT_VALID(pWndTree); + + if (pWnd != pWndTree) + { + CDockablePane::OnContextMenu(pWnd, point); + return; + } + + if (point != CPoint(-1, -1)) + { + // 閫夋嫨宸插崟鍑荤殑椤�: + CPoint ptTree = point; + pWndTree->ScreenToClient(&ptTree); + + UINT flags = 0; + HTREEITEM hTreeItem = pWndTree->HitTest(ptTree, &flags); + if (hTreeItem != nullptr) + { + pWndTree->SelectItem(hTreeItem); + } + } + + pWndTree->SetFocus(); + CMenu menu; + menu.LoadMenu(IDR_POPUP_SORT); + + CMenu* pSumMenu = menu.GetSubMenu(0); + + if (AfxGetMainWnd()->IsKindOf(RUNTIME_CLASS(CMDIFrameWndEx))) + { + CMFCPopupMenu* pPopupMenu = new CMFCPopupMenu; + + if (!pPopupMenu->Create(this, point.x, point.y, (HMENU)pSumMenu->m_hMenu, FALSE, TRUE)) + return; + + ((CMDIFrameWndEx*)AfxGetMainWnd())->OnShowPopupMenu(pPopupMenu); + UpdateDialogControls(this, FALSE); + } +} + +void CNavView::AdjustLayout() +{ + if (GetSafeHwnd() == nullptr) + { + return; + } + + CRect rectClient; + GetClientRect(rectClient); + + int cyTlb = m_wndToolBar.CalcFixedLayout(FALSE, TRUE).cy; + + m_wndToolBar.SetWindowPos(nullptr, rectClient.left, rectClient.top, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER); + m_wndNavView.SetWindowPos(nullptr, rectClient.left + 1, rectClient.top + cyTlb + 1, rectClient.Width() - 2, rectClient.Height() - cyTlb - 2, SWP_NOACTIVATE | SWP_NOZORDER); +} + +BOOL CNavView::PreTranslateMessage(MSG* pMsg) +{ + return CDockablePane::PreTranslateMessage(pMsg); +} + +void CNavView::OnSort(UINT id) +{ + if (m_nCurrSort == id) + { + return; + } + + m_nCurrSort = id; + + CClassViewMenuButton* pButton = DYNAMIC_DOWNCAST(CClassViewMenuButton, m_wndToolBar.GetButton(0)); + + if (pButton != nullptr) + { + pButton->SetImage(GetCmdMgr()->GetCmdImage(id)); + m_wndToolBar.Invalidate(); + m_wndToolBar.UpdateWindow(); + } +} + +void CNavView::OnUpdateSort(CCmdUI* pCmdUI) +{ + pCmdUI->SetCheck(pCmdUI->m_nID == m_nCurrSort); +} + +void CNavView::OnClassAddMemberFunction() +{ + AfxMessageBox(_T("娣诲姞鎴愬憳鍑芥暟...")); +} + +void CNavView::OnClassAddMemberVariable() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲懡浠ゅ鐞嗙▼搴忎唬鐮� +} + +void CNavView::OnClassDefinition() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲懡浠ゅ鐞嗙▼搴忎唬鐮� +} + +void CNavView::OnClassProperties() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲懡浠ゅ鐞嗙▼搴忎唬鐮� +} + +void CNavView::OnNewFolder() +{ + AfxMessageBox(_T("鏂板缓鏂囦欢澶�...")); +} + +void CNavView::OnPaint() +{ + CPaintDC dc(this); // 鐢ㄤ簬缁樺埗鐨勮澶囦笂涓嬫枃 + + CRect rectTree; + m_wndNavView.GetWindowRect(rectTree); + ScreenToClient(rectTree); + + rectTree.InflateRect(1, 1); + dc.Draw3dRect(rectTree, ::GetSysColor(COLOR_3DSHADOW), ::GetSysColor(COLOR_3DSHADOW)); +} + +void CNavView::OnSetFocus(CWnd* pOldWnd) +{ + CDockablePane::OnSetFocus(pOldWnd); + + m_wndNavView.SetFocus(); +} + +void CNavView::OnChangeVisualStyle() +{ + m_NavViewImages.DeleteImageList(); + + UINT uiBmpId = theApp.m_bHiColorIcons ? IDB_CLASS_VIEW_24 : IDB_CLASS_VIEW; +// uiBmpId = IDB_NAV_VIEW1; + CBitmap bmp; + if (!bmp.LoadBitmap(uiBmpId)) + { + TRACE(_T("鏃犳硶鍔犺浇浣嶅浘: %x\n"), uiBmpId); + ASSERT(FALSE); + return; + } + + BITMAP bmpObj; + bmp.GetBitmap(&bmpObj); + + UINT nFlags = ILC_MASK; + + nFlags |= (theApp.m_bHiColorIcons) ? ILC_COLOR24 : ILC_COLOR4; + + m_NavViewImages.Create(16, bmpObj.bmHeight, nFlags, 0, 0); + m_NavViewImages.Add(&bmp, RGB(255, 0, 0)); + + m_wndNavView.SetImageList(&m_NavViewImages, TVSIL_NORMAL); + + m_wndToolBar.CleanUpLockedImages(); + m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_SORT_24 : IDR_SORT, 0, 0, TRUE /* 閿佸畾*/); +} diff --git a/MTerm2/NavView.h b/MTerm2/NavView.h new file mode 100644 index 0000000..cca5028 --- /dev/null +++ b/MTerm2/NavView.h @@ -0,0 +1,54 @@ +锘� +#pragma once + +#include "ViewTree.h" + +class CNavToolBar : public CMFCToolBar +{ + virtual void OnUpdateCmdUI(CFrameWnd* /*pTarget*/, BOOL bDisableIfNoHndler) + { + CMFCToolBar::OnUpdateCmdUI((CFrameWnd*) GetOwner(), bDisableIfNoHndler); + } + + virtual BOOL AllowShowOnList() const { return FALSE; } +}; + +class CNavView : public CDockablePane +{ +public: + CNavView() noexcept; + virtual ~CNavView(); + + void AdjustLayout(); + void OnChangeVisualStyle(); + +protected: + CNavToolBar m_wndToolBar; + CViewTree m_wndNavView; + CImageList m_NavViewImages; + UINT m_nCurrSort; + + void FillClassView(); + +// 閲嶅啓 +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 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); + + DECLARE_MESSAGE_MAP() +}; + diff --git a/MTerm2/PropCommCfg.cpp b/MTerm2/PropCommCfg.cpp new file mode 100644 index 0000000..4a4b264 --- /dev/null +++ b/MTerm2/PropCommCfg.cpp @@ -0,0 +1,34 @@ +锘�// PropCommCfg.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "PropCommCfg.h" +#include "afxdialogex.h" + + +// CPropCommCfg 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CPropCommCfg, CDialogEx) + +CPropCommCfg::CPropCommCfg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_PROP_COMM_CFG, pParent) +{ + +} + +CPropCommCfg::~CPropCommCfg() +{ +} + +void CPropCommCfg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CPropCommCfg, CDialogEx) +END_MESSAGE_MAP() + + +// CPropCommCfg 娑堟伅澶勭悊绋嬪簭 diff --git a/MTerm2/PropCommCfg.h b/MTerm2/PropCommCfg.h new file mode 100644 index 0000000..9415ae5 --- /dev/null +++ b/MTerm2/PropCommCfg.h @@ -0,0 +1,23 @@ +锘�#pragma once + + +// CPropCommCfg 瀵硅瘽妗� + +class CPropCommCfg : public CDialogEx +{ + DECLARE_DYNAMIC(CPropCommCfg) + +public: + CPropCommCfg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CPropCommCfg(); + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_PROP_COMM_CFG }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + + DECLARE_MESSAGE_MAP() +}; diff --git a/MTerm2/PropInputCfg.cpp b/MTerm2/PropInputCfg.cpp new file mode 100644 index 0000000..cba2047 --- /dev/null +++ b/MTerm2/PropInputCfg.cpp @@ -0,0 +1,34 @@ +锘�// PropInputCfg.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "PropInputCfg.h" +#include "afxdialogex.h" + + +// CPropInputCfg 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CPropInputCfg, CDialogEx) + +CPropInputCfg::CPropInputCfg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_PROP_INPUT_CFG, pParent) +{ + +} + +CPropInputCfg::~CPropInputCfg() +{ +} + +void CPropInputCfg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CPropInputCfg, CDialogEx) +END_MESSAGE_MAP() + + +// CPropInputCfg 娑堟伅澶勭悊绋嬪簭 diff --git a/MTerm2/PropInputCfg.h b/MTerm2/PropInputCfg.h new file mode 100644 index 0000000..a3aed5e --- /dev/null +++ b/MTerm2/PropInputCfg.h @@ -0,0 +1,23 @@ +锘�#pragma once + + +// CPropInputCfg 瀵硅瘽妗� + +class CPropInputCfg : public CDialogEx +{ + DECLARE_DYNAMIC(CPropInputCfg) + +public: + CPropInputCfg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CPropInputCfg(); + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_PROP_INPUT_CFG }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + + DECLARE_MESSAGE_MAP() +}; diff --git a/MTerm2/PropMemCfg.cpp b/MTerm2/PropMemCfg.cpp new file mode 100644 index 0000000..5f1815d --- /dev/null +++ b/MTerm2/PropMemCfg.cpp @@ -0,0 +1,34 @@ +锘�// PropMemCfg.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "PropMemCfg.h" +#include "afxdialogex.h" + + +// CPropMemCfg 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CPropMemCfg, CDialogEx) + +CPropMemCfg::CPropMemCfg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_PROP_MEM_CFG, pParent) +{ + +} + +CPropMemCfg::~CPropMemCfg() +{ +} + +void CPropMemCfg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CPropMemCfg, CDialogEx) +END_MESSAGE_MAP() + + +// CPropMemCfg 娑堟伅澶勭悊绋嬪簭 diff --git a/MTerm2/PropMemCfg.h b/MTerm2/PropMemCfg.h new file mode 100644 index 0000000..f935193 --- /dev/null +++ b/MTerm2/PropMemCfg.h @@ -0,0 +1,23 @@ +锘�#pragma once + + +// CPropMemCfg 瀵硅瘽妗� + +class CPropMemCfg : public CDialogEx +{ + DECLARE_DYNAMIC(CPropMemCfg) + +public: + CPropMemCfg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CPropMemCfg(); + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_PROP_MEM_CFG }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + + DECLARE_MESSAGE_MAP() +}; diff --git a/MTerm2/PropModeCfg.cpp b/MTerm2/PropModeCfg.cpp new file mode 100644 index 0000000..e4e5487 --- /dev/null +++ b/MTerm2/PropModeCfg.cpp @@ -0,0 +1,34 @@ +锘�// PropModeCfg.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "PropModeCfg.h" +#include "afxdialogex.h" + + +// CPropModeCfg 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CPropModeCfg, CDialogEx) + +CPropModeCfg::CPropModeCfg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_PROP_MODE_CFG1, pParent) +{ + +} + +CPropModeCfg::~CPropModeCfg() +{ +} + +void CPropModeCfg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CPropModeCfg, CDialogEx) +END_MESSAGE_MAP() + + +// CPropModeCfg 娑堟伅澶勭悊绋嬪簭 diff --git a/MTerm2/PropModeCfg.h b/MTerm2/PropModeCfg.h new file mode 100644 index 0000000..7538b2e --- /dev/null +++ b/MTerm2/PropModeCfg.h @@ -0,0 +1,23 @@ +锘�#pragma once + + +// CPropModeCfg 瀵硅瘽妗� + +class CPropModeCfg : public CDialogEx +{ + DECLARE_DYNAMIC(CPropModeCfg) + +public: + CPropModeCfg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CPropModeCfg(); + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_PROP_MODE_CFG1 }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + + DECLARE_MESSAGE_MAP() +}; diff --git a/MTerm2/PropOutputCfg.cpp b/MTerm2/PropOutputCfg.cpp new file mode 100644 index 0000000..3b111a0 --- /dev/null +++ b/MTerm2/PropOutputCfg.cpp @@ -0,0 +1,34 @@ +锘�// PropOutputCfg.cpp: 瀹炵幇鏂囦欢 +// + +#include "pch.h" +#include "MTerm2.h" +#include "PropOutputCfg.h" +#include "afxdialogex.h" + + +// CPropOutputCfg 瀵硅瘽妗� + +IMPLEMENT_DYNAMIC(CPropOutputCfg, CDialogEx) + +CPropOutputCfg::CPropOutputCfg(CWnd* pParent /*=nullptr*/) + : CDialogEx(IDD_PROP_OUTPUT_SET, pParent) +{ + +} + +CPropOutputCfg::~CPropOutputCfg() +{ +} + +void CPropOutputCfg::DoDataExchange(CDataExchange* pDX) +{ + CDialogEx::DoDataExchange(pDX); +} + + +BEGIN_MESSAGE_MAP(CPropOutputCfg, CDialogEx) +END_MESSAGE_MAP() + + +// CPropOutputCfg 娑堟伅澶勭悊绋嬪簭 diff --git a/MTerm2/PropOutputCfg.h b/MTerm2/PropOutputCfg.h new file mode 100644 index 0000000..a77b836 --- /dev/null +++ b/MTerm2/PropOutputCfg.h @@ -0,0 +1,23 @@ +锘�#pragma once + + +// CPropOutputCfg 瀵硅瘽妗� + +class CPropOutputCfg : public CDialogEx +{ + DECLARE_DYNAMIC(CPropOutputCfg) + +public: + CPropOutputCfg(CWnd* pParent = nullptr); // 鏍囧噯鏋勯�犲嚱鏁� + virtual ~CPropOutputCfg(); + +// 瀵硅瘽妗嗘暟鎹� +#ifdef AFX_DESIGN_TIME + enum { IDD = IDD_PROP_OUTPUT_SET }; +#endif + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔 + + DECLARE_MESSAGE_MAP() +}; diff --git a/MTerm2/CPropSysReg1.cpp b/MTerm2/PropSysReg1.cpp similarity index 97% rename from MTerm2/CPropSysReg1.cpp rename to MTerm2/PropSysReg1.cpp index 85b51e2..3f66489 100644 --- a/MTerm2/CPropSysReg1.cpp +++ b/MTerm2/PropSysReg1.cpp @@ -3,7 +3,7 @@ #include "pch.h" #include "MTerm2.h" -#include "CPropSysReg1.h" +#include "PropSysReg1.h" #include "afxdialogex.h" @@ -46,8 +46,8 @@ GetClientRect(&rect0); CString s1; s1.Format(_T("OnInit H %d "), rect0.bottom - rect0.top); - GetDlgItem(IDC_EDIT1)->SetWindowText(s1); - ShowParams(); +// GetDlgItem(IDC_EDIT1)->SetWindowText(s1); +// ShowParams(); return TRUE; // return TRUE unless you set the focus to a control // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE diff --git a/MTerm2/CPropSysReg1.h b/MTerm2/PropSysReg1.h similarity index 94% rename from MTerm2/CPropSysReg1.h rename to MTerm2/PropSysReg1.h index aaf591d..02e2ce4 100644 --- a/MTerm2/CPropSysReg1.h +++ b/MTerm2/PropSysReg1.h @@ -13,7 +13,7 @@ // 瀵硅瘽妗嗘暟鎹� #ifdef AFX_DESIGN_TIME - enum { IDD = IDD_PROPPAGE_SYSREG1 }; + enum { IDD = IDD_PROP_SYSREG1 }; #endif protected: diff --git a/MTerm2/ViewTree.cpp b/MTerm2/ViewTree.cpp new file mode 100644 index 0000000..86fca26 --- /dev/null +++ b/MTerm2/ViewTree.cpp @@ -0,0 +1,74 @@ +锘� +#include "pch.h" +#include "framework.h" +#include "ViewTree.h" +#include "MTerm2.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CViewTree + +CViewTree::CViewTree() noexcept +{ +} + +CViewTree::~CViewTree() +{ +} + +BEGIN_MESSAGE_MAP(CViewTree, CTreeCtrl) + ON_NOTIFY_REFLECT(NM_DBLCLK, &CViewTree::OnDblClkTree) + ON_NOTIFY_REFLECT(NM_CLICK, &CViewTree::OnClkTree) + +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CViewTree 娑堟伅澶勭悊绋嬪簭 + +BOOL CViewTree::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) +{ + BOOL bRes = CTreeCtrl::OnNotify(wParam, lParam, pResult); + + NMHDR* pNMHDR = (NMHDR*)lParam; + ASSERT(pNMHDR != nullptr); + + if (pNMHDR && pNMHDR->code == TTN_SHOW && GetToolTips() != nullptr) + { + GetToolTips()->SetWindowPos(&wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSIZE); + } + + return bRes; +} + +void CViewTree::OnClkTree(NMHDR* pNMHDR, LRESULT* pResult) +{ + + HTREEITEM hTreeItem = GetSelectedItem(); + //浠etItemText()鍑芥暟涓轰緥锛� + CString S1 = GetItemText(hTreeItem); +// AfxMessageBox(_T("You have selected ") + S1); + + *pResult = 0; + +} + +void CViewTree::OnDblClkTree(NMHDR* pNMHDR, LRESULT* pResult) +{ + LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); + + HTREEITEM hTreeItem = GetSelectedItem(); + //浠etItemText()鍑芥暟涓轰緥锛� + CString s2 = GetItemText(hTreeItem); + //AfxMessageBox(_T("You have selected ") + s1); + CString s1; + s1.Format(_T("dbclk Code %d, id %d %d %d %s "), pNMTreeView->action,pNMTreeView->itemOld.hItem, pNMTreeView->ptDrag.x, pNMTreeView->ptDrag.y,s2); + + SysLog(s1); + + *pResult = 0; +} diff --git a/MTerm2/ViewTree.h b/MTerm2/ViewTree.h new file mode 100644 index 0000000..473e482 --- /dev/null +++ b/MTerm2/ViewTree.h @@ -0,0 +1,24 @@ +锘� +#pragma once + +///////////////////////////////////////////////////////////////////////////// +// CViewTree 绐楀彛 + +class CViewTree : public CTreeCtrl +{ +// 鏋勯�� +public: + CViewTree() noexcept; + +// 閲嶅啓 +protected: + virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult); + +// 瀹炵幇 +public: + virtual ~CViewTree(); + afx_msg void OnDblClkTree(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnClkTree(NMHDR* pNMHDR, LRESULT* pResult); +protected: + DECLARE_MESSAGE_MAP() +}; diff --git a/MTerm2/design1.txt b/MTerm2/design1.txt new file mode 100644 index 0000000..01a5f5b --- /dev/null +++ b/MTerm2/design1.txt @@ -0,0 +1,103 @@ + +设备描述文件 + +可以有多个设备描述文件 + +一个设备描述文件里面可以有多个设备。 + +设备信息块 尺寸 解析 + +数据说明文件。 + +INT8,UINT8,INT16,UINT16,INT32,UINT32.FLOAT32,BIT. 地址偏移. 100.5.长度 bit. + +INT,(INT8,INT16,INT32)有符号整型 +UINT,(UINT8,UINT16,UINT32),无符号整数 +BIN.(HEX)二进制数,按位显示。 +FLOAT(FLOAT16,FLOAT32),浮点数,按小数显示。 + +定点数,定点数有两种,1种是按二进制分,几位整数,几位小数。 +另外一直是倍率关系,都是整数,最后除以10或100或1000,即显示的时候,小数点左移几位。 + +FIX,(FIX8,FIX16,FIX24,FIX32),定点小数,按小数显示。 +FIX.1, 1位二进制小数。 + +BIT, +地址偏移, 纯数字表示字节/字地址,带.后数字表示位地址。 + +地址有两种表示方法。 +1,纯10进制, 100.15 +2,16进制 10CH.F + + +注册登录监视内容。 + +一次性读取。 + + +#地址 +#地址,长度(字节/位),类型,显示名称,转换算式,注释 + +#地址,长度, 类型, 名称, 算式, 注释。 +0000, 2, BIN, 工作模式, + +VCC5,U16,20,2B,5V电压 + + +DIB + +自检 + +说明书 + + +数据图表功能 + + + +组态显示功能 + +元素 +1,文本, + 字体,颜色,位置,内容。 + + + +chart display + + +一个图表中,数据序列数量。 + + +数据类型/格式 + +内存中连续数据组/单个地址,连续采集的数据。 + +数据类型 Bit/Byte/short/dword/int/UINT/float/string +数据长度 ?b/?B +数据地址 + + +当前状态 状态机 + +几个独立的定时器。 +1秒才计算。写入日志 。 + + + +出厂参数设置 + +读取唯一UID。 +读取硬件型号。 + +读取原来的出厂参数 显示/未设置状态。 +遇到UID重复 -> +遇到已经配置过出厂参数 -> ? 覆盖原来的参数? 使用原来的SN? + + + +自动写入 +写入完成后, 显示提示,播放声音,触发硬件动作/打印条码, 存储倒数据库, 提交到服务器。 + + + diff --git a/MTerm2/devices.cfg b/MTerm2/devices.cfg new file mode 100644 index 0000000..ebebb64 --- /dev/null +++ b/MTerm2/devices.cfg @@ -0,0 +1,147 @@ +[璁惧鎻忚堪鏂囦欢] + +[DEVICETYPES] +0=UNKNOWN +1=KL10-E04D-N1 +2=KL10-E08D-N1 +3=KL10-E16D-N2 +4=KL10-E08D-N2 +5=KL10-E16D-N3 +6=KL10-E08D-N3 +7=KL10-E16D-N4 +8=KL10-E08D-N4 +9=KL10-E16D-N42 +10=KL10-E08D-N42 +11=KL10-E08DMINI-N1 + +[KL10-E04D-N1] + +[KL10-E08D-N1] + +[KL10-E16D-N2] + +[KL10-E08D-N2] + +[KL10-E16D-N3] + +[KL10-E08D-N3] + +[KL10-E16D-N4] + +[KL10-E08D-N4] + +[KL10-E16D-N42] +Sign=9 +DigitalInput=16,NPN ;鏁板瓧杈撳叆=16 +Interrupt=0 ;涓柇杈撳叆=0 +AnalogInput=0 ;妯℃嫙杈撳叆=0 +HighSpeedCnt=0 ;楂橀�熻鏁板櫒杈撳叆=0 +DigitalOutPut=16,NPN ;鏁板瓧杈撳嚭=16; +AnalogOutput=0 ;妯℃嫙杈撳嚭 +PulseOutput=0 ;鑴夊啿杈撳嚭 +DIP=6 ;鎷ㄧ爜寮�鍏充綅鏁� +COMM232=1 +COMM485=1 + +鍔熻兘; +纭欢 + +24V杈撳叆绔瓙 +鐢垫簮闃插弽鎺ヤ繚鎶� +鐢垫簮杩囨祦淇濋櫓 + +24V杈撳嚭绔瓙 +24V杈撳嚭闄愭祦鐢甸樆 + +鏁板瓧閲忚緭鍏ョ瀛� +鏁板瓧閲忚緭鍏ュ叕鍏辩 +鏁板瓧閲忚緭鍏ユ瀬鎬ц浆鎹S + +涓柇杈撳叆绔彛 +楂橀�熻鏁板櫒杈撳叆绔彛 +妯℃嫙閲忚緭鍏ョ鍙� +闆嗘垚鐨勬ā鎷熺數浣嶅櫒 +鐑數闃婚噰鏍锋帴鍙� +鐑數鍋堕噰鏍锋帴鍙� + + +鏁板瓧閲忚緭鍑虹瀛� +鏁板瓧閲忚緭鍑洪檺娴佷繚闄� +杈撳叆鏂嚎妫�娴嬬數璺�� +杈撳嚭鏂嚎妫�娴嬬數璺� +杈撳嚭鐭矾妫�娴嬬數璺� +杈撳嚭鏁呴殰妫�娴嬬數璺� + +妯℃嫙閲忚緭鍑虹鍙� +楂橀�熻剦鍐茶緭鍑虹鍙� +鐩存祦鐢垫満椹卞姩 +姝ヨ繘鐢垫満椹卞姩 +鐩存祦鏃犲埛鐢垫満椹卞姩 +鍒硅溅鎺у埗淇″彿 +鍘熺偣杈撳叆淇″彿銆� +闄愪綅杈撳叆淇″彿 + + +鍙岀嚎锛堝彧鏈夌數婧愮嚎锛夐�氳绔瓙 +鑷姩鐢垫簮鏋佹�ц浆鎹� + + +RS485閫氳 +RS485绔瓙 +RS485绔彛鐢垫皵闅旂 +RS485绔彛鍏叡绔瀛� +RS485鏂嚎妫�娴嬬數璺� +鍙岃矾RS485鎺ョ嚎绔彛 + +RS232绔彛 +USB鎺ュ彛 +鍐呴儴鎵╁睍鎺ュ彛 +澶栭儴鎵╁睍鎺ュ彛 +鎸囩ず鐏滑,24V鐢垫簮,5V,3.3V,RUN,ERR,GOOD +鎸囩ず鐏滑,闅旂5V,RXD,TXD,DE,RS232-RXD1,-TXD1銆� + +缃戠粶鎺ュ彛 +鍏夌氦鎺ュ彛 +鏃犵嚎鎺ュ彛 +WIFI +钃濈墮 +RS485鍙彉娉㈢壒鐜� + + +鐢垫簮鐢靛帇妫�娴嬬數璺� +寮�鍏冲紡5V鐢垫簮 +5V鐢靛帇妫�娴嬬數璺� +3.3V鐢靛帇妫�娴嬪姛鑳� +鑺墖娓╁害妫�娴嬪姛鑳� +鍚庡鐢垫睜 +瀹炴椂鏃堕挓 +SPIFlash鎵╁睍 +TF鍗℃帴鍙� +鏄剧ず鐢↙ED鏁扮爜绠� +GOOD鎸囩ず鐏� +GOOD杈撳嚭绔瓙 +ERR鎸囩ず鐏� +RUN鎸囩ず鐏� +澶栭儴SPI鎵╁睍 + +琛屽垪鎸夐敭鐭╅樀鎵弿鐢佃矾 +娈电爜LED杈撳嚭椹卞姩鐢佃矾 +LCD灞忛┍鍔� + +铚傞福鍣� +鎵0鍣� +鎷鹃煶鍣� + +杞欢 +MODBUS RTU SERVER +MODBUS RTU CLIENT +杩愯鏃ュ織璁板綍 +鐢垫簮闂柇璁板綍 + + +Factory1=纭欢鍨嬪彿,String,16,FFFF0000@ROM +factory2=纭欢鍞竴ID,HEX,12,FFFF0000@ROM +Prop1= +[KL10-E08D-N42] + +[KL10-E08DMINI-N1] diff --git a/MTerm2/pch.h b/MTerm2/pch.h index 681fca6..47a715b 100644 --- a/MTerm2/pch.h +++ b/MTerm2/pch.h @@ -20,5 +20,11 @@ #include <afxcontrolbars.h> #include <afxcontrolbars.h> #include <afxcontrolbars.h> +#include <afxcontrolbars.h> +#include <afxcontrolbars.h> +#include <afxcontrolbars.h> +#include <afxcontrolbars.h> +#include <afxcontrolbars.h> +#include <afxcontrolbars.h> #endif //PCH_H diff --git a/MTerm2/res/bitmap1.bmp b/MTerm2/res/bitmap1.bmp new file mode 100644 index 0000000..a35c872 --- /dev/null +++ b/MTerm2/res/bitmap1.bmp Binary files differ diff --git a/MTerm2/res/class_view.ico b/MTerm2/res/class_view.ico new file mode 100644 index 0000000..b356c43 --- /dev/null +++ b/MTerm2/res/class_view.ico Binary files differ diff --git a/MTerm2/res/class_view_hc.ico b/MTerm2/res/class_view_hc.ico new file mode 100644 index 0000000..1aca44e --- /dev/null +++ b/MTerm2/res/class_view_hc.ico Binary files differ diff --git a/MTerm2/res/classview.bmp b/MTerm2/res/classview.bmp new file mode 100644 index 0000000..1e02aa1 --- /dev/null +++ b/MTerm2/res/classview.bmp Binary files differ diff --git a/MTerm2/res/classview_hc.bmp b/MTerm2/res/classview_hc.bmp new file mode 100644 index 0000000..6b22e78 --- /dev/null +++ b/MTerm2/res/classview_hc.bmp Binary files differ diff --git a/MTerm2/res/sort.bmp b/MTerm2/res/sort.bmp new file mode 100644 index 0000000..0307301 --- /dev/null +++ b/MTerm2/res/sort.bmp Binary files differ diff --git a/MTerm2/res/sort_hc.bmp b/MTerm2/res/sort_hc.bmp new file mode 100644 index 0000000..720e742 --- /dev/null +++ b/MTerm2/res/sort_hc.bmp Binary files differ diff --git a/MTerm2/resource.h b/MTerm2/resource.h index 88cebdf..c370656 100644 --- a/MTerm2/resource.h +++ b/MTerm2/resource.h @@ -8,6 +8,7 @@ #define IDD_DIALOGBAR_MDI_INFO 103 #define IDP_SOCKETS_INIT_FAILED 104 #define IDD_PROPPAGE_SYSREG1 106 +#define IDD_PROP_SYSREG1 106 #define IDR_MAINFRAME 128 #define IDR_MultiTerminal2TYPE 130 #define IDR_MTerm2TYPE 130 @@ -18,15 +19,28 @@ #define IDD_DIALOG_COMMSET1 137 #define IDD_DIALOG_INFO_DISPLAY 139 #define IDD_DIALOG_DATA_MON 142 +#define ID_NEW_FOLDER 143 #define IDD_DIALOG_COMMTEST 144 #define IDD_MTerm2CommTestView 144 +#define ID_SORT_MENU 144 +#define ID_SORTING_GROUPBYTYPE 145 +#define ID_SORTING_SORTALPHABETIC 146 #define IDD_DIALOG_STATUS_SHOW 147 +#define ID_SORTING_SORTBYTYPE 147 +#define ID_SORTING_SORTBYACCESS 148 #define IDD_DIALOG_SYSREG_SET 149 #define IDD_DIALOG_COIL_MON 151 #define IDD_DIALOG_PROGRESS 155 #define IDD_DIALOG_EVENTLOG 157 #define IDD_DIALOG_FORCE_IO 159 #define IDD_DIALOG_DATETIME 161 +#define IDI_CLASS_VIEW 163 +#define IDI_CLASS_VIEW_HC 164 +#define IDR_SORT 171 +#define IDB_SORT_24 172 +#define IDR_POPUP_SORT 173 +#define IDB_CLASS_VIEW 177 +#define IDB_CLASS_VIEW_24 178 #define IDR_TOOLBAR_NUM 310 #define IDD_MTerm2TestView 311 #define IDD_MTerm2CtrlView 312 @@ -35,6 +49,7 @@ #define IDW_TOOL_BAR2 315 #define IDD_DIALOG1 316 #define IDW_TOOL_BAR_EDIT 316 +#define ID_VIEW_NAVVIEW 317 #define IDD_DIALOG_SET_COIL 320 #define IDD_DIALOG_SET_DATA 321 #define IDR_MENU1 324 @@ -43,8 +58,16 @@ #define IDR_TOOLBAR_INPUT_SHOW 329 #define IDR_TOOLBAR_COMMENT 332 #define IDR_TOOLBAR_INFO_SHOW 334 +#define IDB_NAV_VIEW1 336 #define IDD_FORM_LOG 337 #define IDD_DIALOG_LOG 339 +#define IDD_PROP_INPUT_CFG 340 +#define IDD_PROP_OUTPUT_SET 341 +#define IDD_PROP_COMM_CFG 342 +#define IDD_PROP_MEM_CFG 343 +#define IDD_PROP_COMM_CFG1 344 +#define IDD_PROP_MODE_CFG1 344 +#define IDD_DIALOG_FACT_CFG 345 #define IDC_EDIT1 1000 #define IDC_BUTTON1 1001 #define IDC_BUTTON_LOAD 1001 @@ -77,48 +100,122 @@ #define IDC_STATIC_STAT_XY 1015 #define IDC_EDIT_IO_COMMENT 1015 #define IDC_STATIC_DRAW_XY 1016 +#define IDC_COMBO_INPUT_FILTER_1 1016 #define IDC_COMBO_MADDR 1017 +#define IDC_COMBO_OUTPUT_SET_1 1017 #define IDC_COMBO_CMD 1018 +#define IDC_STATIC_INPUT_NAME_1 1018 #define IDC_COMBO_CMD_TYPE 1019 +#define IDC_STATIC_INPUT_NAME_2 1019 +#define IDC_CHECK1 1019 #define IDC_COMBO_DADDR 1020 +#define IDC_COMBO_INPUT_FILTER_2 1020 +#define IDC_EDIT3 1020 #define IDC_COMBO_DCOUNT 1021 +#define IDC_STATIC_INPUT_NAME_3 1021 +#define IDC_EDIT4 1021 #define IDC_BUTTON_DO 1022 +#define IDC_COMBO_INPUT_FILTER_3 1022 +#define IDC_EDIT5 1022 #define IDC_EDIT_DATA1 1023 +#define IDC_STATIC_INPUT_NAME_4 1023 +#define IDC_EDIT6 1023 #define IDC_EDIT_DATA2 1024 +#define IDC_COMBO_INPUT_FILTER_4 1024 +#define IDC_EDIT7 1024 #define IDC_BUTTON_START_BULK_TEST 1025 +#define IDC_STATIC_INPUT_NAME_5 1025 +#define IDC_CHECK_AUTO_INC 1025 #define IDC_BUTTON_STOP_BULK_TEST 1026 +#define IDC_COMBO_INPUT_FILTER_5 1026 #define IDC_STATIC_SPEED 1027 +#define IDC_STATIC_INPUT_NAME_6 1027 #define IDC_CHECK_EXT_DATA 1028 +#define IDC_COMBO_INPUT_FILTER_6 1028 +#define IDC_DATETIMEPICKER1 1028 #define IDC_COMBO_EXT_TYPE 1029 +#define IDC_STATIC_INPUT_NAME_7 1029 +#define IDC_BUTTON_DISCONN 1029 #define IDC_COMBO_EXT_DST 1030 +#define IDC_COMBO_INPUT_FILTER_7 1030 +#define IDC_EDIT_KLINK_VER 1030 #define IDC_COMBO_EXT_DATA_LEN 1031 +#define IDC_STATIC_INPUT_NAME_8 1031 +#define IDC_CHECK_AUTO_WRITE 1031 #define IDC_EDIT_EXT_DATA1 1032 +#define IDC_COMBO_INPUT_FILTER_8 1032 +#define IDC_EDIT11 1032 #define IDC_EDIT_EXT_DATA2 1033 +#define IDC_STATIC_OUTPUT_NAME_1 1033 +#define IDC_EDIT12 1033 #define IDC_STATIC_MON 1034 +#define IDC_COMBO_OUTPUT_SET_2 1034 +#define IDC_BUTTON6 1034 #define IDC_STATIC_MON2 1035 +#define IDC_STATIC_OUTPUT_NAME_2 1035 +#define IDC_EDIT13 1035 #define IDC_TREE1 1036 +#define IDC_COMBO_OUTPUT_SET_3 1036 +#define IDC_EDIT1_FUNCTIONS 1036 #define IDC_EDIT_MON 1037 +#define IDC_STATIC_OUTPUT_NAME_3 1037 +#define IDC_BUTTON7 1037 #define IDC_EDIT_MON2 1038 +#define IDC_COMBO_OUTPUT_SET_4 1038 +#define IDC_BUTTON8 1038 +#define IDC_STATIC_OUTPUT_NAME_4 1039 +#define IDC_BUTTON_WRITEDATA 1039 #define IDC_BUTTON2 1040 +#define IDC_COMBO_OUTPUT_SET_5 1040 +#define IDC_CHECK_AUTO_CONN 1040 #define IDC_COMBO_NETWORK_TYPE 1041 +#define IDC_STATIC_OUTPUT_NAME_5 1041 +#define IDC_BUTTON_CONN 1041 #define IDC_COMBO_PORT 1042 +#define IDC_COMBO_OUTPUT_SET_6 1042 +#define IDC_EDIT_DEVICE_TYPE 1042 #define IDC_COMBO_BAUD 1043 +#define IDC_STATIC_OUTPUT_NAME_6 1043 +#define IDC_EDIT_DEVICE_UID 1043 #define IDC_COMBO_COMM_TIMEOUT 1044 +#define IDC_COMBO_OUTPUT_SET_7 1044 +#define IDC_EDIT_FIRM_VER 1044 #define IDC_RADIO_DATA_LENGTH_7B 1045 +#define IDC_STATIC_OUTPUT_NAME_7 1045 +#define IDC_EDIT_LOT_NO 1045 #define IDC_RADIO_DATA_LENGTH_8B 1046 +#define IDC_COMBO_OUTPUT_SET_8 1046 +#define IDC_EDIT_FACT_SN 1046 #define IDC_RADIO_STOP_1B 1047 +#define IDC_STATIC_OUTPUT_NAME_8 1047 +#define IDC_STATIC_CONN_STAT 1047 #define IDC_RADIO_STOP_2B 1048 +#define IDC_EDIT15 1048 #define IDC_RADIO_PARITY_NONE 1049 +#define IDC_CHECK2 1049 #define IDC_RADIO_PARITY_ODD 1050 +#define IDC_CHECK3 1050 #define IDC_RADIO_PARITY_EVEN 1051 +#define IDC_BUTTON9 1051 #define IDC_RADIO_PARITY_0 1052 +#define IDC_BUTTON_READDATA 1052 #define IDC_CHECK_AUTO_BAUD 1053 +#define IDC_STATIC_PROC_STAT 1053 #define IDC_CHECK_AUTO_DATA_LENGTH 1054 +#define IDC_EDIT_ORG_LOT_NO 1054 #define IDC_CHECK_AUTO_PARITY 1055 +#define IDC_EDIT_ORG_FACT_SN 1055 +#define IDC_EDIT_CAP 1056 #define IDC_LIST1 1057 +#define IDC_LIST_SEL1 1057 +#define IDC_EDIT_ORG_FAC_DATE 1057 +#define IDC_BUTTON31 1057 #define IDC_BUTTON3 1058 #define IDC_LIST_STATUS1 1059 +#define IDC_EDIT31 1059 #define IDC_COMBO1 1060 +#define IDC_EDIT8 1060 +#define IDC_EDIT32 1060 #define IDC_COMBO2 1061 #define IDC_COMBO3 1062 #define IDC_RADIO1 1063 @@ -399,6 +496,8 @@ #define ID_MENU_DATA_MON 33076 #define ID_MENU_COIL_MON 33077 #define ID_MENU_PLC_INFO_SHOW 33078 +#define ID_33079 33079 +#define ID_MENU_FACT_CFG 33080 #define ID_INDICATOR_SEL_TYPE 59135 #define ID_INDICATOR_MACHINE_TYPE 59142 #define ID_INDICATOR_PROGRAM_POS 59143 @@ -412,9 +511,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 336 -#define _APS_NEXT_COMMAND_VALUE 33079 -#define _APS_NEXT_CONTROL_VALUE 1016 -#define _APS_NEXT_SYMED_VALUE 317 +#define _APS_NEXT_RESOURCE_VALUE 349 +#define _APS_NEXT_COMMAND_VALUE 33081 +#define _APS_NEXT_CONTROL_VALUE 1061 +#define _APS_NEXT_SYMED_VALUE 318 #endif #endif -- Gitblit v1.9.1