From 8a42cf0dd526a200a9d0af763cfa1264cbcfe801 Mon Sep 17 00:00:00 2001 From: Erick Kinnee Date: Fri, 8 Mar 2019 11:16:37 -0600 Subject: [PATCH] Start CIV (Icom) radio support. Realized I'd need to split radio types. --- SharpCAT/Models/CATRadio.cs | 105 +++++++++++ SharpCAT/Models/CIVCommand.cs | 14 ++ .../{Radios/Icom/ID4100a.cs => CIVRadio.cs} | 4 +- SharpCAT/Models/Radio.cs | 12 -- SharpCAT/Models/Radios/Yaesu/FT818.cs | 165 ------------------ SharpCAT/Radios/Icom/ID4100a.cs | 12 ++ SharpCAT/Radios/Icom/ID4100a.json | 3 + SharpCAT/{Models => }/Radios/Icom/ID880H.cs | 3 +- SharpCAT/Radios/Icom/ID880H.json | 3 + .../{Models => }/Radios/Kenwood/THD74A.cs | 3 +- SharpCAT/Radios/Kenwood/THD74A.json | 3 + SharpCAT/Radios/Yaesu/FT818.cs | 149 ++++++++++++++++ SharpCAT/Radios/Yaesu/FT818.json | 3 + SharpCAT/SharpCATLib.csproj | 12 ++ 14 files changed, 310 insertions(+), 181 deletions(-) create mode 100644 SharpCAT/Models/CATRadio.cs create mode 100644 SharpCAT/Models/CIVCommand.cs rename SharpCAT/Models/{Radios/Icom/ID4100a.cs => CIVRadio.cs} (56%) delete mode 100644 SharpCAT/Models/Radio.cs delete mode 100644 SharpCAT/Models/Radios/Yaesu/FT818.cs create mode 100644 SharpCAT/Radios/Icom/ID4100a.cs create mode 100644 SharpCAT/Radios/Icom/ID4100a.json rename SharpCAT/{Models => }/Radios/Icom/ID880H.cs (83%) create mode 100644 SharpCAT/Radios/Icom/ID880H.json rename SharpCAT/{Models => }/Radios/Kenwood/THD74A.cs (83%) create mode 100644 SharpCAT/Radios/Kenwood/THD74A.json create mode 100644 SharpCAT/Radios/Yaesu/FT818.cs create mode 100644 SharpCAT/Radios/Yaesu/FT818.json diff --git a/SharpCAT/Models/CATRadio.cs b/SharpCAT/Models/CATRadio.cs new file mode 100644 index 0000000..e12d0ca --- /dev/null +++ b/SharpCAT/Models/CATRadio.cs @@ -0,0 +1,105 @@ +namespace SharpCATLib.Models +{ + //Base Radio Model + public partial class CATRadio + { + string RadioMfg { get; } + string RadioModel { get; } + + string CmdPad { get; } + + string VFOToggle { get; } + Lock Lock { get; } + Ptt Ptt { get; } + Clar Clar { get; } + Split Split { get; } + Power Power { get; } + ToneMode ToneMode { get; } + OpModes OpModes { get; } + + partial void LockOn(); + + partial void LockOff(); + + partial void PttOn(); + + partial void PttOff(); + + partial void ClarOn(); + + partial void ClarOff(); + + partial void SplitOn(); + + partial void SplitOff(); + + partial void PowerOn(); + + partial void PowerOff(); + + partial void SetFreq(double freq); + + partial void SetOpMode(OpModes opmode); + + partial void SwitchVFO(); + + partial void SetToneMode(ToneMode mode); + + partial void GetRXStatus(); + + partial void GetTXStatus(); + + partial void GetFreqAndModeStatus(); + } + + public class Lock + { + public static readonly string ON; + public static readonly string OFF; + } + + public class Ptt + { + public static readonly string ON; + public static readonly string OFF; + } + + public class Clar + { + public static readonly string ON; + public static readonly string OFF; + } + + public class Split + { + public static readonly string ON; + public static readonly string OFF; + } + + public class Power + { + public static readonly string ON; + public static readonly string OFF; + } + + public class ToneMode + { + public static readonly string DCS; + public static readonly string CTCSS; + public static readonly string ENCODER; + public static readonly string OFF; + } + + public class OpModes + { + public static readonly string LSB; + public static readonly string USB; + public static readonly string CW; + public static readonly string CWR; + public static readonly string AM; + public static readonly string FM; + public static readonly string DIG; + public static readonly string PKT; + } + +} \ No newline at end of file diff --git a/SharpCAT/Models/CIVCommand.cs b/SharpCAT/Models/CIVCommand.cs new file mode 100644 index 0000000..d796004 --- /dev/null +++ b/SharpCAT/Models/CIVCommand.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SharpCATLib.Models +{ + 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; } + } +} diff --git a/SharpCAT/Models/Radios/Icom/ID4100a.cs b/SharpCAT/Models/CIVRadio.cs similarity index 56% rename from SharpCAT/Models/Radios/Icom/ID4100a.cs rename to SharpCAT/Models/CIVRadio.cs index 4dafcd6..4d64503 100644 --- a/SharpCAT/Models/Radios/Icom/ID4100a.cs +++ b/SharpCAT/Models/CIVRadio.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Text; -namespace SharpCATLib.Models.Radios.Icom +namespace SharpCATLib.Models { - class ID4100a : Radio + class CIVRadio { } } diff --git a/SharpCAT/Models/Radio.cs b/SharpCAT/Models/Radio.cs deleted file mode 100644 index b5d656f..0000000 --- a/SharpCAT/Models/Radio.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace SharpCATLib.Models -{ - //Base Radio Model - class Radio - { - public readonly string CmdPad = "00000000"; - } -} diff --git a/SharpCAT/Models/Radios/Yaesu/FT818.cs b/SharpCAT/Models/Radios/Yaesu/FT818.cs deleted file mode 100644 index 588410a..0000000 --- a/SharpCAT/Models/Radios/Yaesu/FT818.cs +++ /dev/null @@ -1,165 +0,0 @@ -namespace SharpCATLib.Models.Radios.Yaesu -{ - internal class FT818 : Radio - { - public struct Lock - { - public static readonly string ON = "00"; - public static readonly string OFF = "80"; - } - - public struct Ptt - { - public static readonly string ON = "08"; - public static readonly string OFF = "88"; - } - - public struct Clar - { - public static readonly string ON = "05"; - public static readonly string OFF = "85"; - } - - public struct Split - { - public static readonly string ON = "02"; - public static readonly string OFF = "82"; - } - - public struct Power - { - public static readonly string ON = "0F"; - public static readonly string OFF = "8F"; - } - - public string VFOToggle = "81"; - - public struct ToneMode - { - public static readonly string DCS = "0A"; - public static readonly string CTCSS = "2A"; - public static readonly string ENCODER = "4A"; - public static readonly string OFF = "8A"; - } - - public struct OpModes - { - 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 string LockOn() - { - string _cmd = CmdPad + Lock.ON; - return _cmd; - } - - public string LockOff() - { - string _cmd = CmdPad + Lock.OFF; - return _cmd; - } - - public string PttOn() - { - string _cmd = CmdPad + Ptt.ON; - return _cmd; - } - - public string PttOff() - { - string _cmd = CmdPad + Ptt.OFF; - return _cmd; - } - - 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) - { - char[] freqChars = freq.ToString().ToCharArray(); - // 01 42 34 56 = 14.23456MHz - switch (freqChars.Length) - { - case 1: break; - case 2: break; - case 3: break; - case 4: break; - case 5: break; - case 6: break; - case 7: break; - case 8: break; - default: break; - } - } - - public void SetOpMode(OpModes opmode) - { - } - - public string SwitchVFO() - { - string _cmd = CmdPad + VFOToggle; - return _cmd; - } - - public void SetToneMode(ToneMode mode) - { - - } - - public void GetRXStatus() - { - - } - - public void GetTXStatus() - { - - } - - public void GetFreqAndModeStatus() - { - - } - } -} \ No newline at end of file diff --git a/SharpCAT/Radios/Icom/ID4100a.cs b/SharpCAT/Radios/Icom/ID4100a.cs new file mode 100644 index 0000000..b1ef79f --- /dev/null +++ b/SharpCAT/Radios/Icom/ID4100a.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SharpCATLib.Models.Radios.Icom +{ + class ID4100a : CIVRadio + { + string OKFromRadio = "FEFEE09AFBFD"; + string NGFromRadio = "FEFEE09AFAFD"; + } +} diff --git a/SharpCAT/Radios/Icom/ID4100a.json b/SharpCAT/Radios/Icom/ID4100a.json new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/SharpCAT/Radios/Icom/ID4100a.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/SharpCAT/Models/Radios/Icom/ID880H.cs b/SharpCAT/Radios/Icom/ID880H.cs similarity index 83% rename from SharpCAT/Models/Radios/Icom/ID880H.cs rename to SharpCAT/Radios/Icom/ID880H.cs index d3d2c71..b5e1b92 100644 --- a/SharpCAT/Models/Radios/Icom/ID880H.cs +++ b/SharpCAT/Radios/Icom/ID880H.cs @@ -4,7 +4,8 @@ using System.Text; namespace SharpCATLib.Models.Radios.Icom { - class ID880H : Radio + class ID880H { + } } diff --git a/SharpCAT/Radios/Icom/ID880H.json b/SharpCAT/Radios/Icom/ID880H.json new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/SharpCAT/Radios/Icom/ID880H.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/SharpCAT/Models/Radios/Kenwood/THD74A.cs b/SharpCAT/Radios/Kenwood/THD74A.cs similarity index 83% rename from SharpCAT/Models/Radios/Kenwood/THD74A.cs rename to SharpCAT/Radios/Kenwood/THD74A.cs index ead498c..278f223 100644 --- a/SharpCAT/Models/Radios/Kenwood/THD74A.cs +++ b/SharpCAT/Radios/Kenwood/THD74A.cs @@ -4,7 +4,8 @@ using System.Text; namespace SharpCATLib.Models.Radios.Kenwood { - class THD74A : Radio + class THD74A { + } } diff --git a/SharpCAT/Radios/Kenwood/THD74A.json b/SharpCAT/Radios/Kenwood/THD74A.json new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/SharpCAT/Radios/Kenwood/THD74A.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/SharpCAT/Radios/Yaesu/FT818.cs b/SharpCAT/Radios/Yaesu/FT818.cs new file mode 100644 index 0000000..e2dc4ef --- /dev/null +++ b/SharpCAT/Radios/Yaesu/FT818.cs @@ -0,0 +1,149 @@ +using SharpCATLib; + +namespace SharpCATLib.Models.Radios.Yaesu +{ + public class FT818 : CATRadio + { + public string RadioMfg => "Yaesu"; + public string RadioModel => "FT-818"; + public string CmdPad => "00000000"; + + + public class Lock + { + public static readonly string ON = "00"; + public static readonly string OFF = "80"; + } + + public class Ptt + { + public static readonly string ON = "08"; + public static readonly string OFF = "88"; + } + + public class Clar + { + public static readonly string ON = "05"; + public static readonly string OFF = "85"; + } + + public class Split + { + public static readonly string ON = "02"; + public static readonly string OFF = "82"; + } + + public class Power + { + public static readonly string ON = "0F"; + public static readonly string OFF = "8F"; + } + + public string VFOToggle => "81"; + + public class ToneMode + { + public static readonly string DCS = "0A"; + public static readonly string CTCSS = "2A"; + public static readonly string ENCODER = "4A"; + public static readonly string OFF = "8A"; + } + + public class OpModes + { + 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"; + } + + string LockOn() + { + return ""; + } + + string LockOff() + { + return ""; + } + + string PttOn() + { + return ""; + } + + string PttOff() + { + return ""; + } + + string ClarOn() + { + return ""; + } + + string ClarOff() + { + return ""; + } + + string SplitOn() + { + return ""; + } + + string SplitOff() + { + return ""; + } + + string PowerOn() + { + return ""; + } + + string PowerOff() + { + return ""; + } + + string SetFreq(double freq) + { + return ""; + } + + string SetOpMode(OpModes opmode) + { + return ""; + } + + string SwitchVFO() + { + return ""; + } + + string SetToneMode(ToneMode mode) + { + return ""; + } + + string GetRXStatus() + { + return ""; + } + + string GetTXStatus() + { + return ""; + } + + string GetFreqAndModeStatus() + { + return ""; + } + } +} \ No newline at end of file diff --git a/SharpCAT/Radios/Yaesu/FT818.json b/SharpCAT/Radios/Yaesu/FT818.json new file mode 100644 index 0000000..0db3279 --- /dev/null +++ b/SharpCAT/Radios/Yaesu/FT818.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/SharpCAT/SharpCATLib.csproj b/SharpCAT/SharpCATLib.csproj index ef38117..b2de7c0 100644 --- a/SharpCAT/SharpCATLib.csproj +++ b/SharpCAT/SharpCATLib.csproj @@ -9,6 +9,18 @@ + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + MSBuild:Compile