├── .travis.yml
├── SDRSharp.GpredictConnector
├── GlobalSuppressions.cs
├── FrequencyManager.cs
├── Properties
│ └── AssemblyInfo.cs
├── GpredictConnectorPlugin.cs
├── TcpServer.cs
├── SDRSharp.GpredictConnector.csproj
├── Controlpanel.cs
├── Rigctrld.cs
├── Controlpanel.Designer.cs
└── Controlpanel.resx
├── UnitTestGpredictConnector
├── packages.config
├── Properties
│ └── AssemblyInfo.cs
├── Test_FrequencyManager.cs
├── Test_rigctrld_get_frequency.cs
├── Test_rigctrld_set_frequency.cs
├── UnitTestGpredictConnector.csproj
└── Test_HamlibTCP.cs
├── CHANGELOG.md
├── README.md
├── LICENSE
├── SDRSharp.GpredictConnector.sln
├── .gitattributes
└── .gitignore
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: csharp
2 | solution: SDRSharp.GpredictConnector.sln
3 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alexwahl/SDRSharp.GpredictConnector/HEAD/SDRSharp.GpredictConnector/GlobalSuppressions.cs
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # SDRSharp.GpredictConnector Changelog
2 |
3 | ## v0.3
4 | * added command "f" to get the last set frequency back (tnx @Jansemar)
5 | * added propper return error codes
6 | * added version display
7 | * tested with
8 | * gpredict v2.2.1 and v2.3.20
9 | * SDRSharp v1.0.0.1671
10 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/FrequencyManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SDRSharp.GpredictConnector
8 | {
9 | class FrequencyManager
10 | {
11 | public void SetFreqFromOutside(long freq)
12 | {
13 | RxFreqChanged?.Invoke(freq);
14 |
15 | }
16 |
17 | public event Action RxFreqChanged;
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SDRSharp.GpredictConnector
2 | Plugin to connect Gpredict to SDRSharp
3 | ## download
4 | * latest compiled version is available on github [https://github.com/alexwahl/SDRSharp.GpredictConnector/releases/latest](https://github.com/alexwahl/SDRSharp.GpredictConnector/releases/latest)
5 | ## install
6 | * Just copy the SDRSharp.GpredictConnector.dll into your SDRSharp directory.
7 | * add the "magic line" to your plugins.xml file
8 |
9 |
10 |
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("UnitTestHamlibTCP")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("")]
9 | [assembly: AssemblyProduct("UnitTestHamlibTCP")]
10 | [assembly: AssemblyCopyright("Copyright © 2018")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | [assembly: ComVisible(false)]
15 |
16 | [assembly: Guid("1a9dbb8c-c2e8-4d05-ad1d-717a21ae2511")]
17 |
18 | // [assembly: AssemblyVersion("1.0.*")]
19 | [assembly: AssemblyVersion("1.0.0.0")]
20 | [assembly: AssemblyFileVersion("1.0.0.0")]
21 |
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/Test_FrequencyManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using SDRSharp.GpredictConnector;
4 |
5 | namespace UnitTestHamlibTCP
6 | {
7 | [TestClass]
8 | public class Test_FrequencyManager
9 | {
10 |
11 | [TestMethod]
12 | public void SetFrequencyFromOutside_DefaultConfig()
13 | {
14 | long expectedFrequency = 438775000;
15 | long gatheredFrequency = 0;
16 | FrequencyManager cut = new FrequencyManager();
17 | cut.RxFreqChanged += x => gatheredFrequency = x;
18 | cut.SetFreqFromOutside(expectedFrequency);
19 | Assert.AreEqual(expectedFrequency, gatheredFrequency);
20 |
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Alex Wahl
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDRSharp.GpredictConnector", "SDRSharp.GpredictConnector\SDRSharp.GpredictConnector.csproj", "{2995B0D9-C442-4858-9562-33A9E6EE8ACC}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestGpredictConnector", "UnitTestGpredictConnector\UnitTestGpredictConnector.csproj", "{1A9DBB8C-C2E8-4D05-AD1D-717A21AE2511}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {2995B0D9-C442-4858-9562-33A9E6EE8ACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {2995B0D9-C442-4858-9562-33A9E6EE8ACC}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {2995B0D9-C442-4858-9562-33A9E6EE8ACC}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {2995B0D9-C442-4858-9562-33A9E6EE8ACC}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {1A9DBB8C-C2E8-4D05-AD1D-717A21AE2511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {1A9DBB8C-C2E8-4D05-AD1D-717A21AE2511}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {1A9DBB8C-C2E8-4D05-AD1D-717A21AE2511}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {1A9DBB8C-C2E8-4D05-AD1D-717A21AE2511}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {0756CF4E-8F46-49AD-B164-81AFB3A21464}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die einer Assembly zugeordnet sind.
8 | [assembly: AssemblyTitle("SDRSharp.GpredictConnector")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SDRSharp.GpredictConnector")]
13 | [assembly: AssemblyCopyright("Copyright © Alexander Wahl DH2AW 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | [assembly: InternalsVisibleTo(assemblyName: "UnitTestGpredictConnector")]
18 | // Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
19 | // für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
20 | // COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
21 | [assembly: ComVisible(false)]
22 |
23 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
24 | [assembly: Guid("2995b0d9-c442-4858-9562-33a9e6ee8acc")]
25 |
26 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
27 | //
28 | // Hauptversion
29 | // Nebenversion
30 | // Buildnummer
31 | // Revision
32 | //
33 | // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
34 | // indem Sie "*" wie unten gezeigt eingeben:
35 | // [assembly: AssemblyVersion("1.0.*")]
36 | [assembly: AssemblyVersion("0.3.*")]
37 | [assembly: AssemblyFileVersion(version: "0.3.0")]
38 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/GpredictConnectorPlugin.cs:
--------------------------------------------------------------------------------
1 | using SDRSharp.Common;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows.Forms;
8 |
9 | namespace SDRSharp.GpredictConnector
10 | {
11 | public class GpredictConnectorPlugin : ISharpPlugin
12 | {
13 | private const string _displayName = "GpredictConnector";
14 | private Controlpanel _controlpanel;
15 | private ISharpControl control_;
16 | private TcpServer tcpServer_;
17 |
18 | public UserControl Gui
19 | {
20 | get
21 | {
22 | return _controlpanel;
23 | }
24 | }
25 |
26 | public string DisplayName
27 | {
28 | get
29 | {
30 | return _displayName;
31 | }
32 | }
33 |
34 | public void Close()
35 | {
36 | tcpServer_?.Stop();
37 | }
38 |
39 | public void Initialize(ISharpControl control)
40 | {
41 | control_ = control;
42 |
43 | //Instanciate all needed objects
44 | _controlpanel = new Controlpanel();
45 | Rigctrld rigctrl = new Rigctrld();
46 | TcpServer tcpServer = new TcpServer(rigctrl);
47 | tcpServer_ = tcpServer;
48 | //Link the objects together
49 | _controlpanel.ServerStart += tcpServer.Start;
50 | _controlpanel.ServerStop += tcpServer.Stop;
51 | tcpServer.Connected += _controlpanel.TcpServer_Connected_Changed;
52 | tcpServer.Enabled += _controlpanel.TcpServer_Enabled_Changed;
53 | rigctrl.FrequencyInHzChanged += _controlpanel.ReceivedFrequencyInHzChanged;
54 | rigctrl.FrequencyInHzChanged += Rigctrl_FrequencyInHzChanged;
55 |
56 | }
57 |
58 | private void Rigctrl_FrequencyInHzChanged(long frequency)
59 | {
60 | control_.Frequency = frequency;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/Test_rigctrld_get_frequency.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.VisualStudio.TestTools.UnitTesting;
3 | using SDRSharp.GpredictConnector;
4 |
5 | namespace UnitTestGpredictConnector
6 | {
7 | [TestClass]
8 | public class Test_rigctrld_get_frequency
9 | {
10 | [TestInitialize()]
11 | public void Initialize()
12 | {
13 | class_under_test_ = new Rigctrld();
14 | }
15 |
16 | [TestMethod]
17 | public void GetFrequency_00144800123()
18 | {
19 | TestHelper_GetFrequency(given_freq: 144800123, command: "f");
20 | }
21 | [TestMethod]
22 | public void GetFrequency_00144800123_leading_space()
23 | {
24 | class_under_test_.FrequencyInHz = 144800123;
25 | string result = class_under_test_.ExecCommand(" f");
26 | Assert.AreEqual("RPRT -4\n", result);
27 | }
28 | [TestMethod]
29 | public void GetFrequency_00144800123_tailing_LF()
30 | {
31 | TestHelper_GetFrequency(given_freq: 144800123, command: "f\n");
32 | }
33 | [TestMethod]
34 | public void GetFrequency_00144800123_tailing_foo()
35 | {
36 | class_under_test_.FrequencyInHz = 144800123;
37 | string result = class_under_test_.ExecCommand("foooo");
38 | Assert.AreEqual("RPRT -4\n", result);
39 | }
40 | [TestMethod]
41 | public void GetFrequency_1GHZ()
42 | {
43 | TestHelper_GetFrequency(given_freq: 1234567890, command: "f");
44 | }
45 | [TestMethod]
46 | public void GetFrequency_10m()
47 | {
48 | TestHelper_GetFrequency(given_freq: 29420877, command: "f");
49 | }
50 |
51 | private void TestHelper_GetFrequency(long given_freq, string command)
52 | {
53 | class_under_test_.FrequencyInHz = given_freq;
54 | string result = class_under_test_.ExecCommand(command);
55 | Assert.AreEqual(given_freq.ToString()+"\n", result);
56 | }
57 |
58 | private Rigctrld class_under_test_ = null;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/TcpServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net;
5 | using System.Net.Sockets;
6 | using System.Text;
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace SDRSharp.GpredictConnector
12 | {
13 | class TcpServer
14 | {
15 | public TcpServer(Rigctrld rigctrl)
16 | {
17 | this.rigctrl = rigctrl;
18 | }
19 |
20 | public void Start()
21 | {
22 | this.tcpListener = new TcpListener(IPAddress.Any, 4532);
23 | this.cancel_listen = new CancellationTokenSource();
24 |
25 | this.task_connectionHandler = ListenForClientConnection(cancel_listen.Token);
26 | Enabled?.Invoke(true);
27 | }
28 |
29 | public void Stop()
30 | {
31 | cancel_listen?.Cancel();
32 |
33 | }
34 |
35 | private async Task ListenForClientConnection(CancellationToken ct)
36 | {
37 | this.tcpListener.Start();
38 | ct.Register(CancelComm);
39 |
40 | while (!ct.IsCancellationRequested)
41 | {
42 | //blocks until a client has connected to the server
43 | TcpClient client = await this.tcpListener.AcceptTcpClientAsync();
44 |
45 | //only one client can connect !
46 | NetworkStream clientStream = client.GetStream();
47 |
48 | Connection_established();
49 |
50 |
51 | byte[] message = new byte[4096];
52 | int bytesRead;
53 |
54 | while (!ct.IsCancellationRequested)
55 | {
56 | try
57 | {
58 | bytesRead = 0;
59 | //read message from client
60 | bytesRead = await clientStream.ReadAsync(message, 0, 4096, ct).ConfigureAwait(true);
61 | var str = System.Text.Encoding.Default.GetString(message, 0,bytesRead);
62 | var answer = rigctrl.ExecCommand(str);
63 | var answerBytes = (new System.Text.ASCIIEncoding()).GetBytes(answer);
64 | await clientStream.WriteAsync(answerBytes, 0, answerBytes.Length,ct).ConfigureAwait(true);
65 |
66 | }
67 | catch
68 | {
69 |
70 | //a socket error has occured
71 | break;
72 | }
73 | }
74 | client.Close();
75 | connection_lost();
76 | }
77 | }
78 |
79 | private void CancelComm()
80 | {
81 | tcpListener.Stop();
82 | Enabled?.Invoke(false);
83 | }
84 |
85 |
86 | private void Connection_established()
87 | {
88 |
89 | Connected?.Invoke(true);
90 | }
91 |
92 | private void connection_lost()
93 | {
94 |
95 | Connected?.Invoke(false);
96 | }
97 |
98 |
99 |
100 | public event Action Connected;
101 | public event Action Enabled;
102 |
103 |
104 | private TcpListener tcpListener;
105 | private Task task_connectionHandler;
106 |
107 | private CancellationTokenSource cancel_listen;
108 | private Rigctrld rigctrl;
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/SDRSharp.GpredictConnector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {2995B0D9-C442-4858-9562-33A9E6EE8ACC}
8 | Library
9 | Properties
10 | SDRSharp.GpredictConnector
11 | SDRSharp.GpredictConnector
12 | v4.6.1
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | DEBUG;TRACE
21 | prompt
22 | 4
23 | true
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 |
30 |
31 | prompt
32 | 4
33 | true
34 | true
35 |
36 |
37 |
38 | ..\..\..\..\..\..\SDRSharp\SDRSharp.Common.dll
39 | False
40 |
41 |
42 | ..\..\..\..\..\..\SDRSharp\SDRSharp.PanView.dll
43 | False
44 |
45 |
46 | ..\..\..\..\..\..\SDRSharp\SDRSharp.Radio.dll
47 | False
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | UserControl
63 |
64 |
65 | Controlpanel.cs
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | Controlpanel.cs
77 |
78 |
79 |
80 |
81 | copy $(TargetDir)$(TargetFileName) C:\SDRSharp
82 |
83 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/Controlpanel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Data;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using System.Diagnostics;
11 |
12 | namespace SDRSharp.GpredictConnector
13 | {
14 | public partial class Controlpanel : UserControl
15 | {
16 |
17 |
18 | public Controlpanel()
19 | {
20 | InitializeComponent();
21 | this.checkBoxEnable.CheckedChanged += CheckBoxEnable_CheckedChanged;
22 | TcpServer_Connected_Changed(false); // init state is disconnected.
23 |
24 | System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
25 | FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
26 | this.labelVersion.Text = "v"+fvi.FileMajorPart+"."+fvi.FileMinorPart;
27 | }
28 |
29 | public void ReceivedFrequencyInHzChanged(long frequency_in_hz)
30 | {
31 | if (InvokeRequired)
32 | {
33 | this.Invoke(new Action(ReceivedFrequencyInHzChanged), new object[] { frequency_in_hz });
34 | return;
35 | }
36 | else
37 | {
38 | this.labelFrequency.Text = frequency_in_hz.ToString();
39 | }
40 | }
41 |
42 | public void TcpServer_Enabled_Changed(bool enabled)
43 | {
44 | if (InvokeRequired)
45 | {
46 | this.Invoke(new Action(TcpServer_Enabled_Changed), new object[] { enabled });
47 | return;
48 | }
49 | else
50 | {
51 | enabled_ = enabled;
52 | SetDescriptionOfServerState();
53 | }
54 | }
55 |
56 | public void TcpServer_Connected_Changed(bool connected)
57 | {
58 | if (InvokeRequired)
59 | {
60 | this.Invoke(new Action(TcpServer_Connected_Changed), new object[] { connected });
61 | return;
62 | }
63 | else
64 | {
65 | connected_ = connected;
66 | SetDescriptionOfServerState();
67 | }
68 | }
69 |
70 | public void SetDescriptionOfServerState()
71 | {
72 | if (enabled_)
73 | {
74 | if (connected_)
75 | {
76 | this.labelStatus.Text = "connected";
77 | labelStatus.ForeColor = Color.Green;
78 | }
79 | else
80 | {
81 | this.labelStatus.Text = "listening on port 4532";
82 | labelStatus.ForeColor = Color.Blue;
83 | }
84 | }
85 | else
86 | {
87 | this.labelStatus.Text = "disabled";
88 | labelStatus.ForeColor = Color.DarkRed;
89 | }
90 | }
91 |
92 | private void CheckBoxEnable_CheckedChanged(object sender, EventArgs e)
93 | {
94 | CheckBox checkbox = sender as CheckBox;
95 | if (checkbox != null)
96 | {
97 | if (checkbox.Checked)
98 | {
99 | ServerStart?.Invoke();
100 |
101 | } else
102 | {
103 | ServerStop?.Invoke();
104 |
105 | }
106 | }
107 | }
108 |
109 | private bool enabled_ = false;
110 | private bool connected_ = false;
111 |
112 | public event Action ServerStop;
113 | public event Action ServerStart;
114 |
115 |
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/Rigctrld.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 | using System.Threading;
4 |
5 | namespace SDRSharp.GpredictConnector
6 | {
7 | class Rigctrld
8 | {
9 | public string ExecCommand(string command)
10 | {
11 | command = command.Replace("\n", String.Empty); // remove line feed from command
12 | if (command.StartsWith("F"))
13 | {
14 | Regex regex = new Regex("^F[ ]*([0-9]{1,})$");
15 | var matches = regex.Matches(command);
16 | if (matches.Count > 0)
17 | {
18 | if (matches[0].Groups.Count == 2)
19 | {
20 | var f_string = matches[0].Groups[1].Value;
21 | frequency_set_thread_ = new Thread(() => FrequencyInHzString = f_string);
22 | frequency_set_thread_.Start();
23 | }
24 | return GenerateReturn(HamlibErrorcode.RIG_OK);
25 | }
26 | return GenerateReturn(HamlibErrorcode.RIG_EPROTO); ; //wrong or unknown F command
27 | }
28 | else if (command.Equals("f"))
29 | {
30 | return FrequencyInHzString + "\n"; //return current freq.
31 | }
32 | return GenerateReturn(HamlibErrorcode.RIG_ENIMPL); //recieved unsupported command
33 | }
34 |
35 | private string GenerateReturn(HamlibErrorcode errorcode)
36 | {
37 | return "RPRT " + ((int)errorcode).ToString() + "\n";
38 | }
39 | public long FrequencyInHz
40 | {
41 | get
42 | {
43 | return frequency_;
44 | }
45 | set
46 | {
47 | if (frequency_ != value)
48 | {
49 | frequency_ = value;
50 | FrequencyInHzChanged?.Invoke(frequency_);
51 | }
52 |
53 | }
54 | }
55 |
56 | public string FrequencyInHzString
57 | {
58 | get
59 | {
60 | return FrequencyInHz.ToString();
61 | }
62 | private set
63 | {
64 | try
65 | {
66 | FrequencyInHz = long.Parse(value);
67 | }
68 | catch { }
69 | }
70 | }
71 |
72 | public event Action FrequencyInHzChanged;
73 |
74 | private long frequency_ = 0;
75 | private Thread frequency_set_thread_ = null;
76 | public Thread FrequencySetThread
77 | {
78 | get
79 | {
80 | return frequency_set_thread_;
81 | }
82 | }
83 |
84 |
85 | enum HamlibErrorcode
86 | {
87 | RIG_OK = 0, /*!< No error, operation completed successfully */
88 | RIG_EINVAL = -1, /*!< invalid parameter */
89 | RIG_ECONF = -2, /*!< invalid configuration (serial,..) */
90 | RIG_ENOMEM= -3, /*!< memory shortage */
91 | RIG_ENIMPL = -4, /*!< function not implemented, but will be */
92 | RIG_ETIMEOUT = -5, /*!< communication timed out */
93 | RIG_EIO = -6, /*!< IO error, including open failed */
94 | RIG_EINTERNAL = -7, /*!< Internal Hamlib error, huh! */
95 | RIG_EPROTO = -8, /*!< Protocol error */
96 | RIG_ERJCTED = -9, /*!< Command rejected by the rig */
97 | RIG_ETRUNC = -10, /*!< Command performed, but arg truncated */
98 | RIG_ENAVAIL = -11, /*!< function not available */
99 | RIG_ENTARGET = -12, /*!< VFO not targetable */
100 | RIG_BUSERROR = -13, /*!< Error talking on the bus */
101 | RIG_BUSBUSY = -14, /*!< Collision on the bus */
102 | RIG_EARG = -15, /*!< NULL RIG handle or any invalid pointer parameter in get arg */
103 | RIG_EVFO = -16, /*!< Invalid VFO */
104 | RIG_EDOM = -17 /*!< Argument out of domain of func */
105 | };
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/Test_rigctrld_set_frequency.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
2 | using SDRSharp.GpredictConnector;
3 |
4 | namespace UnitTestGpredictConnector
5 | {
6 | ///
7 | /// Zusammenfassungsbeschreibung für Test_rigctrld
8 | ///
9 | [TestClass]
10 | public class Test_rigctrld_set_frequency
11 | {
12 | private TestContext testContextInstance;
13 |
14 | ///
15 | ///Ruft den Textkontext mit Informationen über
16 | ///den aktuellen Testlauf sowie Funktionalität für diesen auf oder legt diese fest.
17 | ///
18 | public TestContext TestContext
19 | {
20 | get
21 | {
22 | return testContextInstance;
23 | }
24 | set
25 | {
26 | testContextInstance = value;
27 | }
28 | }
29 |
30 | #region Zusätzliche Testattribute
31 | //
32 | // Sie können beim Schreiben der Tests folgende zusätzliche Attribute verwenden:
33 | //
34 | // Verwenden Sie ClassInitialize, um vor Ausführung des ersten Tests in der Klasse Code auszuführen.
35 | // [ClassInitialize()]
36 | // public static void MyClassInitialize(TestContext testContext) { }
37 | //
38 | // Verwenden Sie ClassCleanup, um nach Ausführung aller Tests in einer Klasse Code auszuführen.
39 | // [ClassCleanup()]
40 | // public static void MyClassCleanup() { }
41 | //
42 | // Mit TestInitialize können Sie vor jedem einzelnen Test Code ausführen.
43 | // [TestInitialize()]
44 | // public void MyTestInitialize() { }
45 | //
46 | // Mit TestCleanup können Sie nach jedem Test Code ausführen.
47 | // [TestCleanup()]
48 | // public void MyTestCleanup() { }
49 | //
50 | #endregion
51 | [TestInitialize()]
52 | public void Initialize()
53 | {
54 | class_under_test_ = new Rigctrld();
55 | }
56 |
57 |
58 | [TestMethod]
59 | public void SetFrequency_F__144800123()
60 | {
61 | TestHelper_SetFrequency(expected_freq: 144800123, command: "F 144800123");
62 | }
63 | [TestMethod]
64 | public void SetFrequency_F__1GHZ()
65 | {
66 | TestHelper_SetFrequency(expected_freq: 1234567890, command: "F 1234567890");
67 | }
68 | [TestMethod]
69 | public void SetFrequency_F__10m()
70 | {
71 | TestHelper_SetFrequency(expected_freq: 29420877, command: "F 29420877");
72 | }
73 |
74 | [TestMethod]
75 | public void SetFrequency_F_144800123()
76 | {
77 | TestHelper_SetFrequency(expected_freq: 144800123, command: "F 144800123");
78 | }
79 |
80 | [TestMethod]
81 | public void SetFrequency_F_00144800123()
82 | {
83 | TestHelper_SetFrequency(expected_freq: 144800123, command: "F 00144800123");
84 | }
85 |
86 | [TestMethod]
87 | public void SetFrequency_F_1GHZ()
88 | {
89 | TestHelper_SetFrequency(expected_freq: 1234567890, command: "F 1234567890");
90 | }
91 | [TestMethod]
92 | public void SetFrequency_F_10m()
93 | {
94 | TestHelper_SetFrequency(expected_freq: 29420877, command: "F 29420877");
95 | }
96 |
97 | [TestMethod]
98 | public void SetFrequency_unparseableFreq()
99 | {
100 | Assert.AreEqual("RPRT -8\n", class_under_test_.ExecCommand("F 1234d567890"));
101 | Assert.IsNull(class_under_test_.FrequencySetThread);
102 | Assert.AreEqual(0, class_under_test_.FrequencyInHz);
103 | }
104 |
105 | private void TestHelper_SetFrequency(long expected_freq, string command)
106 | {
107 | long result_freq = 0;
108 |
109 | class_under_test_.FrequencyInHzChanged += x => result_freq = x;
110 | Assert.AreEqual("RPRT 0\n", class_under_test_.ExecCommand(command));
111 | Assert.IsNotNull(class_under_test_.FrequencySetThread); // should be running
112 | class_under_test_.FrequencySetThread.Join(); // wait for the freqeuncy set thread to finish his work
113 | Assert.AreEqual(expected_freq, class_under_test_.FrequencyInHz);
114 | Assert.AreEqual(expected_freq, result_freq);
115 | }
116 |
117 | private Rigctrld class_under_test_ = null;
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/Controlpanel.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SDRSharp.GpredictConnector
2 | {
3 | partial class Controlpanel
4 | {
5 | ///
6 | /// Erforderliche Designervariable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Verwendete Ressourcen bereinigen.
12 | ///
13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Vom Komponenten-Designer generierter Code
24 |
25 | ///
26 | /// Erforderliche Methode für die Designerunterstützung.
27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.checkBoxEnable = new System.Windows.Forms.CheckBox();
32 | this.labelStatus = new System.Windows.Forms.Label();
33 | this.labelFrequency = new System.Windows.Forms.Label();
34 | this.labelDescserverStat = new System.Windows.Forms.Label();
35 | this.labelDescLastFrq = new System.Windows.Forms.Label();
36 | this.labelVersion = new System.Windows.Forms.LinkLabel();
37 | this.SuspendLayout();
38 | //
39 | // checkBoxEnable
40 | //
41 | this.checkBoxEnable.AutoSize = true;
42 | this.checkBoxEnable.Location = new System.Drawing.Point(3, 3);
43 | this.checkBoxEnable.Name = "checkBoxEnable";
44 | this.checkBoxEnable.Size = new System.Drawing.Size(58, 17);
45 | this.checkBoxEnable.TabIndex = 1;
46 | this.checkBoxEnable.Text = "enable";
47 | this.checkBoxEnable.UseVisualStyleBackColor = true;
48 | //
49 | // labelStatus
50 | //
51 | this.labelStatus.AutoSize = true;
52 | this.labelStatus.Location = new System.Drawing.Point(83, 23);
53 | this.labelStatus.Name = "labelStatus";
54 | this.labelStatus.Size = new System.Drawing.Size(44, 13);
55 | this.labelStatus.TabIndex = 2;
56 | this.labelStatus.Text = "standby";
57 | //
58 | // labelFrequency
59 | //
60 | this.labelFrequency.AutoSize = true;
61 | this.labelFrequency.Location = new System.Drawing.Point(83, 36);
62 | this.labelFrequency.Name = "labelFrequency";
63 | this.labelFrequency.Size = new System.Drawing.Size(16, 13);
64 | this.labelFrequency.TabIndex = 4;
65 | this.labelFrequency.Text = "---";
66 | //
67 | // labelDescserverStat
68 | //
69 | this.labelDescserverStat.AutoSize = true;
70 | this.labelDescserverStat.Location = new System.Drawing.Point(0, 23);
71 | this.labelDescserverStat.Name = "labelDescserverStat";
72 | this.labelDescserverStat.Size = new System.Drawing.Size(77, 13);
73 | this.labelDescserverStat.TabIndex = 5;
74 | this.labelDescserverStat.Text = "Server Status :";
75 | //
76 | // labelDescLastFrq
77 | //
78 | this.labelDescLastFrq.AutoSize = true;
79 | this.labelDescLastFrq.Location = new System.Drawing.Point(3, 36);
80 | this.labelDescLastFrq.Name = "labelDescLastFrq";
81 | this.labelDescLastFrq.Size = new System.Drawing.Size(74, 13);
82 | this.labelDescLastFrq.TabIndex = 7;
83 | this.labelDescLastFrq.Text = "Last Freq set :";
84 | //
85 | // labelVersion
86 | //
87 | this.labelVersion.AutoSize = true;
88 | this.labelVersion.Location = new System.Drawing.Point(83, 3);
89 | this.labelVersion.Name = "labelVersion";
90 | this.labelVersion.Size = new System.Drawing.Size(28, 13);
91 | this.labelVersion.TabIndex = 8;
92 | this.labelVersion.TabStop = true;
93 | this.labelVersion.Text = "v0.0";
94 | //
95 | // Controlpanel
96 | //
97 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
98 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
99 | this.Controls.Add(this.labelVersion);
100 | this.Controls.Add(this.labelDescLastFrq);
101 | this.Controls.Add(this.labelDescserverStat);
102 | this.Controls.Add(this.labelFrequency);
103 | this.Controls.Add(this.labelStatus);
104 | this.Controls.Add(this.checkBoxEnable);
105 | this.MinimumSize = new System.Drawing.Size(185, 55);
106 | this.Name = "Controlpanel";
107 | this.Size = new System.Drawing.Size(185, 55);
108 | this.ResumeLayout(false);
109 | this.PerformLayout();
110 |
111 | }
112 |
113 | #endregion
114 | private System.Windows.Forms.Label labelFrequency;
115 | private System.Windows.Forms.Label labelDescserverStat;
116 | private System.Windows.Forms.Label labelDescLastFrq;
117 | public System.Windows.Forms.CheckBox checkBoxEnable;
118 | public System.Windows.Forms.Label labelStatus;
119 | private System.Windows.Forms.LinkLabel labelVersion;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/UnitTestGpredictConnector.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1A9DBB8C-C2E8-4D05-AD1D-717A21AE2511}
8 | Library
9 | Properties
10 | UnitTestGpredictConnector
11 | UnitTestGpredictConnector
12 | v4.6.1
13 | 512
14 | {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 15.0
16 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
17 | $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
18 | False
19 | UnitTest
20 |
21 |
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 | ..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
43 |
44 |
45 | ..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
46 |
47 |
48 | False
49 | ..\..\..\..\..\..\SDRSharp\SDRSharp.Common.dll
50 |
51 |
52 | False
53 | ..\..\..\..\..\..\SDRSharp\SDRSharp.PanView.dll
54 |
55 |
56 | False
57 | ..\..\..\..\..\..\SDRSharp\SDRSharp.Radio.dll
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | {2995b0d9-c442-4858-9562-33a9e6ee8acc}
77 | SDRSharp.GpredictConnector
78 |
79 |
80 |
81 |
82 |
83 |
84 | Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/SDRSharp.GpredictConnector/Controlpanel.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
--------------------------------------------------------------------------------
/UnitTestGpredictConnector/Test_HamlibTCP.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.Collections.Generic;
4 | using Microsoft.VisualStudio.TestTools.UnitTesting;
5 | using SDRSharp.GpredictConnector;
6 | using SDRSharp.Common;
7 | using SDRSharp.PanView;
8 | using SDRSharp.Radio;
9 | using System.ComponentModel;
10 | using System.Drawing;
11 | using System.Windows.Forms;
12 |
13 | namespace UnitTestHamlibTCP
14 | {
15 | ///
16 | /// Zusammenfassungsbeschreibung für Test_HamlibTCP
17 | ///
18 | [TestClass]
19 | public class Test_HamlibTCP
20 | {
21 | class Mock_ISharpControl : ISharpControl
22 | {
23 | public DetectorType DetectorType { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
24 | public WindowType FilterType { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
25 | public int AudioGain { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
26 | public long CenterFrequency { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
27 | public int CWShift { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
28 | public bool FilterAudio { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
29 | public bool UnityGain { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
30 | public int FilterBandwidth { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
31 | public int FilterOrder { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
32 | public bool FmStereo { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
33 | public long Frequency { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
34 | public long FrequencyShift { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
35 | public bool FrequencyShiftEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
36 | public bool MarkPeaks { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
37 | public bool SnapToGrid { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
38 | public bool SquelchEnabled { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
39 | public int SquelchThreshold { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
40 |
41 | public bool IsSquelchOpen => throw new NotImplementedException();
42 |
43 | public bool SwapIq { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
44 | public bool UseAgc { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
45 | public bool AgcHang { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
46 | public int AgcThreshold { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
47 | public int AgcDecay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
48 | public int AgcSlope { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
49 |
50 | public int FFTResolution => throw new NotImplementedException();
51 |
52 | public float FFTRange => throw new NotImplementedException();
53 |
54 | public float FFTOffset => throw new NotImplementedException();
55 |
56 | public int FFTContrast => throw new NotImplementedException();
57 |
58 | public float VisualSNR => throw new NotImplementedException();
59 |
60 | public int IFOffset => throw new NotImplementedException();
61 |
62 | public System.Drawing.Drawing2D.ColorBlend Gradient => throw new NotImplementedException();
63 |
64 | public SpectrumStyle FFTSpectrumStyle => throw new NotImplementedException();
65 |
66 | public int StepSize { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
67 | public int Zoom { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
68 |
69 | public bool IsPlaying => throw new NotImplementedException();
70 |
71 | public float SAttack { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
72 | public float SDecay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
73 | public float WAttack { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
74 | public float WDecay { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
75 | public bool UseTimeMarkers { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
76 |
77 | public string RdsProgramService => throw new NotImplementedException();
78 |
79 | public string RdsRadioText => throw new NotImplementedException();
80 |
81 | public bool RdsUseFEC { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
82 |
83 | public int RFBandwidth => throw new NotImplementedException();
84 |
85 | public int RFDisplayBandwidth => throw new NotImplementedException();
86 |
87 | public int TunableBandwidth => throw new NotImplementedException();
88 |
89 | public float TuningLimit { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
90 | public TuningStyle TuningStyle { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
91 | public bool TuningStyleFreezed { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
92 |
93 | public bool SourceIsSoundCard => throw new NotImplementedException();
94 |
95 | public bool SourceIsWaveFile => throw new NotImplementedException();
96 |
97 | public bool SourceIsTunable => throw new NotImplementedException();
98 |
99 | public object Source => throw new NotImplementedException();
100 |
101 | public bool AudioIsMuted { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
102 | public bool BypassDemodulation { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
103 |
104 | public Type SourceType => throw new NotImplementedException();
105 |
106 | public string SourceName => throw new NotImplementedException();
107 |
108 | public double AudioSampleRate => throw new NotImplementedException();
109 |
110 | public Color FilterColor { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
111 |
112 | public int MaximumFilterBandwidth => throw new NotImplementedException();
113 |
114 | public bool FmPilotIsDetected => throw new NotImplementedException();
115 |
116 | public bool ThemeIsDark => throw new NotImplementedException();
117 |
118 | public ushort RdsPICode => throw new NotImplementedException();
119 |
120 | public double InputSampleRate => throw new NotImplementedException();
121 |
122 | public bool SourceIsComplex => throw new NotImplementedException();
123 |
124 | public float AudioPanning { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
125 |
126 | public event PropertyChangedEventHandler PropertyChanged;
127 | public event CustomPaintEventHandler WaterfallCustomPaint;
128 | public event CustomPaintEventHandler SpectrumAnalyzerCustomPaint;
129 | public event CustomPaintEventHandler SpectrumAnalyzerBackgroundCustomPaint;
130 |
131 | public void GetSpectrumSnapshot(byte[] destArray)
132 | {
133 | throw new NotImplementedException();
134 | }
135 |
136 | public void GetSpectrumSnapshot(float[] destArray, float scale = 1, float offset = 0)
137 | {
138 | throw new NotImplementedException();
139 | }
140 |
141 | public void InvalidateSpectrumGraphics()
142 | {
143 | throw new NotImplementedException();
144 | }
145 |
146 | public void Perform()
147 | {
148 | throw new NotImplementedException();
149 | }
150 |
151 | public void RefreshSource(bool reload)
152 | {
153 | throw new NotImplementedException();
154 | }
155 |
156 | public void RegisterFrontControl(System.Windows.Forms.UserControl control, PluginPosition preferredPosition)
157 | {
158 | throw new NotImplementedException();
159 | }
160 |
161 | public void RegisterFrontControl(Control control, PluginPosition preferredPosition)
162 | {
163 | throw new NotImplementedException();
164 | }
165 |
166 | public void RegisterStreamHook(object streamHook, ProcessorType processorType)
167 | {
168 | throw new NotImplementedException();
169 | }
170 |
171 | public void ResetFrequency(long frequency)
172 | {
173 | throw new NotImplementedException();
174 | }
175 |
176 | public void ResetFrequency(long frequency, long centerFrequency)
177 | {
178 | throw new NotImplementedException();
179 | }
180 |
181 | public void ResetRDS()
182 | {
183 | throw new NotImplementedException();
184 | }
185 |
186 | public void SetFrequency(long frequency, bool onlyMoveCenterFrequency)
187 | {
188 | throw new NotImplementedException();
189 | }
190 |
191 | public void StartRadio()
192 | {
193 | throw new NotImplementedException();
194 | }
195 |
196 | public void StopRadio()
197 | {
198 | throw new NotImplementedException();
199 | }
200 |
201 | public void UnregisterStreamHook(object streamHook)
202 | {
203 | throw new NotImplementedException();
204 | }
205 | }
206 |
207 | [TestMethod]
208 | public void JustInstanciate()
209 | {
210 | try
211 | {
212 | GpredictConnectorPlugin hamlibTCPPlugin = new GpredictConnectorPlugin();
213 | }
214 | catch
215 | {
216 | Assert.Fail("con should never fail..");
217 | }
218 | }
219 |
220 | [TestMethod]
221 | public void CloseWithoutInitialize()
222 | {
223 | GpredictConnectorPlugin cut = new GpredictConnectorPlugin();
224 | cut.Close();
225 |
226 | }
227 |
228 | [TestMethod]
229 | public void CloseWithInitialize()
230 | {
231 | Mock_ISharpControl isc = new Mock_ISharpControl();
232 | GpredictConnectorPlugin cut = new GpredictConnectorPlugin();
233 | cut.Initialize(isc);
234 | cut.Close();
235 |
236 | }
237 | }
238 | }
239 |
--------------------------------------------------------------------------------