1.EAP模拟器,启用或禁用警告上报功能实现和模拟测试;
2.Master端,收到EAP的启用或警告消息上报消息后,保存相关配置,如后续机器发生警告,根据配置决定是否上报警告消息;
已修改12个文件
94 ■■■■■ 文件已修改
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.h 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulator.rc 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.cpp 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/Resource.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CBonder.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/CMaster.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.cpp 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/HsmsPassive.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/Servo/Model.cpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SourceCode/Bond/EAPSimulator/CHsmsActive.cpp
@@ -186,6 +186,21 @@
    return 0;
}
int CHsmsActive::hsmsEDAlarmReport(bool bEnable, unsigned int id)
{
    char szEnable[2] = {128, 0};
    IMessage* pMessage = nullptr;
    int nRet = HSMS_Create1Message(pMessage, m_nSessionId, 5 | REPLY, 3, ++m_nSystemByte);
    ISECS2Item* pItem = pMessage->getBody();
    pItem->addBinaryItem(&szEnable[bEnable ? 0 : 1], 1, "ALED");
    pItem->addU4Item(id, "ALID");
    m_pActive->sendMessage(pMessage);
    HSMS_Destroy1Message(pMessage);
    return 0;
}
int CHsmsActive::replyAck0(IMessage* pMessage)
{
    return 0;
SourceCode/Bond/EAPSimulator/CHsmsActive.h
@@ -42,6 +42,9 @@
    // Enable/Disable Event Report
    int hsmsEDEventReport(bool bEnable, std::vector<int>& ids);
    // Enable/Disable Alarm Report
    int hsmsEDAlarmReport(bool bEnable, unsigned int id);
    // 通过的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/EAPSimulatorDlg.cpp
@@ -79,6 +79,7 @@
    ON_BN_CLICKED(IDC_BUTTON_DATETIME_SYNC, &CEAPSimulatorDlg::OnBnClickedButtonDatetimeSync)
    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)
END_MESSAGE_MAP()
@@ -166,6 +167,7 @@
    SetDlgItemInt(IDC_EDIT_PORT, 7000);
    SetGroup2Enabled(FALSE);
    SetGroup1Enabled(TRUE);
    ::SetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"), (void*)1);
    // log edit
@@ -258,6 +260,7 @@
    GetDlgItem(IDC_BUTTON_DATETIME_SYNC)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_TERMINAL_DISPLAY)->EnableWindow(enabled);    
    GetDlgItem(IDC_BUTTON_ED_EVENT_REPORT)->EnableWindow(enabled);
    GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->EnableWindow(enabled);
}
void CEAPSimulatorDlg::OnBnClickedButtonConnect()
@@ -296,3 +299,14 @@
    CEDEventReportDlg dlg;
    dlg.DoModal();
}
void CEAPSimulatorDlg::OnBnClickedButtonEdAlarmReport()
{
    int enable = (int)::GetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"));
    enable = enable == 0 ? 1 : 0;
    theApp.m_model.m_pHsmsActive->hsmsEDAlarmReport(enable == 1, 0);
    SetDlgItemText(IDC_BUTTON_ED_ALARM_REPORT,
        enable == 1 ? _T("Disable Alarm Report") : _T("Enable Alarm Report"));
    ::SetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"), (void*)enable);
}
SourceCode/Bond/EAPSimulator/EAPSimulatorDlg.h
@@ -50,4 +50,5 @@
    afx_msg void OnBnClickedButtonDatetimeSync();
    afx_msg void OnBnClickedButtonTerminalDisplay();
    afx_msg void OnBnClickedButtonEdEventReport();
    afx_msg void OnBnClickedButtonEdAlarmReport();
};
SourceCode/Bond/EAPSimulator/Resource.h
@@ -20,10 +20,10 @@
#define IDC_COMBO_TID                   1008
#define IDC_BUTTON_ED_EVENT_REPORT      1008
#define IDC_EDIT_TEXT                   1009
#define IDC_BUTTON_ED_ALARM_REPORT      1009
#define IDC_BUTTON_SEND                 1010
#define IDC_RADIO_ENABLE                1012
#define IDC_RADIO_DISABLE               1013
#define IDC_EDIT1                       1014
#define IDC_EDIT_CEID                   1014
// Next default values for new objects
SourceCode/Bond/Servo/CBonder.cpp
@@ -422,10 +422,10 @@
        // test     
        static int i[2] = { 0, 0 };
        i[m_nIndex]++;
        if (m_nIndex == 0 && i[m_nIndex] == 100) {
        if (m_nIndex == 0 && i[m_nIndex] % 20 == 0) {
            if (m_listener.onAlarm != nullptr) {
                m_listener.onAlarm(this, 1,
                    100,
                    i[m_nIndex],
                    getID(),
                    1);
            }
SourceCode/Bond/Servo/CMaster.cpp
@@ -1597,4 +1597,9 @@
    {
        m_bEnableAlarmReport = bEnable;
    }
    bool CMaster::isAlarmReportEnable()
    {
        return m_bEnableAlarmReport;
    }
}
SourceCode/Bond/Servo/CMaster.h
@@ -72,6 +72,7 @@
        void datetimeSync(SYSTEMTIME& time);
        void enableEventReport(bool bEnable);
        void enableAlarmReport(bool bEnable);
        bool isAlarmReportEnable();
    private:
        inline void lock() { EnterCriticalSection(&m_criticalSection); }
SourceCode/Bond/Servo/HsmsPassive.cpp
@@ -837,36 +837,9 @@
        if (!pItem->getSubItemU4(1, ALID)) goto MYREPLY;
        bCheckData = TRUE;
        LOGI("EanbleDisableAlarmReport ALED:0x%02x, ALID:%d", ALED[0], ALID);
        double d;
        float f;
        pItem->getSubItemF4(2, f);
        pItem->getSubItemF8(3, d);
        LOGI("EanbleDisableAlarmReport d:%lf, f:%f",
            d, f);
        /*
        unsigned long long n1;
        unsigned int n2;
        unsigned short n3;
        unsigned char n4;
        long long sn1;
        int sn2;
        short sn3;
        char sn4;
        pItem->getSubItemU8(2, n1);
        pItem->getSubItemU4(3, n2);
        pItem->getSubItemU2(4, n3);
        pItem->getSubItemU1(5, n4);
        pItem->getSubItemI8(6, sn1);
        pItem->getSubItemI4(7, sn2);
        pItem->getSubItemI2(8, sn3);
        pItem->getSubItemI1(9, sn4);
        LOGI("EanbleDisableAlarmReport n1:%llu, n2:%u, n3:%hu, n4:%hhu",
            n1, n2, n3, n4);
        LOGI("EanbleDisableAlarmReport sn1:%lld, sn2:%d, sn3:%hd, sn4:%hhd",
            sn1, sn2, sn3, sn4);
            */
        if (m_listener.onEnableDisableAlarmReport != nullptr) {
            m_listener.onEnableDisableAlarmReport(this, ALED[0] != 0, ALID);
        }
    }
SourceCode/Bond/Servo/HsmsPassive.h
@@ -62,6 +62,7 @@
typedef std::function<void(void* pFrom, const char*, std::vector<CommandParameter>&)> SECSCommand;
typedef std::function<void(void* pFrom, SYSTEMTIME& time)> DATETIMESYNC;
typedef std::function<void(void* pFrom, bool bEnable, std::vector<unsigned int>& ids)> EDEVENTREPORT;
typedef std::function<void(void* pFrom, bool bEnable, unsigned int id)> EDALARMREPORT;
typedef struct _SECSListener
{
    SECSEQOFFLINE                onEQOffLine;
@@ -71,6 +72,7 @@
    SECSCommand                    onCommand;
    DATETIMESYNC                onDatetimeSync;
    EDEVENTREPORT                onEnableDisableEventReport;
    EDALARMREPORT                onEnableDisableAlarmReport;
} SECSListener;
SourceCode/Bond/Servo/Model.cpp
@@ -119,6 +119,12 @@
            m_master.enableEventReport(bEnable);
        }
    };
    listener.onEnableDisableAlarmReport = [&](void* pFrom, bool bEnable, unsigned int id) -> void {
        LOGI("onEnableDisableAlarmReport bEnable:%s, id:%d", bEnable ? _T("YES") : _T("NO"), id);
        if (id == 0) {
            m_master.enableAlarmReport(bEnable);
        }
    };
    m_hsmsPassive.setListener(listener);
    m_hsmsPassive.setEquipmentModelType((LPTSTR)(LPCTSTR)strModeType);
    m_hsmsPassive.setSoftRev((LPTSTR)(LPCTSTR)strSoftRev);
@@ -182,9 +188,11 @@
            notify(RX_CODE_ALARM_CLEAR);
        }
        m_hsmsPassive.requestAlarmReport(state,
            pEquipment->getBaseAlarmId() + alarmId,
            strAlarmText.c_str());
        if (m_master.isAlarmReportEnable()) {
            m_hsmsPassive.requestAlarmReport(state,
                pEquipment->getBaseAlarmId() + alarmId,
                strAlarmText.c_str());
        }
    };
    masterListener.onEqVcrEventReport = [&](void* pMaster, SERVO::CEquipment* pEquipment, SERVO::CVcrEventReport* pReport) {
        LOGE("<CModel>onEqVcrEventReport.");