Commits

Matthew Moses committed 546beb4

Initial commit.

Comments (0)

Files changed (5)

+bin/
+obj/
+*.suo

SerialPortTest.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialPortTest", "SerialPortTest\SerialPortTest.csproj", "{A0E6EE33-34E1-4C9B-8053-BE83A1B13A74}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A0E6EE33-34E1-4C9B-8053-BE83A1B13A74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A0E6EE33-34E1-4C9B-8053-BE83A1B13A74}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A0E6EE33-34E1-4C9B-8053-BE83A1B13A74}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A0E6EE33-34E1-4C9B-8053-BE83A1B13A74}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

SerialPortTest/MainClass.cs

+namespace Sti.IO.SerialPortTest
+{
+    using System;
+    using System.IO.Ports;
+
+    public static class MainClass
+    {
+        private const string PORT_NAME = "COM8";
+        private const int BAUD_RATE = 9600;
+        private const Parity PARITY = Parity.None;
+        private const int DATA_BITS = 1;
+        private const StopBits STOP_BITS = StopBits.One;
+
+        public static void Main(string[] args)
+        {
+            SerialPort port = null;
+            try
+            {
+                port = new SerialPort(PORT_NAME, BAUD_RATE, PARITY, DATA_BITS, STOP_BITS);
+                port.DataReceived += DataReceived;
+                port.ErrorReceived += ErrorReceived;
+                port.PinChanged += PinChanged;
+                port.Open();
+            }
+            catch (Exception ex)
+            {
+            }
+            finally
+            {
+                if (port != null)
+                    port.Dispose();
+            }
+
+            Console.Out.WriteLine("You may press any key at any time to quit.");
+            Console.ReadKey(true);
+        }
+
+        private static void PinChanged(object sender, SerialPinChangedEventArgs e)
+        {
+            Console.Out.WriteLine("PinChanged event: EventType = " + e.EventType);
+        }
+
+        private static void ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
+        {
+            Console.Out.WriteLine("ErrorReceived event: Event Type = " + e.EventType);
+        }
+
+        private static void DataReceived(object sender, SerialDataReceivedEventArgs e)
+        {
+            Console.Out.WriteLine("DataReceived event: Event Type = " + e.EventType);
+        }
+    }
+}

SerialPortTest/Properties/AssemblyInfo.cs

+using System.Reflection;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("SerialPortTest")]
+[assembly: AssemblyDescription("A utility to test serial ports.")]
+#if DEBUG
+[assembly: AssemblyConfiguration(".NET 4.0/Debug")]
+#else
+[assembly: AssemblyConfiguration(".NET 4.0/Release")]
+#endif
+[assembly: AssemblyCompany("Salamander Technologies, Inc.")]
+[assembly: AssemblyProduct("SerialPortTest")]
+[assembly: AssemblyCopyright("Copyright © Salamander Technologies, Inc. 2013")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+[assembly: AssemblyVersion("1.0.0.0")]

SerialPortTest/SerialPortTest.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <ProductVersion>8.0.30703</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{A0E6EE33-34E1-4C9B-8053-BE83A1B13A74}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Sti.IO.SerialPortTest</RootNamespace>
+    <AssemblyName>SerialPortTest</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Debug\SerialPortTest.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <CodeAnalysisLogFile>bin\Release\SerialPortTest.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
+    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
+    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
+    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MainClass.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </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>