public void checkDeviceIdErrorAlert(NMSReportCommand nmsReportCommand) { if (nmsReportCommand.nms_reprot_t == null || nmsReportCommand.Device == null) return; AlertClass alertClass = new AlertClass(); alertClass.AlertType = AlertType.DeviceIdError; nmsReportCommand.DeviceAlertCassification = DeviceAlertCassification.ALERT; alertClass.ErrorMessage = ""; //아이피 불일치 조사 if (!nmsReportCommand.Device.RouterIp.Equals(nmsReportCommand.GetLanIPString())) { alertClass.AddErrorMessage("Inconsistent IP"); } //SMS 상태 불일지 조사 if ((SmsSupport)nmsReportCommand.Device.SmsSupport == SmsSupport.SUPPORTED) { if (nmsReportCommand.nms_reprot_t.data.newsms < 0) { alertClass.AddErrorMessage("Inconsistent SMS Status"); } } else { if (nmsReportCommand.nms_reprot_t.data.newsms > 0) { alertClass.AddErrorMessage("Inconsistent SMS Status"); } } //와이파이 상태 불일치 조사 if ((WifiSupport)nmsReportCommand.Device.WifiSupport== WifiSupport.SUPPORTED) { if (nmsReportCommand.nms_reprot_t.data.wifistatus != 1 && nmsReportCommand.nms_reprot_t.data.wifistatus != 0) { alertClass.AddErrorMessage("Inconsistent Wifie Status"); } } else { if (nmsReportCommand.nms_reprot_t.data.wifistatus == 1 || nmsReportCommand.nms_reprot_t.data.wifistatus == 0) { alertClass.AddErrorMessage("Inconsistent Wifie Status"); } } //VPN 상태 불일치 조사 if ((VpnSupport)nmsReportCommand.Device.VpnSupport == VpnSupport.SUPPORTED) { if (nmsReportCommand.nms_reprot_t.data.vpnstatus != 1 && nmsReportCommand.nms_reprot_t.data.vpnstatus != 0) { alertClass.AddErrorMessage("Inconsistent VPN Status"); } } else { if (nmsReportCommand.nms_reprot_t.data.vpnstatus == 1 || nmsReportCommand.nms_reprot_t.data.vpnstatus == 0) { alertClass.AddErrorMessage("Inconsistent Vpn Status"); } } ////배터리 상태 불일치 조사 //if ((BatterySupport)nmsReportCommand.Device.BatterySupport == BatterySupport.SUPPORTED) //{ // if (nmsReportCommand.nms_reprot_t.data.ext_device1[0] < 0) // { // alertClass.AddErrorMessage("Inconsistent Battery Status"); // } //} //else //{ // if (nmsReportCommand.nms_reprot_t.data.ext_device1[0] > 0) // { // alertClass.AddErrorMessage("Inconsistent Battery Status"); // } //} if (alertClass.ErrorMessage.Length > 0) { DeviceIdErrCnt++; nmsReportCommand.AddAlert(alertClass); } }
private void AddRowToAlertGrid(NMSReportCommand nmsReportCommand) { CelotMClient.Model.Device device = nmsReportCommand.Device; nms_reprot_t nms = nmsReportCommand.nms_reprot_t; int insertRowCount = this.alertGrid.Rows.Count; this.alertGrid.Rows.Insert(insertRowCount); SourceGrid.Cells.Views.ColumnHeader nameHeaderView1 = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader namebackHeader1 = new DevAge.Drawing.VisualElements.ColumnHeader(); namebackHeader1.BackColor = Color.DarkSlateGray; nameHeaderView1.Background = namebackHeader1; nameHeaderView1.Border = cellBorder; nameHeaderView1.ForeColor = Color.White; nameHeaderView1.Font = new Font("굴림", 8, FontStyle.Regular); nameHeaderView1.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; alertGrid[insertRowCount, 0] = new SourceGrid.Cells.Cell(device == null ? "" : device.Name); alertGrid[insertRowCount, 0].View = viewNormal; alertGrid[insertRowCount, 1] = new SourceGrid.Cells.Cell(device == null ? "" : device.Des); alertGrid[insertRowCount, 1].View = viewNormal; alertGrid[insertRowCount, 2] = new SourceGrid.Cells.Cell(device == null ? "" : device.GroupName); alertGrid[insertRowCount, 2].View = viewNormal; alertGrid[insertRowCount, 3] = new SourceGrid.Cells.Cell(device == null ? "" : device.SerialNo.ToString()); alertGrid[insertRowCount, 3].View = viewNormal; alertGrid[insertRowCount, 4] = new SourceGrid.Cells.Cell(device == null ? "" : CelotUtility.ChangePhoneNumberToFormatString(device.PhoneNumber)); alertGrid[insertRowCount, 4].View = viewNormal; alertGrid[insertRowCount, 5] = new SourceGrid.Cells.Cell(device == null ? "" : device.RouterIp); alertGrid[insertRowCount, 5].View = viewNormal; alertGrid[insertRowCount, 6] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.header.session_id.ToString()); alertGrid[insertRowCount, 6].View = viewNormal; alertGrid[insertRowCount, 7] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.moduleband.ToString()); alertGrid[insertRowCount, 7].View = viewNormal; alertGrid[insertRowCount, 8] = new SourceGrid.Cells.Cell(nms == null ? "" : nmsReportCommand.GetLanIPString()); alertGrid[insertRowCount, 8].View = viewNormal; alertGrid[insertRowCount, 9] = new SourceGrid.Cells.Cell(nms == null ? "" : nmsReportCommand.GetWanIPString()); alertGrid[insertRowCount, 9].View = viewNormal; alertGrid[insertRowCount, 10] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.devicestatus.ToString()); alertGrid[insertRowCount, 10].View = viewNormal; alertGrid[insertRowCount, 11] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.vpnstatus.ToString()); alertGrid[insertRowCount, 11].View = viewNormal; alertGrid[insertRowCount, 12] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.wifistatus.ToString()); alertGrid[insertRowCount, 12].View = viewNormal; alertGrid[insertRowCount, 13] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.newsms.ToString()); alertGrid[insertRowCount, 13].View = viewNormal; alertGrid[insertRowCount, 14] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.sw_version); alertGrid[insertRowCount, 14].View = viewNormal; alertGrid[insertRowCount, 15] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.external_power.ToString()); alertGrid[insertRowCount, 15].View = viewNormal; alertGrid[insertRowCount, 16] = new SourceGrid.Cells.Cell(nms == null ? "" : nms.data.ext_device1[0].ToString()); alertGrid[insertRowCount, 16].View = viewNormal; SignalBar signal = new SignalBar(); signal.Dock = DockStyle.None; signal.Minimum = 0; signal.Maximum = 4; signal.BackColor = Color.SlateGray; if (nms != null) { signal.CurrentValue = nmsAlertManager.getRssiLevel(nms.data.modulesignal); } else { signal.CurrentValue = 0; } SourceGrid.Cells.Cell signalCell = new SourceGrid.Cells.Cell(); alertGrid[insertRowCount, 17] = signalCell; alertGrid[insertRowCount, 17].View = viewNormal; SourceGrid.LinkedControlValue linkedControlValue = new SourceGrid.LinkedControlValue(signal, new SourceGrid.Position(insertRowCount, 17)); alertGrid.LinkedControls.Add(linkedControlValue); alertGrid[insertRowCount, 18] = new SourceGrid.Cells.Cell((nms == null ? "" : nms.data.rpt_time.ToString())); alertGrid[insertRowCount, 18].View = viewNormal; alertGrid[insertRowCount, 19] = new SourceGrid.Cells.Cell((nms == null ? "" : nms.header.pro_ver.ToString())); alertGrid[insertRowCount, 19].View = nameHeaderView1; string currentTime = CelotUtility.ChangeStampStringToLocalFormat(nms.data.current_time); alertGrid[insertRowCount, 20] = new SourceGrid.Cells.Cell(currentTime); alertGrid[insertRowCount, 20].View = viewNormal; string resetTime = ""; if (device != null && device.ResetTime != 0) { resetTime = CelotUtility.UnixTimeStampToDateString(device.ResetTime); } alertGrid[insertRowCount, 21] = new SourceGrid.Cells.Cell(resetTime); alertGrid[insertRowCount, 21].View = viewNormal; }
private void AddDeviceToMap(NMSReportCommand nmsReportCommand) { CelotMClient.Model.Device device = nmsReportCommand.Device; nms_reprot_t nms = nmsReportCommand.nms_reprot_t; string routerName = device.Name; int serialNo = device.SerialNo; string number = CelotUtility.ChangePhoneNumberToFormatString(device.PhoneNumber); string des = device.Des; string latitude = device.Latitude; string longitude = device.Longitude; string routerIp = device == null ? "" : device.RouterIp; string lanIp = nms == null ? "": nmsReportCommand.GetLanIPString(); string wanIp = nms == null ? "" : nmsReportCommand.GetWanIPString(); string message = nmsReportCommand.GetAlertMessages() !=null ? nmsReportCommand.GetAlertMessages().Substring(1):""; string rssi = nms == null ? "" : String.Format("{0} ({1})", nms.data.modulesignal, this.alertManager.getRssiLevel(nmsReportCommand.nms_reprot_t.data.modulesignal )); string firmVersion = nms == null ? "" : nms.data.sw_version; string nmsVersion = nms == null ? "" : nms.header.pro_ver.ToString(); int routerStatus = 0; switch(nmsReportCommand.DeviceAlertCassification){ case DeviceAlertCassification.NORMAL: routerStatus = 0; break; case DeviceAlertCassification.ABNORMAL: routerStatus = 1; break; case DeviceAlertCassification.ALERT: routerStatus = 2; break; } this.webBrowser1.Document.InvokeScript( "addMarker", new object[] { latitude, longitude, routerName, des, serialNo, number, rssi, routerIp, lanIp, wanIp, firmVersion, nmsVersion, message, routerStatus } ); }