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 GpsCallbackEvent; public event EventHandler RawGpsCallbackEvent; public event EventHandler 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 } }