git_bsmd/AIS/bsmd.AIS2Service/decoding/AIS_BaseStation.cs

67 lines
1.5 KiB
C#

using System;
namespace bsmd.AIS2Service
{
/// <summary>
/// Simple container for BaseStation Reports (Type 4). This class just exists to decouple from
/// the actual AIS messages.
/// </summary>
internal class AIS_BaseStation
{
#region Fields
private readonly int _mmsi;
#endregion
#region Construction
public AIS_BaseStation(int mmsi)
{
_mmsi = mmsi;
}
#endregion
#region Properties
public int MMSI { get { return _mmsi; } }
public DateTime? LastTimeReference { get; private set; }
public bool? Accuracy { get; private set; }
public double? Latitude { get; private set; }
public double? Longitude { get; private set; }
public string EPFD { get; private set; }
public bool? RAIM { get; private set; }
public uint Radio { get; private set; }
#endregion
#region internal methods
internal void Update(AIS_BaseStationReport rep)
{
this.LastTimeReference = rep.UTCTimestamp;
this.Accuracy = rep.Accuracy;
this.Latitude = rep.Latitude;
this.Longitude = rep.Longitude;
if (Lookup.DeviceTypes.ContainsKey((int)rep.EPFD))
this.EPFD = Lookup.DeviceTypes[(int)rep.EPFD];
else
this.EPFD = "";
this.RAIM = rep.Raim;
this.Radio = rep.Radio;
}
#endregion
}
}