1.完善报警窗口,报警信息展示,有报警信息变化时刷新列表。
| | |
| | | #include "Common.h" |
| | | #include <iomanip> |
| | | |
| | | #define PAGE_SIZE 10 |
| | | #define PAGE_SIZE 100 |
| | | #define PAGE_BACKGROUND_COLOR RGB(252, 252, 255) |
| | | |
| | | // CAlarmDlg 对话框 |
| | |
| | | pAny->addRef(); |
| | | int code = pAny->getCode(); |
| | | |
| | | if (RX_CODE_STEP_EVENT_READDATA == code) { |
| | | LOGI("<CAlarmDlg> Accept RX_CODE_STEP_EVENT_READDATA successfully!"); |
| | | if (RX_CODE_ALARM_SET == code) { |
| | | UpdatePageData(); |
| | | |
| | | |
| | | // 通知设备状态 |
| | | /* |
| | | SERVO::CEqAlarmStep* pStep = nullptr; |
| | | if (pAny->getPtrValue("ptr", (void*&)pStep)) { |
| | | if (pStep != nullptr) { |
| | |
| | | alarmData.nUnitId = pStep->getUnitId(); |
| | | alarmData.strDeviceName = alarmManager.getDeviceNameById(alarmData.nDeviceId); |
| | | alarmData.strUnitName = alarmManager.getUnitNameById(alarmData.nDeviceId, alarmData.nUnitId); |
| | | alarmData.strStartTime = getCurrentTimeString(); |
| | | alarmData.strEndTime = "2000-01-01 00:00"; |
| | | |
| | | const AlarmInfo* pAlarmInfo = alarmManager.getAlarmInfoByID(pStep->getAlarmId()); |
| | | alarmData.strDescription = pAlarmInfo != nullptr ? pAlarmInfo->strAlarmText : ""; |
| | | |
| | | // 插入列表控件 |
| | | CListCtrl* pListCtrl = (CListCtrl*)GetDlgItem(IDC_LIST_ALARM); |
| | | if (pListCtrl != nullptr) { |
| | | InsertAlarmData(pListCtrl, alarmData); |
| | | if (pStep->getAlarmState() == 1) { |
| | | alarmData.strStartTime = getCurrentTimeString(); |
| | | alarmData.strEndTime = ""; |
| | | InsertAlarmData(&m_listCtrl, alarmData); |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | } |
| | | |
| | | else if (RX_CODE_ALARM_CLEAR == code) { |
| | | UpdatePageData(); |
| | | } |
| | | |
| | | pAny->release(); |
| | | }, [&]() -> void { |
| | |
| | | CString str; |
| | | str.Format(_T("%d"), alarmData.nId); |
| | | pListCtrl->SetItemText(nNewItem, 1, str); // 报警ID |
| | | str.Format(_T("%d"), alarmData.nSeverityLevel); |
| | | pListCtrl->SetItemText(nNewItem, 2, str); // 等级 |
| | | pListCtrl->SetItemText(nNewItem, 2, pszAlarmLevel[alarmData.nSeverityLevel % 2]); // 等级 |
| | | pListCtrl->SetItemText(nNewItem, 3, alarmData.strDeviceName.c_str()); // 设备名称 |
| | | pListCtrl->SetItemText(nNewItem, 4, alarmData.strUnitName.c_str()); // 单元名称 |
| | | pListCtrl->SetItemText(nNewItem, 5, alarmData.strStartTime.c_str()); // 开始时间 |
| | |
| | | #define RX_CODE_STEP_EVENT_READDATA 1005 |
| | | #define RX_CODE_SELECT_EQUIPMENT 1006 |
| | | #define RX_CODE_SELECT_STEP 1007 |
| | | #define RX_CODE_ALARM_SET 1008 |
| | | #define RX_CODE_ALARM_CLEAR 1009 |
| | | |
| | | |
| | | /* Channel Name */ |
| | | #define MC_CHANNEL1_NAME "McChannel1" |
| | |
| | | else { |
| | | LOGE("<CModel> Failed to add alarm."); |
| | | } |
| | | |
| | | notifyPtr(RX_CODE_ALARM_SET, pStep); |
| | | } |
| | | else { |
| | | alarmManager.clearAlarmByAttributes(pEqAlarmStep->getAlarmId(), |
| | | pEqAlarmStep->getEquipment()->getID(), |
| | | pEqAlarmStep->getUnitId(), |
| | | CToolUnits::getCurrentTimeString()); |
| | | notifyPtr(RX_CODE_ALARM_CLEAR, pStep); |
| | | } |
| | | |
| | | m_hsmsPassive.requestAlarmReport(pEqAlarmStep->getAlarmState(), |
| | |
| | | CRect rcWnd; |
| | | GetWindowRect(&rcWnd); |
| | | int nHeight = GetSystemMetrics(SM_CYSCREEN) - rcWnd.bottom - 38; |
| | | if (nHeight < 280) nHeight = 280; |
| | | m_pAlarmDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), nHeight); |
| | | } |
| | | ASSERT(m_pAlarmDlg); |
| | |
| | | CRect rcWnd; |
| | | GetWindowRect(&rcWnd); |
| | | int nHeight = GetSystemMetrics(SM_CYSCREEN) - rcWnd.bottom - 38; |
| | | if (nHeight < 280) nHeight = 280; |
| | | m_pLogDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), nHeight); |
| | | } |
| | | ASSERT(m_pLogDlg); |
| | |
| | | if (m_pLogDlg != nullptr && !m_pLogDlg->IsZoomed()) { |
| | | CRect rcWnd; |
| | | GetWindowRect(&rcWnd); |
| | | m_pLogDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), 200); |
| | | m_pLogDlg->SetWindowPos(nullptr, rcWnd.left, rcWnd.bottom - 8, 0, 0, SWP_NOSIZE); |
| | | } |
| | | |
| | | if (m_pAlarmDlg != nullptr && !m_pAlarmDlg->IsZoomed()) { |
| | | CRect rcWnd; |
| | | GetWindowRect(&rcWnd); |
| | | m_pAlarmDlg->MoveWindow(rcWnd.left, rcWnd.bottom - 8, rcWnd.Width(), 200); |
| | | m_pAlarmDlg->SetWindowPos(nullptr, rcWnd.left, rcWnd.bottom - 8, 0, 0, SWP_NOSIZE); |
| | | } |
| | | |
| | | CDialogEx::OnMove(x, y); |