Exemple #1
0
 public void Execute(FixTypes command)
 {
     foreach (var item in Container.Resolve <IRepository>().AllOf <SequenceItemNode>())
     {
         item.VariableName = item.VariableNameProvider.GetNewVariableName(item.GetType().Name);
     }
 }
Exemple #2
0
 private IReadOnlyList <IndividualEntry> TypeEntries(string type)
 {
     if (FixTypes.ContainsKey(type))
     {
         return(FixTypes[type]);
     }
     return(new IndividualEntry[0]);
 }
Exemple #3
0
        static string FixTypeToString(FixTypes fixType)
        {
            switch (fixType)
            {
            case FixTypes.None: return(_fixNone);

            case FixTypes.TwoD: return(_fix2d);

            case FixTypes.ThreeD: return(_fix3d);

            case FixTypes.DGps: return(_fixDgps);

            case FixTypes.Pps: return(_fixPps);

            default: return(null);
            }
        }
        // If failed, returns null.
        private static Waypoint GetWpt(string line)
        {
            var words = line.Split(',');

            if (words.Length < 4)
            {
                return(null);
            }
            var ident = words[1];

            if (FixTypes.HasCorrds(words[0]) &&
                double.TryParse(words[2], out var lat) &&
                double.TryParse(words[3], out var lon))
            {
                return(new Waypoint(ident, lat, lon));
            }

            return(null);
        }
        // Convert to SidEntry. If failed, returns null.
        private static ParseResult GetEntry(SectionSplitter.SplitEntry entry)
        {
            var lines     = entry.Lines;
            var firstLine = lines[0].Split(',');

            if (firstLine.Length < 3)
            {
                return(null);
            }
            var rwyOrTransition = firstLine[2];
            var wpts            = lines.Skip(1).Select(line => GetWpt(line)).Where(w => w != null);

            return(new ParseResult()
            {
                Name = firstLine[1],
                RunwayOrTransition = rwyOrTransition,
                Type = GetEntryType.GetType(rwyOrTransition),
                Waypoints = wpts.ToList(),
                EndWithVector = !FixTypes.HasCorrds(lines.Last().Split(',')[0])
            });
        }
        public void NewGPSFix(IGPSFix gpsFix)
        {
            if (sendPVTData)
            {
                // Calculate the fix time in Garmin format.
                const long gpsDelta = 627666624000000000;
                double     gpsDays  = (double)(gpsFix.UTCFixTime.Ticks - gpsDelta) / 864000000000;            // Fractional days since 31/12/1989 00:00:00 UTC
                Int32      wn_days  = (Int32)(gpsDays / 7) * 7;
                double     tow      = (gpsDays - wn_days) * 86400;

                // Determine the Garmin fix type.
                FixTypes fixType = FixTypes.Invalid;
                switch (gpsFix.FixType)
                {
                case GPSFixTypes.Fix2D:
                    fixType = gpsFix.IsDifferential ? FixTypes.Diff2D : FixTypes.Fix2D;
                    break;

                case GPSFixTypes.Fix3D:
                    fixType = gpsFix.IsDifferential ? FixTypes.Diff3D : FixTypes.Fix3D;
                    break;
                }

                // Build the PVT packet.
                pvtPacket = BuildPVTDataPacket((float)gpsFix.AltitudeAboveMSL + (float)gpsFix.MSLAltitudeAboveWGS84,
                                               (float)gpsFix.EPE, (float)gpsFix.EPH, (float)gpsFix.EPV, (Int16)fixType, tow,
                                               gpsFix.LatitudeRadians, gpsFix.LongitudeRadians,
                                               (float)gpsFix.SpeedEast, (float)gpsFix.SpeedNorth, (float)gpsFix.SpeedUp,
                                               -(float)gpsFix.MSLAltitudeAboveWGS84, 0, wn_days);

                // If we are idle, send the packet immediately. Otherwise save it for later.
                if (protocolState == ProtocolState.Idle)
                {
                    SendPacket(pvtPacket);
                    pvtPacket = null;
                }
            }
        }
        private void ParseGGAData(string[] Data)
        {
            double lastLat = _mapLatitude;
            double lastLng = _mapLongitude;
            double dTmp;
            int iTmp;

            //Time
            double timeRawDouble = Double.Parse(Data[1]);
            int timeRaw = (int)timeRawDouble;
            int hours = timeRaw / 10000;
            int minutes = (timeRaw / 100) % 100;
            int seconds = timeRaw % 100;
            int milliseconds = (int)((timeRawDouble - timeRaw) * 1000.0);

            DateTime tmpDate = new DateTime(_currentDateTime.Year, _currentDateTime.Month, _currentDateTime.Day);
            _currentDateTime = tmpDate.Add(new TimeSpan(hours, minutes, seconds));

            // Latitude
            if (Data[2] != string.Empty && Data[3] != string.Empty)
                GeneralParseLatitude(Data[2], Data[3]);

            // Longitude
            if (Data[4] != string.Empty && Data[5] != string.Empty)
                GeneralParseLongitude(Data[4], Data[5]);

            // Fix Indicator
            if (Data[6] != string.Empty)
            {
                if (_fixType != (FixTypes)int.Parse(Data[6]))
                {
                    _fixType = (FixTypes)int.Parse(Data[6]);
                    OnFixTypeChanged(this, _fixType);
                }
            }

            // Satellites Used
            if (Data[7] != string.Empty)
            {
                iTmp = int.Parse(Data[7]);
                if (_satsUsed != iTmp)
                {
                    _satsUsed = iTmp;
                    OnSatellitesUsedChanged(this, _satsUsed);
                }
            }

            // Horizontal Dilution of Precision (in meters)
            if (Data[8] != string.Empty)
                _HOD = double.Parse(Data[8]);

            // MSL Altitude (in meters)
            if (Data[9] != string.Empty)
            {
                dTmp = double.Parse(Data[9]);
                if (_altitude != dTmp)
                {
                    _altitude = dTmp;
                    OnAltitudeChanged(this, _altitude, (int)MetersToFeet(_altitude));
                }
            }

            // Item 10 is ALWAYS M for Meters; so skip it.

            // Geoidal Separation
            if (Data[11] != string.Empty)
                _geoSep = double.Parse(Data[11]);

            // Item 12 is ALWAYS M for Meters; so skip it.

            // Age of Differential Correction (in seconds)
            if (Data[13] != string.Empty)
                _diffAge = int.Parse(Data[13]);

            // Raise Events
            if (_fixType != FixTypes.NoFix && (lastLat != _mapLatitude || lastLng != _mapLongitude))
                OnCoordinatesUpdated(this);
        }
 protected virtual void OnFixTypeChanged(MTK3339 sender, FixTypes e)
 {
     if (FixTypeChanged != null)
         FixTypeChanged(sender, e);
 }