private void initProjectList() { this._mainFDControl = new IO_FD_Main(this._adtRec); FirmwareTargetEnvironment[] targetEnvironmentSet = new FirmwareTargetEnvironment[2]; targetEnvironmentSet[0] = FirmwareTargetEnvironment.System; this._firmwareItems = this._mainFDControl.GetFirmwareAvailable(Path.Combine(Application.StartupPath, "Firmware"), targetEnvironmentSet); string name = ""; if (this._selectedProject != null) { name = this._selectedProject.Name; } this.lstSelectProject.Items.Clear(); foreach (Project project in this._projectDescriptor) { if ((this._chipType != "Si4355") || (project.ChipType == this._chipType)) { if (project.LabEvaluation.Enabled) { bool flag = false; foreach (FirmwareItem item in this._firmwareItems) { if (item.name.Contains("Configuration and evaluation")) { project.LabEvaluation.Firmware = item; flag = true; } } if (!flag) { project.LabEvaluation.Enabled = false; } } if (project.FirmwareLoad.Enabled) { bool flag2 = false; foreach (FirmwareItem item2 in this._firmwareItems) { if (project.Name == item2.name) { project.FirmwareLoad.Firmware = item2; flag2 = true; } } if (!flag2) { project.FirmwareLoad.Enabled = false; } } if (((this.cbbModulationSource.SelectedIndex == 0) && ((this.rdbFixedPacketLen.Checked && project.Filter.IsFixedPacketLen) || (this.rdbVariablePacketLen.Checked && project.Filter.IsVariablePacketLen))) || ((this.cbbModulationSource.SelectedIndex == 1) && project.Filter.IsDirectMode)) { ListViewItem item3 = project.getSi4455RcListViewItem(); this.lstSelectProject.Items.Add(item3); } } } if (this.lstSelectProject.Items.Count > 0) { this.lstSelectProject.Items[0].Selected = true; } for (int i = 0; (name != "") && (i < this.lstSelectProject.Items.Count); i++) { if (((Project) this.lstSelectProject.Items[i].Tag).Name == name) { this.lstSelectProject.Items[i].Selected = true; return; } } }
private bool loadFirmwareCode(FirmwareItem firmware, Difference[] fwChanges) { Application.DoEvents(); try { bool flag = true; ((IOPH_DATA) this._ioph).AllowDeviceHandover(this._adtRec); Thread.Sleep(100); IO_FD_Main main = new IO_FD_Main(this._adtRec); if (main.DownloadFirmware(firmware, null, fwChanges) == FirmwareDownloadResult.OK) { ADTManager.instance().addADTRecord(this._adtRec); } else { flag = false; MessageBox.Show("Failed to load the appropreate firmware!\nPlease try again!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } ((IOPH_DATA) this._ioph).ReconnectDevice(this._adtRec); return flag; } catch (Exception exception) { _log.Error("Failed loading firmware code: " + exception.Message); this._ioph.terminate(); base.Close(); return false; } }
private void Dlg_FirmwareDownloadMultiMCU_Load(object sender, EventArgs e) { new Dlg_PowerWarning(this._adtRec).ShowDialog(); try { this._mainFDControl = new IO_FD_Main(this._adtRec); } catch (Exception exception) { GlobalServices.msgBox(exception.Message, "Firmware Download Error..."); base.DialogResult = DialogResult.Abort; base.Close(); return; } this._firmwareItems = this._mainFDControl.GetFirmwareAvailable(Path.Combine(Application.StartupPath, "Firmware"), new FirmwareTargetEnvironment[] { FirmwareTargetEnvironment.System }); this.lstSelectMcu.Items.Clear(); foreach (FirmwareItem item in this._firmwareItems) { string text = item.findTargetItemName(); bool flag = false; foreach (ListViewItem item2 in this.lstSelectMcu.Items) { if (item2.Text == text) { flag = true; break; } } if (!flag) { this.lstSelectMcu.Items.Add(text); } } if (this.lstSelectMcu.Items.Count > 0) { this.lstSelectMcu.Items[0].Selected = true; } this.loadFirmwareList(); this._pollDeviceTimer = new Timer(); this._pollDeviceTimer.Interval = 500; this._pollDeviceTimer.Tick += new EventHandler(this.PollDeviceTimerExpired); this._pollDeviceTimer.Start(); }
private void UpgradeFirmware() { Application.DoEvents(); try { WDS_MainProg.frameWin().DisablePlugAndPlay(); progressDlg.Show(this); _ioph.terminate(); Thread.Sleep(100); ADTRecord adtRecord = _ioph.getAdtRecord(); FirmwareDownloadResult stoppedWithError = new IO_FD_Main(adtRecord).DownloadFirmware(_latestFirmware, new UpdateFirmwareCallback(firmwareUpdateCallback), null); if (stoppedWithError == FirmwareDownloadResult.OK) { IOPortAddress.HIDAddress hidAddr = adtRecord.PortAddress.hidAddr; FormWait wait = new FormWait(hidAddr.VID, hidAddr.PID, hidAddr.Serial, false, 0x1388, 100) { Text = "Enumerating Application..." }; if (wait.ShowDialog() != DialogResult.OK) { firmwareUpdateCallback(0, true, "There was an error trying to reenumerate in application mode.", MessageBoxButtons.OK); stoppedWithError = FirmwareDownloadResult.StoppedWithError; } adtRecord.PortAddress.handle = DDI_HID.instance().open(adtRecord, ' '); ADTManager.instance().addADTRecord(adtRecord); } _ioph = new IOPH_DCP(adtRecord, this); _ioph.initialize(); createCloseWindowController(); progressDlg.Close(); WDS_MainProg.frameWin().RestorePlugAndPlay(); if (stoppedWithError != FirmwareDownloadResult.OK) { _log.Warn("RF_To_USB_Network_Demo: Mainboard firmware download failed"); _ioph.terminate(); base.Close(); } } catch { _log.Warn("RF_To_USB_Network_Demo: Mainboard firmware download failed"); _ioph.terminate(); base.Close(); } }
private void initProjectList() { _mainFDControl = new IO_FD_Main(_adtRec); FirmwareTargetEnvironment[] targetEnvironmentSet = new FirmwareTargetEnvironment[2]; targetEnvironmentSet[0] = FirmwareTargetEnvironment.System; _firmwareItems = _mainFDControl.GetFirmwareAvailable(Path.Combine(Application.StartupPath, "Firmware"), targetEnvironmentSet); lstSelectProject.Items.Clear(); foreach (PRO2ProjectDescriptor descriptor in _projectDescriptorList) { bool flag = false; foreach (Chip chip in descriptor.SupportedChips) { if ((chip.ChipType == _chipType) && (chip.ChipRevision == _chipRev)) { flag = true; break; } } if (flag) { bool enabled = descriptor.SaveBatch.Enabled; if (descriptor.ConfigureAndEvaluate.Enabled) { bool flag2 = false; foreach (FirmwareItem item in _firmwareItems) { if (item.name.Contains("Configuration and evaluation")) { descriptor.ConfigureAndEvaluate.Firmware = item; flag2 = true; } } if (!flag2) { descriptor.ConfigureAndEvaluate.Enabled = false; } } if (descriptor.DownloadProject.Enabled) { bool flag3 = false; foreach (FirmwareItem item2 in _firmwareItems) { if (descriptor.Name == item2.name) { descriptor.DownloadProject.Firmware = item2; flag3 = true; } } if (!flag3) { descriptor.DownloadProject.Enabled = false; } } if (descriptor.GenerateSource.Enabled && !Directory.Exists(Path.Combine(Application.StartupPath, Path.Combine(NewWDS.Applications.App_Common.GenerateSourceDialog.GenerateSourceDialog.PROJECT_CONTAINER_DIRECTORY, descriptor.GenerateSource.DirectoryName)))) { descriptor.GenerateSource.Enabled = false; } if ((descriptor.SaveBatch.Enabled || descriptor.ConfigureAndEvaluate.Enabled) || (descriptor.DownloadProject.Enabled || descriptor.GenerateSource.Enabled)) { ListViewItem item3 = descriptor.getSi4460RcaListViewItem(); lstSelectProject.Items.Add(item3); } } } if (lstSelectProject.Items.Count > 0) { lstSelectProject.Items[0].Selected = true; } }
private void btnStep3Next_Click(object sender, EventArgs e) { this.tabControl.TabPages[3].Enabled = false; this.tabControl.TabPages[4].Enabled = true; this.tabControl.SelectedTab = this.tabControl.TabPages[4]; this.btnStep3Skip.Focus(); this.txtStep4.Text = this.getStringResource("txtStep4Text_2"); this.pbarStep4.Position = 0; this.pbarStep4.Text = "Download Started..."; this.btnStep4Next.Enabled = false; this.btnStep4Prev.Enabled = false; Application.DoEvents(); try { new Dlg_PowerWarning(this._WirelessNodeAdtRec).ShowDialog(); if (this._additionalDevicePlugged) { this._mainFDControl = new IO_FD_Main(this._WirelessNodeAdtRec); FirmwareDownloadResult result = this._mainFDControl.DownloadFirmware(this._latestNodeFirmware, new UpdateFirmwareCallback(this.nodeFirmwareUpdateCallback), null); if (result != FirmwareDownloadResult.OK) { this.WirelessNodeFirmwareDownloadFailed(this._latestNodeFirmware, result.ToString()); } } } catch (Exception exception) { _log.Warn("Network Wizard: Node firmware download failed"); this.WirelessNodeFirmwareDownloadFailed(this._latestNodeFirmware, exception.Message); } }
private void btnStep1Next_Click(object sender, EventArgs e) { this.tabControl.TabPages[1].Enabled = false; this.tabControl.TabPages[2].Enabled = true; this.tabControl.SelectedTab = this.tabControl.TabPages[2]; this.btnStep2Next.Focus(); this.txtStep2.Text = this.getStringResource("txtStep2Text_2"); this.pbarStep2.Position = 0; this.pbarStep2.Text = "Download Started..."; this.btnStep2Next.Enabled = false; Application.DoEvents(); if (this._MscDbsFirmwareDownload) { try { new Dlg_PowerWarning(_ioph.getAdtRecord()).ShowDialog(); if (!_closeRequested) { _mainFDControl = new IO_FD_Main(_ioph.getAdtRecord()); FirmwareDownloadResult result = this._mainFDControl.DownloadFirmware(this._latestFirmware, new UpdateFirmwareCallback(this.firmwareUpdateCallback), null); if (_ioph.getAdtRecord().DeviceInfo.DeviceType.TypeID == DeviceTypeID.SRW006) { WDS_MainProg.frameWin().ShortcutPlugAndPlay(true, new WDSFrameWindow.DevicePluggedCallback(this.DevicePlugged), new WDSFrameWindow.DeviceUnPluggedCallback(this.DeviceUnPlugged)); this._waitForReconnect = true; this._ioph.terminate(); } if (result != FirmwareDownloadResult.OK) { MainBoardFirmwareDownloadFailed(_latestFirmware, result.ToString()); } } } catch (Exception exception) { _log.Warn("Network Wizard: Mainboard firmware download failed"); this.MainBoardFirmwareDownloadFailed(this._latestFirmware, exception.Message); } } else { string str = this._SelectedAssociatedAppName; if (str != null) { if (!(str == "Remote Keyless Entry Demo")) { if (!(str == "Security Demo") && !(str == "EZMac Network Demo")) { if (str == "Network Demo") { this.switchToWirelessNodeSetup("txtStep3Text"); } return; } } else { this.btnStep4Next_Click(null, null); return; } this.switchToWirelessNodeSetup("txtStep3Text"); } } }