serial comm app

main
syneffort 2 years ago
parent 16d0ca5d8a
commit bce6521e43
  1. 17
      MySolution/MySolution.sln
  2. 6
      MySolution/SerialComApp/App.config
  3. 117
      MySolution/SerialComApp/Dialogs/CommSettingDialog.Designer.cs
  4. 30
      MySolution/SerialComApp/Dialogs/CommSettingDialog.cs
  5. 193
      MySolution/SerialComApp/Dialogs/CommSettingDialog.resx
  6. 22
      MySolution/SerialComApp/Program.cs
  7. 36
      MySolution/SerialComApp/Properties/AssemblyInfo.cs
  8. 63
      MySolution/SerialComApp/Properties/Resources.Designer.cs
  9. 117
      MySolution/SerialComApp/Properties/Resources.resx
  10. 26
      MySolution/SerialComApp/Properties/Settings.Designer.cs
  11. 7
      MySolution/SerialComApp/Properties/Settings.settings
  12. 244
      MySolution/SerialComApp/SerialCommApp.Designer.cs
  13. 178
      MySolution/SerialComApp/SerialCommApp.cs
  14. 95
      MySolution/SerialComApp/SerialCommApp.csproj
  15. 211
      MySolution/SerialComApp/SerialCommApp.resx
  16. 48
      MySolution/SerialComApp/SeriallLibs/PMessageHistory.cs
  17. 128
      MySolution/SerialComApp/SeriallLibs/PSerialComm.cs
  18. 60
      MySolution/SerialComApp/SeriallLibs/PSerialCommSetting.cs
  19. BIN
      Reaources/Refresh.ico
  20. BIN
      Reaources/Refresh_48px.png
  21. BIN
      Reaources/SerialIcon.ico

@ -3,20 +3,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59 VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SerialCommApp", "SerialComApp\SerialCommApp.csproj", "{21CB97AA-1550-4C56-894D-76E6B75B91DC}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Release|Any CPU.Build.0 = Release|Any CPU {AF3FAEF8-E438-4E8C-9A99-C0A94649EFEE}.Release|Any CPU.Build.0 = Release|Any CPU
{21CB97AA-1550-4C56-894D-76E6B75B91DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21CB97AA-1550-4C56-894D-76E6B75B91DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21CB97AA-1550-4C56-894D-76E6B75B91DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21CB97AA-1550-4C56-894D-76E6B75B91DC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FDB80B27-48D0-459C-B186-EDC205130707}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

@ -0,0 +1,117 @@
namespace SerialCommApp.Dialogs
{
partial class CommSettingDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CommSettingDialog));
this.pgrComm = new System.Windows.Forms.PropertyGrid();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.okButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// pgrComm
//
this.pgrComm.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgrComm.Location = new System.Drawing.Point(3, 3);
this.pgrComm.Name = "pgrComm";
this.pgrComm.Size = new System.Drawing.Size(335, 214);
this.pgrComm.TabIndex = 0;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.pgrComm, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(341, 255);
this.tableLayoutPanel1.TabIndex = 1;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.Controls.Add(this.okButton, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 223);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(335, 29);
this.tableLayoutPanel2.TabIndex = 1;
//
// okButton
//
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.okButton.Location = new System.Drawing.Point(238, 3);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(94, 23);
this.okButton.TabIndex = 0;
this.okButton.Text = "Apply";
this.okButton.UseVisualStyleBackColor = true;
//
// CommSettingDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(341, 255);
this.Controls.Add(this.tableLayoutPanel1);
this.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CommSettingDialog";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Serial Communication Setting";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PropertyGrid pgrComm;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button okButton;
}
}

@ -0,0 +1,30 @@
using SerialCommApp.SeriallLibs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SerialCommApp.Dialogs
{
public partial class CommSettingDialog : Form
{
public PSerialCommSetting Setting { get; set; }
public CommSettingDialog(PSerialCommSetting setting)
{
InitializeComponent();
InitInstance(setting);
}
private void InitInstance(PSerialCommSetting setting)
{
this.Setting = setting;
pgrComm.SelectedObject = this.Setting;
}
}
}

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd5X8V
Yiq7Dov2LgAAAABJRU5ErkJggg==
</value>
</data>
</root>

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SerialCommApp
{
internal static class Program
{
/// <summary>
/// 해당 애플리케이션의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new SerialCommApp());
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("SerialCommApp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SerialComApp")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("21cb97aa-1550-4c56-894d-76e6b75b91dc")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SerialCommApp.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SerialCommApp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SerialCommApp.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -0,0 +1,244 @@
namespace SerialCommApp
{
partial class SerialCommApp
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form 디자이너에서 생성한 코드
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SerialCommApp));
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.connectButton = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.settingButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.portComboBox = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.sendButton = new System.Windows.Forms.Button();
this.commandText = new System.Windows.Forms.TextBox();
this.printText = new System.Windows.Forms.TextBox();
this.portRefreshButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.BackColor = System.Drawing.Color.White;
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.printText, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(583, 679);
this.tableLayoutPanel1.TabIndex = 6;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.BackColor = System.Drawing.Color.White;
this.tableLayoutPanel2.ColumnCount = 3;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 350F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel2.Controls.Add(this.connectButton, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.panel1, 0, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 4);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(577, 32);
this.tableLayoutPanel2.TabIndex = 6;
//
// connectButton
//
this.connectButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.connectButton.Location = new System.Drawing.Point(480, 4);
this.connectButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.connectButton.Name = "connectButton";
this.connectButton.Size = new System.Drawing.Size(94, 24);
this.connectButton.TabIndex = 1;
this.connectButton.Text = "Connect";
this.connectButton.UseVisualStyleBackColor = true;
this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
//
// panel1
//
this.panel1.Controls.Add(this.portRefreshButton);
this.panel1.Controls.Add(this.settingButton);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.portComboBox);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(350, 32);
this.panel1.TabIndex = 2;
//
// settingButton
//
this.settingButton.Location = new System.Drawing.Point(207, 3);
this.settingButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.settingButton.Name = "settingButton";
this.settingButton.Size = new System.Drawing.Size(68, 24);
this.settingButton.TabIndex = 1;
this.settingButton.Text = "Setting";
this.settingButton.UseVisualStyleBackColor = true;
this.settingButton.Click += new System.EventHandler(this.settingButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(2, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 15);
this.label1.TabIndex = 0;
this.label1.Text = "Port";
//
// portComboBox
//
this.portComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.portComboBox.FormattingEnabled = true;
this.portComboBox.Location = new System.Drawing.Point(37, 4);
this.portComboBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.portComboBox.Name = "portComboBox";
this.portComboBox.Size = new System.Drawing.Size(116, 23);
this.portComboBox.TabIndex = 0;
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.BackColor = System.Drawing.Color.White;
this.tableLayoutPanel3.ColumnCount = 2;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel3.Controls.Add(this.sendButton, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.commandText, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 643);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(577, 32);
this.tableLayoutPanel3.TabIndex = 6;
//
// sendButton
//
this.sendButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.sendButton.Location = new System.Drawing.Point(480, 4);
this.sendButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.sendButton.Name = "sendButton";
this.sendButton.Size = new System.Drawing.Size(94, 24);
this.sendButton.TabIndex = 1;
this.sendButton.Text = "Send";
this.sendButton.UseVisualStyleBackColor = true;
this.sendButton.Click += new System.EventHandler(this.sendButton_Click);
//
// commandText
//
this.commandText.Dock = System.Windows.Forms.DockStyle.Fill;
this.commandText.Location = new System.Drawing.Point(3, 4);
this.commandText.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.commandText.Name = "commandText";
this.commandText.Size = new System.Drawing.Size(471, 23);
this.commandText.TabIndex = 0;
//
// printText
//
this.printText.BackColor = System.Drawing.Color.White;
this.printText.Dock = System.Windows.Forms.DockStyle.Fill;
this.printText.Location = new System.Drawing.Point(3, 44);
this.printText.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.printText.Multiline = true;
this.printText.Name = "printText";
this.printText.ReadOnly = true;
this.printText.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.printText.Size = new System.Drawing.Size(577, 591);
this.printText.TabIndex = 2;
this.printText.TabStop = false;
//
// portRefreshButton
//
this.portRefreshButton.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("portRefreshButton.BackgroundImage")));
this.portRefreshButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.portRefreshButton.Location = new System.Drawing.Point(159, 4);
this.portRefreshButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.portRefreshButton.Name = "portRefreshButton";
this.portRefreshButton.Size = new System.Drawing.Size(25, 24);
this.portRefreshButton.TabIndex = 2;
this.portRefreshButton.UseVisualStyleBackColor = true;
this.portRefreshButton.Click += new System.EventHandler(this.portRefreshButton_Click);
//
// SerialCommApp
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(583, 679);
this.Controls.Add(this.tableLayoutPanel1);
this.Font = new System.Drawing.Font("맑은 고딕", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.Name = "SerialCommApp";
this.Text = "Serial Communication Application";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button connectButton;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button portRefreshButton;
private System.Windows.Forms.Button settingButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox portComboBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Button sendButton;
private System.Windows.Forms.TextBox commandText;
private System.Windows.Forms.TextBox printText;
}
}

@ -0,0 +1,178 @@
using SerialCommApp.Dialogs;
using SerialCommApp.SeriallLibs;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SerialCommApp
{
public enum MessageType
{
SYS,
SND,
RCV,
}
public partial class SerialCommApp : Form
{
private PSerialComm _serial;
private PSerialCommSetting _serialSetting;
public SerialCommApp()
{
InitializeComponent();
InitInstance();
UIEnable(false);
}
private void InitInstance()
{
_serial = new PSerialComm();
_serialSetting = new PSerialCommSetting();
_serial.OnDataReceived += _serial_OnDataReceived;
GetPortNames();
}
private void GetPortNames()
{
DataTable portTable = new DataTable();
portTable.Columns.Add("VALUE", typeof(string));
string[] portNames = PSerialComm.GetPortNames();
if (portNames == null || portNames.Length < 1)
return;
foreach (string port in portNames)
{
portTable.Rows.Add(port);
}
portComboBox.DataSource = portTable.DefaultView;
portComboBox.ValueMember = "VALUE";
}
private void UIEnable(bool isConnect)
{
portComboBox.Enabled = !isConnect;
portRefreshButton.Enabled = !isConnect;
settingButton.Enabled = !isConnect;
sendButton.Enabled = isConnect;
}
private void PortOpen()
{
try
{
DataRowView rowView = portComboBox.SelectedItem as DataRowView;
if (rowView == null)
{
MessageBox.Show("Please check the selected port.");
return;
}
_serial.PortName = rowView.Row["VALUE"].ToString();
_serial.Open();
UIEnable(true);
connectButton.Text = "Disconnect";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void PortClose()
{
try
{
if (_serial.IsOpen)
_serial.Close();
UIEnable(false);
connectButton.Text = "Connect";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void portRefreshButton_Click(object sender, EventArgs e)
{
GetPortNames();
}
private void settingButton_Click(object sender, EventArgs e)
{
PSerialCommSetting setting = (PSerialCommSetting)_serialSetting.Clone();
CommSettingDialog dlg = new CommSettingDialog(setting);
if (dlg.ShowDialog() != DialogResult.OK)
return;
_serialSetting = dlg.Setting;
}
private void WriteLine(string message, MessageType type)
{
string text = $"[{DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss")} : {type.ToString()}] {message}";
printText.AppendText(text + Environment.NewLine);
}
private void _serial_OnDataReceived(object sender, string e)
{
WriteLine(e, MessageType.RCV);
}
private void connectButton_Click(object sender, EventArgs e)
{
try
{
if (portComboBox.SelectedIndex < 0)
{
MessageBox.Show("Please select port.");
return;
}
if (connectButton.Text == "Connect")
PortOpen();
else
PortClose();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
UIEnable(false);
}
}
private void sendButton_Click(object sender, EventArgs e)
{
string command = commandText.Text + "\r\n";
if (!_serial.IsOpen)
{
MessageBox.Show("포트가 열려있지 않습니다.");
return;
}
WriteLine(commandText.Text, MessageType.SND);
_serial.Write(command);
commandText.Clear();
}
}
}

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{21CB97AA-1550-4C56-894D-76E6B75B91DC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>SerialCommApp</RootNamespace>
<AssemblyName>SerialCommApp</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</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>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<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="Dialogs\CommSettingDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialogs\CommSettingDialog.Designer.cs">
<DependentUpon>CommSettingDialog.cs</DependentUpon>
</Compile>
<Compile Include="SerialCommApp.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SerialCommApp.Designer.cs">
<DependentUpon>SerialCommApp.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SeriallLibs\PMessageHistory.cs" />
<Compile Include="SeriallLibs\PSerialCommSetting.cs" />
<Compile Include="SeriallLibs\PSerialComm.cs" />
<EmbeddedResource Include="Dialogs\CommSettingDialog.resx">
<DependentUpon>CommSettingDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="SerialCommApp.resx">
<DependentUpon>SerialCommApp.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>
<DesignTime>True</DesignTime>
</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>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="portRefreshButton.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAACxIAAAsSAdLdfvwAAALASURBVGhD7dnJy01xHMfxa8yQqYSdBdnYiGxEKJFhZ84Q
pchQeshCRMofoFDGlFnZWFiwUYrM4wJhY2lIGTLz/ixOnU6fc+45557ffdD51GvzdO/v+7v3nt/4NOrU
qVPnn84obMBZ3Mc7fMdXvMZtHMdqDMdfke5Yjhv4XcAvXMV8dEOnZDaew3WwiIeYiralL47BdaYs/SJ7
0BNBMwz34DpRhSsYhCAZimdwhdN8wbfE35q5hQGoNH1wF65gnF6zHeMwGFGGYCJ24wnce+MuodLBfQSu
UEQDcSbypCsWo9kEsAuVRB1zBSJ7oem0aPrjHFybojVkDFqKOpb13Heg1eyDa1suo6UsgWtYVLiK6JE6
D1dDJqB0rsM1+gA9UFU04LXdcLVOoFRGwjUos1B1tEdytT6gFwpnLVyDdxAimqrfw9WcjsI5BdfYNoTK
QbiaWlsKJ23hGotQWQlX8zQK5w1cYwPRSrpgCqYZ6+BqaqF0r5+E1OggkmzoE6rIPGihSrZfhHawy5Aa
9wE+o6oswA8ka+S1BZkJ9QjFswI/4epk2Y+madcgXgU9Dq6WcwG5dqon4RoIMY2uQZ4PcRM6EeZK2kKm
XyZE1iPrQ7yAzhW5MwJpDepAHyIb4eppPOrapnCuwTX4CFVu5uLZjHgtzXyld6RZ2+mjCJVNUA3NUHP1
h7LRaH+KZOcj+rZCRfsfPVItZwZc5yOak8s8Tv2wFdqFBs8huM5HHmMO8kQnsIV4Bb33IoJfaPWGLmeT
HU/Spe4OjEd8ytPqPRk78RLJ951B8DtSdShrPDi62HJ7KkdnAe1Ug0a3czqRuQ5UQduK4NGgOwzXgbL0
S2mLUuZ+qXQ0OxV9pBzdfIxGp0Tf2FKkXb+k0QKlXWVb/y/QLLqG0ZFQ51ddwb+FbqY/QhsxfcgDWARd
09epU6fOf5VG4w+/mDr1A0+1JAAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEAIACxDwAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAAAlw
SFlzAAALEwAACxMBAJqcGAAAD2NJREFUeJzt3QmQHUUZwPHdcHiDAhoTN/vevH1sMCICq3ggWcRgFEuR
I94HpORQFEWkQEs51NKUgJgCqQIvJAYQFJSrwKIgHKXIUVxKQA5BCIeQBGICQZLo97FDVdwkuzP99cw3
897/V/UVKd3d7q+nu+fNvOmenh4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAGptcHBwqyRJtmu1Wu+W2EP+PYsgigrtY2lfe/PkyZO39O7/XWV4eHjjRqOxqxyIOc1m
84/y30ck/ksQjrFI4nLpj9+XmC7ddCPvcdJxdNBL486Xhl5SgQNOEGPFYumr89LJAKH0bC+NOVsa8rYK
HFSCCIlb5OS1n/Zl7/FUK9JwM2Tg316BA0gQMWJhq9X6oPe4qjxpqIky8C+qwAEjiCLigna7/Vrvc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OpI07i4SSypwkAlinZAT1ONyohryHicdTV8+KQ19t/fB
Joi1Q19Zxsf+kkhDby6Nfo73QSeINM7lhp8DmXUPSgLfY08Q1kjfaPwp73HQ1eQATJT4pcQq7w5BdEfo
OywkTu3r69vCu/8j1Wg0ttFNQSO8YIQgNhTP6v4A8nE/8e7v2AA5SBN1NyCJ2yvQYYj6h67k070AD5s8
efKW3v0bOehMLQ6RyWCexN8TLhOIcUK37Zb/LpQ4Q/cGYCFPBxkaGtqk3W4PyIEd1h1f5CDPIgjpDzMl
pusJgx2lAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd5X8V
Yiq7Dov2LgAAAABJRU5ErkJggg==
</value>
</data>
</root>

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SerialCommApp.SeriallLibs
{
public class PMessageHistory<T>
{
private List<T> _messageList;
private int _size;
public PMessageHistory(int size)
{
_size = size;
_messageList = new List<T>(_size);
}
public void Add(T message)
{
if (_messageList.Count == 0)
_messageList.Add(message);
else
_messageList.Insert(0, message);
if (_messageList.Count <= _size)
return;
while (_messageList.Count > _size)
{
_messageList.RemoveAt(_messageList.Count);
}
}
public T this[int index]
{
get { return _messageList[index]; }
}
public void Clear()
{
_messageList = new List<T>(_size);
}
public int Count { get { return _messageList.Count; } }
}
}

@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SerialCommApp.SeriallLibs
{
public class PSerialComm
{
private readonly string CRLF = "\r\n";
private SerialPort _serialPort;
private string _stringBuffer;
private object _receiveLock = new object();
public event EventHandler<string> OnDataReceived;
public PMessageHistory<string> History { get; set; }
public PSerialCommSetting SerialCommSetting { get; set; }
public bool IsOpen { get { return _serialPort.IsOpen; } }
public string PortName
{
get
{
return _serialPort.PortName;
}
set
{
_serialPort.PortName = value;
}
}
public PSerialComm()
{
InitInstance();
}
public PSerialComm(string port)
{
InitInstance();
this.PortName = port;
}
private void InitInstance()
{
if (_serialPort != null)
_serialPort.Close();
_serialPort = new SerialPort();
_serialPort.DataReceived += SerialPort_DataReceived;
SerialCommSetting = new PSerialCommSetting();
this.History = new PMessageHistory<string>(10);
}
private void SerialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
SerialPort serialPort = sender as SerialPort;
if (serialPort == null)
return;
string data = serialPort.ReadExisting();
if (data.Length < 1)
return;
HandleData(data);
}
public static string[] GetPortNames()
{
return SerialPort.GetPortNames();
}
public void Write(string message)
{
_serialPort.Write(message);
}
private void HandleData(string data)
{
_stringBuffer = string.Concat(_stringBuffer, data);
if (this.OnDataReceived == null)
return;
while (true)
{
int subStringIdx = _stringBuffer.IndexOf(CRLF);
if (subStringIdx < 0)
break;
string message = _stringBuffer.Substring(0, subStringIdx);
History.Add(message);
if (this.OnDataReceived != null)
this.OnDataReceived(this, message);
_stringBuffer = _stringBuffer.Remove(0, subStringIdx + CRLF.Length);
}
}
public void Open()
{
if (string.IsNullOrEmpty(this.PortName))
throw new Exception("Port name is cannot be empty.");
if (!_serialPort.IsOpen)
_serialPort.Open();
}
public void Close()
{
if (string.IsNullOrEmpty(this.PortName))
throw new Exception("Port name is cannot be empty.");
if (_serialPort.IsOpen)
_serialPort.Close();
}
}
}

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SerialCommApp.SeriallLibs
{
[DefaultProperty("Serial Communication")]
public class PSerialCommSetting : ICloneable
{
public enum PSerialBaudRate
{
B1200 = 1200,
B2400 = 2400,
B4800 = 4800,
B9600 = 9600,
B19200 = 19200,
B38400 = 38400,
B57600 = 57600,
B115200 = 115200,
}
public enum PSerailDataBit
{
D8 = 8,
D7 = 7,
}
[Category("Communication")]
public PSerialBaudRate BaudRate { get; set; }
[Category("Communication")]
public PSerailDataBit DataBit { get; set; }
[Category("Communication")]
public Parity Parity { get; set; }
[Category("Communication")]
public StopBits StopBits { get; set; }
public PSerialCommSetting(PSerialBaudRate baudRate = PSerialBaudRate.B9600, PSerailDataBit dataBit = PSerailDataBit.D8, Parity parity = Parity.None, StopBits stopBits = StopBits.None)
{
this.BaudRate = baudRate;
this.DataBit = dataBit;
this.Parity = parity;
this.StopBits = stopBits;
}
public object Clone()
{
PSerialCommSetting cloned = new PSerialCommSetting();
cloned.BaudRate = this.BaudRate;
cloned.DataBit = this.DataBit;
cloned.Parity = this.Parity;
cloned.StopBits = this.StopBits;
return cloned;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Loading…
Cancel
Save