예제 #1
0
 private void GSA(string[] words)
 {
     RecivedData.SatellitesChannels = new int[11];
     for (int i = 0; i < 11; i++)
     {
         if (words[i + 3] != "")
         {
             int satelliteID = System.Convert.ToInt32(words[i + 3]);
             if (RecivedData.SatellitesDetails.ContainsKey(satelliteID))
             {
                 Satellite s = (Satellite)RecivedData.SatellitesDetails[satelliteID];
                 s.Channel = i + 1;
             }
             RecivedData.SatellitesChannels[i] = satelliteID;
         }
     }
     if (words[15] != "")
     {
         RecivedData.PDOP = double.Parse(words[15], NmeaCultureInfo);
     }
     if (words[16] != "")
     {
         RecivedData.HDOP = double.Parse(words[16], NmeaCultureInfo);
     }
     if (words[17] != "")
     {
         RecivedData.VDOP = double.Parse(words[17], NmeaCultureInfo);
     }
 }
예제 #2
0
        private void updateSatellitesDetails(string wordSatelliteID, string wordElevation,
                                             string wordAzimuth, string wordSignalToNoiseRatio)
        {
            if (wordSatelliteID != "")
            {
                int SatelliteID        = System.Convert.ToInt32(wordSatelliteID);
                int Elevation          = -1;
                int Azimuth            = -1;
                int SignalToNoiseRatio = -1;

                if (wordElevation != "")
                {
                    Elevation = Convert.ToInt32(wordElevation);
                }
                if (wordAzimuth != "")
                {
                    Azimuth = Convert.ToInt32(wordAzimuth);
                }
                if (wordSignalToNoiseRatio != "")
                {
                    SignalToNoiseRatio = Convert.ToInt32(wordSignalToNoiseRatio);
                }

                if (RecivedData.SatellitesDetails.ContainsKey(SatelliteID))
                {
                    Satellite s = (Satellite)RecivedData.SatellitesDetails[SatelliteID];
                    if (Elevation != -1)
                    {
                        s.Elevation = Elevation;
                    }
                    if (Azimuth != -1)
                    {
                        s.Azimuth = Azimuth;
                    }
                    if (SignalToNoiseRatio != -1)
                    {
                        s.SignalToNoiseRatio = SignalToNoiseRatio;
                    }
                }
                else
                {
                    RecivedData.SatellitesDetails[SatelliteID] = new Satellite(SatelliteID, Elevation, Azimuth, SignalToNoiseRatio);
                }
            }
        }