Formatting and cleanup.

This commit is contained in:
Erick Kinnee 2019-03-08 13:04:43 -06:00
parent a3ae0cc06c
commit 57744dfb6a
29 changed files with 139 additions and 220 deletions

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib
namespace SharpCATLib.Models
{
class CATCommand
internal class CATCommand
{
public string P1 { get; set; }
public string P2 { get; set; }
@ -12,4 +8,4 @@ namespace SharpCATLib
public string P4 { get; set; }
public string OpCode { get; set; }
}
}
}

View file

@ -3,19 +3,19 @@
//Base Radio Model
public partial class CATRadio
{
string RadioMfg { get; }
string RadioModel { get; }
private string RadioMfg { get; }
private string RadioModel { get; }
string CmdPad { get; }
private string CmdPad { get; } = "00000000";
string VFOToggle { get; }
Lock Lock { get; }
Ptt Ptt { get; }
Clar Clar { get; }
Split Split { get; }
Power Power { get; }
ToneMode ToneMode { get; }
OpModes OpModes { get; }
private string VFOToggle { get; }
private Lock Lock { get; }
private Ptt Ptt { get; }
private Clar Clar { get; }
private Split Split { get; }
private Power Power { get; }
private ToneMode ToneMode { get; }
private OpModes OpModes { get; }
partial void LockOn();
@ -101,5 +101,4 @@
public static readonly string DIG;
public static readonly string PKT;
}
}

View file

@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib.Models
namespace SharpCATLib.Models
{
class CIVCommand
internal class CIVCommand
{
string CmdToRadio = "FE FE 9A E0 Cn Sc Data area FD";
string DataFromRadio = "FE FE E0 9A Cn Sc Data area FD";
string OKFromRadio { get; set; }
string NGFromRadio { get; set; }
private string CmdToRadio = "FE FE 9A E0 Cn Sc Data area FD";
private string DataFromRadio = "FE FE E0 9A Cn Sc Data area FD";
private string OKFromRadio { get; set; }
private string NGFromRadio { get; set; }
}
}
}

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib.Models
namespace SharpCATLib.Models
{
class CIVRadio
internal class CIVRadio
{
}
}
}

View file

@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.Text;
using SharpCATLib.Models;
namespace SharpCATLib.Models.Radios.Icom
namespace SharpCATLib.Radios.Icom
{
class ID4100a : CIVRadio
internal class ID4100a : CIVRadio
{
string OKFromRadio = "FEFEE09AFBFD";
string NGFromRadio = "FEFEE09AFAFD";
private string OKFromRadio = "FEFEE09AFBFD";
private string NGFromRadio = "FEFEE09AFAFD";
}
}
}

View file

@ -1,3 +1,2 @@
{
}
}

View file

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib.Models.Radios.Icom
namespace SharpCATLib.Radios.Icom
{
class ID880H
internal class ID880H
{
}
}
}

View file

@ -1,3 +1,2 @@
{
}
}

View file

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib.Models.Radios.Kenwood
namespace SharpCATLib.Radios.Kenwood
{
class THD74A
internal class THD74A
{
}
}
}

View file

@ -1,3 +1,2 @@
{
}
}

View file

@ -1,14 +1,14 @@
using SharpCATLib;
using SharpCATLib.Models;
namespace SharpCATLib.Models.Radios.Yaesu
namespace SharpCATLib.Radios.Yaesu
{
public class FT818 : CATRadio
{
public string RadioMfg => "Yaesu";
public string RadioModel => "FT-818";
public string CmdPad => "00000000";
public string CmdPad => "00000000";
public class Lock
{
public static readonly string ON = "00";
@ -61,87 +61,87 @@ namespace SharpCATLib.Models.Radios.Yaesu
public static readonly string PKT = "0C";
}
string LockOn()
{
return "";
}
string LockOff()
private string LockOn()
{
return "";
}
string PttOn()
private string LockOff()
{
return "";
}
string PttOff()
private string PttOn()
{
return "";
}
string ClarOn()
private string PttOff()
{
return "";
}
string ClarOff()
private string ClarOn()
{
return "";
}
string SplitOn()
private string ClarOff()
{
return "";
}
string SplitOff()
private string SplitOn()
{
return "";
}
string PowerOn()
private string SplitOff()
{
return "";
}
string PowerOff()
private string PowerOn()
{
return "";
}
string SetFreq(double freq)
private string PowerOff()
{
return "";
}
string SetOpMode(OpModes opmode)
private string SetFreq(double freq)
{
return "";
}
string SwitchVFO()
private string SetOpMode(OpModes opmode)
{
return "";
}
string SetToneMode(ToneMode mode)
private string SwitchVFO()
{
return "";
}
string GetRXStatus()
private string SetToneMode(ToneMode mode)
{
return "";
}
string GetTXStatus()
private string GetRXStatus()
{
return "";
}
string GetFreqAndModeStatus()
private string GetTXStatus()
{
return "";
}
private string GetFreqAndModeStatus()
{
return "";
}

View file

@ -1,3 +1,2 @@
{
}
}

View file

@ -7,14 +7,15 @@ namespace SharpCATLib
{
private SerialPort _serialPort;
public Serial(string portname, int baudrate, Parity parity, StopBits bits, Handshake handshake)
//Init
public Serial(string portname, SharpCAT.BaudRates baudrate, Parity parity, StopBits bits, Handshake handshake)
{
_serialPort = new SerialPort
{
ReadTimeout = 500,
WriteTimeout = 500,
PortName = portname,
BaudRate = baudrate,
BaudRate = (int)baudrate,
Parity = parity,
StopBits = bits,
Handshake = handshake

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib
namespace SharpCATLib
{
class SerialClient
internal class SerialClient
{
}
}
}

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib
namespace SharpCATLib
{
class SerialServer
internal class SerialServer
{
}
}
}

View file

@ -1,30 +1,17 @@
using SharpCATLib;
using System;
using System.Collections.Generic;
using System.IO.Ports;
namespace SharpCATLib
{
public class SharpCAT
{
delegate string OnPortsSelected(string[] portnames);
private delegate string OnPortsSelected(string[] portnames);
event OnPortsSelected PortsSelected;
private static event OnPortsSelected PortsSelected;
public SharpCAT()
{
PortsSelected += new OnPortsSelected(ConnectPorts);
}
public SharpCAT() => SharpCAT.PortsSelected += new OnPortsSelected(ConnectPorts);
private string[] _portstouse;
public string[] PortsToUse
{
get => _portstouse;
set
{
_portstouse = value;
PortsSelected.Invoke(_portstouse);
}
}
public string[] PortsToUse { get; set; }
public double[] CTCSSTones = { 67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5,
91.5, 94.8, 97.4, 100.0, 103.5, 107.2, 110.9, 114.8, 118.8, 123, 127.3, 131.8,
@ -41,18 +28,21 @@ namespace SharpCATLib
public string[] PortNames { get => SerialPort.GetPortNames(); }
public static int[] BaudRates { get; } = new int[] { 1200, 2400, 4800, 9600, 19200, 38400 };
public enum BaudRates : int { TwelveHundred = 1200, TwentyFourHundred = 2400, FourtyEightHUndred = 4800, NinteySixHundred = 9600, NineteenTwo = 19200, ThirtyEightFour = 38400 };
public static int[] DataBits { get; } = new int[] { 7, 8 };
public static string[] RadioTypes { get; } = new string[] { "CAT", "CIV" };
private readonly string CATCmdPad = "00000000";
private string ConnectPorts(string[] portnames)
{
List<Serial> ports = new List<Serial>();
foreach (string port in portnames)
{
ports.Add(new Serial("COM11", BaudRates.ThirtyEightFour, Parity.None, StopBits.Two, Handshake.None));
}
return "";
}
}
}

View file

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace SharpCATLib
namespace SharpCATLib
{
class Socket
internal class Socket
{
}
}
}

View file

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

View file

@ -1,24 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SharpCATLib;
using SharpCATLib;
using System;
namespace SharpCATConsole
{
class Program
internal class Program
{
static void Main(string[] args)
private static void Main(string[] args)
{
SharpCAT sharpCAT = new SharpCAT();
Console.WriteLine("Ports found: ");
foreach (var port in sharpCAT.PortNames)
{
Console.WriteLine(port);
}
Console.ReadKey();
}
@ -27,4 +23,4 @@ namespace SharpCATConsole
throw new NotImplementedException();
}
}
}
}

View file

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@ -33,4 +32,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

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

View file

@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharpCATService
namespace SharpCATService
{
class Client
internal class Client
{
}
}
}

View file

@ -1,25 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.ServiceProcess;
namespace SharpCATService
{
static class Program
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
private static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service1()
new Service()
};
ServiceBase.Run(ServicesToRun);
}
}
}
}

View file

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@ -33,4 +32,4 @@ using System.Runtime.InteropServices;
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharpCATService
namespace SharpCATService
{
class Server
internal class Server
{
}
}
}

View file

@ -1,6 +1,6 @@
namespace SharpCATService
{
partial class Service1
partial class Service
{
/// <summary>
/// Required designer variable.

View file

@ -0,0 +1,20 @@
using System.ServiceProcess;
namespace SharpCATService
{
public partial class Service : ServiceBase
{
public Service()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
}
}

View file

@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace SharpCATService
{
public partial class Service1 : ServiceBase
{
public Service1()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
}
protected override void OnStop()
{
}
}
}

View file

@ -46,11 +46,11 @@
<ItemGroup>
<Compile Include="Client.cs" />
<Compile Include="Server.cs" />
<Compile Include="Service1.cs">
<Compile Include="Service.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Service1.Designer.cs">
<DependentUpon>Service1.cs</DependentUpon>
<Compile Include="Service.Designer.cs">
<DependentUpon>Service.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />