Add project files.

This commit is contained in:
2023-07-11 10:54:27 -05:00
parent bffa409ea4
commit 8b111f95d0
24 changed files with 1130 additions and 0 deletions

66
BaseGpsClient.cs Normal file
View File

@@ -0,0 +1,66 @@
using System;
using GpsClient2.Model;
namespace GpsClient2 {
public abstract class BaseGpsClient {
#region Properties
public GpsType GpsType { get; }
public bool IsRunning { get; set; }
protected BaseGpsInfo GpsInfo { get; set; }
#endregion
#region Event handlers
public event EventHandler<GpsDataEventArgs> GpsCallbackEvent;
public event EventHandler<string> RawGpsCallbackEvent;
public event EventHandler<GpsStatus> GpsStatusEvent;
#endregion
#region Constructors
protected BaseGpsClient(GpsType gpsType, BaseGpsInfo gpsInfo) {
GpsType = gpsType;
GpsInfo = gpsInfo;
}
#endregion
#region Connect and Disconnect
public abstract bool Connect();
public abstract bool Disconnect();
#endregion
#region Events Triggers
protected virtual void OnGpsDataReceived(GpsDataEventArgs e) {
if (GpsInfo.CoordinateSystem == GpsCoordinateSystem.Lambert72) {
var x = 0.0d;
var y = 0.0d;
var h = 0.0d;
CoordinateConverterUtilities.GeoETRS89ToLambert72(e.Latitude, e.Longitude, 0, ref x, ref y, ref h);
e.CoordinateSystem = GpsCoordinateSystem.Lambert72;
e.Latitude = x;
e.Longitude = y;
}
GpsCallbackEvent?.Invoke(this, e);
}
protected virtual void OnRawGpsDataReceived(string e) {
RawGpsCallbackEvent?.Invoke(this, e);
}
protected virtual void OnGpsStatusChanged(GpsStatus e) {
GpsStatusEvent?.Invoke(this, e);
}
#endregion
}
}