diff --git a/ProtocolTests.sln b/ProtocolTests.sln new file mode 100644 index 0000000..c0b6b7a --- /dev/null +++ b/ProtocolTests.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33424.131 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialTestApp", "SerialTestApp\SerialTestApp.csproj", "{25FE0910-9C8A-44CA-BE72-5FED8CD92E2E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {25FE0910-9C8A-44CA-BE72-5FED8CD92E2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {25FE0910-9C8A-44CA-BE72-5FED8CD92E2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {25FE0910-9C8A-44CA-BE72-5FED8CD92E2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {25FE0910-9C8A-44CA-BE72-5FED8CD92E2E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C16A06F1-1290-45E0-8EF9-14A633A6D74D} + EndGlobalSection +EndGlobal diff --git a/SerialTestApp/Program.cs b/SerialTestApp/Program.cs new file mode 100644 index 0000000..b0303f7 --- /dev/null +++ b/SerialTestApp/Program.cs @@ -0,0 +1,46 @@ +using RJCP.IO.Ports; +using System.Collections.Generic; + +namespace SerialTestApp; + +internal class Program +{ + public static bool QuitRequested { get; private set; } + + static void Main(string[] args) + { + while (QuitRequested == false) + { + Console.WriteLine($"----- SERIAL PROTOCOL TEST APP -----"); + Console.WriteLine($"Command list:"); + Console.WriteLine($"l = list ports"); + Console.WriteLine($"c = connect"); + Console.WriteLine($"q = quit"); + + var key = Console.ReadKey(); + + switch (key.Key) + { + // list com ports + case ConsoleKey.L: + string[] ports = SerialPortStream.GetPortNames(); + Console.WriteLine($"Following ports were found: {Environment.NewLine}"); + foreach (var port in ports) + { + Console.WriteLine($"-- {port}"); + } + break; + + case ConsoleKey.Q: + QuitRequested = true; + break; + + default: + Console.WriteLine($"{Environment.NewLine}Did not recognize key.. {Environment.NewLine}"); + break; + } + + + } + } +} \ No newline at end of file diff --git a/SerialTestApp/SerialTestApp.csproj b/SerialTestApp/SerialTestApp.csproj new file mode 100644 index 0000000..10a8127 --- /dev/null +++ b/SerialTestApp/SerialTestApp.csproj @@ -0,0 +1,14 @@ + + + + Exe + net6.0 + enable + enable + + + + + + +