1.EAP模拟器,增加Link Report加载功能,列表展示功能,修改Report ID功能,但未真正下发到指令到Master.
已添加11个文件
已修改8个文件
797 ■■■■■ 文件已修改
Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.8(1).xlsx 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CCollectionEvent.cpp 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CCollectionEvent.h 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.cpp 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CLinkReportDetailDlg.h 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CLinkReportDlg.cpp 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CLinkReportDlg.h 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CReport.cpp 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CReport.h 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CVariable.cpp 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CVariable.h 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/Resource.h 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Document/ESWIN_EAS_Bonder_Inline_Mapping_Address_v1.1.8(1).xlsx
Binary files differ
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;
    }
}
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;
    };
}
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();
}
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();
};
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();
}
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();
};
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;
    }
}
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;
    };
}
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;
    }
}
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;
    };
}
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);
    // åˆå§‹åŒ–Rx库
    RX_Init();
    HSMS_Initialize();
SourceCode/Bond/EAPSimulator/EAPSimulator.h
@@ -24,6 +24,8 @@
public:
    CModel m_model;
    CString m_strAppDir;
    CString m_strAppFile;
// é‡å†™
public:
SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
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" />
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">
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();
}
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();
};
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