Completed xml doc comments

This commit is contained in:
mort5161 2014-11-14 15:52:20 -08:00
parent 8f692a4aab
commit 32b9a8b9eb
19 changed files with 269 additions and 23 deletions

View file

@ -34,7 +34,6 @@ namespace NmeaParser
/// <summary>
///
/// </summary>
/// <param name="filename"></param>
/// <param name="readSpeed">The time to wait between each line being read in milliseconds</param>
protected BufferedStreamDevice( int readSpeed = 200)
{

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPBOD")]
public class Gpbod : NmeaMessage
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message[0].Length > 0)
TrueBearing = double.Parse(message[0], CultureInfo.InvariantCulture);

View file

@ -29,20 +29,36 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPGGA")]
public class Gpgga : NmeaMessage
{
/// <summary>
/// Fix quality
/// </summary>
public enum FixQuality : int
{
/// <summary>Invalid</summary>
Invalid = 0,
/// <summary>GPS</summary>
GpsFix = 1,
/// <summary>Differential GPS</summary>
DgpsFix = 2,
/// <summary>Precise Positioning Service</summary>
PpsFix = 3,
/// <summary>Real Time Kinematic (Fixed)</summary>
Rtk = 4,
/// <summary>Real Time Kinematic (Floating)</summary>
FloatRtk = 5,
/// <summary>Estimated</summary>
Estimated = 6,
/// <summary>Manual input</summary>
ManualInput = 7,
/// <summary>Simulation</summary>
Simulation = 8
}
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
var time = message[0];
Latitude = NmeaMessage.StringToLatitude(message[1], message[2]);

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPGLL")]
public class Gpgll : NmeaMessage
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
var time = message[0];
Latitude = NmeaMessage.StringToLatitude(message[0], message[1]);
@ -56,9 +60,15 @@ namespace NmeaParser.Nmea.Gps
/// <summary>
/// Time since last DGPS update
/// </summary>
public TimeSpan FixTime { get; set; }
public TimeSpan FixTime { get; private set; }
public bool DataActive { get; set; }
/// <summary>
/// Gets a value indicating whether data is active.
/// </summary>
/// <value>
/// <c>true</c> if data is active; otherwise, <c>false</c>.
/// </value>
public bool DataActive { get; private set; }
}
}

View file

@ -29,19 +29,44 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPGSA")]
public class Gpgsa : NmeaMessage
{
/// <summary>
/// Mode selection
/// </summary>
public enum ModeSelection
{
/// <summary>
/// Auto
/// </summary>
Auto,
/// <summary>
/// Manual mode
/// </summary>
Manual,
}
/// <summary>
/// Fix Mode
/// </summary>
public enum Mode : int
{
/// <summary>
/// Not available
/// </summary>
NotAvailable = 1,
/// <summary>
/// 2D Fix
/// </summary>
_2D = 2,
/// <summary>
/// 3D Fix
/// </summary>
_3D = 3
}
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
GpsMode = message[0] == "A" ? ModeSelection.Auto : ModeSelection.Manual;
FixMode = (Mode)int.Parse(message[1]);

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPGSV")]
public sealed class Gpgsv : NmeaMessage, IMultiPartMessage<SatelitteVehicle>
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
TotalMessages = int.Parse(message[0]);
MessageNumber = int.Parse(message[1]);
@ -66,18 +70,29 @@ namespace NmeaParser.Nmea.Gps
/// </summary>
public SatelitteVehicle[] SVs { get; private set; }
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns> A System.Collections.Generic.IEnumerator{SatelitteVehicle} that can be used to iterate through the collection.</returns>
public IEnumerator<SatelitteVehicle> GetEnumerator()
{
foreach(var sv in SVs)
yield return sv;
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns> An System.Collections.IEnumerator object that can be used to iterate through the collection.</returns>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
/// <summary>
/// Satellite vehicle
/// </summary>
public sealed class SatelitteVehicle
{
internal SatelitteVehicle(string[] message, int startIndex)

View file

@ -29,12 +29,25 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPRMB")]
public class Gprmb : NmeaMessage
{
/// <summary>
/// Data status
/// </summary>
public enum DataStatus
{
/// <summary>
/// OK
/// </summary>
OK,
/// <summary>
/// Warning
/// </summary>
Warning
}
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
Status = message[0] == "A" ? DataStatus.OK : Gprmb.DataStatus.Warning;
double tmp;

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPRMC")]
public class Gprmc : NmeaMessage
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message[8].Length == 6 && message[0].Length == 6)
{

View file

@ -29,12 +29,25 @@ namespace NmeaParser.Nmea.Gps
[NmeaMessageType(Type = "GPRTE")]
public sealed class Gprte : NmeaMessage, IMultiPartMessage<string>
{
/// <summary>
/// Waypoint tpe
/// </summary>
public enum WaypointListType
{
/// <summary>
/// Complete list of waypoints
/// </summary>
CompleteWaypointsList,
/// <summary>
/// List of remaining waypoints
/// </summary>
RemainingWaypointsList
}
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
TotalMessages = int.Parse(message[0]);
MessageNumber = int.Parse(message[1]);
@ -53,21 +66,35 @@ namespace NmeaParser.Nmea.Gps
/// </summary>
public int MessageNumber { get; private set; }
/// <summary>
/// Gets the type of the list.
/// </summary>
public WaypointListType ListType { get; private set; }
public string RouteID { get; set; }
/// <summary>
/// Gets the route identifier.
/// </summary>
public string RouteID { get; private set; }
/// <summary>
/// Waypoints
/// </summary>
public string[] Waypoints { get; private set; }
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns> A System.Collections.Generic.IEnumerator{T} that can be used to iterate through the collection.</returns>
IEnumerator<string> IEnumerable<string>.GetEnumerator()
{
foreach (string waypoint in Waypoints)
yield return waypoint;
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns> An System.Collections.IEnumerator object that can be used to iterate through the collection.</returns>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return ((IEnumerable<string>)this).GetEnumerator();

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.Gps.Garmin
[NmeaMessageType(Type = "PGRME")]
public class Pgrme : NmeaMessage
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
HorizontalError = NmeaMessage.StringToDouble(message[0]);
HorizontalErrorUnits = message[1];

View file

@ -29,11 +29,23 @@ namespace NmeaParser.Nmea.Gps.Garmin
[NmeaMessageType(Type = "PGRMZ")]
public class Pgrmz : NmeaMessage
{
/// <summary>
/// Altitude unit
/// </summary>
public enum AltitudeUnit
{
/// <summary>
/// Unknown
/// </summary>
Unknown,
/// <summary>
/// Feet
/// </summary>
Feet
}
/// <summary>
/// Position Fix Dimension
/// </summary>
public enum PositionFixDimension : int
{
/// <summary>
@ -49,7 +61,11 @@ namespace NmeaParser.Nmea.Gps.Garmin
/// </summary>
GpsAltitude = 3
}
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message[0].Length > 0)
Altitude = double.Parse(message[0], CultureInfo.InvariantCulture);

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.LaserRange
/// </summary>
public abstract class LaserRangeMessage : NmeaMessage
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
HorizontalVector = message[0];
HorizontalDistance = double.Parse(message[1], CultureInfo.InvariantCulture);
@ -42,22 +46,49 @@ namespace NmeaParser.Nmea.LaserRange
SlopeDistanceUnits = message[8][0];
}
/// <summary>
/// Gets the horizontal vector.
/// </summary>
public string HorizontalVector { get; private set; }
/// <summary>
/// Gets the horizontal distance.
/// </summary>
public double HorizontalDistance { get; private set; }
/// <summary>
/// Gets the units of the <see cref="HorizontalDistance"/> value.
/// </summary>
public char HorizontalDistanceUnits { get; private set; }
/// <summary>
/// Gets the horizontal angle.
/// </summary>
public double HorizontalAngle { get; private set; }
/// <summary>
/// Gets the units of the <see cref="HorizontalAngle"/> value.
/// </summary>
public char HorizontalAngleUnits { get; private set; }
/// <summary>
/// Gets the vertical angle.
/// </summary>
public double VerticalAngle { get; private set; }
/// <summary>
/// Gets the units of the <see cref="VerticalAngle"/> value.
/// </summary>
public char VerticalAngleUnits { get; private set; }
/// <summary>
/// Gets the slope distance.
/// </summary>
public double SlopeDistance { get; private set; }
/// <summary>
/// Gets the units of the <see cref="SlopeDistance"/> value.
/// </summary>
public char SlopeDistanceUnits { get; private set; }
}
}

View file

@ -29,7 +29,11 @@ namespace NmeaParser.Nmea.LaserRange.Trimble
[NmeaMessageType(Type = "PTNLB")]
public class Ptnlb : NmeaMessage
{
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
TreeHeight = message[0];
MeasuredTreeHeight = double.Parse(message[1], CultureInfo.InvariantCulture);
@ -39,16 +43,34 @@ namespace NmeaParser.Nmea.LaserRange.Trimble
MeasuredTreeDiameterUnits = message[5][0];
}
/// <summary>
/// Gets the height of the tree.
/// </summary>
public string TreeHeight { get; private set; }
/// <summary>
/// Gets the message height of the tree.
/// </summary>
public double MeasuredTreeHeight { get; private set; }
/// <summary>
/// Gets the units of the <see cref="MeasuredTreeHeight"/> value.
/// </summary>
public char MeasuredTreeHeightUnits { get; private set; }
/// <summary>
/// Gets the tree diameter.
/// </summary>
public string TreeDiameter { get; private set; }
/// <summary>
/// Gets the measured tree diameter.
/// </summary>
public double MeasuredTreeDiameter { get; private set; }
/// <summary>
/// Gets the units of the <see cref="MeasuredTreeDiameter"/> value.
/// </summary>
public char MeasuredTreeDiameterUnits { get; private set; }
//more to do...

View file

@ -24,10 +24,31 @@ using System.Threading.Tasks;
namespace NmeaParser.Nmea
{
public class NmeaMessageType : Attribute { public string Type { get; set; } }
/// <summary>
/// Nmea message attribute type used on concrete <see cref="NmeaMessage"/> implementations.
/// </summary>
public class NmeaMessageTypeAttribute : Attribute
{
/// <summary>
/// Gets or sets the NMEA message type.
/// </summary>
public string Type { get; set; }
}
/// <summary>
/// NMEA Message base class.
/// </summary>
public abstract class NmeaMessage
{
/// <summary>
/// Parses the specified NMEA message.
/// </summary>
/// <param name="message">The NMEA message string.</param>
/// <returns></returns>
/// <exception cref="System.ArgumentException">
/// Invalid nmea message: Missing starting character '$'
/// or checksum failure
/// </exception>
public static NmeaMessage Parse(string message)
{
int checksum = -1;
@ -69,7 +90,7 @@ namespace NmeaParser.Nmea
}
msg.MessageType = MessageType;
msg.MessageParts = MessageParts;
msg.LoadMessage(MessageParts);
msg.OnLoadMessage(MessageParts);
return msg;
}
@ -79,7 +100,7 @@ namespace NmeaParser.Nmea
var typeinfo = typeof(NmeaMessage).GetTypeInfo();
foreach (var subclass in typeinfo.Assembly.DefinedTypes.Where(t => t.IsSubclassOf(typeof(NmeaMessage))))
{
var attr = subclass.GetCustomAttribute<NmeaMessageType>(false);
var attr = subclass.GetCustomAttribute<NmeaMessageTypeAttribute>(false);
if (attr != null)
{
if (!subclass.IsAbstract)
@ -100,12 +121,31 @@ namespace NmeaParser.Nmea
private static Dictionary<string, ConstructorInfo> messageTypes;
/// <summary>
/// Gets the NMEA message parts.
/// </summary>
protected string[] MessageParts { get; private set; }
/// <summary>
/// Gets the type id for the message.
/// </summary>
public string MessageType { get; private set; }
protected virtual void LoadMessage(string[] message) { MessageParts = message; }
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
/// <remarks>
/// Implement this method to create a custom NMEA message.
/// </remarks>
protected virtual void OnLoadMessage(string[] message) { MessageParts = message; }
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String" /> that represents this instance.
/// </returns>
public override string ToString()
{
return string.Format("${0},{1}", MessageType, string.Join(",", MessageParts));

View file

@ -22,10 +22,20 @@ using System.Threading.Tasks;
namespace NmeaParser.Nmea
{
/// <summary>
/// Represents an unknown message type
/// </summary>
public class UnknownMessage : NmeaMessage
{
/// <summary>
/// Gets the nmea value aarray.
/// </summary>
public string[] Values { get { return base.MessageParts; } }
protected override void LoadMessage(string[] message)
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
}
}

View file

@ -56,6 +56,10 @@ namespace NmeaParser
return Task.FromResult(true); //do nothing
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="force"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected override void Dispose(bool force)
{
if (m_stream != null)

View file

@ -20,6 +20,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\Bin\Debug\NmeaParser.WinDesktop.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +29,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\Bin\Release\NmeaParser.WinDesktop.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View file

@ -25,6 +25,7 @@
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\Debug\NmeaParser.WinPhone.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -33,6 +34,7 @@
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_PHONE_APP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\Release\NmeaParser.WinPhone.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->

View file

@ -25,6 +25,7 @@
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\Debug\NmeaParser.WinStore.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -33,6 +34,7 @@
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\Release\NmeaParser.WinStore.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->