58 lines
1.3 KiB
C#
58 lines
1.3 KiB
C#
using GpsClient2.EventArguments;
|
|
using GpsClient2.Model;
|
|
using System;
|
|
|
|
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) {
|
|
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
|
|
}
|
|
}
|