mirror of
https://github.com/ekinnee/SharpCAT.git
synced 2026-01-04 07:30:03 +01:00
Some re-org. Working on the Forms app so we can test the dll.
This commit is contained in:
parent
0f113dbb72
commit
5dada9781a
|
|
@ -5,7 +5,7 @@ VisualStudioVersion = 15.0.28307.421
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpCATForms", "SharpCATForms\SharpCATForms.csproj", "{3483B368-338A-4BE3-AEB9-460E374B2C99}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCAT", "SharpCAT\SharpCAT.csproj", "{DAD3E7BE-905A-4768-A695-0BCF96171E35}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpCATLib", "SharpCAT\SharpCATLib.csproj", "{DAD3E7BE-905A-4768-A695-0BCF96171E35}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCAT
|
||||
namespace SharpCATLib
|
||||
{
|
||||
class CATCommand
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCAT.Models
|
||||
namespace SharpCATLib.Models
|
||||
{
|
||||
//Base Radio Model
|
||||
class Radio
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCAT.Models.Radios.Icom
|
||||
namespace SharpCATLib.Models.Radios.Icom
|
||||
{
|
||||
class ID4100a : Radio
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCAT.Models.Radios.Icom
|
||||
namespace SharpCATLib.Models.Radios.Icom
|
||||
{
|
||||
class ID880H : Radio
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SharpCAT.Models.Radios.Kenwood
|
||||
namespace SharpCATLib.Models.Radios.Kenwood
|
||||
{
|
||||
class THD74A : Radio
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace SharpCAT.Models.Radios.Yaesu
|
||||
namespace SharpCATLib.Models.Radios.Yaesu
|
||||
{
|
||||
internal class FT818 : Radio
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,45 +1,12 @@
|
|||
using System;
|
||||
using System.IO.Ports;
|
||||
using System.Threading;
|
||||
|
||||
namespace SharpCAT
|
||||
namespace SharpCATLib
|
||||
{
|
||||
public class Serial
|
||||
{
|
||||
private SerialPort _serialPort;
|
||||
|
||||
public string[] PortNames { get => SerialPort.GetPortNames(); }
|
||||
public static int[] BaudRates { get; } = new int[] { 1200, 2400, 4800, 9600, 19200, 38400 };
|
||||
|
||||
public static int[] DataBits { get; } = new int[] { 7, 8 };
|
||||
|
||||
public enum Parity
|
||||
{
|
||||
Even = System.IO.Ports.Parity.Even,
|
||||
Mark = System.IO.Ports.Parity.Mark,
|
||||
None = System.IO.Ports.Parity.None,
|
||||
Odd = System.IO.Ports.Parity.Odd,
|
||||
Space = System.IO.Ports.Parity.Space
|
||||
}
|
||||
|
||||
public enum StopBits
|
||||
{
|
||||
None = System.IO.Ports.StopBits.None,
|
||||
One = System.IO.Ports.StopBits.One,
|
||||
OnePointFive = System.IO.Ports.StopBits.OnePointFive,
|
||||
Two = System.IO.Ports.StopBits.Two
|
||||
}
|
||||
|
||||
public enum Handshake
|
||||
{
|
||||
None = System.IO.Ports.Handshake.None,
|
||||
RequestToSend = System.IO.Ports.Handshake.RequestToSend,
|
||||
RequestToSendXOnXOff = System.IO.Ports.Handshake.RequestToSendXOnXOff,
|
||||
XOnXOff = System.IO.Ports.Handshake.XOnXOff
|
||||
}
|
||||
|
||||
private readonly string CmdPad = "00000000";
|
||||
|
||||
public Serial(string portname, int baudrate, Parity parity, StopBits bits, Handshake handshake)
|
||||
{
|
||||
_serialPort = new SerialPort
|
||||
|
|
@ -48,9 +15,9 @@ namespace SharpCAT
|
|||
WriteTimeout = 500,
|
||||
PortName = portname,
|
||||
BaudRate = baudrate,
|
||||
Parity = (System.IO.Ports.Parity)parity,
|
||||
StopBits = (System.IO.Ports.StopBits)bits,
|
||||
Handshake = (System.IO.Ports.Handshake)handshake
|
||||
Parity = parity,
|
||||
StopBits = bits,
|
||||
Handshake = handshake
|
||||
};
|
||||
|
||||
_serialPort.DataReceived += new SerialDataReceivedEventHandler(SerialDataReceived);
|
||||
|
|
@ -59,22 +26,18 @@ namespace SharpCAT
|
|||
|
||||
private void SerialErrorReceived(object sender, SerialErrorReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void SerialDataReceived(object sender, SerialDataReceivedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ProbeSerialPort(SerialPort port)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Read()
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
string message = _serialPort.ReadLine();
|
||||
|
|
@ -82,6 +45,5 @@ namespace SharpCAT
|
|||
}
|
||||
catch (TimeoutException) { }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
namespace SharpCAT
|
||||
using System.IO.Ports;
|
||||
|
||||
namespace SharpCATLib
|
||||
{
|
||||
public class SharpCAT
|
||||
{
|
||||
|
|
@ -14,5 +16,14 @@
|
|||
365, 371, 411, 412, 413, 423, 431, 432, 445, 446, 452, 454, 455, 462, 464, 465, 466,
|
||||
503, 506, 516, 523, 526, 532, 546, 565, 606, 612, 624, 627, 631, 632, 654, 662, 664,
|
||||
703, 712, 723, 731, 732, 734, 743, 754 };
|
||||
|
||||
public string[] PortNames { get => SerialPort.GetPortNames(); }
|
||||
|
||||
public static int[] BaudRates { get; } = new int[] { 1200, 2400, 4800, 9600, 19200, 38400 };
|
||||
|
||||
public static int[] DataBits { get; } = new int[] { 7, 8 };
|
||||
|
||||
private readonly string CmdPad = "00000000";
|
||||
|
||||
}
|
||||
}
|
||||
32
SharpCATForms/Form1.Designer.cs
generated
32
SharpCATForms/Form1.Designer.cs
generated
|
|
@ -28,13 +28,43 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.ComPorts = new System.Windows.Forms.ListBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ComPorts
|
||||
//
|
||||
this.ComPorts.FormattingEnabled = true;
|
||||
this.ComPorts.Location = new System.Drawing.Point(229, 25);
|
||||
this.ComPorts.Name = "ComPorts";
|
||||
this.ComPorts.Size = new System.Drawing.Size(120, 95);
|
||||
this.ComPorts.TabIndex = 0;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(98, 335);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.ComPorts);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Form1";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListBox ComPorts;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Windows.Forms;
|
||||
using SharpCATLib;
|
||||
|
||||
namespace SharpCATForms
|
||||
{
|
||||
|
|
@ -6,7 +7,11 @@ namespace SharpCATForms
|
|||
{
|
||||
public Form1()
|
||||
{
|
||||
SharpCAT sharpCAT = new SharpCAT();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
ComPorts.DataSource = sharpCAT.PortNames;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
SharpCATForms/Form1.resx
Normal file
120
SharpCATForms/Form1.resx
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?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>
|
||||
</root>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using SharpCATLib;
|
||||
|
||||
namespace SharpCATForms
|
||||
{
|
||||
|
|
@ -10,11 +11,12 @@ namespace SharpCATForms
|
|||
/// </summary>
|
||||
[STAThread]
|
||||
private static void Main()
|
||||
{
|
||||
//SharpCAT sharpCAT = new SharpCAT();
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,6 +22,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
|
@ -33,11 +34,15 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>SharpCATForms.Program</StartupObject>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Ports, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Ports.4.5.0\lib\net461\System.IO.Ports.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
|
@ -57,6 +62,9 @@
|
|||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
|
@ -66,6 +74,7 @@
|
|||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
@ -80,9 +89,9 @@
|
|||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpCAT\SharpCAT.csproj">
|
||||
<ProjectReference Include="..\SharpCAT\SharpCATLib.csproj">
|
||||
<Project>{dad3e7be-905a-4768-a695-0bcf96171e35}</Project>
|
||||
<Name>SharpCAT</Name>
|
||||
<Name>SharpCATLib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
|
|
|||
4
SharpCATForms/packages.config
Normal file
4
SharpCATForms/packages.config
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="System.IO.Ports" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
||||
Loading…
Reference in a new issue