1.EAP模拟器,启用或禁用警告上报功能实现和模拟测试;
2.Master端,收到EAP的启用或警告消息上报消息后,保存相关配置,如后续机器发生警告,根据配置决定是否上报警告消息;
| | |
| | | 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; |
| | |
| | | // 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); |
| | | |
| | |
| | | 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() |
| | | |
| | | |
| | |
| | | SetDlgItemInt(IDC_EDIT_PORT, 7000); |
| | | SetGroup2Enabled(FALSE); |
| | | SetGroup1Enabled(TRUE); |
| | | ::SetProp(GetDlgItem(IDC_BUTTON_ED_ALARM_REPORT)->m_hWnd, _T("Enable"), (void*)1); |
| | | |
| | | |
| | | // log edit |
| | |
| | | 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() |
| | |
| | | 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); |
| | | } |
| | |
| | | afx_msg void OnBnClickedButtonDatetimeSync(); |
| | | afx_msg void OnBnClickedButtonTerminalDisplay(); |
| | | afx_msg void OnBnClickedButtonEdEventReport(); |
| | | afx_msg void OnBnClickedButtonEdAlarmReport(); |
| | | }; |
| | |
| | | #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 |
| | |
| | | // 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); |
| | | } |
| | |
| | | { |
| | | m_bEnableAlarmReport = bEnable; |
| | | } |
| | | |
| | | bool CMaster::isAlarmReportEnable() |
| | | { |
| | | return m_bEnableAlarmReport; |
| | | } |
| | | } |
| | |
| | | void datetimeSync(SYSTEMTIME& time); |
| | | void enableEventReport(bool bEnable); |
| | | void enableAlarmReport(bool bEnable); |
| | | bool isAlarmReportEnable(); |
| | | |
| | | private: |
| | | inline void lock() { EnterCriticalSection(&m_criticalSection); } |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | SECSCommand onCommand; |
| | | DATETIMESYNC onDatetimeSync; |
| | | EDEVENTREPORT onEnableDisableEventReport; |
| | | EDALARMREPORT onEnableDisableAlarmReport; |
| | | } SECSListener; |
| | | |
| | | |
| | |
| | | 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); |
| | |
| | | notify(RX_CODE_ALARM_CLEAR); |
| | | } |
| | | |
| | | 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."); |