private void btnAdd_Click(object sender, EventArgs e) { this._createdConfig = new Config(); this._createdConfig.FreqBandHigh = 960; this._createdConfig.FreqBandLow = 0x1b; switch (this.cbbModulationType.SelectedIndex) { case 0: this._createdConfig.ModulationMode = Modulation.FSK; break; case 1: this._createdConfig.ModulationMode = Modulation.OOK; break; } this._createdConfig.DataRate = (double) this.nudDataRate.Value; if (this._createdConfig.ModulationMode == Modulation.OOK) { this._createdConfig.Deviation = 0.0; this._createdConfig.RampRate = this.cbbRampRate.SelectedIndex; } else { this._createdConfig.Deviation = (double) this.nudDeviation.Value; } this._createdConfig.CrystalTolerance = 90; this._createdConfig.ChannelBandwith = 0.0; base.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { if (this._selectedConfig != null) { this._createdConfig = new Config(); this._createdConfig.FreqBandHigh = this._selectedConfig.FreqBandHigh; this._createdConfig.FreqBandLow = this._selectedConfig.FreqBandLow; switch (this.cbbModulationType.SelectedIndex) { case 0: this._createdConfig.ModulationMode = Modulation.FSK; break; case 1: this._createdConfig.ModulationMode = Modulation.GFSK; break; case 2: this._createdConfig.ModulationMode = Modulation.OOK; break; } this._createdConfig.DataRate = (double) this.nudDataRate.Value; if (this._createdConfig.ModulationMode == Modulation.OOK) { this._createdConfig.Deviation = 0.0; } else { this._createdConfig.Deviation = (double) this.nudDeviation.Value; } if (this.rdbXtaLTolerance.Checked) { this._createdConfig.CrystalTolerance = (int) this.nudXTalTol.Value; this._createdConfig.ChannelBandwith = 0.0; } else { this._createdConfig.CrystalTolerance = 0; this._createdConfig.ChannelBandwith = (double) this.nudChannelBandwidth.Value; } } base.Close(); }
private void addConfig_FormClosed(object sender, FormClosedEventArgs e) { base.Enabled = this.dgvEzConfigEnable = true; this._createdConfig = this._addConfig.getCreatedConfig(); if (this._createdConfig != null) { this.startCalculation(); } }
private bool isValidateSelectionComplete() { if ((this.lstSelectProject.SelectedItems.Count <= 0) || ((this._selectedProject = (Project) this.lstSelectProject.SelectedItems[0].Tag) == null)) { MessageBox.Show("No Poject option is selected. Please select one.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } if ((this.dgvEzConfig.SelectedRows.Count > 0) && ((this._selectedConfig = (Config) this.dgvEzConfig.SelectedRows[0].Tag) != null)) { return true; } MessageBox.Show("Invalid EZConfig option is selected. Please select one.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; }
private void fillCalculatorInput(Pro2Calc.InputParams input, Config selectedConfig, Project selectedProject) { if (input != null) { input.CrystalFrequency = (int) (this.nudXtalFrequency.Value * 1000000M); if (selectedConfig.CrystalTolerance == 0) { input.CrystalTolerance = 30.0; } else { input.CrystalTolerance = selectedConfig.CrystalTolerance; } input.HighPerformanceChannelFilter = High_Perf_Ch_Fil.HighPerformance; input.OversamplingRateTune = 0.0; input.ChannelFilterAutoFrequencyControl = Ch_Fil_Bw_AFC.Rx1; input.AntennaDiversity = false; input.PreamblePattern = (this.cbbModulationSource.SelectedIndex == 0) ? PM_Pattern.EZR2Packet : PM_Pattern.EZR2Direct; string str = selectedConfig.ModulationMode.ToString(); if (selectedProject.Name.Contains("Unmodulated")) { str = "UnmodulatedCarrier"; } if (str.Contains("FSK")) { str = "_2" + str; } input.ModulationType = (MOD_Type) Enum.Parse(typeof(MOD_Type), str, true); input.SymbolRate = (int) (selectedConfig.DataRate * 1000.0); input.FrequencyDeviation = (int) (selectedConfig.Deviation * 1000.0); input.Manchester = this.chbManchesterMode.Checked; input.AutoFrequencyControl = (this.cbbModulationSource.SelectedIndex == 0) && (this.nudPreambeLength.Value >= 5M); input.SymbolRateError = Rsymb_error.onePercent; input.ChipVersion = Chip_Version.RevB_VCOv0; input.RF_Frequency = (int) (this.nudCenterFrequency.Value * 1000000M); input.RampingTime = 0x1c; input.FrequencyHoppingChannelSpacing = ((int) this.nudChannelSpacing.Value) * 0x3e8; if (this._runMode == RunMode.AddConfig) { if (selectedConfig.CrystalTolerance == 0) { input.OOK_Bandwidth = (int) (selectedConfig.ChannelBandwith * 1000.0); input.InputRxBandwidth = selectedConfig.ModulationMode != Modulation.OOK; } else { input.OOK_Bandwidth = 0x30d40; input.InputRxBandwidth = false; } } else if (input.ModulationType == MOD_Type.OOK) { input.OOK_Bandwidth = (int) (selectedConfig.ChannelBandwith * 1000.0); input.InputRxBandwidth = selectedConfig.ModulationMode != Modulation.OOK; } else { input.OOK_Bandwidth = 0x30d40; input.InputRxBandwidth = false; } input.HighPerformanceDividerMode = false; input.BitErrorRateTest = false; input.RawDataOutput = false; input.DataSource = 0; byte num = 0; byte num2 = 0; byte num3 = 0; if (this.cbbModulationSource.SelectedItem.ToString().Contains("Packet")) { num = 0; } else { num = 1; } if (selectedProject.Name.Contains("PN9")) { num = 2; } if (this.cbbModulationSource.SelectedItem.ToString().Contains("Direct")) { if (this.cbbGpio1.SelectedItem.ToString().Contains("(4)")) { num2 = (byte) (num2 | 1); } else if (this.cbbGpio2.SelectedItem.ToString().Contains("(4)")) { num2 = (byte) (num2 | 2); } else if (this.cbbGpio3.SelectedItem.ToString().Contains("(4)")) { num2 = (byte) (num2 | 3); } } num2 = (byte) (num2 << 2); num3 = (byte) (num3 << 4); input.DataSource = (num3 | num2) | num; input.IqCalibrationNeeded = false; } }
private void addConfig_FormClosed(object sender, FormClosedEventArgs e) { this._createdConfig = this._addConfig.getCreatedConfig(); if (this._createdConfig != null) { this._createdConfig.ConfigNumber = this._configurationDescriptor.Count + 1; this._configurationDescriptor.Add(this._createdConfig); this.loadConfigList(true); base.Enabled = this.dgvEzConfigEnable = true; } }
public void setSelectedConfig(Config selectedConfig) { this._selectedConfig = selectedConfig; }
private void btnCancel_Click(object sender, EventArgs e) { this._createdConfig = null; base.Close(); }
public static List<Config> createConfigDescriptorFromXML(string xmlResourcePath) { try { List<Config> list = new List<Config>(); Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(xmlResourcePath); XmlDocument document = new XmlDocument(); document.Load(manifestResourceStream); foreach (XmlNode node in document.GetElementsByTagName("Config")) { Config item = new Config(); if (node.Attributes.GetNamedItem("ConfNum") != null) { item.ConfigNumber = int.Parse(node.Attributes.GetNamedItem("ConfNum").Value); } foreach (XmlNode node2 in node.ChildNodes) { switch (node2.Name) { case "FreqBand": foreach (XmlNode node3 in node2.ChildNodes) { string name = node3.Name; if (name != null) { if (!(name == "LowEnd")) { if (name == "HighEnd") { goto Label_01BF; } } else { item.FreqBandLow = int.Parse(node3.InnerText.Trim()); } } continue; Label_01BF: item.FreqBandHigh = int.Parse(node3.InnerText.Trim()); } break; case "ModulationMode": item.ModulationMode = (Modulation) Enum.Parse(typeof(Modulation), node2.InnerText.Trim(), true); break; case "CrystalTolerance": item.CrystalTolerance = 30; if (node2.InnerText.Trim() == "hiPPM") { item.CrystalTolerance = 90; } break; case "DataRate": double num; if (!WDSConverters.ParseDouble(node2.InnerText.Trim(), out num)) { _log.Error("Could not parse dataRate: " + node2.InnerText.Trim()); } item.DataRate = num; break; case "ChanelBandwidth": double num2; if (!WDSConverters.ParseDouble(node2.InnerText.Trim(), out num2)) { _log.Error("Could not parse channel bandwidth: " + node2.InnerText.Trim()); } item.ChannelBandwith = num2; break; case "FrequencyDeviation": double num3; if (!WDSConverters.ParseDouble(node2.InnerText.Trim(), out num3)) { _log.Error("Could not parse deviation: " + node2.InnerText.Trim()); } item.Deviation = num3; break; case "Command": item.StoredProperties = new List<Pro2Calc.PropertyValuePair>(); foreach (XmlNode node4 in node2.ChildNodes) { if (node4.Name == "Property") { byte result = 0; if (!byte.TryParse(node4.Attributes.GetNamedItem("value").Value, NumberStyles.HexNumber, (IFormatProvider) null, out result)) { Console.WriteLine(node4.Attributes.GetNamedItem("value").Value); } Pro2Calc.PropertyValuePair pair = new Pro2Calc.PropertyValuePair(node4.Attributes.GetNamedItem("name").Value, result); item.StoredProperties.Add(pair); } } break; } } list.Add(item); } return list; } catch (Exception exception) { _log.Error("Configuration descreptor parsing problem: " + exception.Message); return null; } }