-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from GhostwareDev/development
Doing a new release
- Loading branch information
Showing
20 changed files
with
515 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Ghostware.NMEAParser.Enums | ||
{ | ||
public enum SatelliteFixType | ||
{ | ||
NoFix, | ||
TwoDFix, | ||
ThreeDFix | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
NMEAParser/Ghostware.NMEAParser/NMEAMessages/GpgsaMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System; | ||
using Ghostware.NMEAParser.Enums; | ||
using Ghostware.NMEAParser.Extensions; | ||
using Ghostware.NMEAParser.NMEAMessages.Base; | ||
|
||
namespace Ghostware.NMEAParser.NMEAMessages | ||
{ | ||
public class GpgsaMessage : NmeaMessage | ||
{ | ||
#region Description | ||
|
||
// $GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39 | ||
|
||
// Where: | ||
// GSA Satellite status | ||
// A Auto selection of 2D or 3D fix(M = manual) | ||
// 3 3D fix - values include: 1 = no fix | ||
// 2 = 2D fix | ||
// 3 = 3D fix | ||
// 04,05... PRNs of satellites used for fix(space for 12) | ||
// 2.5 PDOP(dilution of precision) | ||
// 1.3 Horizontal dilution of precision(HDOP) | ||
// 2.1 Vertical dilution of precision(VDOP) | ||
// *39 the checksum data, always begins with* | ||
|
||
#endregion | ||
|
||
#region Properties | ||
|
||
/// <summary> | ||
/// Auto selection of 2D or 3D fix(M = manual) | ||
/// </summary> | ||
public bool GpsStatusAuto { get; set; } | ||
|
||
/// <summary> | ||
/// 3D fix - values include: 1 = no fix | ||
// 2 = 2D fix | ||
// 3 = 3D fix | ||
/// </summary> | ||
public SatelliteFixType SatelliteFix { get; set; } | ||
|
||
/// <summary> | ||
/// PRNs of satellites used for fix(space for 12) | ||
/// </summary> | ||
public string Pnrs { get; set; } | ||
|
||
/// <summary> | ||
/// PDOP(dilution of precision) | ||
/// </summary> | ||
public float Pdop { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Horizontal dilution of precision(HDOP) | ||
/// </summary> | ||
public float Hdop { get; set; } | ||
|
||
/// <summary> | ||
/// Vertical dilution of precision(VDOP) | ||
/// </summary> | ||
public float Vdop { get; set; } | ||
|
||
#endregion | ||
|
||
#region Message parsing | ||
|
||
public override void Parse(string[] messageParts) | ||
{ | ||
if (messageParts == null || messageParts.Length < 9) | ||
{ | ||
throw new ArgumentException("Invalid GPGSA message"); | ||
} | ||
GpsStatusAuto = messageParts[1].ToBoolean("A"); | ||
SatelliteFix = (SatelliteFixType)Enum.Parse(typeof(SatelliteFixType), messageParts[2]); | ||
for (var i = 0 + 3; i < 12 + 3; i++) | ||
{ | ||
Pnrs += $"{messageParts[i]},"; | ||
} | ||
|
||
Pdop = messageParts[15].ToFloat(); | ||
Hdop = messageParts[16].ToFloat(); | ||
Vdop = messageParts[17].ToFloat(); | ||
} | ||
|
||
#endregion | ||
|
||
public override string ToString() | ||
{ | ||
return $"Status {GpsStatusAuto} - Satellite Fix Type {SatelliteFix}"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
NMEAParser/Ghostware.NMEAParser/NMEAMessages/GpvtgMessage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
using System; | ||
using Ghostware.NMEAParser.Extensions; | ||
using Ghostware.NMEAParser.NMEAMessages.Base; | ||
|
||
namespace Ghostware.NMEAParser.NMEAMessages | ||
{ | ||
public class GpvtgMessage : NmeaMessage | ||
{ | ||
#region Description | ||
|
||
// $GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48 | ||
|
||
// where: | ||
// VTG Track made good and ground speed | ||
// 054.7,T True track made good(degrees) | ||
// 034.4,M Magnetic track made good | ||
// 005.5,N Ground speed, knots | ||
// 010.2,K Ground speed, Kilometers per hour | ||
// *48 Checksum | ||
|
||
#endregion | ||
|
||
#region Properties | ||
|
||
/// <summary> | ||
/// True track made good(degrees) | ||
/// </summary> | ||
public float TrackDegrees { get; set; } | ||
|
||
/// <summary> | ||
/// Magnetic track made good | ||
/// </summary> | ||
public float MagneticTrack { get; set; } | ||
|
||
/// <summary> | ||
/// Ground speed, knots | ||
/// </summary> | ||
public float GroundSpeetKnots { get; set; } | ||
|
||
/// <summary> | ||
/// Ground speed, Kilometers per hour | ||
/// </summary> | ||
public float GroundSpeed { get; set; } | ||
|
||
#endregion | ||
|
||
#region Message parsing | ||
|
||
public override void Parse(string[] messageParts) | ||
{ | ||
//$GPVTG,054.7,T,034.4,M,005.5,N,010.2,K * 48 | ||
if (messageParts == null || messageParts.Length < 9) | ||
{ | ||
throw new ArgumentException("Invalid GPVTG message"); | ||
} | ||
TrackDegrees = messageParts[1].ToFloat(); | ||
MagneticTrack = messageParts[3].ToFloat(); | ||
GroundSpeetKnots = messageParts[5].ToFloat(); | ||
GroundSpeed = messageParts[7].ToFloat(); | ||
} | ||
|
||
#endregion | ||
|
||
public override string ToString() | ||
{ | ||
return $"Speed {GroundSpeed} - Track level {TrackDegrees}"; | ||
} | ||
} | ||
} |
Oops, something went wrong.