From a6984d4893aaae1e2971696c7cf0b4fc4b2f77b5 Mon Sep 17 00:00:00 2001 From: Erick Kinnee Date: Wed, 6 Mar 2019 10:13:23 -0600 Subject: [PATCH] Added CATCommand.cs model. Add several BaudRates to Serial.cs. Changes to Yaesu FT818.cs fori binary operations such as power on and off. --- CATCommand.cs | 15 +++++++ Serial.cs | 18 ++++---- SharpCAT.cs | 19 +++++---- Yaesu FT818.cs | 113 +++++++++++++++++++++++++++++++++++++------------ 4 files changed, 119 insertions(+), 46 deletions(-) create mode 100644 CATCommand.cs diff --git a/CATCommand.cs b/CATCommand.cs new file mode 100644 index 0000000..fb61b65 --- /dev/null +++ b/CATCommand.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SharpCAT +{ + class CATCommand + { + public string P1 { get; set; } + public string P2 { get; set; } + public string P3 { get; set; } + public string P4 { get; set; } + public string OpCode { get; set; } + } +} diff --git a/Serial.cs b/Serial.cs index 238bcf7..d616ec8 100644 --- a/Serial.cs +++ b/Serial.cs @@ -9,7 +9,7 @@ namespace SharpCAT private SerialPort _serialPort; public string[] PortNames { get => SerialPort.GetPortNames(); } - public static int[] BaudRates { get; } = new int[] { 1200, 4800, 9600, 19200, 38400 }; + public static int[] BaudRates { get; } = new int[] { 1200, 2400, 4800, 9600, 19200, 38400 }; public static int[] DataBits { get; } = new int[] { 7, 8 }; @@ -38,6 +38,8 @@ namespace SharpCAT 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 @@ -65,6 +67,11 @@ namespace SharpCAT } + public void ProbeSerialPort(SerialPort port) + { + + } + public void Read() { @@ -76,14 +83,5 @@ namespace SharpCAT catch (TimeoutException) { } } - public void GetRXStatus() - { - - } - - public void GetFreqAndMode() - { - - } } } \ No newline at end of file diff --git a/SharpCAT.cs b/SharpCAT.cs index df60149..e472579 100644 --- a/SharpCAT.cs +++ b/SharpCAT.cs @@ -2,14 +2,17 @@ { public class SharpCAT { - private string CatCmdStr { 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, + 136.5, 141.3, 146.2, 151.4, 156.7, 162.2, 167.9, 173.8, 179.9, 186.2, 192.8, + 203.5, 210.7, 218.1, 225.7, 233.6, 241.8, 250.3 }; - private Serial _serial; - - public SharpCAT() - { - //_serial = new Serial(); - - } + public int[] DCSCodes = { 023, 025, 026, 031, 032, 036, 043, 047, 051, 053, 054, 065, + 071, 072, 073, 074, 114, 115, 116, 122, 125, 131, 132, 134, 143, 145, 152, 155, + 156, 162, 165, 172, 174, 205, 212, 223, 225, 226, 243, 244, 245, 246, 251, 252, 255, + 261, 263, 265, 266, 271, 274, 306, 311, 315, 325, 331, 332, 343, 346, 351, 356, 364, + 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 }; } } \ No newline at end of file diff --git a/Yaesu FT818.cs b/Yaesu FT818.cs index eead5fc..f1ff20d 100644 --- a/Yaesu FT818.cs +++ b/Yaesu FT818.cs @@ -2,66 +2,108 @@ namespace SharpCAT.Yaesu { internal class FT818 { - public struct LOCK + private readonly string CmdPad = "00000000"; + + public struct Lock { - private static readonly string ON = "00"; - private static readonly string OFF = "80"; + public static readonly string ON = "00"; + public static readonly string OFF = "80"; } - public struct PTT + public struct Ptt { - private static readonly string ON = "08"; - private static readonly string OFF = "88"; + public static readonly string ON = "08"; + public static readonly string OFF = "88"; } - public struct CLAR + public struct Clar { - private static readonly string ON = "05"; - private static readonly string OFF = "85"; + public static readonly string ON = "05"; + public static readonly string OFF = "85"; } - public struct SPLIT + public struct Split { - private static readonly string ON = "02"; - private static readonly string OFF = "82"; + public static readonly string ON = "02"; + public static readonly string OFF = "82"; } - public struct POWER + public struct Power { - private static readonly string ON = "0F"; - private static readonly string OFF = "8F"; + public static readonly string ON = "0F"; + public static readonly string OFF = "8F"; } public struct OpModes { - private static readonly string LSB = "00"; - private static readonly string USB = "01"; - private static readonly string CW = "02"; - private static readonly string CWR = "03"; - private static readonly string AM = "04"; - private static readonly string FM = "08"; - private static readonly string DIG = "0A"; - private static readonly string PKT = "0C"; + public static readonly string LSB = "00"; + public static readonly string USB = "01"; + public static readonly string CW = "02"; + public static readonly string CWR = "03"; + public static readonly string AM = "04"; + public static readonly string FM = "08"; + public static readonly string DIG = "0A"; + public static readonly string PKT = "0C"; } - public void SetLock() + public string LockOn() { + string _cmd = CmdPad + Lock.ON; + return _cmd; } - public void SetPTT() + public string LockOff() { + string _cmd = CmdPad + Lock.OFF; + return _cmd; } - public void SetCLAR() + public string PttOn() { + string _cmd = CmdPad + Ptt.ON; + return _cmd; } - public void SetSPLIT() + public string PttOff() { + string _cmd = CmdPad + Ptt.OFF; + return _cmd; } - public void SetPOWER() + public string ClarOn() { + string _cmd = CmdPad + Clar.ON; + return _cmd; + } + + public string ClarOff() + { + string _cmd = CmdPad + Clar.OFF; + return _cmd; + } + + public string SplitOn() + { + string _cmd = CmdPad + Split.ON; + return _cmd; + } + + public string SplitOff() + { + string _cmd = CmdPad + Split.OFF; + return _cmd; + } + + public string PowerOn() + { + string _cmd = CmdPad + Power.ON; + return _cmd; + } + + public string PowerOff() + { + string _cmd = CmdPad + Power.OFF; + return _cmd; } public void SetFreq(double freq) @@ -75,5 +117,20 @@ namespace SharpCAT.Yaesu public void SetVFO() { } + + public void GetRXStatus() + { + + } + + public void GetTXStatus() + { + + } + + public void GetFreqAndModeStatus() + { + + } } } \ No newline at end of file