Example #1
0
 /// <summary>
 ///  GPS DOP and active satellites and parses an NMEA sentence
 /// </summary>
 /// <param name="nmeaSentence"></param>
 public GPGSA(string nmeaSentence)
 {
     _prnInSolution = new List<string>();
     try
     {
         if (nmeaSentence.IndexOf('*') > 0)
             nmeaSentence = nmeaSentence.Substring(0, nmeaSentence.IndexOf('*'));
         //Split into an array of strings.
         string[] split = nmeaSentence.Split(new[] { ',' });
         _mode = split[1].Length > 0 ? split[1][0] : ' ';
         if (split[2].Length > 0)
         {
             switch (split[2])
             {
                 case "2": _fixMode = GSAFixModeEnum._2D; break;
                 case "3": _fixMode = GSAFixModeEnum._3D; break;
                 default: _fixMode = GSAFixModeEnum.FixNotAvailable; break;
             }
         }
         _prnInSolution.Clear();
         for (int i = 0; i <= 11; i++)
             if(split[i + 3]!="")
                 _prnInSolution.Add(split[i + 3]);
         double.TryParse(split[15], out _pdop);
         double.TryParse(split[16], out _hdop);
         double.TryParse(split[17], out _vdop);
     }
     catch { }
 }
Example #2
0
 /// <summary>
 ///  GPS DOP and active satellites and parses an NMEA sentence
 /// </summary>
 /// <param name="NMEAsentence"></param>
 public GPGSA(string NMEAsentence)
 {
     _pRNInSolution = new List<string>();
     try
     {
         if (NMEAsentence.IndexOf('*') > 0)
             NMEAsentence = NMEAsentence.Substring(0, NMEAsentence.IndexOf('*'));
         //Split into an array of strings.
         string[] split = NMEAsentence.Split(new Char[] { ',' });
         if (split[1].Length > 0)
             _mode = split[1][0];
         else
             _mode = ' ';
         if (split[2].Length > 0)
         {
             switch (split[2])
             {
                 case "2": _fixMode = GSAFixModeEnum._2D; break;
                 case "3": _fixMode = GSAFixModeEnum._3D; break;
                 default: _fixMode = GSAFixModeEnum.FixNotAvailable; break;
             }
         }
         _pRNInSolution.Clear();
         for (int i = 0; i <= 11; i++)
             if(split[i + 3]!="")
                 _pRNInSolution.Add(split[i + 3]);
         GPSHandler.dblTryParse(split[15], out _pdop);
         GPSHandler.dblTryParse(split[16], out _hdop);
         GPSHandler.dblTryParse(split[17], out _vdop);
     }
     catch { }
 }