Ejemplo n.º 1
0
 public bool initCreateStartDemoProject(IDELauncherSetup projectSetup, Project selectedProject, out string errorMsg)
 {
     errorMsg = "";
     this._setup = projectSetup;
     string path = Path.Combine(Application.StartupPath, Path.Combine("DemoExample", selectedProject.IDELoader.DirectoryName));
     string str2 = Path.Combine(this._setup.projectDirectoyPath, this._setup.projectName);
     if (!Directory.Exists(str2))
     {
         Directory.CreateDirectory(str2);
     }
     if (!Directory.Exists(path))
     {
         errorMsg = "Project source does not exist!";
         return false;
     }
     DirectoryInfo source = new DirectoryInfo(path);
     DirectoryInfo target = new DirectoryInfo(str2);
     CopyAll(source, target);
     if (this._setup.radioChipHeader != string.Empty)
     {
         string str3 = Path.Combine(str2, selectedProject.IDELoader.HeaderLocation);
         if (str3 == string.Empty)
         {
             errorMsg = "Could not find modem_params.h file!";
             return false;
         }
         File.WriteAllText(str3, this._setup.radioChipHeader);
     }
     string str4 = this.getFilePathAndName(target, new string[] { this._setup.toolVendor.ToString() }, ".wsp");
     if (str4 == string.Empty)
     {
         errorMsg = "Could not find project file!";
         return false;
     }
     string contents = File.ReadAllText(str4).Replace("<Assembler>", this._setup.assemblerExec).Replace("<AssFlag>", this._setup.assemblerFlags).Replace("<Compiler>", this._setup.compilerExec).Replace("<CompFlag>", this._setup.compilerFlags).Replace("<Linker>", this._setup.linkerExec).Replace("<LinkFlag>", this._setup.linkerFlags);
     File.WriteAllText(str4, contents);
     ProcessStartInfo startInfo = new ProcessStartInfo(this._setup.ideExecutable) {
         Arguments = str4
     };
     Process.Start(startInfo);
     return true;
 }
Ejemplo n.º 2
0
 public void setProject(Project project)
 {
     this._selectedProject = project;
 }
Ejemplo n.º 3
0
 private void lstSelectProject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.lstSelectProject.SelectedItems.Count > 0)
     {
         this._selectedProject = (Project) this.lstSelectProject.SelectedItems[0].Tag;
         this.FirmwareDescriptionTextBox.Text = this._selectedProject.Description;
         if (this._selectedProject.Name == "Direct TX")
         {
             this.cbbGpio0.SelectedIndex = 4;
             this.cbbGpio1.SelectedIndex = 7;
         }
         else if (this._selectedProject.Name == "Direct RX")
         {
             this.cbbGpio0.SelectedIndex = 8;
             this.cbbGpio1.SelectedIndex = 10;
         }
         else if (this._selectedProject.Name == "Packet TX")
         {
             this.chbEnablePHInt.Checked = true;
             this.bstPHStatus.StatusValue = (byte) (this.bstPHStatus.StatusValue | 0x20);
             this.cbbGpio0.SelectedIndex = 1;
             this.cbbGpio1.SelectedIndex = 1;
             this.cbbGpio2.SelectedIndex = 1;
             this.cbbGpio3.SelectedIndex = 1;
         }
         else if (this._selectedProject.Name == "Packet RX")
         {
             this.chbEnablePHInt.Checked = true;
             this.bstPHStatus.StatusValue = (byte) (this.bstPHStatus.StatusValue | 0x10);
         }
         else if (this._selectedProject.Name == "Packet RX LDC")
         {
             this.chbEnablePHInt.Checked = true;
             this.bstPHStatus.StatusValue = (byte) (this.bstPHStatus.StatusValue | 0x18);
             this.chbEnableModemInt.Checked = true;
             this.bstModemStatus.StatusValue = (byte) (this.bstModemStatus.StatusValue | 3);
             this.chbEnableChipInt.Checked = true;
             this.bstChipStatus.StatusValue = (byte) (this.bstChipStatus.StatusValue | 4);
         }
         else if (this._selectedProject.Name == "Packet TRX")
         {
             this.chbEnablePHInt.Checked = true;
             this.bstPHStatus.StatusValue = (byte) (this.bstPHStatus.StatusValue | 0x30);
             this.cbbGpio0.SelectedIndex = 1;
             this.cbbGpio1.SelectedIndex = 1;
             this.cbbGpio2.SelectedIndex = 1;
             this.cbbGpio3.SelectedIndex = 1;
         }
         this.btnLabEvaluation.Enabled = this.btnLabEvaluationHelp.Enabled = this._selectedProject.LabEvaluation.Enabled;
         this.btnLoadFirmware.Enabled = this.btnLoadFirmwareHelp.Enabled = this._selectedProject.FirmwareLoad.Enabled;
         this.btnLaunchIDE.Enabled = this.btnLaunchIDEHelp.Enabled = this._selectedProject.IDELoader.Enabled;
     }
     else
     {
         this.btnLabEvaluation.Enabled = this.btnLabEvaluationHelp.Enabled = this.btnLoadFirmware.Enabled = this.btnLoadFirmwareHelp.Enabled = this.btnLaunchIDE.Enabled = this.btnLaunchIDEHelp.Enabled = false;
     }
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
     }
 }
Ejemplo n.º 6
0
 private void lstSelectProject_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.lstSelectProject.SelectedItems.Count > 0)
     {
         this._selectedProject = (Project) this.lstSelectProject.SelectedItems[0].Tag;
         this.FirmwareDescriptionTextBox.Text = this._selectedProject.Description;
         this.btnLabEvaluation.Enabled = this.btnLabEvaluationHelp.Enabled = this._selectedProject.LabEvaluation.Enabled;
         this.btnLoadFirmware.Enabled = this.btnLoadFirmwareHelp.Enabled = this._selectedProject.FirmwareLoad.Enabled;
         this.btnLaunchIDE.Enabled = this.btnLaunchIDEHelp.Enabled = this._selectedProject.IDELoader.Enabled;
     }
     else
     {
         this.btnLabEvaluation.Enabled = this.btnLabEvaluationHelp.Enabled = this.btnLoadFirmware.Enabled = this.btnLoadFirmwareHelp.Enabled = this.btnLaunchIDE.Enabled = this.btnLaunchIDEHelp.Enabled = false;
     }
 }
Ejemplo n.º 7
0
 public static List<Project> createProjectDescriptorFromXML(string xmlResourcePath)
 {
     try
     {
         List<Project> list = new List<Project>();
         Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(xmlResourcePath);
         XmlDocument document = new XmlDocument();
         document.Load(manifestResourceStream);
         foreach (XmlNode node in document.GetElementsByTagName("Project"))
         {
             Project item = new Project();
             if (node.Attributes.GetNamedItem("name") != null)
             {
                 item.Name = node.Attributes.GetNamedItem("name").Value;
             }
             if (node.Attributes.GetNamedItem("chipType") != null)
             {
                 item.ChipType = node.Attributes.GetNamedItem("chipType").Value;
             }
             if (node.Attributes.GetNamedItem("chipRev") != null)
             {
                 item.ChipRev = node.Attributes.GetNamedItem("chipRev").Value;
             }
             if (node.Attributes.GetNamedItem("way") != null)
             {
                 item.RfWay = node.Attributes.GetNamedItem("way").Value;
             }
             foreach (XmlNode node2 in node.ChildNodes)
             {
                 string name = node2.Name;
                 if (name != null)
                 {
                     if (!(name == "Description"))
                     {
                         if (name == "Filter")
                         {
                             goto Label_01AD;
                         }
                         if (name == "LabEval")
                         {
                             goto Label_02BE;
                         }
                         if (name == "FirmwareLoad")
                         {
                             goto Label_03E1;
                         }
                         if (name == "IDELoad")
                         {
                             goto Label_050D;
                         }
                     }
                     else
                     {
                         item.Description = node2.InnerText.Trim();
                     }
                 }
                 continue;
             Label_01AD:
                 foreach (XmlNode node3 in node2.ChildNodes)
                 {
                     string str2;
                     if ((node3.Attributes.GetNamedItem("value") != null) && ((str2 = node3.Name) != null))
                     {
                         if (!(str2 == "IsFixedPacketLen"))
                         {
                             if (str2 == "IsVariablePacketLen")
                             {
                                 goto Label_0248;
                             }
                             if (str2 == "IsDirectMode")
                             {
                                 goto Label_0271;
                             }
                         }
                         else
                         {
                             item.Filter.IsFixedPacketLen = bool.Parse(node3.Attributes.GetNamedItem("value").Value);
                         }
                     }
                     goto Label_0298;
                 Label_0248:
                     item.Filter.IsVariablePacketLen = bool.Parse(node3.Attributes.GetNamedItem("value").Value);
                     goto Label_0298;
                 Label_0271:
                     item.Filter.IsDirectMode = bool.Parse(node3.Attributes.GetNamedItem("value").Value);
                 Label_0298:;
                 }
                 continue;
             Label_02BE:
                 if (node2.Attributes.GetNamedItem("enabled") != null)
                 {
                     item.LabEvaluation.Enabled = bool.Parse(node2.Attributes.GetNamedItem("enabled").Value);
                 }
                 foreach (XmlNode node4 in node2.ChildNodes)
                 {
                     string str3;
                     if (((str3 = node4.Name) != null) && (str3 == "InteractionOptions"))
                     {
                         XmlNodeList childNodes = node4.ChildNodes;
                         List<string> list4 = new List<string>();
                         foreach (XmlNode node5 in childNodes)
                         {
                             if (node5.Name == "Option")
                             {
                                 list4.Add(node5.InnerText.Trim());
                             }
                         }
                         item.LabEvaluation.InteractionOptions = list4.ToArray();
                     }
                 }
                 continue;
             Label_03E1:
                 if (node2.Attributes.GetNamedItem("enabled") != null)
                 {
                     item.FirmwareLoad.Enabled = bool.Parse(node2.Attributes.GetNamedItem("enabled").Value);
                     if (item.FirmwareLoad.Enabled)
                     {
                         foreach (XmlNode node6 in node2.ChildNodes)
                         {
                             string str4;
                             if (((str4 = node6.Name) != null) && (str4 == "Firmware"))
                             {
                                 if (node6.Attributes.GetNamedItem("name") != null)
                                 {
                                     item.FirmwareLoad.Name = node6.Attributes.GetNamedItem("name").Value;
                                 }
                                 if (node6.Attributes.GetNamedItem("dataAddress") != null)
                                 {
                                     item.FirmwareLoad.DataStartAddress = ushort.Parse(node6.Attributes.GetNamedItem("dataAddress").Value.Substring(2), NumberStyles.HexNumber);
                                 }
                             }
                         }
                     }
                 }
                 continue;
             Label_050D:
                 if (node2.Attributes.GetNamedItem("enabled") != null)
                 {
                     item.IDELoader.Enabled = bool.Parse(node2.Attributes.GetNamedItem("enabled").Value);
                 }
                 foreach (XmlNode node7 in node2.ChildNodes)
                 {
                     string str5 = node7.Name;
                     if (str5 != null)
                     {
                         if (!(str5 == "DirName"))
                         {
                             if (str5 == "HeaderLocation")
                             {
                                 goto Label_05BA;
                             }
                             if (str5 == "HeaderTemplateName")
                             {
                                 goto Label_05D4;
                             }
                         }
                         else
                         {
                             item.IDELoader.DirectoryName = node7.InnerText.Trim();
                         }
                     }
                     continue;
                 Label_05BA:
                     item.IDELoader.HeaderLocation = node7.InnerText.Trim();
                     continue;
                 Label_05D4:
                     item.IDELoader.HeaderTemplateName = node7.InnerText.Trim();
                 }
             }
             list.Add(item);
         }
         return list;
     }
     catch (Exception exception)
     {
         _log.Error("Project descreptor parsing problem: " + exception.Message);
         return null;
     }
 }