mirror of
https://github.com/UzixLS/sdrsharp-catcontroller.git
synced 2025-07-18 23:01:39 +03:00
initial (SerialController-1.2)
This commit is contained in:
53
SerialControllerPlugin.cs
Normal file
53
SerialControllerPlugin.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using SDRSharp.Common;
|
||||
|
||||
namespace SDRSharp.SerialController
|
||||
{
|
||||
public class SerialControllerPlugin: ISharpPlugin
|
||||
{
|
||||
private const string _displayName = "SerialController";
|
||||
|
||||
private SerialControllerPanel _controlPanel;
|
||||
private SerialPortCtrl _serialPort;
|
||||
private ISharpControl _control;
|
||||
|
||||
public string DisplayName
|
||||
{
|
||||
get { return _displayName; }
|
||||
}
|
||||
|
||||
public bool HasGui
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public UserControl Gui
|
||||
{
|
||||
get { return _controlPanel; }
|
||||
}
|
||||
|
||||
public void Initialize(ISharpControl control)
|
||||
{
|
||||
_control = control;
|
||||
_serialPort = new SerialPortCtrl();
|
||||
_serialPort.OnFrequencyChange += UpdateFrequency;
|
||||
|
||||
_controlPanel = new SerialControllerPanel(_serialPort);
|
||||
_controlPanel.readSettings();
|
||||
}
|
||||
|
||||
void UpdateFrequency(object sender, long freq) {
|
||||
_control.Frequency = freq;
|
||||
_controlPanel.addToLogList(freq.ToString("N0")+" Hz");
|
||||
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
_serialPort.closePort();
|
||||
_controlPanel.saveSettings();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user