From 8b96cadc838caf8d664e2d54576874bec299972a Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期四, 24 七月 2025 17:36:32 +0800
Subject: [PATCH] 1.EAP模拟器,增加Link Report加载功能,列表展示功能,修改Report ID功能,但未真正下发到指令到Master.

---
 SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.cpp           |   65 ++++
 SourceCode/Bond/EAPSimulator/CLinkReportDlg.h                   |   36 ++
 SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h                  |    1 
 SourceCode/Bond/EAPSimulator/EAPSimulator.rc                    |    0 
 Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.8(1).xlsx |    0 
 SourceCode/Bond/EAPSimulator/CReport.cpp                        |   98 +++++++
 SourceCode/Bond/EAPSimulator/EAPSimulator.h                     |    2 
 SourceCode/Bond/EAPSimulator/CReport.h                          |   28 ++
 SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters       |   30 ++
 SourceCode/Bond/EAPSimulator/Resource.h                         |   10 
 SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp                |   11 
 SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp               |  105 +++++++
 SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj               |   10 
 SourceCode/Bond/EAPSimulator/CVariable.cpp                      |   90 ++++++
 SourceCode/Bond/EAPSimulator/CVariable.h                        |   37 ++
 SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.h             |   31 ++
 SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp                 |  200 ++++++++++++++
 SourceCode/Bond/EAPSimulator/CCollectionEvent.h                 |   32 ++
 SourceCode/Bond/EAPSimulator/EAPSimulator.cpp                   |   11 
 19 files changed, 794 insertions(+), 3 deletions(-)

diff --git "a/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.8\0501\051.xlsx" "b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.8\0501\051.xlsx"
new file mode 100644
index 0000000..01341f2
--- /dev/null
+++ "b/Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.8\0501\051.xlsx"
Binary files differ
diff --git a/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp b/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
new file mode 100644
index 0000000..fcb5e86
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp
@@ -0,0 +1,105 @@
+#include "pch.h"
+#include "CCollectionEvent.h"
+
+
+namespace SERVO {
+	CCollectionEvent::CCollectionEvent()
+	{
+		m_nCEID = 0;
+	}
+
+	CCollectionEvent::CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids)
+	{
+		m_nCEID = id;
+		m_strName = pszName;
+		m_strDescription = pszDescription;
+		for (auto item : prtids) {
+			m_rptids.push_back(item);
+		}
+	}
+
+	CCollectionEvent::~CCollectionEvent()
+	{
+
+	}
+
+	unsigned int CCollectionEvent::getEventId()
+	{
+		return m_nCEID;
+	}
+
+	std::string& CCollectionEvent::getName()
+	{
+		return m_strName;
+	}
+
+	std::string& CCollectionEvent::getDescription()
+	{
+		return m_strDescription;
+	}
+
+	BOOL CCollectionEvent::addReport(CReport* pReport)
+	{
+		ASSERT(pReport);
+		if (getReport(pReport->getReportId()) != nullptr) {
+			return FALSE;
+		}
+
+		m_reports.push_back(pReport);
+		return TRUE;
+	}
+
+	BOOL CCollectionEvent::deleteReport(unsigned int nReportId)
+	{
+		BOOL bDelete = FALSE;
+		for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) {
+			if (nReportId == (*iter)->getReportId()) {
+				m_reports.erase(iter);
+				bDelete = TRUE;
+				break;
+			}
+		}
+
+		return bDelete;
+	}
+
+	CReport* CCollectionEvent::getReport(unsigned int nReportId)
+	{
+		for (auto item : m_reports) {
+			if (nReportId == item->getReportId()) {
+				return item;
+			}
+		}
+
+		return nullptr;
+	}
+
+	void CCollectionEvent::setReport(unsigned int nReportId)
+	{
+		m_rptids.clear();
+		if (nReportId != 0) {
+			m_rptids.push_back(nReportId);
+		}
+	}
+
+	std::vector<CReport*>& CCollectionEvent::getReports()
+	{
+		return m_reports;
+	}
+
+	std::string CCollectionEvent::getReportIdsText()
+	{
+		std::string strResult, strName;
+		for (int i = 0; i < m_rptids.size(); i++) {
+			strResult += std::to_string(m_rptids[i]);// (getReport(m_rptids[i]) ?
+			if (nullptr == getReport(m_rptids[i])) {
+				strResult += "";
+			}
+			if (i != m_rptids.size() - 1) {
+				strResult += ",";
+			}
+		}
+
+		return strResult;
+	}
+}
diff --git a/SourceCode/Bond/EAPSimulator/CCollectionEvent.h b/SourceCode/Bond/EAPSimulator/CCollectionEvent.h
new file mode 100644
index 0000000..b999c55
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CCollectionEvent.h
@@ -0,0 +1,32 @@
+#pragma once
+#include "CReport.h"
+#include <vector>
+
+
+namespace SERVO {
+	class CCollectionEvent
+	{
+	public:
+		CCollectionEvent();
+		CCollectionEvent(unsigned int id, const char* pszName, const char* pszDescription, std::vector<unsigned int>& prtids);
+		virtual ~CCollectionEvent();
+
+	public:
+		unsigned int getEventId();
+		std::string& getName();
+		std::string& getDescription();
+		std::vector<CReport*>& getReports();
+		std::string getReportIdsText();
+		BOOL addReport(CReport* pReport);
+		BOOL deleteReport(unsigned int nReportId);
+		CReport* getReport(unsigned int nReportId);
+		void setReport(unsigned int nReportId);
+
+	private:
+		unsigned int m_nCEID;
+		std::string m_strName;
+		std::string m_strDescription;
+		std::vector<unsigned int> m_rptids;
+		std::vector<CReport*> m_reports;
+	};
+}
diff --git a/SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.cpp b/SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.cpp
new file mode 100644
index 0000000..dc2c082
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.cpp
@@ -0,0 +1,65 @@
+锘�// CLinkReportDetailDlg.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "pch.h"
+#include "EAPSimulator.h"
+#include "CLinkReportDetailDlg.h"
+#include "afxdialogex.h"
+
+
+// CLinkReportDetailDlg 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CLinkReportDetailDlg, CDialogEx)
+
+CLinkReportDetailDlg::CLinkReportDetailDlg(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_DIALOG_LINK_REPORT_DETAIL, pParent)
+{
+	m_pEvent = nullptr;
+}
+
+CLinkReportDetailDlg::~CLinkReportDetailDlg()
+{
+}
+
+void CLinkReportDetailDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CLinkReportDetailDlg, CDialogEx)
+	ON_BN_CLICKED(IDOK, &CLinkReportDetailDlg::OnBnClickedOk)
+END_MESSAGE_MAP()
+
+
+// CLinkReportDetailDlg 娑堟伅澶勭悊绋嬪簭
+
+void CLinkReportDetailDlg::SetCollectionEvent(SERVO::CCollectionEvent* pEvent)
+{
+	m_pEvent = pEvent;
+}
+
+BOOL CLinkReportDetailDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	
+	ASSERT(m_pEvent);
+	SetDlgItemInt(IDC_EDIT_CEID, m_pEvent->getEventId());
+	SetDlgItemText(IDC_EDIT_CE_NAME, m_pEvent->getName().c_str());
+	SetDlgItemText(IDC_EDIT_CE_DESCRIPTIONS, m_pEvent->getDescription().c_str());
+	SetDlgItemText(IDC_EDIT_CE_RPTID, m_pEvent->getReportIdsText().c_str());
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+void CLinkReportDetailDlg::OnBnClickedOk()
+{
+	ASSERT(m_pEvent);
+
+	UINT RPTID = GetDlgItemInt(IDC_EDIT_CE_RPTID);
+	m_pEvent->setReport(RPTID);
+
+	CDialogEx::OnOK();
+}
diff --git a/SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.h b/SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.h
new file mode 100644
index 0000000..db98f5d
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.h
@@ -0,0 +1,31 @@
+锘�#pragma once
+#include "CCollectionEvent.h"
+
+
+// CLinkReportDetailDlg 瀵硅瘽妗�
+
+class CLinkReportDetailDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CLinkReportDetailDlg)
+
+public:
+	CLinkReportDetailDlg(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CLinkReportDetailDlg();
+	void SetCollectionEvent(SERVO::CCollectionEvent* pEvent);
+
+private:
+	SERVO::CCollectionEvent* m_pEvent;
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_LINK_REPORT_DETAIL };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 鏀寔
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnBnClickedOk();
+};
diff --git a/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp b/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp
new file mode 100644
index 0000000..0c23e25
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp
@@ -0,0 +1,200 @@
+锘�// CLinkReportDlg.cpp: 瀹炵幇鏂囦欢
+//
+
+#include "pch.h"
+#include "EAPSimulator.h"
+#include "CLinkReportDlg.h"
+#include "afxdialogex.h"
+#include <string.h>  
+#include <regex>
+#include "CLinkReportDetailDlg.h"
+
+
+// CLinkReportDlg 瀵硅瘽妗�
+
+IMPLEMENT_DYNAMIC(CLinkReportDlg, CDialogEx)
+
+CLinkReportDlg::CLinkReportDlg(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_DIALOG_LINK_REPORT, pParent)
+{
+
+}
+
+CLinkReportDlg::~CLinkReportDlg()
+{
+}
+
+void CLinkReportDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CLinkReportDlg, CDialogEx)
+	ON_NOTIFY(NM_DBLCLK, IDC_LIST1, &CLinkReportDlg::OnListCtrlDoubleClick)
+	ON_BN_CLICKED(IDC_BUTTON_SEND, &CLinkReportDlg::OnBnClickedButtonSend)
+	ON_WM_DESTROY()
+END_MESSAGE_MAP()
+
+
+// CLinkReportDlg 娑堟伅澶勭悊绋嬪簭
+BOOL CLinkReportDlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1);
+	DWORD dwStyle = pListCtrl->GetExtendedStyle();
+	dwStyle |= LVS_EX_FULLROWSELECT;
+	dwStyle |= LVS_EX_GRIDLINES;
+	pListCtrl->SetExtendedStyle(dwStyle);
+	pListCtrl->ModifyStyle(0, LVS_SHOWSELALWAYS);
+
+	HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1);
+	ListView_SetImageList(pListCtrl->GetSafeHwnd(), imageList, LVSIL_SMALL);
+	pListCtrl->InsertColumn(0, _T(""), LVCFMT_RIGHT, 0);
+	pListCtrl->InsertColumn(1, _T("CEID"), LVCFMT_LEFT, 120);
+	pListCtrl->InsertColumn(2, _T("CD Name"), LVCFMT_LEFT, 120);
+	pListCtrl->InsertColumn(3, _T("Descriptions"), LVCFMT_LEFT, 180);
+	pListCtrl->InsertColumn(4, _T("Attached RPTID"), LVCFMT_LEFT, 120);
+	pListCtrl->SetColumnWidth(4, LVSCW_AUTOSIZE_USEHEADER);
+
+
+	CString strFile;
+	strFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)theApp.m_strAppDir);
+	loadCollectionEvents((LPTSTR)(LPCTSTR)strFile);
+
+	for (auto item : m_collectionEvents) {
+		int index = pListCtrl->InsertItem(pListCtrl->GetItemCount(), _T(""));
+		pListCtrl->SetItemData(index, (DWORD_PTR)item);
+		pListCtrl->SetItemText(index, 1, std::to_string(item->getEventId()).c_str());
+		pListCtrl->SetItemText(index, 2, item->getName().c_str());
+		pListCtrl->SetItemText(index, 3, item->getDescription().c_str());
+		pListCtrl->SetItemText(index, 4, item->getReportIdsText().c_str());
+	}
+
+
+	return TRUE;  // return TRUE unless you set the focus to a control
+				  // 寮傚父: OCX 灞炴�ч〉搴旇繑鍥� FALSE
+}
+
+int CLinkReportDlg::loadCollectionEvents(const char* pszFilepath)
+{
+	CStdioFile file;
+	if (!file.Open(pszFilepath, CFile::modeRead)) {
+		return -1;
+	}
+
+	std::regex pattern("^\\d+,[^,]*,[^,]*,\\(\\d+(,\\d+)*\\).*");  // 鍖归厤浠ユ暟瀛�+閫楀彿寮�澶寸殑瀛楃涓�
+	std::vector<SERVO::CCollectionEvent*> events;
+	int index, last;
+	CString strLine, strRPTIDs;
+	CString strId, strName, strDescription;
+	while (file.ReadString(strLine)) {
+		if (!std::regex_match((LPTSTR)(LPCTSTR)strLine, pattern)) {
+			continue;
+		}
+
+		last = 0;
+		index = strLine.Find(",", last);
+		if (index < 0) continue;
+		strId = strLine.Left(index);
+		last = index + 1;
+
+		index = strLine.Find(",", last);
+		if (index < 0) continue;
+		strName = strLine.Mid(last, index - last);
+		last = index + 1;
+
+		index = strLine.Find(",", last);
+		if (index < 0) continue;
+		strDescription = strLine.Mid(last, index - last);
+		strRPTIDs = strLine.Right(strLine.GetLength() - index - 1);
+		strRPTIDs.Delete(0);
+		strRPTIDs.Delete(strRPTIDs.GetLength() - 1);
+		auto prtids = parseVidList(strRPTIDs);
+
+		SERVO::CCollectionEvent* pEvent = new SERVO::CCollectionEvent(
+			atoi(strId), (LPTSTR)(LPCTSTR)strName, (LPTSTR)(LPCTSTR)strDescription, prtids);
+		events.push_back(pEvent);
+	}
+
+	if (!events.empty()) {
+		clearAllCollectionEvent();
+		for (auto item : events) {
+			m_collectionEvents.push_back(item);
+		}
+	}
+
+
+	file.Close();
+	return 0;
+}
+
+std::vector<unsigned int> CLinkReportDlg::parseVidList(CString& strNums)
+{
+	// 1. 鍏堝幓鎺夊彲鑳藉嚭鐜扮殑绌虹櫧绗︼紙绌烘牸銆佸埗琛ㄧ绛夛級
+	strNums.Trim();
+
+	// 2锔�.
+	std::vector<unsigned int> result;
+	int i = 0;
+	CString strVid;
+	while (1) {
+		if (!AfxExtractSubString(strVid, (LPCTSTR)strNums, i, ',')) {
+			break;
+		}
+		if (!strVid.IsEmpty())                 // 闃插尽鎬ф鏌�
+			result.push_back(std::stoi((LPTSTR)(LPCTSTR)strVid));
+		i++;
+
+	}
+
+	return result;
+}
+
+void CLinkReportDlg::clearAllCollectionEvent()
+{
+	for (auto item : m_collectionEvents) {
+		delete item;
+	}
+	m_collectionEvents.clear();
+}
+
+void CLinkReportDlg::OnListCtrlDoubleClick(NMHDR* pNMHDR, LRESULT* pResult)
+{
+	LPNMITEMACTIVATE pNMItem = (LPNMITEMACTIVATE)pNMHDR;
+	int nItem = pNMItem->iItem;
+	if (nItem >= 0) {
+		CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1);
+		SERVO::CCollectionEvent* pEvent = (SERVO::CCollectionEvent*)pListCtrl->GetItemData(nItem);
+		CLinkReportDetailDlg dlg;
+		dlg.SetCollectionEvent(pEvent);
+		if (IDOK == dlg.DoModal()) {
+			pListCtrl->SetItemText(nItem, 4, pEvent->getReportIdsText().c_str());
+		}
+	}
+
+	*pResult = 0;
+}
+
+void CLinkReportDlg::OnBnClickedButtonSend()
+{
+	std::vector<SERVO::CCollectionEvent*> events;
+	CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST1);
+	POSITION pos = pListCtrl->GetFirstSelectedItemPosition();
+	while (pos) {
+		int nItem = pListCtrl->GetNextSelectedItem(pos); // 鑾峰彇閫変腑椤圭储寮�
+		SERVO::CCollectionEvent* pEvent = (SERVO::CCollectionEvent*)pListCtrl->GetItemData(nItem);
+		events.push_back(pEvent);
+	}
+
+	for (auto item : events) {
+		TRACE("name:%s\n", item->getName().c_str());
+	}
+}
+
+void CLinkReportDlg::OnDestroy()
+{
+	CDialogEx::OnDestroy();
+	clearAllCollectionEvent();
+}
diff --git a/SourceCode/Bond/EAPSimulator/CLinkReportDlg.h b/SourceCode/Bond/EAPSimulator/CLinkReportDlg.h
new file mode 100644
index 0000000..434a28c
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CLinkReportDlg.h
@@ -0,0 +1,36 @@
+锘�#pragma once
+#include "CCollectionEvent.h"
+
+
+// CLinkReportDlg 瀵硅瘽妗�
+
+class CLinkReportDlg : public CDialogEx
+{
+	DECLARE_DYNAMIC(CLinkReportDlg)
+
+public:
+	CLinkReportDlg(CWnd* pParent = nullptr);   // 鏍囧噯鏋勯�犲嚱鏁�
+	virtual ~CLinkReportDlg();
+	int loadCollectionEvents(const char* pszFilepath);
+	std::vector<unsigned int> parseVidList(CString& strNums);
+	void clearAllCollectionEvent();
+
+
+private:
+	std::vector<SERVO::CCollectionEvent*> m_collectionEvents;
+
+// 瀵硅瘽妗嗘暟鎹�
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_DIALOG_LINK_REPORT };
+#endif
+
+protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 鏀寔
+
+	DECLARE_MESSAGE_MAP()
+public:
+	virtual BOOL OnInitDialog();
+	afx_msg void OnListCtrlDoubleClick(NMHDR* pNMHDR, LRESULT* pResult);
+	afx_msg void OnBnClickedButtonSend();
+	afx_msg void OnDestroy();
+};
diff --git a/SourceCode/Bond/EAPSimulator/CReport.cpp b/SourceCode/Bond/EAPSimulator/CReport.cpp
new file mode 100644
index 0000000..d5bc103
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CReport.cpp
@@ -0,0 +1,98 @@
+#include "pch.h"
+#include "CReport.h"
+
+
+namespace SERVO {
+	CReport::CReport()
+	{
+		m_nReportId = 0;
+	}
+
+	CReport::CReport(unsigned int reportId, std::vector<unsigned int>& vids)
+	{
+		m_nReportId = reportId;
+		for (auto vid : vids) {
+			m_vids.push_back(vid);
+		}
+	}
+
+	CReport::~CReport()
+	{
+
+	}
+
+	unsigned int CReport::getReportId()
+	{
+		return m_nReportId;
+	}
+
+	BOOL CReport::addVariable(CVariable* pVariable)
+	{
+		ASSERT(pVariable);
+		if (getVariable(pVariable->getVarialbleId()) != nullptr) {
+			return FALSE;
+		}
+
+		m_variabels.push_back(pVariable);
+		return TRUE;
+	}
+
+	BOOL CReport::deleteVarialble(unsigned int nVarialbleId)
+	{
+		BOOL bDelete = FALSE;
+		for (auto iter = m_variabels.begin(); iter != m_variabels.end(); ++iter) {
+			if (nVarialbleId == (*iter)->getVarialbleId()) {
+				m_variabels.erase(iter);
+				bDelete = TRUE;
+				break;
+			}
+		}
+
+		return bDelete;
+	}
+
+	CVariable* CReport::getVariable(unsigned int nVarialbleId)
+	{
+		for (auto item : m_variabels) {
+			if (nVarialbleId == item->getVarialbleId()) {
+				return item;
+			}
+		}
+
+		return nullptr;
+	}
+
+	std::vector<CVariable*>& CReport::getVariables()
+	{
+		return m_variabels;
+	}
+
+	std::string CReport::getVariablesIdsText()
+	{
+		std::string strResult, strName;
+		for (int i = 0; i < m_vids.size(); i++) {
+			strResult += std::to_string(m_vids[i]);
+			strResult += "(";
+			strResult += (getVariableName(m_vids[i], strName) ?
+				strName : _T("null"));
+			strResult += ")";
+			if (i != m_vids.size() - 1) {
+				strResult += ",";
+			}
+		}
+
+		return strResult;
+	}
+
+	bool CReport::getVariableName(unsigned int vid, std::string& strName)
+	{
+		for (auto item : m_variabels) {
+			if (item->getVarialbleId() == vid) {
+				strName = item->getName();
+				return true;
+			}
+		}
+
+		return false;
+	}
+}
diff --git a/SourceCode/Bond/EAPSimulator/CReport.h b/SourceCode/Bond/EAPSimulator/CReport.h
new file mode 100644
index 0000000..191d539
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CReport.h
@@ -0,0 +1,28 @@
+#pragma once
+#include "CVariable.h"
+#include <vector>
+
+namespace SERVO {
+	class CReport
+	{
+	public:
+		CReport();
+		CReport(unsigned int reportId, std::vector<unsigned int>& vids);
+		virtual ~CReport();
+
+	public:
+		unsigned int getReportId();
+		BOOL addVariable(CVariable* pVariable);
+		BOOL deleteVarialble(unsigned int nVarialbleId);
+		CVariable* getVariable(unsigned int nVarialbleId);
+		std::vector<CVariable*>& getVariables();
+		std::string getVariablesIdsText();
+		bool getVariableName(unsigned int vid, std::string& strName);
+
+	private:
+		unsigned int m_nReportId;
+		std::vector<unsigned int> m_vids;
+		std::vector<CVariable*> m_variabels;
+	};
+}
+
diff --git a/SourceCode/Bond/EAPSimulator/CVariable.cpp b/SourceCode/Bond/EAPSimulator/CVariable.cpp
new file mode 100644
index 0000000..465f927
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CVariable.cpp
@@ -0,0 +1,90 @@
+#include "pch.h"
+#include "CVariable.h"
+
+
+namespace SERVO {
+	CVariable::CVariable()
+	{
+		m_nVarialbeId = 0;
+		m_format = SVFromat::U1;
+	}
+
+	CVariable::CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark)
+	{
+		m_nVarialbeId = atoi(pszId);
+		m_strName = pszName;
+		m_format = toFormat(pszFormat);
+		m_strRemark = pszRemark;
+		TRACE("CVariable .....%d,%s,%d,%s\n", m_nVarialbeId, m_strName.c_str(),
+			m_format, m_strRemark.c_str());
+
+	}
+
+	CVariable::~CVariable()
+	{
+
+	}
+
+	SVFromat CVariable::toFormat(const char* pszFormat)
+	{
+		if (_strcmpi("U1", pszFormat) == 0) {
+			return SVFromat::U1;
+		}
+		if (_strcmpi("U2", pszFormat) == 0) {
+			return SVFromat::U2;
+		}
+		if (_strcmpi("I2", pszFormat) == 0) {
+			return SVFromat::I2;
+		}
+		if (_strcmpi("A50", pszFormat) == 0) {
+			return SVFromat::A50;
+		}
+		if (_strcmpi("A20", pszFormat) == 0) {
+			return SVFromat::A20;
+		}
+
+		return SVFromat::U1;
+	}
+
+
+	std::string CVariable::formatToString(SVFromat format)
+	{
+		if (SVFromat::U1 == format) {
+			return "U1";
+		}
+		if (SVFromat::U2 == format) {
+			return "U1";
+		}
+		if (SVFromat::I2 == format) {
+			return "I2";
+		}
+		if (SVFromat::A50 == format) {
+			return "A50";
+		}
+		if (SVFromat::A20 == format) {
+			return "A20";
+		}
+
+		return "U1";
+	}
+
+	unsigned int CVariable::getVarialbleId()
+	{
+		return m_nVarialbeId;
+	}
+
+	std::string& CVariable::getName()
+	{
+		return m_strName;
+	}
+
+	SVFromat CVariable::getFormat()
+	{
+		return m_format;
+	}
+
+	std::string& CVariable::getRemark()
+	{
+		return m_strRemark;
+	}
+}
\ No newline at end of file
diff --git a/SourceCode/Bond/EAPSimulator/CVariable.h b/SourceCode/Bond/EAPSimulator/CVariable.h
new file mode 100644
index 0000000..7bac823
--- /dev/null
+++ b/SourceCode/Bond/EAPSimulator/CVariable.h
@@ -0,0 +1,37 @@
+#pragma once
+#include <string>
+
+
+namespace SERVO {
+	// 变量格式
+	enum class SVFromat {
+		U1 = 0,
+		U2,
+		I2,
+		A20,
+		A50
+	};
+
+	class CVariable
+	{
+	public:
+		CVariable();
+		CVariable(const char* pszId, const char* pszName, const char* pszFormat, const char* pszRemark);
+		~CVariable();
+
+	public:
+		static SVFromat toFormat(const char* pszFormat);
+		static std::string formatToString(SVFromat format);
+		unsigned int getVarialbleId();
+		std::string& getName();
+		SVFromat getFormat();
+		std::string& getRemark();
+
+	private:
+		unsigned int m_nVarialbeId;
+		std::string m_strName;
+		SVFromat m_format;
+		std::string m_strRemark;
+	};
+}
+
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.cpp b/SourceCode/Bond/EAPSimulator/EAPSimulator.cpp
index 41e7cee..52d469b 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.cpp
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.cpp
@@ -72,6 +72,17 @@
 	SetRegistryKey(_T("搴旂敤绋嬪簭鍚戝鐢熸垚鐨勬湰鍦板簲鐢ㄧ▼搴�"));
 
 
+	// 鏈▼搴忔枃浠剁洰褰�
+	TCHAR sDrive[_MAX_DRIVE];
+	TCHAR sDir[_MAX_DIR];
+	TCHAR sFilename[_MAX_FNAME], sAppFilename[_MAX_FNAME];
+	TCHAR sExt[_MAX_EXT];
+	GetModuleFileName(AfxGetInstanceHandle(), sAppFilename, _MAX_FNAME);
+	_tsplitpath_s(sAppFilename, sDrive, sDir, sFilename, sExt);
+	m_strAppDir = CString(sDrive) + CString(sDir);
+	m_strAppFile = CString(sFilename);
+
+
 	// 鍒濆鍖朢x搴�
 	RX_Init();
 	HSMS_Initialize();
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.h b/SourceCode/Bond/EAPSimulator/EAPSimulator.h
index 6b6fc00..0734c5a 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.h
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.h
@@ -24,6 +24,8 @@
 
 public:
 	CModel m_model;
+	CString m_strAppDir;
+	CString m_strAppFile;
 
 // 閲嶅啓
 public:
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
index f869cdd..ade0d9e 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj b/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj
index 57d8fcc..a614abf 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj
@@ -184,13 +184,18 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClInclude Include="CAddIDSDlg.h" />
+    <ClInclude Include="CCollectionEvent.h" />
     <ClInclude Include="CDefineReportsDlg.h" />
     <ClInclude Include="CEDEventReportDlg.h" />
     <ClInclude Include="CHsmsActive.h" />
+    <ClInclude Include="CLinkReportDetailDlg.h" />
+    <ClInclude Include="CLinkReportDlg.h" />
     <ClInclude Include="CModel.h" />
     <ClInclude Include="Common.h" />
     <ClInclude Include="Context.h" />
+    <ClInclude Include="CReport.h" />
     <ClInclude Include="CTerminalDisplayDlg.h" />
+    <ClInclude Include="CVariable.h" />
     <ClInclude Include="EAPSimulator.h" />
     <ClInclude Include="EAPSimulatorDlg.h" />
     <ClInclude Include="framework.h" />
@@ -202,12 +207,17 @@
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="CAddIDSDlg.cpp" />
+    <ClCompile Include="CCollectionEvent.cpp" />
     <ClCompile Include="CDefineReportsDlg.cpp" />
     <ClCompile Include="CEDEventReportDlg.cpp" />
     <ClCompile Include="CHsmsActive.cpp" />
+    <ClCompile Include="CLinkReportDetailDlg.cpp" />
+    <ClCompile Include="CLinkReportDlg.cpp" />
     <ClCompile Include="CModel.cpp" />
     <ClCompile Include="Context.cpp" />
+    <ClCompile Include="CReport.cpp" />
     <ClCompile Include="CTerminalDisplayDlg.cpp" />
+    <ClCompile Include="CVariable.cpp" />
     <ClCompile Include="EAPSimulator.cpp" />
     <ClCompile Include="EAPSimulatorDlg.cpp" />
     <ClCompile Include="Log.cpp" />
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters b/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters
index 1a45eff..dab50ba 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters
@@ -63,6 +63,21 @@
     <ClInclude Include="CAddIDSDlg.h">
       <Filter>澶存枃浠�</Filter>
     </ClInclude>
+    <ClInclude Include="CLinkReportDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="CCollectionEvent.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="CReport.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="CVariable.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
+    <ClInclude Include="CLinkReportDetailDlg.h">
+      <Filter>澶存枃浠�</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="EAPSimulator.cpp">
@@ -101,6 +116,21 @@
     <ClCompile Include="CAddIDSDlg.cpp">
       <Filter>婧愭枃浠�</Filter>
     </ClCompile>
+    <ClCompile Include="CLinkReportDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="CCollectionEvent.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="CReport.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="CVariable.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
+    <ClCompile Include="CLinkReportDetailDlg.cpp">
+      <Filter>婧愭枃浠�</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="EAPSimulator.rc">
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
index bb79178..756b7b2 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -12,6 +12,7 @@
 #include "CTerminalDisplayDlg.h"
 #include "CEDEventReportDlg.h"
 #include "CDefineReportsDlg.h"
+#include "CLinkReportDlg.h"
 
 
 #ifdef _DEBUG
@@ -82,6 +83,7 @@
 	ON_BN_CLICKED(IDC_BUTTON_ED_EVENT_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonEdEventReport)
 	ON_BN_CLICKED(IDC_BUTTON_ED_ALARM_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonEdAlarmReport)
 	ON_BN_CLICKED(IDC_BUTTON_DEFINE_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonDefineReport)
+	ON_BN_CLICKED(IDC_BUTTON_LINE_REPORT, &CEAPSimulatorDlg::OnBnClickedButtonLineReport)
 END_MESSAGE_MAP()
 
 
@@ -263,7 +265,8 @@
 	GetDlgItem(IDC_BUTTON_TERMINAL_DISPLAY)->EnableWindow(enabled);	
 	GetDlgItem(IDC_BUTTON_ED_EVENT_REPORT)->EnableWindow(enabled);
 	GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->EnableWindow(enabled);	
-	GetDlgItem(IDC_BUTTON_DEFINE_REPORT)->EnableWindow(enabled);	
+	GetDlgItem(IDC_BUTTON_DEFINE_REPORT)->EnableWindow(enabled);
+	GetDlgItem(IDC_BUTTON_LINE_REPORT)->EnableWindow(enabled);	
 }
 
 void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -319,3 +322,9 @@
 	CDefineReportsDlg dlg;
 	dlg.DoModal();
 }
+
+void CEAPSimulatorDlg::OnBnClickedButtonLineReport()
+{
+	CLinkReportDlg dlg;
+	dlg.DoModal();
+}
diff --git a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
index 6fafcec..70228c3 100644
--- a/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
+++ b/SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -52,4 +52,5 @@
 	afx_msg void OnBnClickedButtonEdEventReport();
 	afx_msg void OnBnClickedButtonEdAlarmReport();
 	afx_msg void OnBnClickedButtonDefineReport();
+	afx_msg void OnBnClickedButtonLineReport();
 };
diff --git a/SourceCode/Bond/EAPSimulator/Resource.h b/SourceCode/Bond/EAPSimulator/Resource.h
index 4a5ed28..8cda42b 100644
--- a/SourceCode/Bond/EAPSimulator/Resource.h
+++ b/SourceCode/Bond/EAPSimulator/Resource.h
@@ -11,6 +11,8 @@
 #define IDD_DIALOG_ED_EVENT_REPORT      131
 #define IDD_DIALOG_DEFINE_REPORTS       133
 #define IDD_DIALOG_ADD_IDS              135
+#define IDD_DIALOG_LINK_REPORT          137
+#define IDD_DIALOG_LINK_REPORT_DETAIL   139
 #define IDC_EDIT_LOG                    1000
 #define IDC_EDIT_IP                     1001
 #define IDC_EDIT_PORT                   1002
@@ -25,12 +27,16 @@
 #define IDC_BUTTON_ED_ALARM_REPORT      1009
 #define IDC_BUTTON_SEND                 1010
 #define IDC_BUTTON_DEFINE_REPORT        1010
+#define IDC_BUTTON_LINE_REPORT          1011
 #define IDC_RADIO_ENABLE                1012
 #define IDC_RADIO_DISABLE               1013
 #define IDC_EDIT_CEID                   1014
 #define IDC_LIST1                       1015
+#define IDC_EDIT_CE_NAME                1015
 #define IDC_LIST2                       1016
+#define IDC_EDIT_CE_DESCRIPTIONS        1016
 #define IDC_BUTTON_ADD_RPTID            1017
+#define IDC_EDIT_CE_RPTID               1017
 #define IDC_BUTTON_DEL_REPORT           1018
 #define IDC_BUTTON_ADD_VID              1019
 #define IDC_BUTTON_DEL_VID              1020
@@ -42,9 +48,9 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        137
+#define _APS_NEXT_RESOURCE_VALUE        141
 #define _APS_NEXT_COMMAND_VALUE         32771
-#define _APS_NEXT_CONTROL_VALUE         1024
+#define _APS_NEXT_CONTROL_VALUE         1025
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif

--
Gitblit v1.9.3