Esempio n. 1
0
        public override void Empty()
        {
            base.Empty();

            IsLoranBlinkOK                  = NMEA.Boolean.Unknown;
            IsLoranCCycleLockOK             = NMEA.Boolean.Unknown;
            CrossTrackErrorMagnitude        = 0.0D;
            DirectionToSteer                = NMEA.LeftOrRight.Unknown;
            CrossTrackUnits                 = string.Empty;
            IsArrivalCircleEntered          = NMEA.Boolean.Unknown;
            IsPerpendicular                 = NMEA.Boolean.Unknown;
            BearingOriginToDestination      = 0.0D;
            BearingOriginToDestinationUnits = string.Empty;
            To = string.Empty;
            BearingPresentPositionToDestination      = 0.0D;
            BearingPresentPositionToDestinationUnits = string.Empty;
            HeadingToSteer      = 0.0D;
            HeadingToSteerUnits = string.Empty;
            FAAMode             = NMEA.FAAModeIndicator.Unknown;
        }
Esempio n. 2
0
        public override bool Parse(Sentence sentence)
        {
            /*
            ** APB - Autopilot Sentence "B"
            **                                         13    15
            **        1 2 3   4 5 6 7 8   9 10   11  12|   14|
            **        | | |   | | | | |   | |    |   | |   | |
            ** $--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a*hh<CR><LF>
            **
            **  1) Status
            **     V = LORAN-C Blink or SNR warning
            **     V = general warning flag or other navigation systems when a reliable
            **         fix is not available
            **  2) Status
            **     V = Loran-C Cycle Lock warning flag
            **     A = OK or not used
            **  3) Cross Track Error Magnitude
            **  4) Direction to steer, L or R
            **  5) Cross Track Units, N = Nautical Miles
            **  6) Status
            **     A = Arrival Circle Entered
            **  7) Status
            **     A = Perpendicular passed at waypoint
            **  8) Bearing origin to destination
            **  9) M = Magnetic, T = True
            ** 10) Destination Waypoint ID
            ** 11) Bearing, present position to Destination
            ** 12) M = Magnetic, T = True
            ** 13) Heading to steer to destination waypoint
            ** 14) M = Magnetic, T = True
            ** 15) Checksum or FAA Mode Indicator
            ** 16) Checksum if FAA Mode Indicator is present
            */

            // 2005-02-24, according to http://gpsd.berlios.de/NMEA.txt, NMEA added another field to the sentence

            /*
            ** First we check the checksum...
            */

            if (sentence.IsChecksumBad() == Boolean.True)
            {
                Empty();
                return(false);
            }

            IsLoranBlinkOK                  = sentence.Boolean(1);
            IsLoranCCycleLockOK             = sentence.Boolean(2);
            CrossTrackErrorMagnitude        = sentence.Double(3);
            DirectionToSteer                = sentence.LeftOrRight(4);
            CrossTrackUnits                 = sentence.Field(5);
            IsArrivalCircleEntered          = sentence.Boolean(6);
            IsPerpendicular                 = sentence.Boolean(7);
            BearingOriginToDestination      = sentence.Double(8);
            BearingOriginToDestinationUnits = sentence.Field(9);
            To = sentence.Field(10);
            BearingPresentPositionToDestination      = sentence.Double(11);
            BearingPresentPositionToDestinationUnits = sentence.Field(12);
            HeadingToSteer      = sentence.Double(13);
            HeadingToSteerUnits = sentence.Field(14);

            if (sentence.GetNumberOfDataFields() == 16)
            {
                // Parse here...
                FAAMode = sentence.FAAMode(15);
            }
            else
            {
                FAAMode = FAAModeIndicator.Unknown;
            }

            return(true);
        }