Exemple #1
0
        /// <summary>
        /// Create the data set using PRTI01.  Then add PRTI02 to the
        /// dataset.  Then send the dataset.
        /// </summary>
        /// <param name="prti01">PRTI01 Sentence.</param>
        /// <param name="prti02">PRTI02 Sentence.</param>
        /// <param name="prti03">PRTI03 Sentence.</param>
        /// <param name="prti30">PRTI30 Sentence.</param>
        /// <param name="prti31">PRTI31 Sentence.</param>
        /// <param name="nmeaBuffer">NMEA buffer.</param>
        /// <returns>Created ensemble.</returns>
        private DataSet.Ensemble CreateEnsemble(Prti01Sentence prti01, Prti02Sentence prti02, Prti03Sentence prti03 = null, Prti30Sentence prti30 = null, Prti31Sentence prti31 = null, List <string> nmeaBuffer = null)
        {
            // Create the dataset
            DataSet.Ensemble ensemble = CreateDataSet(prti01);

            if (prti02 != null)
            {
                ensemble.AddAdditionalBottomTrackData(prti02);
            }

            if (prti03 != null)
            {
                ensemble.AddAdditionalBottomTrackData(prti03);
            }

            if (prti30 != null)
            {
                ensemble.AddAdditionalAncillaryData(prti30);
                ensemble.AddAdditionalBottomTrackData(prti30);

                // Setup the serial number
                if (ensemble.IsEnsembleAvail)
                {
                    // Remove the temp serial number subsystem
                    ensemble.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                    // Add the actual subsystem
                    ensemble.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                }
            }

            if (prti31 != null)
            {
                ensemble.AddAdditionalAncillaryData(prti31);
                ensemble.AddAdditionalBottomTrackData(prti31);

                // Setup the serial number
                if (ensemble.IsEnsembleAvail)
                {
                    // Remove the temp serial number subsystem
                    ensemble.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                    // Add the actual subsystem
                    ensemble.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                }
            }

            if (nmeaBuffer != null)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var nmea in nmeaBuffer)
                {
                    sb.Append(nmea);
                }

                ensemble.AddNmeaData(sb.ToString());
            }

            return(ensemble);
        }
Exemple #2
0
        /// <summary>
        /// Create the data set using PRTI01.  Then add PRTI02 to the
        /// dataset.  Then send the dataset.
        /// </summary>
        /// <param name="prti01">PRTI01 Sentence.</param>
        /// <param name="prti02">PRTI02 Sentence.</param>
        /// <param name="prti30">PRTI30 Sentence.</param>
        /// <param name="prti31">PRTI31 Sentence.</param>
        private void SendData(Prti01Sentence prti01, Prti02Sentence prti02, Prti30Sentence prti30 = null, Prti31Sentence prti31 = null)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(prti01);
            adcpData.AddAdditionalBottomTrackData(prti02);

            if (IsUseBtHpr)
            {
                if (prti30 != null)
                {
                    adcpData.AddAdditionalAncillaryData(prti30);
                    adcpData.AddAdditionalBottomTrackData(prti30);

                    // Setup the serial number
                    if (adcpData.IsEnsembleAvail)
                    {
                        // Remove the temp serial number subsystem
                        adcpData.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                        // Add the actual subsystem
                        adcpData.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                    }
                }
            }
            else
            {
                if (prti31 != null)
                {
                    adcpData.AddAdditionalAncillaryData(prti31);
                    adcpData.AddAdditionalBottomTrackData(prti31);

                    // Setup the serial number
                    if (adcpData.IsEnsembleAvail)
                    {
                        // Remove the temp serial number subsystem
                        adcpData.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                        // Add the actual subsystem
                        adcpData.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                    }
                }
            }

            // Combine all the messages and convert to a byte array
            string adcpMesg = "";

            if (prti01 != null)
            {
                adcpMesg += prti01.ToString();
            }
            if (prti02 != null)
            {
                adcpMesg += prti02.ToString();
            }
            if (prti30 != null)
            {
                adcpMesg += prti30.ToString();
            }
            if (prti31 != null)
            {
                adcpMesg += prti31.ToString();
            }
            byte[] adcpMesgBA = Encoding.ASCII.GetBytes(adcpMesg);

            // Send the data set
            SendData(adcpData, adcpMesgBA);
        }