commit d2f85c32713238440e081e820cb3756102efa0d6 Author: mlewis Date: Sun Sep 20 12:32:10 2026 -0400 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3a0e59 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.vs/ +**/bin/ +**/obj/ +*.user +*.suo +TestResults/ +ReSharper/ +*.userprefs +packages/ diff --git a/Hypervault_Control.iss b/Hypervault_Control.iss new file mode 100644 index 0000000..b43148a --- /dev/null +++ b/Hypervault_Control.iss @@ -0,0 +1,38 @@ +; Script generated by the Inno Script Studio Wizard. +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! + +#define MyAppName "Hypervault_Control" +#define MyAppVersion "1.0" +#define MyAppPublisher "Erisys, LLC" +#define MyAppExeName "Hypervault_Control.exe" + +[Setup] +; NOTE: The value of AppId uniquely identifies this application. +; Do not use the same AppId value in installers for other applications. +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) +AppId={{58D74FFA-60CB-4BBD-99BF-3964226AECB2} +AppName={#MyAppName} +AppVersion={#MyAppVersion} +;AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher={#MyAppPublisher} +DefaultDirName={pf}\Erisys\{#MyAppName} +DefaultGroupName=Hypervault Control +OutputDir=C:\Users\mlewis\source\repos\Hypervault_Control +OutputBaseFilename=Hypervault_Control_setup +Compression=lzma +SolidCompression=yes + +[Languages] +Name: "english"; MessagesFile: "compiler:Default.isl" + +[Tasks] +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked + +[Files] +Source: "C:\Users\mlewis\source\repos\Hypervault_Control\Hypervault_Control\bin\Release\Hypervault_Control.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "C:\Users\mlewis\source\repos\Hypervault_Control\Hypervault_Control\Images\Icon.ico"; DestDir: "{app}" +; NOTE: Don't use "Flags: ignoreversion" on any shared system files + +[Icons] +Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" +Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Icon.ico"; Tasks: desktopicon diff --git a/Hypervault_Control.sln b/Hypervault_Control.sln new file mode 100644 index 0000000..df3aeea --- /dev/null +++ b/Hypervault_Control.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36623.8 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hypervault_Control", "Hypervault_Control\Hypervault_Control.csproj", "{F9F3360E-0E4D-49B5-A8C5-CDAA7CD37D8D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F9F3360E-0E4D-49B5-A8C5-CDAA7CD37D8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9F3360E-0E4D-49B5-A8C5-CDAA7CD37D8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9F3360E-0E4D-49B5-A8C5-CDAA7CD37D8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9F3360E-0E4D-49B5-A8C5-CDAA7CD37D8D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BAEC0ED4-36A8-4145-87EE-D5D3F51010A2} + EndGlobalSection +EndGlobal diff --git a/Hypervault_Control/App.config b/Hypervault_Control/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/Hypervault_Control/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Hypervault_Control/App_Settings.cs b/Hypervault_Control/App_Settings.cs new file mode 100644 index 0000000..3207c80 --- /dev/null +++ b/Hypervault_Control/App_Settings.cs @@ -0,0 +1,116 @@ +using System; +using System.IO; +using System.Text; + +namespace App_Settings +{ + public class AppSettings + { + public string FSWXIpAddress { get; set; } = "10.1.1.51"; + public string FSWXPort { get; set; } = "5025"; + + public string HypervaultIpAddress { get; set; } = "10.1.1.188"; + public string HypervaultPort { get; set; } = "5000"; + } + + public static class SettingsManager + { + // private static readonly string SettingsFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.ini"); + + private static readonly string SettingsDirectory = Path.Combine (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Erisys", "Hypervault_Control"); + private static readonly string SettingsFile = Path.Combine (SettingsDirectory, "settings.ini"); + + public static AppSettings Load() + { + AppSettings settings = new AppSettings(); + + //-- Make sure the settings directory exists + Directory.CreateDirectory (SettingsDirectory); + + if (!File.Exists (SettingsFile)) + { + Save(settings); + return settings; + } + + string section = ""; + + foreach (string rawLine in File.ReadAllLines(SettingsFile)) + { + string line = rawLine.Trim(); + + // Ignore blank lines and comments + if (string.IsNullOrEmpty(line) || + line.StartsWith("#") || + line.StartsWith(";")) + { + continue; + } + + // Section + if (line.StartsWith("[") && line.EndsWith("]")) + { + section = line.Substring(1, line.Length - 2).Trim(); + continue; + } + + // Setting + int equalsIndex = line.IndexOf('='); + + if (equalsIndex < 0) + continue; + + string key = line.Substring(0, equalsIndex).Trim(); + string value = line.Substring(equalsIndex + 1).Trim(); + + if (section.Equals("FSWX", StringComparison.OrdinalIgnoreCase)) + { + if (key.Equals("IPAddress", StringComparison.OrdinalIgnoreCase)) + { + settings.FSWXIpAddress = value; + } + else if (key.Equals("Port", StringComparison.OrdinalIgnoreCase)) + { + settings.FSWXPort = value; + } + } + else if (section.Equals("Hypervault", StringComparison.OrdinalIgnoreCase)) + { + if (key.Equals("IPAddress", StringComparison.OrdinalIgnoreCase)) + { + settings.HypervaultIpAddress = value; + } + else if (key.Equals("Port", StringComparison.OrdinalIgnoreCase)) + { + settings.HypervaultPort = value; + } + } + } + + return settings; + } + + public static void Save(AppSettings settings) + { + //-- Make sure the settings directory exists + Directory.CreateDirectory (SettingsDirectory); + + StringBuilder sb = new StringBuilder(); + + sb.AppendLine("; Application settings"); + sb.AppendLine(); + + sb.AppendLine("[FSWX]"); + sb.AppendLine($"IPAddress={settings.FSWXIpAddress}"); + sb.AppendLine($"Port={settings.FSWXPort}"); + sb.AppendLine(); + + sb.AppendLine("[Hypervault]"); + sb.AppendLine($"IPAddress={settings.HypervaultIpAddress}"); + sb.AppendLine($"Port={settings.HypervaultPort}"); + sb.AppendLine(); + + File.WriteAllText(SettingsFile, sb.ToString()); + } + } +} \ No newline at end of file diff --git a/Hypervault_Control/FSWX_SA.cs b/Hypervault_Control/FSWX_SA.cs new file mode 100644 index 0000000..c6000a4 --- /dev/null +++ b/Hypervault_Control/FSWX_SA.cs @@ -0,0 +1,896 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Timers; +using System.Net.Sockets; +using System.Net; + +namespace FSWXSA +{ + class FSWX_SA + { + private TcpClient client; + private IPEndPoint serverEndPoint; + private NetworkStream clientStream; + + public FSWX_SA(string IPADDR, int PORT) + //----------------------------------------------------------------------------- + //-- FSWX_SA () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + client = new TcpClient(); + serverEndPoint = new IPEndPoint(IPAddress.Parse(IPADDR), PORT); + } + + public bool Connect() + //----------------------------------------------------------------------------- + //-- Connect () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + try + { + client.Connect(serverEndPoint); + } + catch + { + return false; + } + + clientStream = client.GetStream(); + return true; + } + + public bool Disconnect() + //----------------------------------------------------------------------------- + //-- Disconnect () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + try + { + client.Close(); + } + catch + { + return false; + } + return true; + } + + public void SendSCPIcommand(string command) + //----------------------------------------------------------------------------- + //-- SendSCPIcommand () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + ASCIIEncoding encoder = new ASCIIEncoding(); + byte[] buffer = encoder.GetBytes(command); + + clientStream.Write(buffer, 0, buffer.Length); + clientStream.Flush(); + } + + public void SendSCPIcommand(string command, out string response, int optionaldelay = 5, int optionaltimeout = 20) + //----------------------------------------------------------------------------- + //-- SendSCPIcommand () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + int TOSECONDS = optionaltimeout; + ASCIIEncoding encoder = new ASCIIEncoding(); + byte[] buffer = encoder.GetBytes(command); + byte[] retbuffer = new byte[65536]; + Stopwatch timer = new Stopwatch(); + + clientStream.Write(buffer, 0, buffer.Length); + clientStream.Flush(); + + timer.Start(); + while ((!clientStream.DataAvailable) && (timer.Elapsed.TotalSeconds < TOSECONDS)) ; + + if (!clientStream.DataAvailable) + { + timer.Stop(); + response = String.Format("ERROR - NO Data Available!!"); + } + timer.Stop(); + + Thread.Sleep(optionaldelay); + + if (clientStream.DataAvailable) + { + clientStream.Read(retbuffer, 0, 65536); + + string str = Encoding.UTF8.GetString(retbuffer, 0, 65536); + + str = str.Replace("\r", string.Empty); + str = str.Replace("\n", string.Empty); + str = str.Replace("\0", string.Empty); + + string[] lines = Regex.Split(str, "\r\n\0"); + + response = lines[0]; + } + else + response = ""; + } + + public bool WaitOPC(int optionaltimeout = 20) + //----------------------------------------------------------------------------- + //-- WaitOPC () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand("*OPC?\n", out response, 5, optionaltimeout); + + if (response.Equals("1")) + DONE = true; + else + Thread.Sleep(1); + } + + return (true); + } + + public void setCF (int CHANNEL, double CF) + //----------------------------------------------------------------------------- + //-- setCF () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format(":SENS{0}:FREQ:CENT {1}\n", CHANNEL, CF)); + WaitOPC(); + SendSCPIcommand(String.Format(":SENS{0}:FREQ:CENT?\n", CHANNEL), out response); + + if (Double.TryParse(response, out VALUE)) + if (VALUE == CF) + DONE = true; + } + } + + public double getCF (int CHANNEL) + //----------------------------------------------------------------------------- + //-- getCF () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + SendSCPIcommand(String.Format(":SENS{0}:FREQ:CENT?\n", CHANNEL), out response); + + if (Double.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1.0); + } + + public void setIQBW (int CHANNEL, double IQBW) + //----------------------------------------------------------------------------- + //-- setIQBW () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format(":SENS{0}:IQ:BWID {1}\n", CHANNEL, IQBW)); + WaitOPC(); + SendSCPIcommand(String.Format(":SENS{0}:IQ:BWID?\n", CHANNEL), out response); + + if (Double.TryParse(response, out VALUE)) + if (VALUE == IQBW) + DONE = true; + } + } + + public double getIQBW (int CHANNEL) + //----------------------------------------------------------------------------- + //-- getIQBW () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + SendSCPIcommand(String.Format(":SENS{0}:IQ:BWID?\n", CHANNEL), out response); + + if (Double.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1.0); + } + + + public void setRefLevel (int CHANNEL, int REFLEV) + //----------------------------------------------------------------------------- + //-- setRefLevel () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int32 VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format(":INP{0}:RLEV {1}\n", CHANNEL, REFLEV)); + WaitOPC(); + SendSCPIcommand(String.Format(":INP{0}:RLEV?\n", CHANNEL), out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == REFLEV) + DONE = true; + } + } + + public int getRefLevel (int CHANNEL) + //----------------------------------------------------------------------------- + //-- getRefLevel () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int32 VALUE; + + SendSCPIcommand(String.Format(":INP{0}:RLEV?\n", CHANNEL), out response); + + if (Int32.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1); + } + + + public void setSingleSweep() + //----------------------------------------------------------------------------- + //-- setSingleSweep () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":INIT:CONT ON\n"); + WaitOPC(); + SendSCPIcommand("INIT:CONT OFF\n"); + WaitOPC(); + SendSCPIcommand("INIT:IMM\n"); + } + +#if false + public void setAttenuation(Int32 ATTENUATION) + //----------------------------------------------------------------------------- + //-- setAttenuation () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int32 VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format(":POW:ATT {0}\n", ATTENUATION)); + WaitOPC(); + SendSCPIcommand(":POW:ATT?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == ATTENUATION) + DONE = true; + } + } + + public int getAttenuation() + //----------------------------------------------------------------------------- + //-- getAttenuation () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int32 VALUE; + + SendSCPIcommand(":POW:ATT?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1); + } + + public void setPreamp(bool ENABLE) + //----------------------------------------------------------------------------- + //-- setPreamp () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double CF; + Int32 VALUE; + + + if (ENABLE) + { +#if false + for (bool DONE = false; DONE == false; ) + { + SendSCPIcommand (":POW:EATT:STATE OFF\n"); + WaitOPC (); + SendSCPIcommand (":POW:EATT:STATE?\n", out response); + + if (Int32.TryParse (response, out VALUE)) + if (VALUE == 0) + DONE = true; + } +#endif + + CF = getCF(); + + if (CF <= 3.6e9) + { + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:BAND LOW\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:BAND?\n", out response); + + if (response.Contains("LOW")) + DONE = true; + } + } + else + { + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:BAND FULL\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:BAND?\n", out response); + + if (response.Contains("FULL")) + DONE = true; + } + } + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:STATE ON\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:STATE?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == 1) + DONE = true; + } + } + else + { +#if false + for (bool DONE = false; DONE == false; ) + { + SendSCPIcommand (":POW:EATT:STATE OFF\n"); + WaitOPC (); + SendSCPIcommand (":POW:EATT:STATE?\n", out response); + + if (Int32.TryParse (response, out VALUE)) + if (VALUE == 0) + DONE = true; + } +#endif + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:STATE OFF\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:STATE?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == 0) + DONE = true; + } + } + } + + public void setVBW(double VBW) + //----------------------------------------------------------------------------- + //-- setVBW () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(String.Format("SENSE:BANDWIDTH:VIDEO {0}\n", VBW)); + } + + public void SetTraceMode(string MODE) + //----------------------------------------------------------------------------- + //-- SetTraceMode () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(String.Format("TRACE1:TYPE {0}\n", MODE)); + } + + public void EnableMaxHoldTrace() + //----------------------------------------------------------------------------- + //-- EnableMaxHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE2:DISPLAY:STATE ON\n"); + SendSCPIcommand("TRACE2:TYPE MAXHOLD\n"); + } + + public void EnableMinHoldTrace() + //----------------------------------------------------------------------------- + //-- EnableMinHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE3:DISPLAY:STATE ON\n"); + SendSCPIcommand("TRACE3:TYPE MINHOLD\n"); + } + + public void DisableMaxHoldTrace() + //----------------------------------------------------------------------------- + //-- DisnableMaxHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE2:DISPLAY:STATE OFF\n"); + SendSCPIcommand("TRACE2:UPDATE:STATE OFF\n"); + } + + public void DisableMinHoldTrace() + //----------------------------------------------------------------------------- + //-- DisableMinHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE3:DISPLAY:STATE OFF\n"); + SendSCPIcommand("TRACE3:UPDATE:STATE OFF\n"); + } + + public void ReadMaxHoldTrace(out double[] dTraceData) + //----------------------------------------------------------------------------- + //-- ReadMaxHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + int i; + string tracedata; + string[] sTraceData; + + SendSCPIcommand("TRACE:DATA? TRACE2\n", out tracedata, 100); + + sTraceData = Regex.Split(tracedata, ","); + dTraceData = new double[sTraceData.Length]; + + for (i = 0; i < sTraceData.Length; i++) + dTraceData[i] = Convert.ToDouble(sTraceData[i]); + } + + public void ReadMinHoldTrace(out double[] dTraceData) + //----------------------------------------------------------------------------- + //-- ReadMinHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + int i; + string tracedata; + string[] sTraceData; + + SendSCPIcommand("TRACE:DATA? TRACE3\n", out tracedata, 100); + + sTraceData = Regex.Split(tracedata, ","); + dTraceData = new double[sTraceData.Length]; + + for (i = 0; i < sTraceData.Length; i++) + dTraceData[i] = Convert.ToDouble(sTraceData[i]); + } + + public void EnableMarker(double FREQ) + //----------------------------------------------------------------------------- + //-- EnableMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":CALC:MARKER1:STATE ON;\n"); + SendSCPIcommand(String.Format(":CALC:MARKER1:X {0};\n", FREQ)); + + //:CALC:MARKER:AOFF; + //:CALC:MARKER:ADD; + //:CALC:DPX:MARKER0:TRACE TRACE1; + //:CALC:DPX:MARKER0:FREQ FREQ + } + + public void EnableMarker(double FREQ, string TRACE) + //----------------------------------------------------------------------------- + //-- EnableMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":CALC:MARKER1:STATE ON;\n"); + SendSCPIcommand(String.Format(":CALC:MARKER1:X {0};\n", FREQ)); + + if (TRACE == "MAXHOLD") + SendSCPIcommand(":CALC:MARKER1:TRACE 2;\n"); + } + + public void DisableMarker() + //----------------------------------------------------------------------------- + //-- DisableMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":CALC:MARKER1:STATE OFF;\n"); + + //:CALC:MARKER:AOFF + } + + public void QueryMarker(out double LEVEL) + //----------------------------------------------------------------------------- + //-- QueryMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + + SendSCPIcommand(":CALC:MARKER1:Y?;\n", out response); + + //:CALC:DPX:MARKER0:Y? + + LEVEL = Convert.ToDouble(response); + } + + public void QueryMarker(int READCOUNT, out double LEVEL) + //----------------------------------------------------------------------------- + //-- QueryMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + int i; + + for (i = 0, LEVEL = 0; i < READCOUNT; i++) + { + SendSCPIcommand(":CALC:MARKER1:Y?;\n", out response); + + LEVEL += Convert.ToDouble(response); + } + + LEVEL /= READCOUNT; + } + + public bool CheckAlign() + //----------------------------------------------------------------------------- + //-- CheckAlign () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int16 VALUE; + bool retval = false; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand("STAT:QUES:CAL?;\n", out response); + if (Int16.TryParse(response, out VALUE)) + { + if ((VALUE & 0x4000) != 0) + { + SendSCPIcommand("*CAL?;\n", out response, 5, 240); + + if (response.Contains("1")) + { + DONE = true; + retval = true; + } + } + else + DONE = true; + } + else + DONE = true; + } + + return (retval); + } + + public bool CheckAlign(out bool success) + //----------------------------------------------------------------------------- + //-- CheckAlign () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int16 VALUE; + bool retval = false; + + success = false; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand("STAT:QUES:CAL?;\n", out response); + if (Int16.TryParse(response, out VALUE)) + { + if ((VALUE & 0x4000) != 0) + { + SendSCPIcommand("*CAL?;\n", out response, 5, 240); + + if (response.Contains("0")) + { + success = true; + DONE = true; + retval = true; + } + } + else + DONE = true; + } + else + DONE = true; + } + + return (retval); + } +#endif + } +} diff --git a/Hypervault_Control/Hypervault.cs b/Hypervault_Control/Hypervault.cs new file mode 100644 index 0000000..0b60ac1 --- /dev/null +++ b/Hypervault_Control/Hypervault.cs @@ -0,0 +1,817 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Timers; +using System.Net.Sockets; +using System.Net; + +namespace HypervaultSystem +{ + class Hypervault_System + { + private TcpClient client; + private IPEndPoint serverEndPoint; + private NetworkStream clientStream; + + public Hypervault_System(string IPADDR, int PORT) + //----------------------------------------------------------------------------- + //-- HypervaultSystem () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + client = new TcpClient(); + serverEndPoint = new IPEndPoint(IPAddress.Parse(IPADDR), PORT); + } + + public bool Connect() + //----------------------------------------------------------------------------- + //-- Connect () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + try + { + client.Connect(serverEndPoint); + } + catch + { + return false; + } + + clientStream = client.GetStream(); + return true; + } + + public bool Disconnect() + //----------------------------------------------------------------------------- + //-- Disconnect () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + try + { + client.Close(); + } + catch + { + return false; + } + return true; + } + + public void SendSCPIcommand(string command) + //----------------------------------------------------------------------------- + //-- SendSCPIcommand () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + ASCIIEncoding encoder = new ASCIIEncoding(); + byte[] buffer = encoder.GetBytes(command); + + clientStream.Write(buffer, 0, buffer.Length); + clientStream.Flush(); + } + + public void SendSCPIcommand(string command, out string response, int optionaldelay = 5, int optionaltimeout = 20) + //----------------------------------------------------------------------------- + //-- SendSCPIcommand () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + int TOSECONDS = optionaltimeout; + ASCIIEncoding encoder = new ASCIIEncoding(); + byte[] buffer = encoder.GetBytes(command); + byte[] retbuffer = new byte[65536]; + Stopwatch timer = new Stopwatch(); + + clientStream.Write(buffer, 0, buffer.Length); + clientStream.Flush(); + + timer.Start(); + while ((!clientStream.DataAvailable) && (timer.Elapsed.TotalSeconds < TOSECONDS)) ; + + if (!clientStream.DataAvailable) + { + timer.Stop(); + response = String.Format("ERROR - NO Data Available!!"); + } + timer.Stop(); + + Thread.Sleep(optionaldelay); + + if (clientStream.DataAvailable) + { + clientStream.Read(retbuffer, 0, 65536); + + string str = Encoding.UTF8.GetString(retbuffer, 0, 65536); + + str = str.Replace("\r", string.Empty); + str = str.Replace("\n", string.Empty); + str = str.Replace("\0", string.Empty); + + string[] lines = Regex.Split(str, "\r\n\0"); + + response = lines[0]; + } + else + response = ""; + } + + public bool WaitOPC(int optionaltimeout = 20) + //----------------------------------------------------------------------------- + //-- WaitOPC () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand("*OPC?\n", out response, 5, optionaltimeout); + + if (response.Equals("1")) + DONE = true; + else + Thread.Sleep(1); + } + + return (true); + } + + public void setCF(double CF) + //----------------------------------------------------------------------------- + //-- setCF () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format("SENSE:FREQUENCY:RF:CENTER {0}\n", CF)); + WaitOPC(); + SendSCPIcommand("SENSE:FREQUENCY:RF:CENTER?\n", out response); + + if (Double.TryParse(response, out VALUE)) + if (VALUE == CF) + DONE = true; + } + } + + public double getCF() + //----------------------------------------------------------------------------- + //-- getCF () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + SendSCPIcommand(String.Format("SENSE:FREQUENCY:RF:CENTER?\n"), out response); + + if (Double.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1.0); + } + + public void setSpan(double SPAN) + //----------------------------------------------------------------------------- + //-- setSpan () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format("SENSE:FREQUENCY:SPAN {0}\n", SPAN)); + WaitOPC(); + SendSCPIcommand("SENSE:FREQUENCY:SPAN?\n", out response); + + if (Double.TryParse(response, out VALUE)) + if (VALUE == SPAN) + DONE = true; + } + } + + public double getSpan() + //----------------------------------------------------------------------------- + //-- getSpan () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double VALUE; + + SendSCPIcommand("SENSE:FREQUENCY:SPAN?\n", out response); + + if (Double.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1.0); + } + + public void setAttenuation(Int32 ATTENUATION) + //----------------------------------------------------------------------------- + //-- setAttenuation () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int32 VALUE; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(String.Format(":POW:ATT {0}\n", ATTENUATION)); + WaitOPC(); + SendSCPIcommand(":POW:ATT?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == ATTENUATION) + DONE = true; + } + } + + public int getAttenuation() + //----------------------------------------------------------------------------- + //-- getAttenuation () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int32 VALUE; + + SendSCPIcommand(":POW:ATT?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + return (VALUE); + else + return (-1); + } + + public void setPreamp(bool ENABLE) + //----------------------------------------------------------------------------- + //-- setPreamp () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + double CF; + Int32 VALUE; + + + if (ENABLE) + { +#if false + for (bool DONE = false; DONE == false; ) + { + SendSCPIcommand (":POW:EATT:STATE OFF\n"); + WaitOPC (); + SendSCPIcommand (":POW:EATT:STATE?\n", out response); + + if (Int32.TryParse (response, out VALUE)) + if (VALUE == 0) + DONE = true; + } +#endif + + CF = getCF(); + + if (CF <= 3.6e9) + { + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:BAND LOW\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:BAND?\n", out response); + + if (response.Contains("LOW")) + DONE = true; + } + } + else + { + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:BAND FULL\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:BAND?\n", out response); + + if (response.Contains("FULL")) + DONE = true; + } + } + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:STATE ON\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:STATE?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == 1) + DONE = true; + } + } + else + { +#if false + for (bool DONE = false; DONE == false; ) + { + SendSCPIcommand (":POW:EATT:STATE OFF\n"); + WaitOPC (); + SendSCPIcommand (":POW:EATT:STATE?\n", out response); + + if (Int32.TryParse (response, out VALUE)) + if (VALUE == 0) + DONE = true; + } +#endif + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand(":POW:GAIN:STATE OFF\n"); + WaitOPC(); + SendSCPIcommand(":POW:GAIN:STATE?\n", out response); + + if (Int32.TryParse(response, out VALUE)) + if (VALUE == 0) + DONE = true; + } + } + } + + public void setVBW(double VBW) + //----------------------------------------------------------------------------- + //-- setVBW () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(String.Format("SENSE:BANDWIDTH:VIDEO {0}\n", VBW)); + } + + public void SetTraceMode(string MODE) + //----------------------------------------------------------------------------- + //-- SetTraceMode () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(String.Format("TRACE1:TYPE {0}\n", MODE)); + } + + public void EnableMaxHoldTrace() + //----------------------------------------------------------------------------- + //-- EnableMaxHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE2:DISPLAY:STATE ON\n"); + SendSCPIcommand("TRACE2:TYPE MAXHOLD\n"); + } + + public void EnableMinHoldTrace() + //----------------------------------------------------------------------------- + //-- EnableMinHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE3:DISPLAY:STATE ON\n"); + SendSCPIcommand("TRACE3:TYPE MINHOLD\n"); + } + + public void DisableMaxHoldTrace() + //----------------------------------------------------------------------------- + //-- DisnableMaxHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE2:DISPLAY:STATE OFF\n"); + SendSCPIcommand("TRACE2:UPDATE:STATE OFF\n"); + } + + public void DisableMinHoldTrace() + //----------------------------------------------------------------------------- + //-- DisableMinHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand("TRACE3:DISPLAY:STATE OFF\n"); + SendSCPIcommand("TRACE3:UPDATE:STATE OFF\n"); + } + + public void ReadMaxHoldTrace(out double[] dTraceData) + //----------------------------------------------------------------------------- + //-- ReadMaxHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + int i; + string tracedata; + string[] sTraceData; + + SendSCPIcommand("TRACE:DATA? TRACE2\n", out tracedata, 100); + + sTraceData = Regex.Split(tracedata, ","); + dTraceData = new double[sTraceData.Length]; + + for (i = 0; i < sTraceData.Length; i++) + dTraceData[i] = Convert.ToDouble(sTraceData[i]); + } + + public void ReadMinHoldTrace(out double[] dTraceData) + //----------------------------------------------------------------------------- + //-- ReadMinHoldTrace () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + int i; + string tracedata; + string[] sTraceData; + + SendSCPIcommand("TRACE:DATA? TRACE3\n", out tracedata, 100); + + sTraceData = Regex.Split(tracedata, ","); + dTraceData = new double[sTraceData.Length]; + + for (i = 0; i < sTraceData.Length; i++) + dTraceData[i] = Convert.ToDouble(sTraceData[i]); + } + + public void EnableMarker(double FREQ) + //----------------------------------------------------------------------------- + //-- EnableMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":CALC:MARKER1:STATE ON;\n"); + SendSCPIcommand(String.Format(":CALC:MARKER1:X {0};\n", FREQ)); + + //:CALC:MARKER:AOFF; + //:CALC:MARKER:ADD; + //:CALC:DPX:MARKER0:TRACE TRACE1; + //:CALC:DPX:MARKER0:FREQ FREQ + } + + public void EnableMarker(double FREQ, string TRACE) + //----------------------------------------------------------------------------- + //-- EnableMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":CALC:MARKER1:STATE ON;\n"); + SendSCPIcommand(String.Format(":CALC:MARKER1:X {0};\n", FREQ)); + + if (TRACE == "MAXHOLD") + SendSCPIcommand(":CALC:MARKER1:TRACE 2;\n"); + } + + public void DisableMarker() + //----------------------------------------------------------------------------- + //-- DisableMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + SendSCPIcommand(":CALC:MARKER1:STATE OFF;\n"); + + //:CALC:MARKER:AOFF + } + + public void QueryMarker(out double LEVEL) + //----------------------------------------------------------------------------- + //-- QueryMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + + SendSCPIcommand(":CALC:MARKER1:Y?;\n", out response); + + //:CALC:DPX:MARKER0:Y? + + LEVEL = Convert.ToDouble(response); + } + + public void QueryMarker(int READCOUNT, out double LEVEL) + //----------------------------------------------------------------------------- + //-- QueryMarker () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + int i; + + for (i = 0, LEVEL = 0; i < READCOUNT; i++) + { + SendSCPIcommand(":CALC:MARKER1:Y?;\n", out response); + + LEVEL += Convert.ToDouble(response); + } + + LEVEL /= READCOUNT; + } + + public bool CheckAlign() + //----------------------------------------------------------------------------- + //-- CheckAlign () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int16 VALUE; + bool retval = false; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand("STAT:QUES:CAL?;\n", out response); + if (Int16.TryParse(response, out VALUE)) + { + if ((VALUE & 0x4000) != 0) + { + SendSCPIcommand("*CAL?;\n", out response, 5, 240); + + if (response.Contains("1")) + { + DONE = true; + retval = true; + } + } + else + DONE = true; + } + else + DONE = true; + } + + return (retval); + } + + public bool CheckAlign(out bool success) + //----------------------------------------------------------------------------- + //-- CheckAlign () + //-- + //-- Purpose: + //-- + //-- Parameters: + //-- + //-- Returns: + //-- + //-- Notes: + //-- + //----------------------------------------------------------------------------- + { + string response; + Int16 VALUE; + bool retval = false; + + success = false; + + for (bool DONE = false; DONE == false;) + { + SendSCPIcommand("STAT:QUES:CAL?;\n", out response); + if (Int16.TryParse(response, out VALUE)) + { + if ((VALUE & 0x4000) != 0) + { + SendSCPIcommand("*CAL?;\n", out response, 5, 240); + + if (response.Contains("0")) + { + success = true; + DONE = true; + retval = true; + } + } + else + DONE = true; + } + else + DONE = true; + } + + return (retval); + } + } +} diff --git a/Hypervault_Control/Hypervault_Control.Designer.cs b/Hypervault_Control/Hypervault_Control.Designer.cs new file mode 100644 index 0000000..f7f4373 --- /dev/null +++ b/Hypervault_Control/Hypervault_Control.Designer.cs @@ -0,0 +1,460 @@ +namespace Hypervault_Control +{ + partial class Hypervault_Control + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Hypervault_Control)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.Channel1_Enable = new System.Windows.Forms.CheckBox(); + this.Channel2_Enable = new System.Windows.Forms.CheckBox(); + this.Channel1_Filename = new System.Windows.Forms.TextBox(); + this.Channel1_CF = new System.Windows.Forms.TextBox(); + this.Channel1_CF_Multiplier = new System.Windows.Forms.ComboBox(); + this.Channel1_BW = new System.Windows.Forms.ComboBox(); + this.Channel1_RefLevel = new System.Windows.Forms.TextBox(); + this.Channel2_Filename = new System.Windows.Forms.TextBox(); + this.Channel2_CF = new System.Windows.Forms.TextBox(); + this.Channel2_CF_Multiplier = new System.Windows.Forms.ComboBox(); + this.Channel2_BW = new System.Windows.Forms.ComboBox(); + this.Channel2_RefLevel = new System.Windows.Forms.TextBox(); + this.StartStop_Button = new System.Windows.Forms.Button(); + this.Update_Button = new System.Windows.Forms.Button(); + this.label11 = new System.Windows.Forms.Label(); + this.FSWX_IP = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.FSWX_Port = new System.Windows.Forms.TextBox(); + this.HYPERVAULT_Port = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.HYPERVAULT_IP = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.Connect_Button = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(13, 16); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(90, 20); + this.label1.TabIndex = 0; + this.label1.Text = "Channel 1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(396, 16); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(90, 20); + this.label2.TabIndex = 1; + this.label2.Text = "Channel 2"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(17, 54); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(96, 13); + this.label3.TabIndex = 2; + this.label3.Text = "File Name.............:"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(397, 54); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(96, 13); + this.label4.TabIndex = 3; + this.label4.Text = "File Name.............:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(17, 110); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(96, 13); + this.label5.TabIndex = 4; + this.label5.Text = "Bandwidth............:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(397, 110); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(96, 13); + this.label6.TabIndex = 5; + this.label6.Text = "Bandwidth............:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(17, 83); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(97, 13); + this.label7.TabIndex = 6; + this.label7.Text = "Center Frequency :"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(397, 83); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(97, 13); + this.label8.TabIndex = 7; + this.label8.Text = "Center Frequency :"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(17, 137); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(98, 13); + this.label9.TabIndex = 8; + this.label9.Text = "Ref Level..............:"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(397, 137); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(98, 13); + this.label10.TabIndex = 9; + this.label10.Text = "Ref Level..............:"; + // + // Channel1_Enable + // + this.Channel1_Enable.AutoSize = true; + this.Channel1_Enable.Checked = true; + this.Channel1_Enable.CheckState = System.Windows.Forms.CheckState.Checked; + this.Channel1_Enable.Location = new System.Drawing.Point(110, 18); + this.Channel1_Enable.Name = "Channel1_Enable"; + this.Channel1_Enable.Size = new System.Drawing.Size(59, 17); + this.Channel1_Enable.TabIndex = 10; + this.Channel1_Enable.Text = "Enable"; + this.Channel1_Enable.UseVisualStyleBackColor = true; + // + // Channel2_Enable + // + this.Channel2_Enable.AutoSize = true; + this.Channel2_Enable.Checked = true; + this.Channel2_Enable.CheckState = System.Windows.Forms.CheckState.Checked; + this.Channel2_Enable.Location = new System.Drawing.Point(505, 18); + this.Channel2_Enable.Name = "Channel2_Enable"; + this.Channel2_Enable.Size = new System.Drawing.Size(59, 17); + this.Channel2_Enable.TabIndex = 11; + this.Channel2_Enable.Text = "Enable"; + this.Channel2_Enable.UseVisualStyleBackColor = true; + // + // Channel1_Filename + // + this.Channel1_Filename.Location = new System.Drawing.Point(118, 47); + this.Channel1_Filename.Name = "Channel1_Filename"; + this.Channel1_Filename.Size = new System.Drawing.Size(272, 20); + this.Channel1_Filename.TabIndex = 12; + // + // Channel1_CF + // + this.Channel1_CF.Location = new System.Drawing.Point(118, 76); + this.Channel1_CF.Name = "Channel1_CF"; + this.Channel1_CF.Size = new System.Drawing.Size(99, 20); + this.Channel1_CF.TabIndex = 13; + this.Channel1_CF.Text = "8.0"; + // + // Channel1_CF_Multiplier + // + this.Channel1_CF_Multiplier.FormattingEnabled = true; + this.Channel1_CF_Multiplier.Items.AddRange(new object[] { + "GHz", + "MHz"}); + this.Channel1_CF_Multiplier.Location = new System.Drawing.Point(223, 76); + this.Channel1_CF_Multiplier.Name = "Channel1_CF_Multiplier"; + this.Channel1_CF_Multiplier.Size = new System.Drawing.Size(48, 21); + this.Channel1_CF_Multiplier.TabIndex = 14; + this.Channel1_CF_Multiplier.Text = "GHz"; + // + // Channel1_BW + // + this.Channel1_BW.FormattingEnabled = true; + this.Channel1_BW.Items.AddRange(new object[] { + "<=2GHz", + "4GHz"}); + this.Channel1_BW.Location = new System.Drawing.Point(118, 106); + this.Channel1_BW.Name = "Channel1_BW"; + this.Channel1_BW.Size = new System.Drawing.Size(66, 21); + this.Channel1_BW.TabIndex = 15; + this.Channel1_BW.Text = "4GHz"; + // + // Channel1_RefLevel + // + this.Channel1_RefLevel.Location = new System.Drawing.Point(118, 130); + this.Channel1_RefLevel.Name = "Channel1_RefLevel"; + this.Channel1_RefLevel.Size = new System.Drawing.Size(66, 20); + this.Channel1_RefLevel.TabIndex = 16; + this.Channel1_RefLevel.Text = "10"; + // + // Channel2_Filename + // + this.Channel2_Filename.Location = new System.Drawing.Point(498, 51); + this.Channel2_Filename.Name = "Channel2_Filename"; + this.Channel2_Filename.Size = new System.Drawing.Size(272, 20); + this.Channel2_Filename.TabIndex = 17; + // + // Channel2_CF + // + this.Channel2_CF.Location = new System.Drawing.Point(498, 77); + this.Channel2_CF.Name = "Channel2_CF"; + this.Channel2_CF.Size = new System.Drawing.Size(99, 20); + this.Channel2_CF.TabIndex = 18; + this.Channel2_CF.Text = "8.0"; + // + // Channel2_CF_Multiplier + // + this.Channel2_CF_Multiplier.FormattingEnabled = true; + this.Channel2_CF_Multiplier.Items.AddRange(new object[] { + "GHz", + "MHz"}); + this.Channel2_CF_Multiplier.Location = new System.Drawing.Point(603, 76); + this.Channel2_CF_Multiplier.Name = "Channel2_CF_Multiplier"; + this.Channel2_CF_Multiplier.Size = new System.Drawing.Size(46, 21); + this.Channel2_CF_Multiplier.TabIndex = 19; + this.Channel2_CF_Multiplier.Text = "GHz"; + // + // Channel2_BW + // + this.Channel2_BW.FormattingEnabled = true; + this.Channel2_BW.Items.AddRange(new object[] { + "<=2GHz", + "4GHz"}); + this.Channel2_BW.Location = new System.Drawing.Point(498, 106); + this.Channel2_BW.Name = "Channel2_BW"; + this.Channel2_BW.Size = new System.Drawing.Size(66, 21); + this.Channel2_BW.TabIndex = 20; + this.Channel2_BW.Text = "4GHz"; + // + // Channel2_RefLevel + // + this.Channel2_RefLevel.Location = new System.Drawing.Point(498, 129); + this.Channel2_RefLevel.Name = "Channel2_RefLevel"; + this.Channel2_RefLevel.Size = new System.Drawing.Size(66, 20); + this.Channel2_RefLevel.TabIndex = 21; + this.Channel2_RefLevel.Text = "10"; + // + // StartStop_Button + // + this.StartStop_Button.Location = new System.Drawing.Point(695, 126); + this.StartStop_Button.Name = "StartStop_Button"; + this.StartStop_Button.Size = new System.Drawing.Size(75, 23); + this.StartStop_Button.TabIndex = 22; + this.StartStop_Button.Text = "Arm"; + this.StartStop_Button.UseVisualStyleBackColor = true; + this.StartStop_Button.Click += new System.EventHandler(this.StartStop_Button_Click); + // + // Update_Button + // + this.Update_Button.Location = new System.Drawing.Point(603, 126); + this.Update_Button.Name = "Update_Button"; + this.Update_Button.Size = new System.Drawing.Size(86, 23); + this.Update_Button.TabIndex = 23; + this.Update_Button.Text = "Update FSWX"; + this.Update_Button.UseVisualStyleBackColor = true; + this.Update_Button.Click += new System.EventHandler(this.Update_Button_Click); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(17, 180); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(99, 13); + this.label11.TabIndex = 24; + this.label11.Text = "FSWX IP...............:"; + // + // FSWX_IP + // + this.FSWX_IP.Location = new System.Drawing.Point(117, 177); + this.FSWX_IP.Name = "FSWX_IP"; + this.FSWX_IP.Size = new System.Drawing.Size(91, 20); + this.FSWX_IP.TabIndex = 25; + this.FSWX_IP.TextChanged += new System.EventHandler(this.FSWX_IP_TextChanged); + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(214, 180); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(44, 13); + this.label12.TabIndex = 26; + this.label12.Text = "Port.....:"; + // + // FSWX_Port + // + this.FSWX_Port.Location = new System.Drawing.Point(258, 177); + this.FSWX_Port.Name = "FSWX_Port"; + this.FSWX_Port.Size = new System.Drawing.Size(40, 20); + this.FSWX_Port.TabIndex = 27; + this.FSWX_Port.TextChanged += new System.EventHandler(this.FSWX_Port_TextChanged); + // + // HYPERVAULT_Port + // + this.HYPERVAULT_Port.Location = new System.Drawing.Point(638, 177); + this.HYPERVAULT_Port.Name = "HYPERVAULT_Port"; + this.HYPERVAULT_Port.Size = new System.Drawing.Size(40, 20); + this.HYPERVAULT_Port.TabIndex = 31; + this.HYPERVAULT_Port.TextChanged += new System.EventHandler(this.HYPERVAULT_Port_TextChanged); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(594, 180); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(44, 13); + this.label13.TabIndex = 30; + this.label13.Text = "Port.....:"; + // + // HYPERVAULT_IP + // + this.HYPERVAULT_IP.Location = new System.Drawing.Point(497, 177); + this.HYPERVAULT_IP.Name = "HYPERVAULT_IP"; + this.HYPERVAULT_IP.Size = new System.Drawing.Size(91, 20); + this.HYPERVAULT_IP.TabIndex = 29; + this.HYPERVAULT_IP.TextChanged += new System.EventHandler(this.HYPERVAULT_IP_TextChanged); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(397, 180); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(98, 13); + this.label14.TabIndex = 28; + this.label14.Text = "Hypervault IP........:"; + // + // Connect_Button + // + this.Connect_Button.Location = new System.Drawing.Point(695, 174); + this.Connect_Button.Name = "Connect_Button"; + this.Connect_Button.Size = new System.Drawing.Size(75, 23); + this.Connect_Button.TabIndex = 32; + this.Connect_Button.Text = "Connect"; + this.Connect_Button.UseVisualStyleBackColor = true; + this.Connect_Button.Click += new System.EventHandler(this.Connect_Button_Click); + // + // Hypervault_Control + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(794, 209); + this.Controls.Add(this.Connect_Button); + this.Controls.Add(this.HYPERVAULT_Port); + this.Controls.Add(this.label13); + this.Controls.Add(this.HYPERVAULT_IP); + this.Controls.Add(this.label14); + this.Controls.Add(this.FSWX_Port); + this.Controls.Add(this.label12); + this.Controls.Add(this.FSWX_IP); + this.Controls.Add(this.label11); + this.Controls.Add(this.Update_Button); + this.Controls.Add(this.Channel1_BW); + this.Controls.Add(this.StartStop_Button); + this.Controls.Add(this.Channel2_RefLevel); + this.Controls.Add(this.Channel2_BW); + this.Controls.Add(this.Channel2_CF_Multiplier); + this.Controls.Add(this.Channel2_CF); + this.Controls.Add(this.Channel2_Filename); + this.Controls.Add(this.Channel1_RefLevel); + this.Controls.Add(this.Channel1_CF_Multiplier); + this.Controls.Add(this.Channel1_CF); + this.Controls.Add(this.Channel1_Filename); + this.Controls.Add(this.Channel2_Enable); + this.Controls.Add(this.Channel1_Enable); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Name = "Hypervault_Control"; + this.Text = "Hypervault Control"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Hypervault_Control_FormClosing); + this.Shown += new System.EventHandler(this.Hypervault_Control_Shown); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.CheckBox Channel1_Enable; + private System.Windows.Forms.CheckBox Channel2_Enable; + private System.Windows.Forms.TextBox Channel1_Filename; + private System.Windows.Forms.TextBox Channel1_CF; + private System.Windows.Forms.ComboBox Channel1_CF_Multiplier; + private System.Windows.Forms.ComboBox Channel1_BW; + private System.Windows.Forms.TextBox Channel1_RefLevel; + private System.Windows.Forms.TextBox Channel2_Filename; + private System.Windows.Forms.TextBox Channel2_CF; + private System.Windows.Forms.ComboBox Channel2_CF_Multiplier; + private System.Windows.Forms.ComboBox Channel2_BW; + private System.Windows.Forms.TextBox Channel2_RefLevel; + private System.Windows.Forms.Button StartStop_Button; + private System.Windows.Forms.Button Update_Button; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox FSWX_IP; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox FSWX_Port; + private System.Windows.Forms.TextBox HYPERVAULT_Port; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox HYPERVAULT_IP; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Button Connect_Button; + } +} + diff --git a/Hypervault_Control/Hypervault_Control.cs b/Hypervault_Control/Hypervault_Control.cs new file mode 100644 index 0000000..9b3fdf6 --- /dev/null +++ b/Hypervault_Control/Hypervault_Control.cs @@ -0,0 +1,806 @@ +using FSWXSA; +using HypervaultSystem; +using App_Settings; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.Remoting.Channels; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Hypervault_Control +{ + public partial class Hypervault_Control : Form + { + enum SystemState + { + Disarmed, + Armed, + Collecting + } + + bool Hypervault_Connected = false; + bool FSWX_Connected = false; + Hypervault_System Hypervault; + FSWX_SA FSWXSA; + AppSettings settings; + bool COLLECTING = false; + SystemState state = SystemState.Disarmed; + String START_CAP1; + String START_CAP2; + String STOP_CAP1; + String STOP_CAP2; + String STREAM1; + String STREAM2; + int PORT1; + int PORT2; + int RefLevel1; + int RefLevel2; + int StreamCount1; + int StreamCount2; + long CLOCK1; + long CLOCK2; + float CF1; + float CF2; + + public Hypervault_Control() + { + InitializeComponent(); + } + + private void Hypervault_Control_Shown(object sender, EventArgs e) + { + Update_Button.Enabled = false; + StartStop_Button.Enabled = false; + + settings = SettingsManager.Load (); + + FSWX_IP.Text = settings.FSWXIpAddress; + FSWX_Port.Text = settings.FSWXPort; + + HYPERVAULT_IP.Text = settings.HypervaultIpAddress; + HYPERVAULT_Port.Text = settings.HypervaultPort; + } + + private void Hypervault_Control_FormClosing(object sender, FormClosingEventArgs e) + { + if (Hypervault_Connected) + Hypervault.Disconnect(); + + if (FSWX_Connected) + { + //-- Disable the FSWX Channel 1 Stream + FSWXSA.SendSCPIcommand("OUTP1:IQHS:STATe OFF\n"); + + //-- Disable the FSWX Channel 2 Stream + FSWXSA.SendSCPIcommand("OUTP2:IQHS:STATe OFF\n"); + + FSWXSA.Disconnect(); + } + } + + public static bool ValidateFileName(string fileName) + { + char [] invalidChars = Path.GetInvalidFileNameChars (); + foreach (char c in invalidChars) + { + if (fileName.Contains (c)) + { + return (false); + } + } + return (true); + } + + private bool ValidateInt(string StringVal) + { + Int32 VAL; + + return (Int32.TryParse(StringVal, out VAL)); + } + + private bool ValidateFloat(string StringVal) + { + float VAL; + + return (float.TryParse(StringVal, out VAL)); + } + + private bool CheckIPValid (string strIP) + { + //-- Split string by ".", check that array length is 3 + char chrFullStop = '.'; + string [] arrOctets = strIP.Split (chrFullStop); + if (arrOctets.Length != 4) + { + return (false); + } + + //-- Check each substring checking that the int value is less than 255 and that is char[] length is !> 2 + Int16 MAXVALUE = 255; + Int32 temp; //-- Parse returns Int32 + foreach (string strOctet in arrOctets) + { + if (strOctet.Length > 3) + { + return (false); + } + + temp = int.Parse (strOctet); + if (temp > MAXVALUE) + { + return (false); + } + } + return (true); + } + + private void StartStop_Button_Click(object sender, EventArgs e) + { + DialogResult result; + int retcode; + string response = ""; + + if (state == SystemState.Disarmed) + { + StartStop_Button.Text = "Arming"; + this.Refresh (); + + FSWXSA.SendSCPIcommand("OUTPut1:IQHS:CQSFp?\n", out response); + Console.WriteLine(string.Format("OUTPut1:IQHS:CQSFp? returned: {0}\n", response)); + + if ((response.Length > 0) && (response[0] == '1')) + { + //Channel1_Enable.Enabled = true; + } + else + { + result = MessageBox.Show("FSWX Digital IO 1 Cable Not Conneced!", "WARNING!", MessageBoxButtons.OK); + } + + FSWXSA.SendSCPIcommand("OUTPut2:IQHS:CQSFp?\n", out response); + Console.WriteLine(string.Format("OUTPut2:IQHS:CQSFp? returned: {0}\n", response)); + + if ((response.Length > 0) && (response[0] == '1')) + { + //Channel2_Enable.Enabled = true; + } + else + { + result = MessageBox.Show("FSWX Digital IO 2 Cable Not Conneced!", "WARNING!", MessageBoxButtons.OK); + } + + //-- Enable the FSWX Channel 1 Stream + if (Channel1_Enable.Checked) + FSWXSA.SendSCPIcommand("OUTP1:IQHS:STATe ON\n"); + + //-- Enable the FSWX Channel 2 Stream + if (Channel2_Enable.Checked) + FSWXSA.SendSCPIcommand("OUTP2:IQHS:STATe ON\n"); + + Thread.Sleep (10000); //-- Wait 10 seconds Added 9/15/2026 + + state = SystemState.Armed; + StartStop_Button.Text = "Start"; + } + else if (state == SystemState.Armed) +// if (COLLECTING == false) + { + //-- Process Channel 1 + if (Channel1_Enable.Checked) + { + //-- Validate the inputs + if ((Channel1_Filename.Text == "") || (ValidateFileName(Channel1_Filename.Text) == false)) + { + result = MessageBox.Show("Channel 1 filename is invalid", "Error!", MessageBoxButtons.OK); + return; + } + + if (ValidateFloat(Channel1_CF.Text) == false) + { + result = MessageBox.Show("Channel 1 Center Frequency is invalid", "Error!", MessageBoxButtons.OK); + return; + } + + if (ValidateInt(Channel1_RefLevel.Text) == false) + { + result = MessageBox.Show("Channel 1 Ref Level is invlalid", "Error!", MessageBoxButtons.OK); + return; + } + + //-- Get the input values into a form that we can use. + if (Channel1_BW.Text == "<=2GHz") + { + PORT1 = 2; + CLOCK1 = 2500000000; + STREAM1 = "1"; + StreamCount1 = 1; + } + else + { + PORT1 = 3; + CLOCK1 = 5000000000; + STREAM1 = "1,0"; + StreamCount1 = 2; + } + + float.TryParse(Channel1_CF.Text, out CF1); + if (Channel1_CF_Multiplier.Text == "GHz") + CF1 *= 1000000000; + else + CF1 *= 1000000; + + //-- Build the capture start and stop commands + START_CAP1 = String.Format ("CAPTURE:START {{\"portinfo\": {{\"port\": {0}}}, \"fileinfo\": {{\"filename\": \"{1}\"}}}}\n", PORT1, Channel1_Filename.Text); + STOP_CAP1 = String.Format ("CAPTURE:STOP {{\"portinfo\": {{\"port\": {0}}}, \"fileinfo\": {{\"filename\": \"{1}\"}}, \"headerinfo\": {{\"header\": \"{{COPYRIGHT:2020 Rohde&Schwarz IQW}}{{FWVERSION:2021}}{{DATE:2025-04-11;14:45:04}}{{TYPE:RAW16BE}}{{COMPONENTS:IQ}}{{CLOCK:{2:0}}}{{RESOLUTION:16}}{{FREQUENCY:{3:0}}}{{REFLEVEL:{4}}}{{STREAMCOUNT:{5}}}{{STREAMORDER:{6}}}\"}}\n", PORT1, Channel1_Filename.Text, CLOCK1, CF1, Channel1_RefLevel.Text, StreamCount1, STREAM1); + Console.WriteLine (START_CAP1); + Console.WriteLine (STOP_CAP1); + } + + //-- Process Channel 1 + if (Channel2_Enable.Checked) + { + //-- Validate the inputs + if ((Channel2_Filename.Text == "") || (ValidateFileName(Channel2_Filename.Text) == false)) + { + result = MessageBox.Show("Channel 2 filename is invalid", "Error!", MessageBoxButtons.OK); + return; + } + + if (ValidateFloat(Channel2_CF.Text) == false) + { + result = MessageBox.Show("Channel 2 Center Frequency is invalid", "Error!", MessageBoxButtons.OK); + return; + } + + if (ValidateInt(Channel2_RefLevel.Text) == false) + { + result = MessageBox.Show("Channel 2 Ref Level is invlalid", "Error!", MessageBoxButtons.OK); + return; + } + + //-- Get the input values into a form that we can use. + if (Channel2_BW.Text == "<=2GHz") + { + PORT2 = 8; + CLOCK2 = 2500000000; + STREAM2 = "3"; + StreamCount2 = 1; + } + else + { + PORT2 = 12; + CLOCK2 = 5000000000; + STREAM2 = "3,2"; + StreamCount2 = 2; + } + + float.TryParse(Channel2_CF.Text, out CF2); + if (Channel2_CF_Multiplier.Text == "GHz") + CF2 *= 1000000000; + else + CF2 *= 1000000; + + //-- Build the capture start and stop commands + START_CAP2 = String.Format ("CAPTURE:START {{\"portinfo\": {{\"port\": {0}}}, \"fileinfo\": {{\"filename\": \"{1}\"}}}}\n", PORT2, Channel2_Filename.Text); + STOP_CAP2 = String.Format ("CAPTURE:STOP {{\"portinfo\": {{\"port\": {0}}}, \"fileinfo\": {{\"filename\": \"{1}\"}}, \"headerinfo\": {{\"header\": \"{{COPYRIGHT:2020 Rohde&Schwarz IQW}}{{FWVERSION:2021}}{{DATE:2025-04-11;14:45:04}}{{TYPE:RAW16BE}}{{COMPONENTS:IQ}}{{CLOCK:{2:0}}}{{RESOLUTION:16}}{{FREQUENCY:{3:0}}}{{REFLEVEL:{4}}}{{STREAMCOUNT:{5}}}{{STREAMORDER:{6}}}\"}}\n", PORT2, Channel2_Filename.Text, CLOCK2, CF2, Channel2_RefLevel.Text, StreamCount2, STREAM2); + Console.WriteLine (START_CAP2); + Console.WriteLine (STOP_CAP2); + } + + if ((Channel1_Enable.Checked) || (Channel2_Enable.Checked)) + { + //-- Need some error checking on start commands! + if (Channel1_Enable.Checked) + { + Hypervault.SendSCPIcommand (START_CAP1, out response); + Console.WriteLine (response); + + int.TryParse(response, out retcode); + if (retcode != 0) + { + //-- We have an error! + if (retcode == 17) + result = MessageBox.Show ("Channel 1 File Already Exists", "Error!", MessageBoxButtons.OK); + else + result = MessageBox.Show ("Channel 1 Parameter Error", "Error!", MessageBoxButtons.OK); + + return; + } + } + + if (Channel2_Enable.Checked) + { + Hypervault.SendSCPIcommand (START_CAP2, out response); + Console.WriteLine (response); + + int.TryParse (response, out retcode); + if (retcode != 0) + { + //-- We have an error! + if (retcode == 17) + result = MessageBox.Show ("Channel 2 File Already Exists", "Error!", MessageBoxButtons.OK); + else + result = MessageBox.Show ("Channel 2 Parameter Error", "Error!", MessageBoxButtons.OK); + + return; + } + } + + Hypervault.SendSCPIcommand ("CAPTURE:ENABLE ON\n"); + Hypervault.SendSCPIcommand ("CAPTURE:ENABLE?\n", out response); + + if (response == "ON") + { + //-- Enable the FSWX Channel 1 Stream + //if (Channel1_Enable.Checked) + // FSWXSA.SendSCPIcommand ("OUTP1:IQHS:STATe ON\n"); + + //-- Enable the FSWX Channel 2 Stream + //if (Channel2_Enable.Checked) + // FSWXSA.SendSCPIcommand ("OUTP2:IQHS:STATe ON\n"); + + //Thread.Sleep (3000); //-- Wait 3 seconds Added 7/15/26 + + //-- Turn on the FSWX Data?? + FSWXSA.SendSCPIcommand (":INIT:IMM\n"); + + //-- Change the text on the button + StartStop_Button.Text = "Stop"; + + state = SystemState.Collecting; + + COLLECTING = true; + } + else + { + result = MessageBox.Show("CAPTURE:ENABLE ON FAILED!", "Error!", MessageBoxButtons.OK); + return; + } + } + } + else if (state == SystemState.Collecting) +// else if (COLLECTING == true) + { + //-- Need some error checking on stop commands! + if (Channel1_Enable.Checked) + { + //-- Disable the FSWX Channel 1 Stream + //FSWXSA.SendSCPIcommand ("OUTP1:IQHS:STATe OFF\n"); + + Hypervault.SendSCPIcommand(STOP_CAP1, out response); + Console.WriteLine(response); + } + + if (Channel2_Enable.Checked) + { + //-- Disable the FSWX Channel 2 Stream + //FSWXSA.SendSCPIcommand ("OUTP2:IQHS:STATe OFF\n"); + + Hypervault.SendSCPIcommand (STOP_CAP2, out response); + Console.WriteLine (response); + } + + Hypervault.SendSCPIcommand ("CAPTURE:ENABLE OFF\n"); + Hypervault.SendSCPIcommand ("CAPTURE:ENABLE?\n", out response); + + if (response != "OFF") + { + result = MessageBox.Show("CAPTURE:ENABLE OFF FAILED!", "Error!", MessageBoxButtons.OK); + return; + } + else + { + //-- Change the text on the button + StartStop_Button.Text = "Start"; + } + + state = SystemState.Armed; + StartStop_Button.Text = "Start"; + + COLLECTING = false; + } + } + + private void Update_Button_Click(object sender, EventArgs e) + { + DialogResult result; + string response = ""; + + if (state != SystemState.Collecting) + { + //-- Disable the FSWX Channel 1 Stream + FSWXSA.SendSCPIcommand("OUTP1:IQHS:STATe OFF\n"); + + //-- Disable the FSWX Channel 2 Stream + FSWXSA.SendSCPIcommand("OUTP2:IQHS:STATe OFF\n"); + + state = SystemState.Disarmed; + StartStop_Button.Text = "Arm"; + +// if (COLLECTING == false) +// { + Update_Button.Text = "Updating"; + Update_Button.Enabled = false; + + if (ValidateFloat(Channel1_CF.Text) == false) + { + result = MessageBox.Show("Channel 1 Center Frequency is invalid", "Error!", MessageBoxButtons.OK); + return; + } + else + { + float.TryParse(Channel1_CF.Text, out CF1); + if (Channel1_CF_Multiplier.Text == "GHz") + CF1 *= 1000000000; + else + CF1 *= 1000000; + + FSWXSA.setCF (1, CF1); + } + + if (ValidateFloat(Channel2_CF.Text) == false) + { + result = MessageBox.Show("Channel 2 Center Frequency is invalid", "Error!", MessageBoxButtons.OK); + return; + } + else + { + float.TryParse(Channel2_CF.Text, out CF2); + if (Channel2_CF_Multiplier.Text == "GHz") + CF2 *= 1000000000; + else + CF2 *= 1000000; + + FSWXSA.setCF(2, CF2); + } + + if (ValidateInt(Channel1_RefLevel.Text) == false) + { + result = MessageBox.Show("Channel 1 Ref Level is invlalid", "Error!", MessageBoxButtons.OK); + return; + } + else + { + int.TryParse (Channel1_RefLevel.Text, out RefLevel1); + FSWXSA.setRefLevel (1, RefLevel1); + } + + if (ValidateInt(Channel2_RefLevel.Text) == false) + { + result = MessageBox.Show("Channel 2 Ref Level is invlalid", "Error!", MessageBoxButtons.OK); + return; + } + else + { + int.TryParse(Channel2_RefLevel.Text, out RefLevel2); + FSWXSA.setRefLevel(2, RefLevel2); + } + + if (Channel1_BW.Text == "<=2GHz") + FSWXSA.setIQBW (1, 2000000000); + else + FSWXSA.setIQBW(1, 4000000000); + + if (Channel2_BW.Text == "<=2GHz") + FSWXSA.setIQBW(2, 2000000000); + else + FSWXSA.setIQBW(2, 4000000000); + +#if false + FSWXSA.SendSCPIcommand("OUTPut1:IQHS:CQSFp?\n", out response); + Console.WriteLine(string.Format("OUTPut1:IQHS:CQSFp? returned: {0}\n", response)); + + if ((response.Length > 0) && (response[0] == '1')) + { + Channel1_Enable.Enabled = true; + } + else + { + Channel1_Enable.CheckState = CheckState.Unchecked; + Channel1_Enable.Enabled = true; + } + + FSWXSA.SendSCPIcommand("OUTPut2:IQHS:CQSFp?\n", out response); + Console.WriteLine(string.Format("OUTPut2:IQHS:CQSFp? returned: {0}\n", response)); + + if ((response.Length > 0) && (response[0] == '1')) + { + Channel2_Enable.Enabled = true; + } + else + { + Channel2_Enable.CheckState = CheckState.Unchecked; + Channel2_Enable.Enabled = true; + } +#endif + + FSWXSA.SendSCPIcommand ("SENSe:ADJust:PTIMe\n"); + FSWXSA.SendSCPIcommand ("INIT:IMM\n"); + + //FSWXSA.setSingleSweep(); + + Update_Button.Text = "Update FSWX"; + Update_Button.Enabled = true; + } + } + + + + private void Connect_Button_Click(object sender, EventArgs e) + { + DialogResult result; + Int32 VALUE; + int FSWXPort; + int HypervaultPort; + string response = ""; + + if (!CheckIPValid (FSWX_IP.Text)) + { + result = MessageBox.Show ("Invalid FSWX IP Address!", "Error!", MessageBoxButtons.OK); + return; + } + + if (!ValidateInt (FSWX_Port.Text)) + { + result = MessageBox.Show ("Invalid FSWX Port!", "Error!", MessageBoxButtons.OK); + return; + } + else + Int32.TryParse (FSWX_Port.Text, out FSWXPort); + + if (!CheckIPValid (HYPERVAULT_IP.Text)) + { + result = MessageBox.Show ("Invalid Hypervault IP Address!", "Error!", MessageBoxButtons.OK); + return; + } + + if (!ValidateInt (HYPERVAULT_Port.Text)) + { + result = MessageBox.Show ("Invalid Hypervault Port!", "Error!", MessageBoxButtons.OK); + return; + } + else + Int32.TryParse (HYPERVAULT_Port.Text, out HypervaultPort); + + Connect_Button.Text = "Connecting"; + this.Refresh (); + + Hypervault = new Hypervault_System (HYPERVAULT_IP.Text, HypervaultPort); + if (Hypervault.Connect()) + { + Hypervault_Connected = true; + StartStop_Button.Enabled = true; + + Hypervault.SendSCPIcommand("*IDN?\n"); + } + else + { + StartStop_Button.Enabled = false; + Connect_Button.Text = "Connect"; + + result = MessageBox.Show("Failed to connect to Hypervault!", "Error!", MessageBoxButtons.OK); + return; + } + + + FSWXSA = new FSWX_SA (FSWX_IP.Text, FSWXPort); + if (FSWXSA.Connect ()) + { + FSWXSA.SendSCPIcommand("*IDN?\n", out response); + Console.WriteLine(string.Format("*IDN? returned: {0}\n", response)); + + + FSWXSA.SendSCPIcommand("OUTPut1:IQHS:CQSFp?\n", out response); + Console.WriteLine(string.Format("OUTPut1:IQHS:CQSFp? returned: {0}\n", response)); + + if ((response.Length > 0) && (response [0] == '1')) + { + //Channel1_Enable.Enabled = true; + } + else + { + result = MessageBox.Show ("FSWX Digital IO 1 Cable Not Conneced!", "WARNING!", MessageBoxButtons.OK); + } + + FSWXSA.SendSCPIcommand("OUTPut2:IQHS:CQSFp?\n", out response); + Console.WriteLine(string.Format("OUTPut2:IQHS:CQSFp? returned: {0}\n", response)); + + if ((response.Length > 0) && (response[0] == '1')) + { + //Channel2_Enable.Enabled = true; + } + else + { + result = MessageBox.Show ("FSWX Digital IO 2 Cable Not Conneced!", "WARNING!", MessageBoxButtons.OK); + } + +#if false + FSWXSA.SendSCPIcommand("OUTP:IQHS:SELFtest?\n", out response); + Console.WriteLine(string.Format("OUTP:IQHS:SELFtest? returned: {0}\n", response)); +#endif + //-- Get values from current active tab on FSWX + FSWXSA.SendSCPIcommand(":INP1:RF:STAT?\n", out response); + if (Int32.TryParse(response, out VALUE)) + { + if (VALUE == 1) + { + CF1 = (float)FSWXSA.getCF(1); + RefLevel1 = FSWXSA.getRefLevel(1); + CLOCK1 = 4000000000; + } + else + { + CF1 = 8000000000; + RefLevel1 = 0; + CLOCK1 = 4000000000; + } + } + else + { + CF1 = 8000000000; + RefLevel1 = 0; + CLOCK1 = 4000000000; + } + + FSWXSA.SendSCPIcommand(":INP2:RF:STAT?\n", out response); + if (Int32.TryParse(response, out VALUE)) + { + if (VALUE == 1) + { + CF2 = (float)FSWXSA.getCF(2); + RefLevel2 = FSWXSA.getRefLevel(2); + CLOCK2 = 4000000000; + } + else + { + CF2 = 8000000000; + RefLevel2 = 0; + CLOCK2 = 4000000000; + } + } + else + { + CF2 = 8000000000; + RefLevel2 = 0; + CLOCK2 = 4000000000; + } + + FSWXSA.SendSCPIcommand(":INST:CRE:NEW IQSA, 'I/Q Spectrum Analyzer'\n"); + FSWXSA.SendSCPIcommand(":SYST:PRES:CHAN:EXEC\n"); + FSWXSA.SendSCPIcommand(":INIT:CONT OFF\n"); + FSWXSA.SendSCPIcommand(":INP1:RF:STAT ON\n"); + FSWXSA.SendSCPIcommand(":INP2:RF:STAT ON\n"); + //FSWXSA.SendSCPIcommand (":SENS1:IQ:MODE:AUTO OFF\n"); //-- Commented out 7/15/26 + //FSWXSA.SendSCPIcommand (":SENS2:IQ:MODE:AUTO OFF\n"); + + //FSWXSA.SendSCPIcommand ("OUTP1:IQHS:STATe OFF\n"); //-- Commented out 7/15/26 moved below + //FSWXSA.SendSCPIcommand ("OUTP2:IQHS:STATe OFF\n"); + + FSWXSA.setCF(1, CF1); + FSWXSA.setCF(2, CF2); + + FSWXSA.setIQBW(1, CLOCK1); + FSWXSA.setIQBW(2, CLOCK2); + + FSWXSA.setRefLevel(1, RefLevel1); + FSWXSA.setRefLevel(2, RefLevel2); + + FSWXSA.SendSCPIcommand("SENSe:ADJust:PTIMe\n"); //-- Added 7/15/26 + + FSWXSA.SendSCPIcommand(":INIT:IMM\n"); //-- Run a single measurement to appply settings added 7/15/26 + + //FSWXSA.SendSCPIcommand ("OUTP1:IQHS:FEC OFF\n"); //-- Commented out 7/15/26 //-- Disable RS(528,518) KR4 FEC for all 100GbE streams + //FSWXSA.SendSCPIcommand ("OUTP2:IQHS:FEC OFF\n"); + + FSWXSA.SendSCPIcommand("OUTP1:IQHS:STATe OFF\n"); //-- Moved here from above 7/15/26 + FSWXSA.SendSCPIcommand("OUTP2:IQHS:STATe OFF\n"); + + Thread.Sleep(3000); //-- Wait 3 seconds Added 7/15/26 + + CF1 = (float)FSWXSA.getCF(1); + CF2 = (float)FSWXSA.getCF(2); + + CF1 = CF1 / 1000000; + if (CF1 > 1000) + { + Channel1_CF.Text = string.Format("{0}", (int)(CF1 / 1000)); + Channel1_CF_Multiplier.SelectedIndex = 0; + } + CF2 = CF2 / 1000000; + if (CF2 > 1000) + { + Channel2_CF.Text = string.Format("{0}", (int)(CF2 / 1000)); + Channel2_CF_Multiplier.SelectedIndex = 0; + } + + RefLevel1 = FSWXSA.getRefLevel(1); + RefLevel2 = FSWXSA.getRefLevel(2); + Channel1_RefLevel.Text = string.Format("{0}", RefLevel1); + Channel2_RefLevel.Text = string.Format("{0}", RefLevel2); + + CLOCK1 = (long)FSWXSA.getIQBW(1); + CLOCK2 = (long)FSWXSA.getIQBW(2); + + if (CLOCK1 > 2000000000) + Channel1_BW.SelectedIndex = 1; + else + Channel1_BW.SelectedIndex = 0; + + if (CLOCK2 > 2000000000) + Channel2_BW.SelectedIndex = 1; + else + Channel2_BW.SelectedIndex = 0; + + FSWX_Connected = true; + Update_Button.Enabled = true; + + Connect_Button.Text = "Connected"; + Connect_Button.Enabled = false; + } + else + { + Update_Button.Enabled = false; + Connect_Button.Text = "Connect"; + + result = MessageBox.Show ("Failed to connect to FSWX!", "Error!", MessageBoxButtons.OK); + return; + } + + if ((Hypervault_Connected) && (FSWX_Connected)) + { + FSWX_IP.Enabled = false; + FSWX_Port.Enabled = false; + + HYPERVAULT_IP.Enabled = false; + HYPERVAULT_Port.Enabled = false; + } + } + + private void FSWX_IP_TextChanged(object sender, EventArgs e) + { + if (CheckIPValid (FSWX_IP.Text)) + { + settings.FSWXIpAddress = FSWX_IP.Text; + SettingsManager.Save (settings); + } + } + + private void FSWX_Port_TextChanged(object sender, EventArgs e) + { + UInt16 VAL; + + if (UInt16.TryParse(FSWX_Port.Text, out VAL)) + { + settings.FSWXPort = FSWX_Port.Text; + SettingsManager.Save (settings); + } + } + + private void HYPERVAULT_IP_TextChanged(object sender, EventArgs e) + { + if (CheckIPValid(HYPERVAULT_IP.Text)) + { + settings.HypervaultIpAddress = HYPERVAULT_IP.Text; + SettingsManager.Save (settings); + } + } + + private void HYPERVAULT_Port_TextChanged(object sender, EventArgs e) + { + UInt16 VAL; + + if (UInt16.TryParse (HYPERVAULT_Port.Text, out VAL)) + { + settings.HypervaultPort = HYPERVAULT_Port.Text; + SettingsManager.Save (settings); + } + } + } +} diff --git a/Hypervault_Control/Hypervault_Control.csproj b/Hypervault_Control/Hypervault_Control.csproj new file mode 100644 index 0000000..79c1b5d --- /dev/null +++ b/Hypervault_Control/Hypervault_Control.csproj @@ -0,0 +1,86 @@ + + + + + Debug + AnyCPU + {F9F3360E-0E4D-49B5-A8C5-CDAA7CD37D8D} + WinExe + Hypervault_Control + Hypervault_Control + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + Form + + + Hypervault_Control.cs + + + + + Hypervault_Control.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + \ No newline at end of file diff --git a/Hypervault_Control/Hypervault_Control.resx b/Hypervault_Control/Hypervault_Control.resx new file mode 100644 index 0000000..823eb94 --- /dev/null +++ b/Hypervault_Control/Hypervault_Control.resx @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAACMuAAAjLgAAAAAAAAAA + AAAXCgn/FwoJ/xcKCf8XCgn/FwoI/xgJCf8ZCQn/GQkJ/xkJCv8YCQn/FwkK/xcKCf8YCQn/GAoJ/xgJ + Cf8YCQn/GQgK/xgJCf8WCQn/FQgK/xgJCf8YCQn/GAkJ/xkKCf8YCQn/FwkI/xcKCf8XCgn/FwoJ/xwQ + D/8fFBP/GxAP/xcKCf8XCgn/FwoJ/xcKCf8YCQn/GAgI/xgICP8YCAn/GAgK/xcICf8WCAj/FwkJ/xgI + Cf8ZCQj/GAcJ/xgICf8YCAr/GAkI/xgJCP8YCAj/FwgJ/xYICf8XCAn/FwgI/xgICP8YCAj/GAkJ/xcK + Cf8XCgn/Gg0M/xoODf8YDAv/FwoJ/xcKCf8WCQj/FwkJ/xgICf85LCr/IBMR/xcICP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KhYM/x8PC/8dDAv/HQoM/x0MC/8cCwv/GwoM/xoK + Cv8aCgr/GgoK/xoKCv8aCgr/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/Hypervault_Control/Images/Icon.ico b/Hypervault_Control/Images/Icon.ico new file mode 100644 index 0000000..d6edbcb Binary files /dev/null and b/Hypervault_Control/Images/Icon.ico differ diff --git a/Hypervault_Control/Program.cs b/Hypervault_Control/Program.cs new file mode 100644 index 0000000..64467ed --- /dev/null +++ b/Hypervault_Control/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Hypervault_Control +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Hypervault_Control()); + } + } +} diff --git a/Hypervault_Control/Properties/AssemblyInfo.cs b/Hypervault_Control/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..62e1aec --- /dev/null +++ b/Hypervault_Control/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Hypervault_Control")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Hypervault_Control")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("f9f3360e-0e4d-49b5-a8c5-cdaa7cd37d8d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Hypervault_Control/Properties/Resources.Designer.cs b/Hypervault_Control/Properties/Resources.Designer.cs new file mode 100644 index 0000000..4805466 --- /dev/null +++ b/Hypervault_Control/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Hypervault_Control.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Hypervault_Control.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Hypervault_Control/Properties/Resources.resx b/Hypervault_Control/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Hypervault_Control/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Hypervault_Control/Properties/Settings.Designer.cs b/Hypervault_Control/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4125eac --- /dev/null +++ b/Hypervault_Control/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Hypervault_Control.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Hypervault_Control/Properties/Settings.settings b/Hypervault_Control/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Hypervault_Control/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Hypervault_Control_setup.exe b/Hypervault_Control_setup.exe new file mode 100644 index 0000000..0eed0ed Binary files /dev/null and b/Hypervault_Control_setup.exe differ