forked from Kelvin312/NMEA-to-TSIP-Converter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,816 additions
and
698 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
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmpMagnetometersData", "CmpMagnetometersData\CmpMagnetometersData.csproj", "{51C7E2FF-E023-4F74-A4E1-969E1C79A473}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{51C7E2FF-E023-4F74-A4E1-969E1C79A473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{51C7E2FF-E023-4F74-A4E1-969E1C79A473}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{51C7E2FF-E023-4F74-A4E1-969E1C79A473}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{51C7E2FF-E023-4F74-A4E1-969E1C79A473}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
98 changes: 98 additions & 0 deletions
98
CmpMagnetometersData/CmpMagnetometersData/CmpMagnetometersData.csproj
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,98 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{51C7E2FF-E023-4F74-A4E1-969E1C79A473}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CmpMagnetometersData</RootNamespace> | ||
<AssemblyName>CmpMagnetometersData</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ApplicationIcon>Saved-Data-Utility.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Windows.Forms.DataVisualization" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="InputData.cs" /> | ||
<Compile Include="MainForm.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="MainForm.Designer.cs"> | ||
<DependentUpon>MainForm.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<EmbeddedResource Include="MainForm.resx"> | ||
<DependentUpon>MainForm.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
<SubType>Designer</SubType> | ||
</EmbeddedResource> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="Saved-Data-Utility.ico" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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,102 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms.DataVisualization.Charting; | ||
|
||
namespace CmpMagnetometersData | ||
{ | ||
public static class Config | ||
{ | ||
public static bool IsMagneticField = true; | ||
public static Color NormalColor = Color.DarkGreen; | ||
public static Color WarningColor = Color.DarkOrange; | ||
public static Color ErrorColor = Color.Red; | ||
} | ||
|
||
public class InDataPoint | ||
{ | ||
public DateTime Time; | ||
public int MagneticField; | ||
public ushort RmsDeviation; | ||
public byte StateCode; | ||
|
||
public DataPoint GetPixel() | ||
{ | ||
DataPoint result = new DataPoint(); | ||
result.SetValueXY(Time, Config.IsMagneticField ? MagneticField : RmsDeviation); | ||
result.Color = Config.ErrorColor; | ||
if ((StateCode & 0x80) != 0) result.Color = Config.WarningColor; | ||
if (StateCode == 0x80) result.Color = Config.NormalColor; | ||
return result; | ||
} | ||
|
||
public InDataPoint(string text) | ||
{ | ||
TextParse(text); | ||
} | ||
public void TextParse(string txt) | ||
{ | ||
//54641714 +- 00076 [82] 01-20-97 23:01:36.00 | ||
var args = txt.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); | ||
MagneticField = int.Parse(args[0]); | ||
RmsDeviation = ushort.Parse(args[2]); | ||
StateCode = (byte)uint.Parse(args[3].Trim('[', ']')); | ||
CultureInfo provider = CultureInfo.InvariantCulture; | ||
Time = DateTime.ParseExact(args[4] + ' ' + args[5], "MM-dd-yy HH:mm:ss.ff", provider); | ||
} | ||
} | ||
|
||
public class InputData | ||
{ | ||
private List<InDataPoint> dataPoints = new List<InDataPoint>(); | ||
public DateTime StartFileTime; | ||
public string FileName; | ||
|
||
public void Read(string filePath) | ||
{ | ||
FileName = ""; | ||
dataPoints.Clear(); | ||
int pointIndex = 0; | ||
using (var objReader = new StreamReader(filePath, Encoding.Default)) | ||
{ | ||
foreach (var s in objReader.ReadToEnd().Split(new char[] {'\0'}, | ||
StringSplitOptions.RemoveEmptyEntries)) | ||
{ | ||
if (++pointIndex > 2) | ||
{ | ||
try | ||
{ | ||
var temp = new InDataPoint(s); | ||
dataPoints.Add(temp); | ||
} | ||
catch (Exception) | ||
{ | ||
// throw; | ||
} | ||
|
||
} | ||
} | ||
} | ||
if (dataPoints.Count > 0) | ||
{ | ||
StartFileTime = dataPoints[0].Time; | ||
FileName = Path.GetFileNameWithoutExtension(filePath); | ||
} | ||
} | ||
|
||
public void UpdateTime(DateTime time) | ||
{ | ||
|
||
} | ||
|
||
public void Save(string filePath) | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.