Exemplo n.º 1
0
        /// <summary>
        /// Creates a GPSV sentence instance from the specified parameters describing the location and signal strength of GPS satellites
        /// </summary>
        /// <param name="totalMessageCount">The total message count.</param>
        /// <param name="currentMessageNumber">The current message number.</param>
        /// <param name="satellitesInView">The satellites in view.</param>
        /// <param name="satellites">The satellites.</param>
        /// <remarks></remarks>
        public GpgsvSentence(int totalMessageCount, int currentMessageNumber,
                             int satellitesInView, IList <Satellite> satellites)
        {
            _totalMessageCount    = totalMessageCount;
            _currentMessageNumber = currentMessageNumber;
            _satellitesInView     = satellitesInView;
            _satellites           = satellites;

            // Build a sentence
            StringBuilder builder = new StringBuilder(128);

            // Append the command word
            builder.Append("$GPGSV");

            // Append a comma
            builder.Append(',');

            // Total message count
            builder.Append(_totalMessageCount);

            // Append a comma
            builder.Append(',');

            // Current message number
            builder.Append(_currentMessageNumber);

            // Append a comma
            builder.Append(',');

            // Satellites in view
            builder.Append(_satellitesInView);

            #region Satellite information

            int count = _satellites.Count;
            for (int index = 0; index < count; index++)
            {
                Satellite satellite = _satellites[index];

                // Serialize this satellite
                builder.Append(",");
                builder.Append(satellite.PseudorandomNumber.ToString("0#", NmeaCultureInfo));
                builder.Append(",");
                builder.Append(satellite.Elevation.ToString("dd", NmeaCultureInfo));
                builder.Append(",");
                builder.Append(satellite.Azimuth.ToString("ddd", NmeaCultureInfo));
                builder.Append(",");
                builder.Append(satellite.SignalToNoiseRatio.Value.ToString("0#", NmeaCultureInfo));
            }

            #endregion Satellite information

            // Set this object's sentence
            SetSentence(builder.ToString());

            // Finally, append the checksum
            AppendChecksum();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 /// <param name="satellite">The satellite.</param>
 public SatelliteEventArgs(Satellite satellite)
 {
     _satellite = satellite;
 }