/// <summary> /// Get the correct object for the modem which is in bootloader mode. /// </summary> /// <param name="Session">The session. Must not be null.</param> /// <returns>null if could not generate modem object</returns> public static RFD900APU GetObjectForModem(TSession Session) { Uploader U = new Uploader(); U.port = Session.Port; Uploader.Board Board = Uploader.Board.FAILED; Uploader.Frequency Freq = Uploader.Frequency.FAILED; U.getDevice(ref Board, ref Freq); switch (Board) { case Uploader.Board.DEVICE_ID_RFD900A: return(new RFD900a(Session)); case Uploader.Board.DEVICE_ID_RFD900P: return(new RFD900p(Session)); case Uploader.Board.DEVICE_ID_RFD900U: return(new RFD900u(Session)); case Uploader.Board.DEVICE_ID_RFD900: return(new RFD900old(Session)); case Uploader.Board.DEVICE_ID_HM_TRP: return(new HM_TRP(Session)); default: return(null); } }
private bool getFirmwareLocal(Uploader.Board device) { using (var openFileDialog1 = new OpenFileDialog()) { openFileDialog1.Filter = "Firmware|*.hex;*.ihx"; openFileDialog1.RestoreDirectory = true; openFileDialog1.Multiselect = false; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { File.Copy(openFileDialog1.FileName, firmwarefile, true); } catch (Exception ex) { CustomMessageBox.Show("Error copying file\n" + ex, "ERROR"); return(false); } return(true); } return(false); } }
TSetting.TOption[] GetDefaultBaudRateSettingForBoard(Uploader.Board Board) { switch (Board) { case Uploader.Board.DEVICE_ID_RFD900X: return(GetBaudRateOptionsGivenRawBaudRates( new int[] { 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800 })); default: return(GetBaudRateOptionsGivenRawBaudRates( new int[] { 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 })); } }
private bool getFirmware(Uploader.Board device, bool custom = false) { if (custom) { return(getFirmwareLocal()); } if (device == Uploader.Board.DEVICE_ID_HM_TRP) { if (beta) { return(Download.getFilefromNet("http://firmware.ardupilot.org/SiK/beta/radio~hm_trp.ihx", firmwarefile)); } return(Download.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio~hm_trp.ihx", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900) { if (beta) { return(Download.getFilefromNet("http://firmware.ardupilot.org/SiK/beta/radio~rfd900.ihx", firmwarefile)); } return(Download.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio~rfd900.ihx", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900A) { if (beta) { return(Download.getFilefromNet("http://firmware.ardupilot.org/SiK/beta/radio~rfd900a.ihx", firmwarefile)); } return(Download.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio~rfd900a.ihx", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900U) { if (beta) { return(Download.getFilefromNet("http://files.rfdesign.com.au/Files/firmware/MPSiK%20V2.6%20rfd900u.ihx", firmwarefile)); } return(Download.getFilefromNet("http://files.rfdesign.com.au/Files/firmware/RFDSiK%20V1.9%20rfd900u.ihx", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900P) { if (beta) { return(Download.getFilefromNet("http://files.rfdesign.com.au/Files/firmware/MPSiK%20V2.6%20rfd900p.ihx", firmwarefile)); } return(Download.getFilefromNet("http://files.rfdesign.com.au/Files/firmware/RFDSiK%20V1.9%20rfd900p.ihx", firmwarefile)); } return(false); }
private bool getFirmware(Uploader.Board device, bool custom = false) { if (custom) { return(getFirmwareLocal(device)); } if (device == Uploader.Board.DEVICE_ID_HM_TRP) { if (beta) { return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/beta/radio~hm_trp.ihx", firmwarefile)); } return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio~hm_trp.ihx", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900) { if (beta) { return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/beta/radio~rfd900.ihx", firmwarefile)); } return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio.rfd900.hex", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900A) { if (beta) { return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/beta/radio~rfd900a.ihx", firmwarefile)); } return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio.rfd900a.hex", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900U) { if (beta) { return(Common.getFilefromNet("http://rfdesign.com.au/firmware/radio~rfd900u.ihx", firmwarefile)); } return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio~rfd900u.ihx", firmwarefile)); } if (device == Uploader.Board.DEVICE_ID_RFD900P) { if (beta) { return(Common.getFilefromNet("http://rfdesign.com.au/firmware/radio~rfd900p.ihx", firmwarefile)); } return(Common.getFilefromNet("http://firmware.ardupilot.org/SiK/stable/radio~rfd900p.ihx", firmwarefile)); } return(false); }
public Dictionary <string, TSetting> GetSettings(string ATI5Response, Uploader.Board Board) { Dictionary <string, TSetting> Result = new Dictionary <string, TSetting>(); ParseATI5QueryResponse(ATI5Response, Result); string SerialName = "SERIAL_SPEED"; if (Result.ContainsKey(SerialName)) { if (Result[SerialName].Options == null) { Result[SerialName].Options = GetDefaultBaudRateSettingForBoard(Board); } } return(Result); }