Add project files.

This commit is contained in:
2023-07-11 10:54:27 -05:00
parent bffa409ea4
commit 8b111f95d0
24 changed files with 1130 additions and 0 deletions

36
NmeaConstants.cs Normal file
View File

@@ -0,0 +1,36 @@
using GpsClient2.Exceptions;
using GpsClient2.NmeaMessages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GpsClient2 {
public static class NmeaConstants {
private static readonly Dictionary<string, Type> TypeDictionary = new Dictionary<string, Type>
{
{"GPGGA", typeof(GpggaMessage)},
{"GPRMC", typeof(GprmcMessage)},
{"GPVTG", typeof(GpvtgMessage)},
{"GPGSA", typeof(GpgsaMessage)}
};
/// <summary>
/// Returns the correct class type of the message.
/// </summary>
/// <param name="typeName">The type name given.</param>
/// <returns>The class type.</returns>
/// <exception cref="UnknownTypeException">Given if the type is unkown.</exception>
public static Type GetClassType(string typeName) {
Type result;
TypeDictionary.TryGetValue(typeName, out result);
if (result == null) {
throw new UnknownTypeException();
}
return result;
}
}
}