/// <summary> /// Send the command to the ADCP. /// </summary> /// <param name="cmd"></param> public void SendCommand(string cmd) { if (_serialPort != null && _serialPort.IsAvailable()) { Task.Run(() => _serialPort.SendDataWaitReply(cmd)); } else { DisplayConnectionError(); } }
/// <summary> /// Execute the upload process. This should be called /// from the async command. /// </summary> /// <param name="fileName">File name to upload.</param> private void ExecuteUpdateFirmware(object fileName) { // Convert the object to a string array var files = fileName as string[]; if (files != null) { // Stop the ADCP pinging if its pinging AdcpSerialPort.StopPinging(); // Upload all the selected files foreach (var file in files) { // Upload the file to the ADCP AdcpSerialPort.XModemUpload(file); // Wait for the update to complete Thread.Sleep(AdcpSerialPort.WAIT_STATE * 2); // Load the firmware to NAND if (file.ToLower().Contains("rtisys")) { AdcpSerialPort.SendDataWaitReply("FMCOPYS"); } // Load the boot code to NAND if (file.ToLower().Contains("boot")) { AdcpSerialPort.SendDataWaitReply("FMCOPYB"); } } // Reboot the ADCP to use the new firmware AdcpSerialPort.Reboot(); // Validate the files uploaded // By downloading it and compairing it against // the original file } }
/// <summary> /// Send the command to the serial port. /// </summary> private void SendAdcpCommand() { _adcpSerialPort.SendDataWaitReply(_SerialCmd); DispalyStatus("Send Command: " + _SerialCmd); }