From bce6521e4391eee4af38dc57ffafaa234f06f3f3 Mon Sep 17 00:00:00 2001 From: syneffort Date: Tue, 16 May 2023 11:14:28 +0900 Subject: [PATCH] serial comm app --- MySolution/MySolution.sln | 17 +- MySolution/SerialComApp/App.config | 6 + .../Dialogs/CommSettingDialog.Designer.cs | 117 +++++++++ .../SerialComApp/Dialogs/CommSettingDialog.cs | 30 +++ .../Dialogs/CommSettingDialog.resx | 193 ++++++++++++++ MySolution/SerialComApp/Program.cs | 22 ++ .../SerialComApp/Properties/AssemblyInfo.cs | 36 +++ .../Properties/Resources.Designer.cs | 63 +++++ .../SerialComApp/Properties/Resources.resx | 117 +++++++++ .../Properties/Settings.Designer.cs | 26 ++ .../SerialComApp/Properties/Settings.settings | 7 + .../SerialComApp/SerialCommApp.Designer.cs | 244 ++++++++++++++++++ MySolution/SerialComApp/SerialCommApp.cs | 178 +++++++++++++ MySolution/SerialComApp/SerialCommApp.csproj | 95 +++++++ MySolution/SerialComApp/SerialCommApp.resx | 211 +++++++++++++++ .../SeriallLibs/PMessageHistory.cs | 48 ++++ .../SerialComApp/SeriallLibs/PSerialComm.cs | 128 +++++++++ .../SeriallLibs/PSerialCommSetting.cs | 60 +++++ Reaources/Refresh.ico | Bin 0 -> 4811 bytes Reaources/Refresh_48px.png | Bin 0 -> 792 bytes Reaources/SerialIcon.ico | Bin 0 -> 4039 bytes 21 files changed, 1594 insertions(+), 4 deletions(-) create mode 100644 MySolution/SerialComApp/App.config create mode 100644 MySolution/SerialComApp/Dialogs/CommSettingDialog.Designer.cs create mode 100644 MySolution/SerialComApp/Dialogs/CommSettingDialog.cs create mode 100644 MySolution/SerialComApp/Dialogs/CommSettingDialog.resx create mode 100644 MySolution/SerialComApp/Program.cs create mode 100644 MySolution/SerialComApp/Properties/AssemblyInfo.cs create mode 100644 MySolution/SerialComApp/Properties/Resources.Designer.cs create mode 100644 MySolution/SerialComApp/Properties/Resources.resx create mode 100644 MySolution/SerialComApp/Properties/Settings.Designer.cs create mode 100644 MySolution/SerialComApp/Properties/Settings.settings create mode 100644 MySolution/SerialComApp/SerialCommApp.Designer.cs create mode 100644 MySolution/SerialComApp/SerialCommApp.cs create mode 100644 MySolution/SerialComApp/SerialCommApp.csproj create mode 100644 MySolution/SerialComApp/SerialCommApp.resx create mode 100644 MySolution/SerialComApp/SeriallLibs/PMessageHistory.cs create mode 100644 MySolution/SerialComApp/SeriallLibs/PSerialComm.cs create mode 100644 MySolution/SerialComApp/SeriallLibs/PSerialCommSetting.cs create mode 100644 Reaources/Refresh.ico create mode 100644 Reaources/Refresh_48px.png create mode 100644 Reaources/SerialIcon.ico diff --git a/MySolution/MySolution.sln b/MySolution/MySolution.sln index f84d375..f27f0aa 100644 --- a/MySolution/MySolution.sln +++ b/MySolution/MySolution.sln @@ -3,20 +3,29 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 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 Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {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}.Release|Any CPU.ActiveCfg = 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 EndGlobal diff --git a/MySolution/SerialComApp/App.config b/MySolution/SerialComApp/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/MySolution/SerialComApp/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MySolution/SerialComApp/Dialogs/CommSettingDialog.Designer.cs b/MySolution/SerialComApp/Dialogs/CommSettingDialog.Designer.cs new file mode 100644 index 0000000..faad714 --- /dev/null +++ b/MySolution/SerialComApp/Dialogs/CommSettingDialog.Designer.cs @@ -0,0 +1,117 @@ +namespace SerialCommApp.Dialogs +{ + partial class CommSettingDialog + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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; + } +} \ No newline at end of file diff --git a/MySolution/SerialComApp/Dialogs/CommSettingDialog.cs b/MySolution/SerialComApp/Dialogs/CommSettingDialog.cs new file mode 100644 index 0000000..2d24c06 --- /dev/null +++ b/MySolution/SerialComApp/Dialogs/CommSettingDialog.cs @@ -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; + } + } +} diff --git a/MySolution/SerialComApp/Dialogs/CommSettingDialog.resx b/MySolution/SerialComApp/Dialogs/CommSettingDialog.resx new file mode 100644 index 0000000..89cb1fa --- /dev/null +++ b/MySolution/SerialComApp/Dialogs/CommSettingDialog.resx @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAAAAAAAEAIACxDwAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAAAlw + SFlzAAALEwAACxMBAJqcGAAAD2NJREFUeJzt3QmQHUUZwPHdcHiDAhoTN/vevH1sMCICq3ggWcRgFEuR + I94HpORQFEWkQEs51NKUgJgCqQIvJAYQFJSrwKIgHKXIUVxKQA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l0JnkAb6m3Fm1W2l+TYAhYhx91+fqPTO + o7KkgeZGaOBruBeA2HS9ifSvmyP0z+55AUhe+thnhOsrjTneuaCzJMZdrF+MrngBaCh9tlxmyKciNPSa + Cq4PQE3pWTvSienRHl5tP7ZYM20ac7vmjauITpdD6559EfvjD71zqjxppJ0iNrjGnbqltndeqBfpM++X + wX9vxH64Jl3ViPFIY10VeRLQmy83yPXX/u12u887P1RTujPRgdJfbo3d/yR+751fbSRxFgeNFfenb6Q5 + PxnZ8Ybo3rhA+sJ1Ed5RMebZX+Jt3uOqVuSAXFLgASGI0kJ3bvIeT7WTjGx5FbIDLkFUKZYPDAxM8R5P + tSTX7EdV4AASRHA0Go2DvcdRnU2QRrza+yASREik235Vai/D2tFXTRd8g4Ygioi7+vv7X+M9fjqCTALb + R1iDTRBlxZOxtkpHSldiMQkQNYilMvjf6j1eOpI07i4SSypwkAlinZAT1ONyohryHicdTV8+KQ19t/fB + Joi1Q19Zxsf+kkhDby6Nfo73QSeINM7lhp8DmXUPSgLfY08Q1kjfaPwp73HQ1eQATJT4pcQq7w5BdEfo + OywkTu3r69vCu/8j1Wg0ttFNQSO8YIQgNhTP6v4A8nE/8e7v2AA5SBN1NyCJ2yvQYYj6h67k070AD5s8 + efKW3v0bOehMLQ6RyWCexN8TLhOIcUK37Zb/LpQ4Q/cGYCFPBxkaGtqk3W4PyIEd1h1f5CDPIgjpDzMl + pusJgx2lAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADd5X8V + Yiq7Dov2LgAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/MySolution/SerialComApp/Program.cs b/MySolution/SerialComApp/Program.cs new file mode 100644 index 0000000..016c012 --- /dev/null +++ b/MySolution/SerialComApp/Program.cs @@ -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 + { + /// + /// 해당 애플리케이션의 주 진입점입니다. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new SerialCommApp()); + } + } +} diff --git a/MySolution/SerialComApp/Properties/AssemblyInfo.cs b/MySolution/SerialComApp/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6cefab9 --- /dev/null +++ b/MySolution/SerialComApp/Properties/AssemblyInfo.cs @@ -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")] diff --git a/MySolution/SerialComApp/Properties/Resources.Designer.cs b/MySolution/SerialComApp/Properties/Resources.Designer.cs new file mode 100644 index 0000000..814fe10 --- /dev/null +++ b/MySolution/SerialComApp/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace SerialCommApp.Properties { + using System; + + + /// + /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. + /// + // 이 클래스는 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() { + } + + /// + /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. + /// + [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; + } + } + + /// + /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을 + /// 재정의합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/MySolution/SerialComApp/Properties/Resources.resx b/MySolution/SerialComApp/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/MySolution/SerialComApp/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/MySolution/SerialComApp/Properties/Settings.Designer.cs b/MySolution/SerialComApp/Properties/Settings.Designer.cs new file mode 100644 index 0000000..0d6935a --- /dev/null +++ b/MySolution/SerialComApp/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/MySolution/SerialComApp/Properties/Settings.settings b/MySolution/SerialComApp/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/MySolution/SerialComApp/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/MySolution/SerialComApp/SerialCommApp.Designer.cs b/MySolution/SerialComApp/SerialCommApp.Designer.cs new file mode 100644 index 0000000..f54a431 --- /dev/null +++ b/MySolution/SerialComApp/SerialCommApp.Designer.cs @@ -0,0 +1,244 @@ +namespace SerialCommApp +{ + partial class SerialCommApp + { + /// + /// 필수 디자이너 변수입니다. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 사용 중인 모든 리소스를 정리합니다. + /// + /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form 디자이너에서 생성한 코드 + + /// + /// 디자이너 지원에 필요한 메서드입니다. + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. + /// + 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; + } +} + diff --git a/MySolution/SerialComApp/SerialCommApp.cs b/MySolution/SerialComApp/SerialCommApp.cs new file mode 100644 index 0000000..61be7f6 --- /dev/null +++ b/MySolution/SerialComApp/SerialCommApp.cs @@ -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(); + } + } +} diff --git a/MySolution/SerialComApp/SerialCommApp.csproj b/MySolution/SerialComApp/SerialCommApp.csproj new file mode 100644 index 0000000..b614b66 --- /dev/null +++ b/MySolution/SerialComApp/SerialCommApp.csproj @@ -0,0 +1,95 @@ + + + + + Debug + AnyCPU + {21CB97AA-1550-4C56-894D-76E6B75B91DC} + WinExe + SerialCommApp + SerialCommApp + v4.5 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + CommSettingDialog.cs + + + Form + + + SerialCommApp.cs + + + + + + + + CommSettingDialog.cs + + + SerialCommApp.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/MySolution/SerialComApp/SerialCommApp.resx b/MySolution/SerialComApp/SerialCommApp.resx new file mode 100644 index 0000000..09cdc5d --- /dev/null +++ b/MySolution/SerialComApp/SerialCommApp.resx @@ -0,0 +1,211 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAACxIAAAsSAdLdfvw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LgAAAABJRU5ErkJggg== + + + \ No newline at end of file diff --git a/MySolution/SerialComApp/SeriallLibs/PMessageHistory.cs b/MySolution/SerialComApp/SeriallLibs/PMessageHistory.cs new file mode 100644 index 0000000..1b73d83 --- /dev/null +++ b/MySolution/SerialComApp/SeriallLibs/PMessageHistory.cs @@ -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 + { + private List _messageList; + private int _size; + + public PMessageHistory(int size) + { + _size = size; + _messageList = new List(_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(_size); + } + + public int Count { get { return _messageList.Count; } } + } +} diff --git a/MySolution/SerialComApp/SeriallLibs/PSerialComm.cs b/MySolution/SerialComApp/SeriallLibs/PSerialComm.cs new file mode 100644 index 0000000..12e9387 --- /dev/null +++ b/MySolution/SerialComApp/SeriallLibs/PSerialComm.cs @@ -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 OnDataReceived; + + public PMessageHistory 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(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(); + } + } +} diff --git a/MySolution/SerialComApp/SeriallLibs/PSerialCommSetting.cs b/MySolution/SerialComApp/SeriallLibs/PSerialCommSetting.cs new file mode 100644 index 0000000..c55b995 --- /dev/null +++ b/MySolution/SerialComApp/SeriallLibs/PSerialCommSetting.cs @@ -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; + } + } +} diff --git a/Reaources/Refresh.ico b/Reaources/Refresh.ico new file mode 100644 index 0000000000000000000000000000000000000000..571e26f9c92f12b8816f5fb89e06ff289499f783 GIT binary patch literal 4811 zcmbtYi96KY7atT+$d*Eu-ek*?T{0tUjj}UIMv+7q*_Sa$kr7&KV~O-i8k%I^*Wry} z5FyK0zt%8jFc>qx>2LU*`<&;T=X1|Yi4tu4)Y zdBk{FF7M47CboZj|LO@&mbn-3`4P)-``>U11c6Qp{Z%$lcJ5gaNYL}9$#wg%+&_7d z!#Hckt~z7kiMRd_8g%Dk z&!>t)Q$4)(o0oZy#k(G48kJzy0+{f_sZGY8z0in_rTYA(edMnLdd2>H)5c+aK8Z4! zu$IA^%Ks(V9ajNupcyC!egJiV2cQL<2cm!ugJ=Z9m1rKp+TK{2B^1N*=VKnAV@ ze85RU`YJa!=+U+)kOJ5M;{Y$GejgqP3*1@FIaV-LT1HKZNC|J5D# zqS3YG*qmPG6{4oAEFe%YU;0Gy0o;ROLyoKPi<%=#6eXGhd<8;bg_}O`&(sJBgA*2H zzoPKCrBqTSXmL(suNxDpfclocE=92Db4j~o$R?JI!{mQC$Xxk7V@1%(!KO^Eg4%o@ zpsxRUKY;Bu1+KW=6cCHSjUR64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7F+F^Krd4E;7AVy->=UXaDLIyF0M6cJQHE#sB)446)~7O+-KxoH@2aD8TR3iZ6E}9 zFzPerO^q#bPG)T{zj|uyL^J(<6wr$0^%bUt20s(@=G^@mEi(Q3il2Ovdu0&wkpE}M zhiDt~I~I$-f+-2D<@-hn?OQeA%}`gFF(n#eMVR@O)&|azIxQ6E(nh38i5!^+@j{^c z#&~|}_%+yN0rrRU4rr-`IBNE@VSy|OzClCRei&U^YQYL$J^Pd#C@p2@-R=I2c}D)U zD@utP^*A8cvlSuQT2CWG@NrhqrY2@~>RK^ic@WF@NsCkB_ zyns~}LJ{T9zxKziDJ-0zr8>I)XKA7>l;_~E!1{ghBP7qQm9;Lo`)ls@P9A8>K?i(z zwu-JmVA|c z&s(`bd7;IevQ}e2|B%K8IU?>gHMcsZ*Fc?UytPse!HYGbic#$B*OK$Q6c>%&JZ zT42?9^JSW0oirNd8uBr#=Bj_~iw1sHh3AnS0mLdteZ|sScAIfPtL0`i#xd z#Ao$8qfx4!+MfQRYzs@cz6#UwH&>~@Urh3yGF2bF)`5hQIf{Iz-8M9WtU$-Um)J%{ zOrN;4cL;105_B|Q*FnW?KZ7;18OfW)8Z}aNcs8Dg%0+@Bp{&!NUJ6^+8$k|+^_{ZT zW{9n=jVxi$>8uYgYC#tpU{Wn!Y}xp$z$_pFEy8}}dN6g6G4+m+Eazh$(>334G78cr z;=R}T!BroKW8mFv`3qE=Gp9n&p@tf*$Z;WpQN`2jloNq}E4l#@_+!a`sfM+;$#D_d zQfe&^CEfjsEA0e9ik&cFKBdcZ=XLT!#K&gSdf$1q`9RJsM4G7eF anhr6&=cK-xQh@%O>ZYls$ycNM&;AD>$C=mw literal 0 HcmV?d00001 diff --git a/Reaources/Refresh_48px.png b/Reaources/Refresh_48px.png new file mode 100644 index 0000000000000000000000000000000000000000..ea4833c37dc698f87507f7e45a6e8921018f6c6a GIT binary patch literal 792 zcmV+z1LypSP)<|VG79Y% zvz_ME2youw%Xi3>!0bPR+2;M$&;n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