/// <summary> /// Sentence constructor /// </summary> public GPGSVGpsSentence(string Sentence) : base(Sentence) { // Base this.SentenceName = "$GPGSV"; this.Description = "GNSS Satellites in View"; // Instance _numberOfMessages = int.Parse(this.Words[1]); _messageNumber = int.Parse(this.Words[2]); _satellitesInView = int.Parse(this.Words[3]); _satelliteCountInSentence = (this.WordCount - 3) / 4; _satellites = new SatelliteInView[_satelliteCountInSentence]; int satelliteWordIndex = 4; int currentIndex; for (int i = 0; i < _satelliteCountInSentence; i++) { _satellites[i] = new SatelliteInView(); currentIndex = satelliteWordIndex; if (this.Words[currentIndex] != String.Empty) { _satellites[i].SatelliteID = int.Parse(this.Words[currentIndex]); } satelliteWordIndex++; currentIndex = satelliteWordIndex; if (this.Words[currentIndex] != String.Empty) { _satellites[i].Elevation = double.Parse(this.Words[currentIndex]); } satelliteWordIndex++; currentIndex = satelliteWordIndex; if (this.Words[currentIndex] != String.Empty) { _satellites[i].Azimuth = double.Parse(this.Words[currentIndex]); } satelliteWordIndex++; currentIndex = satelliteWordIndex; if (this.Words[currentIndex] != String.Empty) { _satellites[i].SignalToNoiseRatio = double.Parse(this.Words[currentIndex]); } satelliteWordIndex++; } }
private int _satellitesInView; // Number of visible satellites #endregion Fields #region Constructors /// <summary> /// Sentence constructor /// </summary> public GPGSVGpsSentence(string Sentence) : base(Sentence) { // Base this.SentenceName = "$GPGSV"; this.Description = "GNSS Satellites in View"; // Instance _numberOfMessages = int.Parse(this.Words[1]); _messageNumber = int.Parse(this.Words[2]); _satellitesInView = int.Parse(this.Words[3]); _satelliteCountInSentence = (this.WordCount - 3) / 4; _satellites = new SatelliteInView[_satelliteCountInSentence]; int satelliteWordIndex = 4; int currentIndex; for(int i=0; i < _satelliteCountInSentence; i++) { _satellites[i] = new SatelliteInView(); currentIndex = satelliteWordIndex; if(this.Words[currentIndex] != String.Empty) _satellites[i].SatelliteID = int.Parse(this.Words[currentIndex]); satelliteWordIndex ++; currentIndex = satelliteWordIndex; if(this.Words[currentIndex] != String.Empty) _satellites[i].Elevation = double.Parse(this.Words[currentIndex]); satelliteWordIndex ++; currentIndex = satelliteWordIndex; if(this.Words[currentIndex] != String.Empty) _satellites[i].Azimuth = double.Parse(this.Words[currentIndex]); satelliteWordIndex ++; currentIndex = satelliteWordIndex; if(this.Words[currentIndex] != String.Empty) _satellites[i].SignalToNoiseRatio = double.Parse(this.Words[currentIndex]); satelliteWordIndex ++; } }