LAPTOP-SNT8I5JK\Boounion
2025-07-19 8860b7e63527fad69f15944d340b7158edde1bed
1.Define Report功能测试,EAP模拟
已添加4个文件
已修改13个文件
492 ■■■■■ 文件已修改
SourceCode/Bond/EAPSimulator/CAddIDSDlg.cpp 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CAddIDSDlg.h 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CDefineReportsDlg.cpp 193 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CDefineReportsDlg.h 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.h 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/Resource.h 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CBonder.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.h 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/ServoDlg.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CAddIDSDlg.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,65 @@
// CAddIDSDlg.cpp: å®žçŽ°æ–‡ä»¶
//
#include "pch.h"
#include "EAPSimulator.h"
#include "CAddIDSDlg.h"
#include "afxdialogex.h"
// CAddIDSDlg å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CAddIDSDlg, CDialogEx)
CAddIDSDlg::CAddIDSDlg(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_DIALOG_ADD_IDS, pParent)
{
    m_nId = 0;
}
CAddIDSDlg::~CAddIDSDlg()
{
}
void CAddIDSDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAddIDSDlg, CDialogEx)
    ON_BN_CLICKED(IDOK, &CAddIDSDlg::OnBnClickedOk)
END_MESSAGE_MAP()
// CAddIDSDlg æ¶ˆæ¯å¤„理程序
void CAddIDSDlg::SetTitle(const char* pszTitle)
{
    m_strTitle = pszTitle;
}
BOOL CAddIDSDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();
    // TODO:  åœ¨æ­¤æ·»åŠ é¢å¤–çš„åˆå§‹åŒ–
    SetWindowText(m_strTitle);
    SetDlgItemText(IDC_GROUP_IDS, m_strTitle);
    return TRUE;  // return TRUE unless you set the focus to a control
                  // å¼‚常: OCX å±žæ€§é¡µåº”返回 FALSE
}
unsigned int CAddIDSDlg::GetId()
{
    return m_nId;
}
void CAddIDSDlg::OnBnClickedOk()
{
    m_nId = GetDlgItemInt(IDC_EDIT_ID);
    CDialogEx::OnOK();
}
SourceCode/Bond/EAPSimulator/CAddIDSDlg.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
#pragma once
// CAddIDSDlg å¯¹è¯æ¡†
class CAddIDSDlg : public CDialogEx
{
    DECLARE_DYNAMIC(CAddIDSDlg)
public:
    CAddIDSDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CAddIDSDlg();
    void SetTitle(const char* pszTitle);
    unsigned int GetId();
private:
    CString m_strTitle;
    unsigned int m_nId;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_ADD_IDS };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    DECLARE_MESSAGE_MAP()
public:
    virtual BOOL OnInitDialog();
    afx_msg void OnBnClickedOk();
};
SourceCode/Bond/EAPSimulator/CDefineReportsDlg.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,193 @@
// CDefineReportsDlg.cpp: å®žçŽ°æ–‡ä»¶
//
#include "pch.h"
#include "EAPSimulator.h"
#include "CDefineReportsDlg.h"
#include "afxdialogex.h"
#include "CAddIDSDlg.h"
// CDefineReportsDlg å¯¹è¯æ¡†
IMPLEMENT_DYNAMIC(CDefineReportsDlg, CDialogEx)
CDefineReportsDlg::CDefineReportsDlg(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_DIALOG_DEFINE_REPORTS, pParent)
{
}
CDefineReportsDlg::~CDefineReportsDlg()
{
}
void CDefineReportsDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CDefineReportsDlg, CDialogEx)
    ON_BN_CLICKED(IDC_BUTTON_ADD_RPTID, &CDefineReportsDlg::OnBnClickedButtonAddRptid)
    ON_LBN_SELCHANGE(IDC_LIST1, &CDefineReportsDlg::OnLbnSelchangeList1)
    ON_BN_CLICKED(IDC_BUTTON_DEL_REPORT, &CDefineReportsDlg::OnBnClickedButtonDelReport)
    ON_BN_CLICKED(IDC_BUTTON_ADD_VID, &CDefineReportsDlg::OnBnClickedButtonAddVid)
    ON_LBN_SELCHANGE(IDC_LIST2, &CDefineReportsDlg::OnLbnSelchangeList2)
    ON_BN_CLICKED(IDC_BUTTON_DEL_VID, &CDefineReportsDlg::OnBnClickedButtonDelVid)
    ON_BN_CLICKED(IDC_BUTTON_SEND, &CDefineReportsDlg::OnBnClickedButtonSend)
END_MESSAGE_MAP()
// CDefineReportsDlg æ¶ˆæ¯å¤„理程序
void CDefineReportsDlg::OnBnClickedButtonAddRptid()
{
    CAddIDSDlg dlg;
    dlg.SetTitle("RPTID");
    dlg.DoModal();
    int PRTID = dlg.GetId();
    addReport(PRTID);
}
void CDefineReportsDlg::OnBnClickedButtonAddVid()
{
    CString strReportId;
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1);
    int nSel = pListBox->GetCurSel();
    if (nSel >= 0) {
        pListBox->GetText(nSel, strReportId);
        int RPTID = atoi(strReportId);
        CAddIDSDlg dlg;
        dlg.SetTitle("RPTID");
        dlg.DoModal();
        unsigned int VID = dlg.GetId();;
        addVid(RPTID, VID);
    }
}
void CDefineReportsDlg::OnLbnSelchangeList1()
{
    CString strReportId;
    int RPTID = -1;
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1);
    int nSel = pListBox->GetCurSel();
    if (nSel >= 0) {
        pListBox->GetText(nSel, strReportId);
        RPTID = atoi(strReportId);
    }
    GetDlgItem(IDC_BUTTON_DEL_REPORT)->EnableWindow(nSel >= 0);
    GetDlgItem(IDC_BUTTON_ADD_VID)->EnableWindow(nSel >= 0);
    CListBox* pListBox2 = (CListBox*)GetDlgItem(IDC_LIST2);
    pListBox2->ResetContent();
    auto iter = m_mapReport.find(RPTID);
    if (iter != m_mapReport.end()) {
        auto& vids = m_mapReport[RPTID];
        for (auto item : vids) {
            pListBox2->AddString(std::to_string(item).c_str());
        }
    }
}
void CDefineReportsDlg::OnBnClickedButtonDelReport()
{
    CString strReportId;
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1);
    int nSel = pListBox->GetCurSel();
    if (nSel >= 0) {
        pListBox->GetText(nSel, strReportId);
        int RPTID = atoi(strReportId);
        delReport(RPTID);
        pListBox->DeleteString(nSel);
        ((CListBox*)GetDlgItem(IDC_LIST2))->ResetContent();
    }
    nSel = pListBox->GetCurSel();
    GetDlgItem(IDC_BUTTON_DEL_REPORT)->EnableWindow(nSel >= 0);
    GetDlgItem(IDC_BUTTON_ADD_VID)->EnableWindow(nSel >= 0);
}
void CDefineReportsDlg::OnLbnSelchangeList2()
{
    CListBox* pListBox2 = (CListBox*)GetDlgItem(IDC_LIST2);
    int nSel = pListBox2->GetCurSel();
    GetDlgItem(IDC_BUTTON_DEL_VID)->EnableWindow(nSel >= 0);
}
void CDefineReportsDlg::OnBnClickedButtonDelVid()
{
    CString strRPTID, strVID;
    CListBox* pListBox1 = (CListBox*)GetDlgItem(IDC_LIST1);
    CListBox* pListBox2 = (CListBox*)GetDlgItem(IDC_LIST2);
    int nSel1 = pListBox1->GetCurSel();
    int nSel2 = pListBox2->GetCurSel();
    if (nSel1 >= 0 && nSel2 >= 0) {
        pListBox1->GetText(nSel1, strRPTID);
        pListBox2->GetText(nSel2, strVID);
        int RPTID = atoi(strRPTID);
        int VID = atoi(strVID);
        delVid(RPTID, VID);
        pListBox2->DeleteString(nSel2);
    }
    nSel2 = pListBox2->GetCurSel();
    GetDlgItem(IDC_BUTTON_DEL_VID)->EnableWindow(nSel2 >= 0);
}
void CDefineReportsDlg::addReport(int RPTID)
{
    auto iter = m_mapReport.find(RPTID);
    if (iter == m_mapReport.end()) {
        std::vector<unsigned int> vids;
        m_mapReport[RPTID] = vids;
    }
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST1);
    pListBox->AddString(std::to_string(RPTID).c_str());
}
bool CDefineReportsDlg::addVid(unsigned int RPTID, unsigned int vid)
{
    auto iter = m_mapReport.find(RPTID);
    if (iter == m_mapReport.end()) {
        return false;
    }
    auto& vids = m_mapReport[RPTID];
    vids.push_back(vid);
    CListBox* pListBox = (CListBox*)GetDlgItem(IDC_LIST2);
    pListBox->AddString(std::to_string(vid).c_str());
    return true;
}
void CDefineReportsDlg::delReport(int RPTID)
{
    auto iter = m_mapReport.find(RPTID);
    if (iter != m_mapReport.end()) {
        m_mapReport.erase(iter);
    }
}
void CDefineReportsDlg::delVid(int RPTID, int VID)
{
    auto iter = m_mapReport.find(RPTID);
    if (iter != m_mapReport.end()) {
        auto& vids = iter->second;
        for (auto iter2 = vids.begin(); iter2 != vids.end(); iter2++) {
            if ((*iter2) == VID) {
                vids.erase(iter2);
                break;
            }
        }
    }
}
void CDefineReportsDlg::OnBnClickedButtonSend()
{
    theApp.m_model.m_pHsmsActive->hsmsDefineReports(m_mapReport);
}
SourceCode/Bond/EAPSimulator/CDefineReportsDlg.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
#pragma once
#include <map>
#include <vector>
// CDefineReportsDlg å¯¹è¯æ¡†
class CDefineReportsDlg : public CDialogEx
{
    DECLARE_DYNAMIC(CDefineReportsDlg)
public:
    CDefineReportsDlg(CWnd* pParent = nullptr);   // æ ‡å‡†æž„造函数
    virtual ~CDefineReportsDlg();
    void addReport(int RPTID);
    void delReport(int RPTID);
    bool addVid(unsigned int RPTID, unsigned int vid);
    void delVid(int RPTID, int VID);
private:
    std::map<unsigned int, std::vector<unsigned int>> m_mapReport;
// å¯¹è¯æ¡†æ•°æ®
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_DIALOG_DEFINE_REPORTS };
#endif
protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV æ”¯æŒ
    DECLARE_MESSAGE_MAP()
public:
    afx_msg void OnBnClickedButtonAddRptid();
    afx_msg void OnLbnSelchangeList1();
    afx_msg void OnBnClickedButtonDelReport();
    afx_msg void OnBnClickedButtonAddVid();
    afx_msg void OnLbnSelchangeList2();
    afx_msg void OnBnClickedButtonDelVid();
    afx_msg void OnBnClickedButtonSend();
};
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -201,6 +201,27 @@
    return 0;
}
int CHsmsActive::hsmsDefineReports(std::map<unsigned int, std::vector<unsigned int>>& mapReport)
{
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 2 | REPLY, 33, ++m_nSystemByte);
    ISECS2Item* pItem = pMessage->getBody();
    pItem->addU4Item(1, "DATAID");
    ISECS2Item* pItemReportList = pItem->addItem();
    for (auto item : mapReport) {
        ISECS2Item* pItemReport = pItemReportList->addItem();
        pItemReport->addU4Item(item.first, "RPTID");
        ISECS2Item* pItemVidList = pItemReport->addItem();
        for (auto vid : item.second) {
            pItemVidList->addU4Item(vid, "VID");
        }
    }
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::replyAck0(IMessage* pMessage)
{
    return 0;
SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -1,7 +1,7 @@
#pragma once
#include <string>
#include <vector>
#include <map>
typedef std::function<void(void* pFrom, ACTIVESTATE state)> STATECHANGED;
typedef struct _ACTIVEListener
@@ -45,6 +45,9 @@
    // Enable/Disable Alarm Report
    int hsmsEDAlarmReport(bool bEnable, unsigned int id);
    // Define reports
    int hsmsDefineReports(std::map<unsigned int, std::vector<unsigned int>>& mapReport);
    // é€šè¿‡çš„reply函数
    void replyAck(int s, int f, unsigned int systemBytes, BYTE ack, const char* pszAckName);
SourceCode/Bond/EAPSimulator/EAPSimulator.rc
Binary files differ
SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj
@@ -183,6 +183,8 @@
    </ResourceCompile>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClInclude Include="CAddIDSDlg.h" />
    <ClInclude Include="CDefineReportsDlg.h" />
    <ClInclude Include="CEDEventReportDlg.h" />
    <ClInclude Include="CHsmsActive.h" />
    <ClInclude Include="CModel.h" />
@@ -199,6 +201,8 @@
    <ClInclude Include="targetver.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="CAddIDSDlg.cpp" />
    <ClCompile Include="CDefineReportsDlg.cpp" />
    <ClCompile Include="CEDEventReportDlg.cpp" />
    <ClCompile Include="CHsmsActive.cpp" />
    <ClCompile Include="CModel.cpp" />
SourceCode/Bond/EAPSimulator/EAPSimulator.vcxproj.filters
@@ -57,6 +57,12 @@
    <ClInclude Include="CEDEventReportDlg.h">
      <Filter>头文件</Filter>
    </ClInclude>
    <ClInclude Include="CDefineReportsDlg.h">
      <Filter>头文件</Filter>
    </ClInclude>
    <ClInclude Include="CAddIDSDlg.h">
      <Filter>头文件</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="EAPSimulator.cpp">
@@ -89,6 +95,12 @@
    <ClCompile Include="CEDEventReportDlg.cpp">
      <Filter>源文件</Filter>
    </ClCompile>
    <ClCompile Include="CDefineReportsDlg.cpp">
      <Filter>源文件</Filter>
    </ClCompile>
    <ClCompile Include="CAddIDSDlg.cpp">
      <Filter>源文件</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="EAPSimulator.rc">
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp
@@ -11,6 +11,7 @@
#include <regex>
#include "CTerminalDisplayDlg.h"
#include "CEDEventReportDlg.h"
#include "CDefineReportsDlg.h"
#ifdef _DEBUG
@@ -80,6 +81,7 @@
    ON_BN_CLICKED(IDC_BUTTON_TERMINAL_DISPLAY, &CEAPSimulatorDlg::OnBnClickedButtonTerminalDisplay)
    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)
END_MESSAGE_MAP()
@@ -261,6 +263,7 @@
    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);
}
void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -310,3 +313,9 @@
        enable == 1 ? _T("Disable Alarm Report") : _T("Enable Alarm Report"));
    ::SetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"), (void*)enable);
}
void CEAPSimulatorDlg::OnBnClickedButtonDefineReport()
{
    CDefineReportsDlg dlg;
    dlg.DoModal();
}
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -51,4 +51,5 @@
    afx_msg void OnBnClickedButtonTerminalDisplay();
    afx_msg void OnBnClickedButtonEdEventReport();
    afx_msg void OnBnClickedButtonEdAlarmReport();
    afx_msg void OnBnClickedButtonDefineReport();
};
SourceCode/Bond/EAPSimulator/Resource.h
@@ -9,6 +9,8 @@
#define IDR_MAINFRAME                   128
#define IDD_DIALOG_TERMINAL_DISPLAY     129
#define IDD_DIALOG_ED_EVENT_REPORT      131
#define IDD_DIALOG_DEFINE_REPORTS       133
#define IDD_DIALOG_ADD_IDS              135
#define IDC_EDIT_LOG                    1000
#define IDC_EDIT_IP                     1001
#define IDC_EDIT_PORT                   1002
@@ -22,17 +24,27 @@
#define IDC_EDIT_TEXT                   1009
#define IDC_BUTTON_ED_ALARM_REPORT      1009
#define IDC_BUTTON_SEND                 1010
#define IDC_BUTTON_DEFINE_REPORT        1010
#define IDC_RADIO_ENABLE                1012
#define IDC_RADIO_DISABLE               1013
#define IDC_EDIT_CEID                   1014
#define IDC_LIST1                       1015
#define IDC_LIST2                       1016
#define IDC_BUTTON_ADD_RPTID            1017
#define IDC_BUTTON_DEL_REPORT           1018
#define IDC_BUTTON_ADD_VID              1019
#define IDC_BUTTON_DEL_VID              1020
#define IDC_GROUP_IDS                   1021
#define IDC_EDIT_ID                     1022
#define IDC_BUTTON1                     1023
// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        133
#define _APS_NEXT_RESOURCE_VALUE        137
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1015
#define _APS_NEXT_CONTROL_VALUE         1024
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
SourceCode/Bond/Servo/CBonder.cpp
@@ -420,6 +420,7 @@
        CEquipment::onTimer(nTimerid);
        // test     
        /*
        static int i[2] = { 0, 0 };
        i[m_nIndex]++;
        if (m_nIndex == 0 && i[m_nIndex] % 20 == 0) {
@@ -430,6 +431,7 @@
                    1);
            }
        }
        */
    }
    void CBonder::serialize(CArchive& ar)
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -133,26 +133,19 @@
    return 0;
}
void CHsmsPassive::deleteReport(unsigned int RPTID)
SERVO::CReport* CHsmsPassive::defineReport(unsigned int RPTID, std::vector<unsigned int>& vids)
{
    for (auto it = m_mapValueIdToPRTID.begin(); it != m_mapValueIdToPRTID.end(); ) {
        if (it->second == RPTID) {
            m_mapValueIdToPRTID.erase(it++);  // æ›´æ–°è¿­ä»£å™¨
        }
        else {
            ++it;
    // æ·»åŠ å®šä¹‰report
    SERVO::CReport* pReport = new SERVO::CReport(RPTID, vids);
    for (auto vid : vids) {
        SERVO::CVariable* pVariable = getVariable(vid);
        if (pVariable != nullptr) {
            pReport->addVariable(pVariable);
        }
    }
}
    m_reports.push_back(pReport);
void CHsmsPassive::deleteAllReport()
{
    m_mapValueIdToPRTID.clear();
}
void CHsmsPassive::defineReport(unsigned int VID, unsigned int RPTID)
{
    m_mapValueIdToPRTID[VID] = RPTID;
    return pReport;
}
void CHsmsPassive::OnTimer(UINT nTimerid)
@@ -333,6 +326,19 @@
    }
    return nullptr;
}
bool CHsmsPassive::removeReport(int rptid)
{
    for (auto iter = m_reports.begin(); iter != m_reports.end(); ++iter) {
        if ((*iter)->getReportId() == rptid) {
            delete (*iter);
            m_reports.erase(iter);
            return true;
        }
    }
    return false;
}
void CHsmsPassive::clearAllReport()
@@ -889,40 +895,47 @@
    ISECS2Item* pBody = pRecv->getBody();
    ISECS2Item* defineItem, *rptListItem, * vidListItem;
    unsigned int dataId, rptid, vid;
    if (!pBody->getSubItemU4(0, dataId)) goto MYREPLY;
    rptListItem = pBody->getSubItem(1);
    if (rptListItem == nullptr) goto MYREPLY;
    if (rptListItem->getSubItemSize() == 0) {
        deleteAllReport();
        clearAllReport();
        goto MYREPLY;
    }
    for (int i = 0; i < rptListItem->getSubItemSize(); i++) {
        defineItem = rptListItem->getSubItem(i);
        if (defineItem == nullptr) continue;
        std::vector<unsigned int> vids;
        SERVO::CReport* pReport = nullptr;
        vidListItem = defineItem->getSubItem(1);
        if (defineItem->getSubItemU4(0, rptid)
            && vidListItem != nullptr) {
            int vidCount = vidListItem->getSubItemSize();
            if (vidCount == 0) {
                deleteReport(rptid);
            }
            else {
                for (int k = 0; k < vidCount; k++) {
                    if (vidListItem->getSubItemU4(k, vid)) {
                        defineReport(vid, rptid);
                    }
            for (int k = 0; k < vidListItem->getSubItemSize(); k++) {
                if (vidListItem->getSubItemU4(k, vid)) {
                    vids.push_back(vid);
                }
            }
        }
        removeReport(rptid);
        if (!vids.empty()) {
            pReport = defineReport(rptid, vids);
        }
        // æ£€éªŒç»“果是否正确
        if (pReport != nullptr) {
            auto variables = pReport->getVariables();
            for (auto item : variables) {
                LOGE("=== prtid:%d, vid:%d", rptid, item->getVarialbleId());
            }
        }
    }
MYREPLY:
    // æ£€éªŒç»“果是否正确
    for (auto item : m_mapValueIdToPRTID) {
        LOGE("=== vid:%d, prtid:%d", item.first, item.second);
    }
    replyAck(2, 34, pRecv->getHeader()->systemBytes, BYTE(0), "DRACK");
    return 0;
}
SourceCode/Bond/Servo/HsmsPassive.h
@@ -103,10 +103,11 @@
    unsigned int getCEID(int RPTID);
    // define Report
    void defineReport(unsigned int VID, unsigned int RPTID);
    SERVO::CReport* defineReport(unsigned int RPTID, std::vector<unsigned int>& vids);
    // å–消 define report
    void deleteReport(unsigned int RPTID);
    bool removeReport(int rptid);
    void clearAllReport();
    // ä»Žæ–‡ä»¶ä¸­åŠ è½½CVariable列表
    int loadVarialbles(const char* pszFilepath);
@@ -120,9 +121,6 @@
    // ä»Žæ–‡ä»¶ä¸­åŠ è½½CReport列表
    int loadReports(const char* pszFilepath);
    // å–消/删除所有 define report
    void deleteAllReport();
    // å–å¾—Report列表
    std::vector<SERVO::CReport*>& getReports();
@@ -134,6 +132,7 @@
    // å–消/删除所有CollectionEvent
    void clearAllCollectionEvent();
    SERVO::CReport* getReport(int rptid);
@@ -175,7 +174,6 @@
    int onRecvMsg(IMessage* pMessage);
    void clearAllVariabel();
    std::vector<unsigned int> parseVidList(CString& strNums);
    void clearAllReport();
private:
    CModel* m_pModel;
@@ -203,9 +201,6 @@
    
    // RPTID to Report
    std::map<unsigned int, REPORT> m_mapReport;
    // VID to RPTID
    std::map<unsigned int, unsigned int> m_mapValueIdToPRTID;
    // VID to Report
    std::map<unsigned int, VALUE> m_mapValue;
SourceCode/Bond/Servo/Model.cpp
@@ -136,7 +136,7 @@
    m_hsmsPassive.loadReports((LPTSTR)(LPCTSTR)strVarialbleFile);
    strVarialbleFile.Format(_T("%s\\CollectionEventList.txt"), (LPTSTR)(LPCTSTR)m_strWorkDir);
    m_hsmsPassive.loadCollectionEvents((LPTSTR)(LPCTSTR)strVarialbleFile);
    m_hsmsPassive.init(this, "APP", 7000);
    SERVO::MasterListener masterListener;
    masterListener.onMasterStateChanged = [&](void* pMaster, SERVO::MASTERSTATE state) -> void {
SourceCode/Bond/Servo/ServoDlg.cpp
@@ -560,7 +560,7 @@
void CServoDlg::OnMenuProjectVarialbleList()
{
    CHMPropertyDlg dlg(_T("Variable|Rreport|Collection Event"), 658, 788);
    CHMPropertyDlg dlg(_T("Variable | Rreport | Collection Event"), 658, 788);
    CPageCollectionEvent* pPage1 = new CPageCollectionEvent();
    pPage1->Create(IDD_PAGE_COLLECTION_EVENT);