Tinkering with events.

This commit is contained in:
Erick Kinnee 2019-03-08 12:23:02 -06:00
parent 6a8ecd3732
commit a3ae0cc06c
8 changed files with 56 additions and 15 deletions

Binary file not shown.

View file

@ -52,7 +52,7 @@
partial void GetFreqAndModeStatus();
}
public class Lock
public partial class Lock
{
public static readonly string ON;
public static readonly string OFF;

View file

@ -6,8 +6,8 @@ namespace SharpCATLib.Models.Radios.Yaesu
{
public string RadioMfg => "Yaesu";
public string RadioModel => "FT-818";
public string CmdPad => "00000000";
public string CmdPad => "00000000";
public class Lock
{

10
SharpCAT/SerialClient.cs Normal file
View file

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

View file

@ -1,24 +1,29 @@
using System;
using SharpCATLib;
using System;
using System.IO.Ports;
namespace SharpCATLib
{
public class SharpCAT
{
delegate string OnPortsSelected(string[] portnames);
event OnPortsSelected PortsSelected;
public SharpCAT()
{
PortsSelected += new EventHandler(OnPortsSelected);
PortsSelected += new OnPortsSelected(ConnectPorts);
}
public event EventHandler PortsSelected;
public void OnSetPortsToUse()
private string[] _portstouse;
public string[] PortsToUse
{
PortsSelected?.Invoke(this, EventArgs.Empty);
}
private void OnPortsSelected(object s, EventArgs e)
{
//Init and start the serial ports selected.
get => _portstouse;
set
{
_portstouse = value;
PortsSelected.Invoke(_portstouse);
}
}
public double[] CTCSSTones = { 67.0, 69.3, 71.9, 74.4, 77.0, 79.7, 82.5, 85.4, 88.5,
@ -40,10 +45,14 @@ namespace SharpCATLib
public static int[] DataBits { get; } = new int[] { 7, 8 };
private readonly string CmdPad = "00000000";
public static string[] RadioTypes { get; } = new string[] { "CAT", "CIV" };
private SerialPort[] PortsToUse;
private readonly string CATCmdPad = "00000000";
private string ConnectPorts(string[] portnames)
{
return "";
}
}
}

10
SharpCAT/Socket.cs Normal file
View file

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

View file

@ -12,6 +12,7 @@ namespace SharpCATConsole
static void Main(string[] args)
{
SharpCAT sharpCAT = new SharpCAT();
Console.WriteLine("Ports found: ");
foreach (var port in sharpCAT.PortNames)
{
@ -20,5 +21,10 @@ namespace SharpCATConsole
Console.ReadKey();
}
private static string SharpCAT_PortsSelected(string[] portnames)
{
throw new NotImplementedException();
}
}
}

View file

@ -58,5 +58,11 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharpCAT\SharpCATLib.csproj">
<Project>{dad3e7be-905a-4768-a695-0bcf96171e35}</Project>
<Name>SharpCATLib</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>