Пример #1
0
        /// <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
            }
        }