public void CWInterferenceReportMsgReceived(ref CW_PeakRegs[] IR, string decodedScanResultsStr) { try { string[] strArray = decodedScanResultsStr.Split(new char[] { ' ' }); int num2 = strArray.GetLength(0) / 2; lock (this.LockInterferenceReport) { for (int i = 0; i < num2; i++) { IR[i].freq = Convert.ToInt32(strArray[i], 0x10); } for (int j = 0; j < num2; j++) { IR[j].mag = Convert.ToUInt16(strArray[num2 + j], 0x10); } IR[0].freqD = IR[0].freq * 1000000.0; IR[1].freqD = IR[1].freq * 1000000.0; IR[2].freqD = IR[2].freq * 1000000.0; IR[3].freqD = IR[3].freq * 1000000.0; IR[4].freqD = IR[4].freq * 1000000.0; IR[5].freqD = IR[5].freq * 1000000.0; IR[6].freqD = IR[6].freq * 1000000.0; IR[7].freqD = IR[7].freq * 1000000.0; IR[0].magD = IR[0].mag * 0.01; IR[1].magD = IR[1].mag * 0.01; IR[2].magD = IR[2].mag * 0.01; IR[3].magD = IR[3].mag * 0.01; IR[4].magD = IR[4].mag * 0.01; IR[5].magD = IR[5].mag * 0.01; IR[6].magD = IR[6].mag * 0.01; IR[7].magD = IR[7].mag * 0.01; } } catch (Exception exception) { string msg = "### Interference Report GUI handler error -- " + exception.Message; this.comm.WriteApp(msg); } }
private void CreateSameData(ref CW_PeakRegs[] IR) { IR[0].freqD = -1270000.0; IR[1].freqD = -475000.0; IR[2].freqD = -200000.0; IR[3].freqD = 1500000.0; IR[4].freqD = 2000000.0; IR[5].freqD = 2270000.0; IR[6].freqD = 2475000.0; IR[7].freqD = 3125000.0; IR[0].magD = 5.0; IR[1].magD = 4.0; IR[2].magD = 10.0; IR[3].magD = 20.0; IR[4].magD = 25.0; IR[5].magD = 5.0; IR[6].magD = 4.0; IR[7].magD = 6.0; }
public void CreateChart(ZedGraph.ZedGraphControl zgc, ref CW_PeakRegs[] IR) { EventHandler method = null; try { zgc.GraphPane = this.myPane; zgc.GraphPane.CurveList.Clear(); zgc.GraphPane.GraphObjList.Clear(); this.RedLimit = (double) this.RedNumericUpDown.Value; this.BlueLimit = (double) this.BlueNumericUpDown.Value; this.GreenLimit = (double) this.GreenNumericUpDown.Value; this.myPane.Title.Text = "CW Interference Detection"; this.myPane.YAxis.Title.Text = "Power dB/Hz"; this.myPane.XAxis.Title.Text = "Frequency (from L1 center)"; this.myPane.BarSettings.Type = ZedGraph.BarType.Overlay; int num = 0; int num2 = 0; int num3 = 0; for (int i = 0; i < 8; i++) { if (IR[i].magD >= this.GreenLimit) { if (IR[i].magD >= this.RedLimit) { num++; } if ((IR[i].magD >= this.BlueLimit) && (IR[i].magD < this.RedLimit)) { num2++; } if (IR[i].magD < this.BlueLimit) { num3++; } } } double[] x = new double[num]; double[] y = new double[num]; double[] numArray3 = new double[num3]; double[] numArray4 = new double[num3]; double[] numArray5 = new double[num2]; double[] numArray6 = new double[num2]; int index = -1; int num6 = -1; int num7 = -1; for (int j = 0; j < 8; j++) { try { if (IR[j].magD >= this.GreenLimit) { if ((num > 0) && (IR[j].magD >= this.RedLimit)) { index++; x[index] = IR[j].freqD; y[index] = IR[j].magD; } if (((num2 > 0) && (IR[j].magD >= this.BlueLimit)) && (IR[j].magD < this.RedLimit)) { num6++; numArray5[num6] = IR[j].freqD; numArray6[num6] = IR[j].magD; } if ((num3 > 0) && (IR[j].magD < this.BlueLimit)) { num7++; numArray3[num7] = IR[j].freqD; numArray4[num7] = IR[j].magD; } } } catch (IndexOutOfRangeException exception) { string str = exception.ToString(); string msg = "### Interference Report GUI handler error -- " + str; this.comm.WriteApp(msg); } } if (num > 0) { string label = string.Format(">{0:F1}", this.RedLimit); this.myPane.AddBar(label, x, y, Color.Red); } if (num2 > 0) { string str4 = string.Format(">{0:F1}", this.BlueLimit); this.myPane.AddBar(str4, numArray5, numArray6, Color.Blue); } if (num3 > 0) { string str5 = string.Format("<{0:F1}", this.GreenLimit); this.myPane.AddBar(str5, numArray3, numArray4, Color.Green); } AddlabelToBars(this.myPane, x, y); AddlabelToBars(this.myPane, numArray5, numArray6); AddlabelToBars(this.myPane, numArray3, numArray4); this.myPane.Chart.Fill = new ZedGraph.Fill(Color.White, Color.LightGoldenrodYellow, 45f); this.myPane.YAxis.Scale.MaxAuto = false; this.myPane.YAxis.Scale.MinAuto = false; this.myPane.XAxis.Scale.MaxAuto = false; this.myPane.XAxis.Scale.MinAuto = false; this.myPane.YAxis.Scale.Max = 100.0; this.myPane.YAxis.Scale.Min = 0.0; this.myPane.XAxis.Scale.Min = 1.57E+15; this.myPane.XAxis.Scale.Max = 1.58E+15; this.myPane.BarSettings.ClusterScaleWidthAuto = false; this.myPane.BarSettings.ClusterScaleWidth = 1000000000000; zgc.AxisChange(); this.myPane.Fill = new ZedGraph.Fill(Color.WhiteSmoke); if (method == null) { method = delegate { zgc.Refresh(); zgc.Update(); }; } base.Invoke(method); zgc.Size = new Size(base.ClientRectangle.Width - 0x19, base.ClientRectangle.Height - 90); } catch (Exception exception2) { string str6 = exception2.ToString(); string str7 = "### Interference Report GUI handler error -- " + str6; this.comm.WriteApp(str7); } }