/// <summary>
        /// Configure the ADCP with the proper commands to do a fresh water lake test.
        /// CDEFAULT            Set default settings
        /// C232B 19200         Change GPS serial port to 19200
        /// CSAVE               Save all settings to SD card
        /// </summary>
        private void On_ConfigureAdcpFresh()
        {
            // Ensure the serial port is open
            if (_adcpConn.IsOpen())
            {
                if (File.Exists(RTI.Pulse.Commons.DEFAULT_CONFIG_DIR + @"\ConfigureFresh.txt"))
                {
                    string[] commands = File.ReadAllLines(RTI.Pulse.Commons.DEFAULT_CONFIG_DIR + @"\ConfigureFresh.txt");

                    _adcpConn.SendCommands(commands.ToList());
                }
                else
                {
                    // List of commands to send to the ADCP
                    List <string> commands = new List <string>();
                    commands.Add(RTI.Commands.AdcpCommands.CMD_STOP_PINGING);                                                           // Stop pinging
                    commands.Add(RTI.Commands.AdcpCommands.CMD_CDEFAULT);                                                               // Set default settings
                    commands.Add(RTI.Commands.AdcpCommands.CMD_C232B + " 19200");                                                       // Set GPS serial port to 19200 baud
                    //commands.Add(RTI.Commands.AdcpCommands.CMD_CHO + " " + Commands.AdcpCommands.DEFAULT_SAN_DIEGO_DECLINATION);        // Add in San Diego Declination
                    commands.Add(RTI.Commands.AdcpCommands.GetLocalSystemTimeCommand());                                                // Set Local Time
                    commands.Add(RTI.Commands.AdcpCommands.CMD_CWS + " 0");                                                             // Salinity set to 0
                    commands.Add(RTI.Commands.AdcpCommands.CMD_CSAVE);                                                                  // Save settings to the SD card
                    commands.Add(RTI.Commands.AdcpCommands.CMD_START_PINGING);                                                          // Start pinging

                    // Send these commands to the ADCP serial port
                    _adcpConn.SendCommands(commands);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Get all the commands that are necessary to configure the
        /// ADCP.  Validate the additional commands given.
        /// Then pass all the commands to the ADCP.
        /// </summary>
        private void ConfigureAdcp()
        {
            if (_adcpConnection.IsAdcpSerialConnected())
            {
                IsLoading = true;

                // Get all the commands
                List <string> commands = GetCommands();

                // Start the ADCP pinging
                //commands.Add(Commands.AdcpCommands.CMD_START_PINGING);

                // Save the commands to the file
                SaveCommandsToFile();

                // Send all the commands to the ADCP
                _adcpConnection.SendCommands(commands);

                // Decode CSHOW again to get all the additional commands given
                //CheckAllOptionsFromAdcp();

                // Start Pinging
                _adcpConnection.StartPinging();

                IsLoading = false;

                // Display message that is is ok to disconnect the ADCP
                MessageBox.Show("It is OK to disconnect the ADCP now.", "Configuration Complete", MessageBoxButton.OK, MessageBoxImage.Information);

                // Change the view to the ViewData view
                //_events.Publish(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView));
            }
            else
            {
                // Display message that it could not send the commands
                MessageBox.Show("An ADCP is not connected.\nCannot send the commands.", "Configuration Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }