Esempio n. 1
0
        private void HandleGga(GgaStandardGpsMessage message, DateTime systemReceivedUtcDateTime)
        {
            LatestPosition = new PositionData(
                AdjustSystemUtc(systemReceivedUtcDateTime),
                message.Latitude,
                message.Longitude,
                message.FixStatus,
                message.NumberOfSatellites,
                message.HorizontalDilutioOfPrecision,
                message.Altitude,
                message.GeoIdSeparation,
                message.DgpsAge,
                message.DgpsStateId);

            if (LatestPosition.Latitude.HasValue &&
                LatestPosition.Longitude.HasValue &&
                LatestPosition.Altitude.HasValue)
            {
                _currentPosition = new SimplePosition(
                    LatestPosition.Latitude.Value,
                    LatestPosition.Longitude.Value,
                    LatestPosition.Altitude.Value);
            }

            OnPositionData?.Invoke(this, new PositionDataEventArgs(LatestPosition));
        }
Esempio n. 2
0
        private GpsManager(SerialDevice serialDevice)
        {
            _serialDevice = serialDevice;
            _serialDevice.WriteTimeout = TimeSpan.FromSeconds(1);
            _serialDevice.ReadTimeout  = TimeSpan.FromSeconds(1);
            _serialDevice.BaudRate     = 9600;
            _serialDevice.Parity       = SerialParity.None;
            _serialDevice.StopBits     = SerialStopBitCount.One;
            _serialDevice.DataBits     = 8;

            _gpsMessageHandler = new GpsMessageHandler(_serialDevice);
            _gpsMessageHandler.OnCustomMessage   += HandleCustomMessage;
            _gpsMessageHandler.OnStandardMessage += HandleStandardMessage;

            LatestPosition = new PositionData(AdjustedUtcNow, null, null, GgaFixStatus.Unknown, null, null, null, null, null, null);
            LatestMovement = new MovementData(AdjustedUtcNow, null, null, null, GpsPositioningMode.Unknown);
        }
Esempio n. 3
0
 public PositionDataEventArgs(PositionData position)
 {
     Position = position;
 }