Exemple #1
0
 private void AppWin_Si4455_RC_Load(object sender, EventArgs e)
 {
     this._chipType = this._adtRec.DeviceInfo.EBID.ChipType;
     this._chipRev = this._adtRec.DeviceInfo.EBID.ChipRevision;
     this.Text = this._chipType + " " + this.Text;
     this._excelCalculator = new ExcelCalculatorAPISpreadsheetGear((byte[]) this._appResources.GetObject("EZRadio2Calculator"));
     this._ezr2Config = new EZRadio2Config(this._chipType, this._chipRev);
     this._projectDescriptor = ProjectManager.createProjectDescriptorFromXML("NewWDS.Applications.App_Si4455.EZR2_projects.xml");
     this._configurationDescriptor = ConfigurationManager.createConfigDescriptorFromXML("NewWDS.Applications.App_Si4455.EZR2_config.xml");
     this.lstSelectProject.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
     this.errInfoProvider.Icon = Icon.FromHandle(new Bitmap(App_Si4455_Resource.info_16x16).GetHicon());
     this.initChipDescriptor();
     this.initChipSpecificData();
     this.initProjectList();
     this.loadConfigList(false);
     if (!GlobalServices.isfeatureAllowed(GlobalServices.Features.ClockOutput_Eval) && !GlobalServices.isfeatureAllowed(GlobalServices.Features.NextGenerationPRO_EngExtra))
     {
         this.chbEnableClockOutput.Visible = this.chbEnableClockOutput.Checked = this.grbEnableClockOutput.Visible = false;
     }
     try
     {
         this.cbbXtalTolerance.SelectedIndex = 0;
         this.cbbModulationSource.SelectedIndex = 0;
         this.cbbClockOutput.SelectedIndex = 0;
         this.cbbGpio0.SelectedIndex = 0;
         this.cbbGpio1.SelectedIndex = 0;
         this.cbbGpio2.SelectedIndex = 0;
         this.cbbGpio3.SelectedIndex = 0;
         this.cbbNirq.SelectedIndex = 0;
         this.cbbSdo.SelectedIndex = 0;
         this.cbbFRRA.SelectedIndex = 0;
         this.cbbFRRB.SelectedIndex = 0;
         this.cbbFRRC.SelectedIndex = 0;
         this.cbbFRRD.SelectedIndex = 0;
         this.bstModemStatus.StatusValue = (byte) (this.bstPHStatus.StatusValue = 0);
         this.chbEnableChipInt.Checked = true;
         this.bstChipStatus.StatusValue = 4;
     }
     catch (Exception exception)
     {
         _log.Error("Init form failed! " + exception.Message);
     }
 }
Exemple #2
0
 private void createXMLFileFromExcel()
 {
     XmlTextWriter writer = new XmlTextWriter("alma.xml", Encoding.UTF8) {
         Formatting = Formatting.Indented
     };
     writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
     writer.WriteStartElement("EzR2_config");
     writer.Close();
     XmlDocument document = new XmlDocument();
     document.Load("alma.xml");
     GlobalXMLManipulatorWriter xmlRW = new GlobalXMLManipulatorWriter(document.DocumentElement);
     ExcelCalculatorAPISpreadsheetGear gear = new ExcelCalculatorAPISpreadsheetGear("EZR2_config_table_for_4012.xlsx");
     int cnt = 0;
     string[] strArray = new string[] { "283-350", "425-525", "850-960" };
     string[] strArray2 = new string[] { "FSK", "GFSK", "OOK" };
     int[] numArray = new int[] { 5, 5, 0x23 };
     string[] strArray3 = new string[] { "loPPM", "hiPPM" };
     int[] numArray4 = new int[2];
     numArray4[1] = 15;
     int[] numArray2 = numArray4;
     int[] numArray3 = new int[] { 14, 14, 12 };
     for (int i = 0; i < strArray.Length; i++)
     {
         for (int j = 0; j < strArray2.Length; j++)
         {
             for (int k = 0; k < strArray3.Length; k++)
             {
                 string freqBand = strArray[i];
                 string modulation = strArray2[j];
                 string str3 = strArray3[k];
                 if ((j != 2) || (k != 1))
                 {
                     for (int m = 0; m < numArray3[j]; m++)
                     {
                         string str4 = "C";
                         string str5 = ((numArray[j] + numArray2[k]) + m).ToString();
                         string dataRate = gear.ReadCell(i + 1, str4 + str5);
                         if (dataRate != "")
                         {
                             double num7;
                             str4 = "E";
                             string s = gear.ReadCell(i + 1, str4 + str5);
                             string str8 = gear.ReadCell(i + 1, "J" + str5);
                             double result = 0.0;
                             double.TryParse(s, NumberStyles.Number, (IFormatProvider) null, out result);
                             double.TryParse(str8, NumberStyles.Number, (IFormatProvider) null, out num7);
                             cnt = this.addEzConfigNode(xmlRW, cnt, freqBand, modulation, ((j == 2) && (k == 0)) ? "hiPPM" : str3, dataRate, Math.Round(num7, 1).ToString("0.#"), result);
                         }
                     }
                 }
             }
         }
     }
     document.Save("alma.xml");
 }
 public static List<WizardConfig> createWizardDescriptorFromXLS(bool enableAFC, Modulation modulation, double dataRate)
 {
     List<WizardConfig> list = new List<WizardConfig>();
     ResourceManager manager = new ResourceManager("NewWDS.Applications.App_Si4455.App_Si4455_Resource", Assembly.GetExecutingAssembly());
     ExcelCalculatorAPISpreadsheetGear gear = new ExcelCalculatorAPISpreadsheetGear((byte[]) manager.GetObject("EZR2WizardData_v0_2B"));
     int workSheetNumber = 0;
     if (modulation == Modulation.OOK)
     {
         workSheetNumber = 1;
     }
     if (!enableAFC)
     {
         workSheetNumber += 2;
     }
     gear.WriteCell(workSheetNumber, "B4", dataRate.ToString("0.###"));
     int[] numArray = new int[] { 7, 20, 0x1d };
     for (int i = 0; i < numArray.Length; i++)
     {
         for (int j = numArray[i]; gear.ReadCell(workSheetNumber, "B" + j.ToString()) != ""; j++)
         {
             try
             {
                 WizardConfig item = new WizardConfig {
                     AFCEnabled = enableAFC,
                     Modulation = modulation,
                     DataRate = dataRate,
                     Region = (UsingRegion) Enum.Parse(typeof(UsingRegion), gear.ReadCell(workSheetNumber, "B" + j.ToString()), true)
                 };
                 string[] strArray = gear.ReadCell(workSheetNumber, "C" + j.ToString()).Split(new char[] { '-' });
                 double[] numArray2 = new double[Math.Min(strArray.Length, 2)];
                 if (((strArray.Length < 2) || !WDSConverters.ParseDouble(strArray[0], out numArray2[0])) || !WDSConverters.ParseDouble(strArray[1], out numArray2[1]))
                 {
                     throw new Exception("Could not parse Frequency band: " + gear.ReadCell(workSheetNumber, "B" + j.ToString()).Split(new char[] { '-' }));
                 }
                 item.FrequencyBand = new FreqRange();
                 item.FrequencyBand.LowEnd = numArray2[0];
                 item.FrequencyBand.HighEnd = numArray2[1];
                 string[] strArray2 = gear.ReadCell(workSheetNumber, "D" + j.ToString()).Split(new char[] { '-' });
                 double[] numArray3 = new double[Math.Min(strArray2.Length, 2)];
                 if (((strArray2.Length < 2) || !WDSConverters.ParseDouble(strArray2[0], out numArray3[0])) || !WDSConverters.ParseDouble(strArray2[1], out numArray3[1]))
                 {
                     throw new Exception("Could not parse Xtal tolerance: " + gear.ReadCell(workSheetNumber, "D" + j.ToString()).Split(new char[] { '-' }));
                 }
                 item.CrystalTolerance = (int) ((numArray3[0] + numArray3[1]) / 2.0);
                 double[] numArray4 = new double[4];
                 WDSConverters.ParseDouble(gear.ReadCell(workSheetNumber, "F" + j.ToString()), out numArray4[0]);
                 WDSConverters.ParseDouble(gear.ReadCell(workSheetNumber, "G" + j.ToString()), out numArray4[1]);
                 WDSConverters.ParseDouble(gear.ReadCell(workSheetNumber, "H" + j.ToString()), out numArray4[2]);
                 WDSConverters.ParseDouble(gear.ReadCell(workSheetNumber, "I" + j.ToString()), out numArray4[3]);
                 item.RangeIndorMax = (int) numArray4[0];
                 item.RangeIndorAllowed = (int) numArray4[1];
                 item.RangeOutdorMax = (int) numArray4[2];
                 item.RangeOutdorAllowed = (int) numArray4[3];
                 string[] strArray3 = gear.ReadCell(workSheetNumber, "J" + j.ToString()).Split(new char[] { ';' });
                 double[] numArray5 = new double[Math.Min(strArray3.Length, 2)];
                 if (((strArray3.Length < 3) || !WDSConverters.ParseDouble(strArray3[1], out numArray5[0])) || !WDSConverters.ParseDouble(strArray3[2], out numArray5[1]))
                 {
                     throw new Exception("Could not parse TX options: " + gear.ReadCell(workSheetNumber, "J" + j.ToString()).Split(new char[] { '-' }));
                 }
                 item.AntennaType = strArray3[0];
                 item.ConductedPower = numArray5[0];
                 item.CurrentDriven = numArray5[1];
                 item.Description = gear.ReadCell(workSheetNumber, "K" + j.ToString());
                 item.Standards = gear.ReadCell(workSheetNumber, "L" + j.ToString());
                 if (item.Standards.Contains("~"))
                 {
                     string strValue = item.Standards.Split(new char[] { '~' })[1].Trim();
                     if (strValue.EndsWith("dBm"))
                     {
                         strValue = strValue.Substring(0, strValue.Length - 3);
                     }
                     double num4 = 0.0;
                     WDSConverters.ParseDouble(strValue, out num4);
                     item.DbmDiff = num4;
                 }
                 item.AntennaGain = gear.ReadCell(workSheetNumber, "M" + j.ToString());
                 item.TxEirps = gear.ReadCell(workSheetNumber, "N" + j.ToString());
                 double doubleValue = 0.0;
                 WDSConverters.ParseDouble(gear.ReadCell(workSheetNumber, "R" + j.ToString()), out doubleValue);
                 item.CurrentDriven = doubleValue;
                 string str2 = gear.ReadCell(workSheetNumber, "Q" + j.ToString());
                 byte result = 0x4f;
                 if (str2.StartsWith("0x") && (str2.Length >= 4))
                 {
                     byte.TryParse(str2.Substring(2, 2), NumberStyles.HexNumber, (IFormatProvider) null, out result);
                 }
                 item.PowerSetting = result;
                 string str3 = "";
                 if (item.Standards.Contains("~"))
                 {
                     str3 = item.Standards.Split(new char[] { '~' })[1];
                 }
                 else if (item.TxEirps.Contains("~"))
                 {
                     str3 = item.TxEirps.Split(new char[] { '~' })[1];
                 }
                 if ((str3 != "") && str3.EndsWith("dBm"))
                 {
                     double num7 = 0.0;
                     if (WDSConverters.ParseDouble(str3.Substring(0, str3.Length - 3), out num7))
                     {
                         item.ConductedPower = num7;
                     }
                 }
                 list.Add(item);
             }
             catch (Exception exception)
             {
                 _log.Error("Could not create Si4455 Wizard configuration. " + exception.Message);
             }
         }
     }
     return list;
 }
Exemple #4
0
 private void AppWin_Si4012_CP_Load(object sender, EventArgs e)
 {
     this.tsrMainToolStrip.initVoltageRange(2.2, 3.6, this._currentVoltage);
     base.Location = WDS_MainProg.frameWin().getNextChildPosition();
     this.cbbPolarity.SelectedIndex = 0;
     this.cbbRampRate.SelectedIndex = 1;
     this.txbCarrierFrequency.Text = this._carrierFreqDefaultValue.ToString("#,000.000");
     this.txbDeviation.Text = this._deviationDefaultValue.ToString("#,000.00");
     this.txbCrystalFrequency.Text = this._externalXODefaultValue.ToString("#,000.000");
     for (int i = 0; i < 0x100; i++)
     {
         this.dgvTxFIFO.Rows.Add(new object[] { i.ToString(), "" });
     }
     if (this._ioph.getAdtRecord().isSimuation)
     {
         this.tsrMainToolStrip.VoltageEnabled = false;
         this.tsrMainToolStrip.AmmeteringEnabled = false;
         this.tsrMainToolStrip.ResetEnabled = false;
         this.tsrMainToolStrip.SwitchEnabled = false;
         this.tsrMainToolStrip.IdentifyEnabled = false;
     }
     this._appResources = new ResourceManager("NewWDS.Applications.App_Si4012.App_Si4012_Resource", base.GetType().Assembly);
     this._excelCalculator = new ExcelCalculatorAPISpreadsheetGear((byte[]) this._appResources.GetObject("Si4012_ExcelCalculator"));
     this.ModeSelectionChanged(null, null);
     this.TuneIntervalChanged(null, null);
     this.ModulationTypeAndDeviationChanged(null, null);
     this.ChipConfigChanged(null, null);
     this.CarrierFrequencyChanged(null, null);
     this.DataRateChanged(null, null);
     this.ExternalCrystalChanged(null, null);
     this.PowerAmplifierChanged(null, null);
     this.BatteryTresholdChanged(null, null);
     this.LEDControlChanged(null, null);
     this.LEDIntensityChanged(null, null);
     this.FIFOInterruptsChanged(null, null);
     this.FIFOTresholdChanged(null, null);
     this.BatteryLifeInformationChanged(null, null);
     this.sendDeviceInitCommands();
 }
Exemple #5
0
 private void AppWin_Si4012_RC_Load(object sender, EventArgs e)
 {
     this._chipType = this._adtRec.DeviceInfo.EBID.ChipType;
     this._chipRev = this._adtRec.DeviceInfo.EBID.ChipRevision;
     this.Text = this._chipType + " " + this.Text;
     this._projectDescriptor = ProjectManager.createProjectDescriptorFromXML("NewWDS.Applications.App_Si4012.Si4012_projects.xml");
     this._configurationDescriptor = ConfigurationManager.createConfigDescriptorFromXML("NewWDS.Applications.App_Si4012.Si4012_config.xml");
     this._excelCalculator = new ExcelCalculatorAPISpreadsheetGear((byte[]) this._appResources.GetObject("Si4012_ExcelCalculator"));
     this.initChipSpecificData();
     this.initProjectList();
     this.loadConfigList(false);
 }
Exemple #6
0
 private void createXMLFileFromExcel()
 {
     XmlTextWriter writer = new XmlTextWriter("alma.xml", Encoding.UTF8) {
         Formatting = Formatting.Indented
     };
     writer.WriteProcessingInstruction("xml", "version='1.0' encoding='UTF-8'");
     writer.WriteStartElement("EzR2_config");
     writer.Close();
     XmlDocument document = new XmlDocument();
     document.Load("alma.xml");
     GlobalXMLManipulatorWriter xmlRW = new GlobalXMLManipulatorWriter(document.DocumentElement);
     ExcelCalculatorAPISpreadsheetGear gear = new ExcelCalculatorAPISpreadsheetGear("EZR2_config_table_for_4012.xlsx");
     int cnt = 0;
     string[] strArray = new string[] { "283-350", "425-525", "850-960" };
     string[] strArray2 = new string[] { "FSK", "OOK" };
     int[] numArray = new int[] { 20, 0x23 };
     int[] numArray2 = new int[] { 14, 12 };
     for (int i = 0; i < strArray.Length; i++)
     {
         for (int j = 0; j < strArray2.Length; j++)
         {
             string freqBand = strArray[i];
             string modulation = strArray2[j];
             for (int k = 0; k < numArray2[j]; k++)
             {
                 string str4 = (numArray[j] + k).ToString();
                 string str3 = "P";
                 string s = string.Empty;
                 s = gear.ReadCell(i + 1, str3 + str4);
                 if (s != "0")
                 {
                     str3 = "C";
                     string dataRate = gear.ReadCell(i + 1, str3 + str4);
                     if (dataRate != "")
                     {
                         double num6;
                         str3 = "E";
                         string str7 = gear.ReadCell(i + 1, str3 + str4);
                         string str8 = gear.ReadCell(i + 1, "J" + str4);
                         double result = 0.0;
                         if (s == "1")
                         {
                             double.TryParse(str7, NumberStyles.Number, (IFormatProvider) null, out result);
                         }
                         else
                         {
                             double.TryParse(s, NumberStyles.Number, (IFormatProvider) null, out result);
                         }
                         double.TryParse(str8, NumberStyles.Number, (IFormatProvider) null, out num6);
                         cnt = this.addEzConfigNode(xmlRW, cnt, freqBand, modulation, "hiPPM", dataRate, Math.Round(num6, 1).ToString("0.#"), result);
                     }
                 }
             }
         }
     }
     document.Save("alma.xml");
 }