Пример #1
0
        /// <summary>
        /// Get the ADCP Configuration.  This
        /// will decode the BREAK statement
        /// and also CSHOW.
        /// </summary>
        /// <returns></returns>
        public AdcpConfiguration GetAdcpConfiguration()
        {
            // Stop pinging just in case
            StopPinging();

            // Send a BREAK to get the serial number
            SendBreak();
            // Wait for an output
            Thread.Sleep(RTI.AdcpSerialPort.WAIT_STATE*5);

            // Get the buffer output
            string breakResult = ReceiveBufferString;
            BreakStmt breakStmt = AdcpCommands.DecodeBREAK(breakResult);

            // Wait for an output
            Thread.Sleep(RTI.AdcpSerialPort.WAIT_STATE);

            // Send a command for CSHOW to the ADCP
            // Decode the CSHOW command
            string result = "";
            ReceiveBufferString = "";
            bool sndReply = SendDataWaitReply(RTI.Commands.AdcpCommands.CMD_CSHOW);
            if (sndReply)
            {
                result = ReceiveBufferString;
            }

            // Decode CSHOW for all the settings
            AdcpConfiguration adcpConfig = AdcpCommands.DecodeCSHOW(result, breakStmt.SerialNum);

            AdcpSerialOptions adcpSerialOptions = new AdcpSerialOptions();
            adcpSerialOptions.Firmware = breakStmt.FirmwareVersion;
            adcpSerialOptions.Hardware = breakStmt.Hardware;
            adcpSerialOptions.SerialNumber = breakStmt.SerialNum;
            adcpSerialOptions.SerialOptions = SerialOptions;

            // Set the ADCP serial options to the configuraiton
            adcpConfig.AdcpSerialOptions = adcpSerialOptions;

            // Set the hardware configuration
            adcpConfig.HardwareOptions = GetHardwareConfiguration();

            // Get ENGPORT
            ReceiveBufferString = "";
            bool engPortReply = SendDataWaitReply(RTI.Commands.AdcpCommands.CMD_ENGPORT);
            if (sndReply)
            {
                result = ReceiveBufferString;
                adcpConfig.EngPort = AdcpCommands.DecodeENGPORT(result);
            }

            // Get the Directory Listing
            RTI.Commands.AdcpDirListing listing = GetDirectoryListing();
            adcpConfig.DeploymentOptions.InternalMemoryCardUsed = (long)Math.Round(listing.UsedSpace * MathHelper.MB_TO_BYTES);
            adcpConfig.DeploymentOptions.InternalMemoryCardTotalSize = (long)Math.Round(listing.TotalSpace * MathHelper.MB_TO_BYTES);

            return adcpConfig;
        }
Пример #2
0
        /// <summary>
        /// Get the ADCP Configuration.  This
        /// will decode the BREAK statement
        /// and also CSHOW.
        /// </summary>
        /// <returns></returns>
        public AdcpConfiguration GetAdcpConfiguration()
        {
            // Stop pinging just in case
            StopPinging();

            // Send a BREAK to get the serial number
            //string breakResult = _adcpSerialPort.SendDataGetReply("", true, RTI.AdcpSerialPort.WAIT_STATE * 3);
            SendBreak();
            // Wait for an output
            Thread.Sleep(RTI.AdcpSerialPort.WAIT_STATE*5);

            // Get the buffer output
            string breakResult = ReceiveBufferString;
            BreakStmt breakStmt = AdcpCommands.DecodeBREAK(breakResult);

            // Wait for an output
            Thread.Sleep(RTI.AdcpSerialPort.WAIT_STATE);

            // Send a command for CSHOW to the ADCP
            // Decode the CSHOW command
            //string result = SendDataGetReply(RTI.Commands.AdcpCommands.CMD_CSHOW);
            string result = "";
            ReceiveBufferString = "";
            bool sndReply = SendDataWaitReply(RTI.Commands.AdcpCommands.CMD_CSHOW);
            if (sndReply)
            {
                result = ReceiveBufferString;
            }

            // Decode CSHOW for all the settings
            AdcpConfiguration adcpConfig = AdcpCommands.DecodeCSHOW(result, breakStmt.SerialNum);

            AdcpSerialOptions adcpSerialOptions = new AdcpSerialOptions();
            adcpSerialOptions.Firmware = breakStmt.FirmwareVersion;
            adcpSerialOptions.Hardware = breakStmt.Hardware;
            adcpSerialOptions.SerialNumber = breakStmt.SerialNum;
            adcpSerialOptions.SerialOptions = SerialOptions;

            // Set the ADCP serial options to the configuraiton
            adcpConfig.AdcpSerialOptions = adcpSerialOptions;

            return adcpConfig;
        }